What Happened
OpenCode config validation failed with “Invalid input mcp.mcp-image” error. The MCP server configuration used wrong schema format.
The Broken Config
"mcp-image": {
"type": "stdio", // WRONG
"command": "npx", // WRONG
"args": ["-y", "mcp-image"], // WRONG
"env": { // WRONG field name
"GEMINI_API_KEY": "...",
"IMAGE_OUTPUT_DIR": "..."
}
}
Investigation
- First tried adding
"type": "stdio"- still failed - Fetched official OpenCode docs at opencode.ai/docs/mcp-servers
- Discovered correct schema from docs
Resolution
"mcp-image": {
"type": "local", // local, not stdio
"command": ["npx", "-y", "mcp-image"], // array, not separate args
"environment": { // environment, not env
"GEMINI_API_KEY": "...",
"IMAGE_OUTPUT_DIR": "..."
}
}
Key differences:
type: "local"not"stdio"(OpenCode terminology)commandis a single array including args, no separateargsfieldenvironmentnotenvfor env vars
Lesson
OpenCode MCP schema differs from Claude Desktop’s MCP schema. Always check vendor docs - don’t assume schema compatibility between different MCP hosts.