MCP server config uses unrecognized 'mcpServers' key in altimate-code.json
When asking the tool to add an MCP server for GitLab, it creates a file that will prevent altimate from starting up when running a new session. The following error is shown when you run altimate to create a new session.
Error: Configuration is invalid at ~/.config/altimate-code/altimate-code.json
↳ Unrecognized key: "mcpServers"
Output of ~/.config/altimate-code/altimate-code.json:
{
"mcpServers": {
"gitlab": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-gitlab"],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "my-token",
"GITLAB_API_URL": "https://gitlab.com/api/v4"
}
}
}
}
Metadata
| Field | Value |
|---|---|
| CLI Version | 0.5.17 |
| Platform | darwin |
| Architecture | arm64 |
| OS Release | 25.3.0 |
| Category | bug |
Status: Fixed by #639 (merged April 4, 2026)
The compatibility gap you reported — AI tools writing `mcpServers` instead of `mcp` in `altimate-code.json` — has been fully resolved.
What was shipped
#639 added `normalizeMcpConfig()` in `packages/opencode/src/config/config.ts:1372-1421` which does:
- Top-level key aliasing: `mcpServers` → `mcp` (with `log.warn` when migrated, `log.debug` when dropped due to conflict)
- Per-server shape translation: converts Claude Code / Copilot format to altimate-code's schema:
- `{command: "npx", args: [...], env: {...}}` → `{type: "local", command: [...], environment: {...}}`
- String `command` + `args` array → merged into `command` array
- `env` → `environment`
- Remote servers with `url` → `{type: "remote", url, headers}`
- Conflict handling: always deletes `mcpServers` from the parsed config before Zod schema validation, regardless of whether `mcp` is also present
Adversarial test coverage
Comprehensive tests at `packages/opencode/test/config/config.test.ts:346-490` covering:
- Normal case: `mcpServers` only → aliased to `mcp`
- Array `command` format → preserved as-is
- Conflict: both `mcp` and `mcpServers` → `mcp` wins, `mcpServers` dropped silently
- Remote servers without `type` field → auto-inferred as `"remote"`
- Typed entries with external field names → normalized
- Empty `mcpServers` object → loads without error
- Malformed entries → rejected cleanly
Verifying the fix
# Drop an altimate-code.json with Claude Code's mcpServers format:
{
\"mcpServers\": {
\"gitlab\": {
\"command\": \"npx\",
\"args\": [\"-y\", \"@modelcontextprotocol/server-gitlab\"],
\"env\": { \"GITLAB_PERSONAL_ACCESS_TOKEN\": \"your-token\" }
}
}
}
altimate-code will auto-normalize it on load and log a warning instead of crashing. No config rewrite needed — the transformation happens in-memory before schema validation.
Closing this issue as resolved. Thanks @VJ-yadav for reporting it!