Sharing the MCP setup with your team in .mcp.json without sharing the key

Coding with AIClaude Code·· 5 views· 3 min read

The claude mcp add command with --scope user saves the MCP server on your computer only, with your key. In a team, it is simpler to put the server in a .mcp.json file, at the project root, and push it to the repository. Each person uses their own key, kept in their own variable.

Before you start

1 Each person on the team creates a key in the API Center with the ai:read and ai:write permissions.
2 Each person keeps the key in the MOZOUT_API_KEY variable on their computer: export MOZOUT_API_KEY="prod_..." on Linux and macOS, or setx MOZOUT_API_KEY "prod_..." on Windows, followed by a new terminal.
3 The account has AI credits or an active Coding Plan in All in One AI.

1. Create .mcp.json

At the project root, create the .mcp.json file with this content:

{
"mcpServers": {
"mozout-ai": {
"type": "http",
"url": "https://api.mozout.com/mcp",
"headers": { "Authorization": "Bearer ${MOZOUT_API_KEY}" }
}
}
}

Claude Code replaces ${MOZOUT_API_KEY} with the value of each person's variable when it reads the file. The key is never written down. The name mozout-ai is only the name Claude Code shows: it can be another one.

2. Push it to the repository

git add .mcp.json
git commit -m "Add the All in One AI MCP server"

3. What each person sees

1 When they open Claude Code in the project, it asks for approval before using servers from .mcp.json. Approve mozout-ai.
2 Type /mcp or run claude mcp list: the server must show as connected.
3 To undo a choice, run claude mcp reset-project-choices: Claude Code asks again.

Common errors

What happens Why What to do
The server gives 401 and shows as failed. The MOZOUT_API_KEY variable does not exist on that computer. Claude Code warns about it in claude mcp list and sends the text ${MOZOUT_API_KEY} as it is. Set the variable, open a new terminal and start Claude Code again.
You used ${ANTHROPIC_AUTH_TOKEN} in the header. In the header of a remote server, Claude Code reads ANTHROPIC_AUTH_TOKEN and ANTHROPIC_API_KEY as empty. Use ${MOZOUT_API_KEY}, even if it holds the same key.
Someone already had the server with --scope user. With the same name, the project one wins: the project scope comes before the user scope. Nothing: the one in .mcp.json now applies.
Do not create this file with claude mcp add --scope project and the header in double quotes. The terminal replaces ${MOZOUT_API_KEY} with the key before running the command, and the key ends up written in .mcp.json, which goes into the repository. Write the file by hand, as in step 1.
Each request spends the AI credits, or the Coding Plan points, of the account that owns the key used. To test, use a sandbox_ key: the model list and the balance are real and generations cost 0.

Want to code with AI in Claude Code? Visit the Coding with AI page.

See Coding with AI

SEE ALSO

The All in One AI MCP server: images, video and voice inside Claude Code, Codex and ChatGPT

ANTHROPIC_AUTH_TOKEN or ANTHROPIC_API_KEY: which one to use in Claude Code

The All in One AI skill for Claude Code: downloading, installing and using it

An API key or token has leaked: what to do, in the right order

Coding with AI in All in One AI

RECOMMENDED PRODUCT

Web hosting with cPanel

Domain and SSL included, daily backups and the panel you already know. from $6.60/mo (3-year plan, with coupon)

See plans
Was this answer helpful? Your answer helps us improve this article.