Unhelpful error message when MCP server configuration was invalid
Technically a UX improvement suggestion rather than a bug, but bug seemed the most appropriate category.
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 1.0.56
- Operating System: Ubuntu 22.04
- Terminal: Ubuntu terminal
Description
Steps to Reproduce
- Create subtly-incorrect MCP server config in
.claude.json- in my case it was for gitlab usinghttps://github.com/zereight/gitlab-mcp:
"mcpServers": {
"gitlab": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@zereight/mcp-gitlab"
],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "glpat-{MY_API_TOKEN}",
"GITLAB_API_URL": "https://our.gitserver.com/api/v4",
"GITLAB_READ_ONLY_MODE": "true",
"GITLAB_PROJECT_ID": 7
}
}
}
- Start
claude
Expected Behavior
Clear error message stating what the problem is (namely, the project ID must be formatted as a string, "7").
Actual Behavior
Error message is too vague:
:warning: Found invalid settings files. They will be ignored. Run /doctor for details.
> /doctor
[Failed to parse] User MCP Config
Location: /path/to/.claude.json
└ [Error] mcpServers.gitlab: Does not adhere to MCP server configuration schema
It doesn't tell you what the exact issue with the configuration is. I tried various things before eventually stumbling on the string format as the correct solution.
The documentation here is also insufficient: https://docs.anthropic.com/en/docs/claude-code/mcp#project-scope, it doesn't document the type parameter nor the format/optional-ness of the parameters.
Is the type parameter required? I asked Claude itself what might be wrong and it said the type parameter needed to be added. After fixing that I asked again and Claude didn't identify the environment variable format as the problem, instead suggesting alternatives such as installing the package directly and invoking it without args.
Additional Context
The same config (with the wrong env var formatting and without type) was accepted in a very recent previous version, as I wasn't getting this error yesterday. I couldn't find a changelog entry suggesting that extra validation has been added.
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗