Summary
wizard mcp add installs the PostHog MCP server into the user's AI coding clients. We should add OpenCode (sst/opencode) as a supported target.
Current supported clients
Defined in getSupportedClients() (src/steps/add-mcp-server-to-clients/index.ts): Claude Code, Claude Desktop/Web, Codex, Cursor, VS Code, Zed. OpenCode is a popular terminal AI coding agent with native MCP support and isn't covered.
How OpenCode consumes MCP
OpenCode is config-file based (not a CLI subcommand like claude mcp add / codex mcp add), so it fits the existing DefaultMCPClient file-writer pattern (same shape as Zed / VS Code):
- Config:
opencode.json (project) or ~/.config/opencode/opencode.json (global).
- Remote MCP server entry under an
mcp key, roughly:
⚠️ Verify the exact schema (key name mcp, type: "remote" vs "local", enabled, header shape) against the current OpenCode docs before implementing — it has changed over releases.
Implementation sketch
- New
src/steps/add-mcp-server-to-clients/clients/opencode.ts extending DefaultMCPClient:
getServerPropertyName() → "mcp"
getConfigPath() → global OpenCode config path (mac/linux; check Windows)
getServerConfig() → remote entry shape above (reuse getNativeHTTPServerConfig, add type/enabled)
isClientSupported() → detect OpenCode install / supported platforms
- Register in
getSupportedClients() (index.ts).
- Add label/enum + tests mirroring
clients/__tests__/claude.test.ts (the DefaultMCPClient reference test).
Context
Filed while hardening the MCP install path (subprocess timeouts + error-tracking the previously-silent config-write failures). Adding OpenCode is follow-up scope, not part of that fix.
Summary
wizard mcp addinstalls the PostHog MCP server into the user's AI coding clients. We should add OpenCode (sst/opencode) as a supported target.Current supported clients
Defined in
getSupportedClients()(src/steps/add-mcp-server-to-clients/index.ts): Claude Code, Claude Desktop/Web, Codex, Cursor, VS Code, Zed. OpenCode is a popular terminal AI coding agent with native MCP support and isn't covered.How OpenCode consumes MCP
OpenCode is config-file based (not a CLI subcommand like
claude mcp add/codex mcp add), so it fits the existingDefaultMCPClientfile-writer pattern (same shape as Zed / VS Code):opencode.json(project) or~/.config/opencode/opencode.json(global).mcpkey, roughly:{ "mcp": { "posthog": { "type": "remote", "url": "https://mcp.posthog.com/mcp", "enabled": true, "headers": { "Authorization": "Bearer <key>" } } } }mcp,type: "remote"vs"local",enabled, header shape) against the current OpenCode docs before implementing — it has changed over releases.Implementation sketch
src/steps/add-mcp-server-to-clients/clients/opencode.tsextendingDefaultMCPClient:getServerPropertyName()→"mcp"getConfigPath()→ global OpenCode config path (mac/linux; check Windows)getServerConfig()→ remote entry shape above (reusegetNativeHTTPServerConfig, addtype/enabled)isClientSupported()→ detect OpenCode install / supported platformsgetSupportedClients()(index.ts).clients/__tests__/claude.test.ts(the DefaultMCPClient reference test).Context
Filed while hardening the MCP install path (subprocess timeouts + error-tracking the previously-silent config-write failures). Adding OpenCode is follow-up scope, not part of that fix.