-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
Bug description
When running opkg install <package> in a workspace with OpenCode detected, the generated .opencode/opencode.json uses the key "mcpServers" instead of "mcp". OpenCode rejects this with:
Configuration is invalid at .opencode/opencode.json
↳ Unrecognized key: "mcpServers"
Steps to reproduce
- Create a package with a
mcp.jsonc: - Run
opkg install <package>in a workspace where OpenCode is detected - Inspect
.opencode/opencode.json
Actual result:
{
"mcpServers": {
"atlassian": {
"type": "http",
"url": "https://mcp.atlassian.com/v1/mcp"
}
}
}Expected result:
{
"mcp": {
"atlassian": {
"type": "http",
"url": "https://mcp.atlassian.com/v1/mcp"
}
}
}Root cause
The OpenCode export flow in platforms.jsonc (lines 816-828) is missing the map transformation to rename mcpServers → mcp:
// Current (line 816-828) — MISSING map
{
"from": ["mcp.jsonc", "mcp.json"],
"to": { "$switch": { ... ".opencode/opencode.json" } },
"merge": "deep"
// ❌ No map — mcpServers passes through unchanged
}The Codex platform correctly handles the equivalent rename on line 472:
{ "$rename": { "mcpServers": "mcp_servers" } }The spec in specs/platforms/flows.md (line 1898) also confirms the inverse rename should exist:
"map": [{ "$rename": { "mcpServers": "mcp" } }]Suggested fix
Export flow (line 816-828) — add map:
{
"from": ["mcp.jsonc", "mcp.json"],
"to": {
"$switch": {
"field": "$$targetRoot",
"cases": [
{ "pattern": "~/", "value": ".config/opencode/opencode.json" }
],
"default": ".opencode/opencode.json"
}
},
"merge": "deep",
"map": [
{ "$rename": { "mcpServers": "mcp" } }
]
}Import flow (line 884-895) — add reverse map:
{
"from": {
"$switch": {
"field": "$$targetRoot",
"cases": [
{ "pattern": "~/", "value": ".config/opencode/opencode.json" }
],
"default": ".opencode/opencode.json"
}
},
"to": "mcp.jsonc",
"map": [
{ "$rename": { "mcp": "mcpServers" } }
]
}Workaround
Users can override via ~/.openpackage/platforms.jsonc or <cwd>/.openpackage/platforms.jsonc with the corrected OpenCode section.
Environment
- opkg version: latest (npm)
- Platform: macOS (darwin)
- Target: OpenCode
lgladysz
Metadata
Metadata
Assignees
Labels
No labels
{ "mcpServers": { "atlassian": { "type": "http", "url": "https://mcp.atlassian.com/v1/mcp" } } }