[BUG] Project-specific MCP Authentication leaks into other projects
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When configuring the same MCP server (e.g., Linear) in two different projects with different authentication, the credentials from one project are incorrectly used in another project.
Setup:
- Project A has the Linear MCP server configured in ~/.claude.json under its project-specific section with a valid API key:
```
"projects": {
"/path/to/project-a": {
"mcpServers": {
"linear": {
"type": "http",
"url": "https://mcp.linear.app/mcp",
"headers": {
"Authorization": "Bearer <PROJECT_A_API_KEY>"
}
}
}
}
}
2. Project B has the Linear MCP server configured in .mcp.json (project-local file) with no authentication:
```
{
"mcpServers": {
"linear": {
"type": "http",
"url": "https://mcp.linear.app/mcp"
}
}
What Should Happen?
When running Claude Code in Project B, the Linear MCP server should either:
- Fail to authenticate (since no credentials are provided), or
- Use only credentials explicitly configured for Project B
Error Messages/Logs
Steps to Reproduce
- Create two separate projects (Project A and Project B) in different directories
- Configure Project A with a Linear MCP server including authentication in ~/.claude.json:
```
{
"projects": {
"/path/to/project-a": {
"mcpServers": {
"linear": {
"type": "http",
"url": "https://mcp.linear.app/mcp",
"headers": {
"Authorization": "Bearer <PROJECT_A_LINEAR_API_KEY>"
}
}
}
}
}
}
3. Run Claude Code in Project A and verify Linear works:
cd /path/to/project-a
claude
3. Ask: "Use the Linear MCP server to list teams"
3. → Confirm it returns teams from Project A's Linear workspace
4. Configure Project B with a Linear MCP server without authentication in .mcp.json:
{
"mcpServers": {
"linear": {
"type": "http",
"url": "https://mcp.linear.app/mcp"
}
}
}
5. Run Claude Code in Project B:
cd /path/to/project-b
claude
5. Ask: "Use the Linear MCP server to list teams"
6. Observe the bug: Linear returns teams from Project A's workspace, even though Project B has no authentication configured
### Claude Model
Opus
### Is this a regression?
I don't know
### Last Working Version
_No response_
### Claude Code Version
2.1.1 (Claude Code)
### Platform
Anthropic API
### Operating System
macOS
### Terminal/Shell
Terminal.app (macOS)
### Additional Information
_No response_This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗