Skip to content

feat(config): add support for loading MCP configuration from mcp.json#1170

Closed
delafthi wants to merge 1 commit into
anomalyco:devfrom
delafthi:push-spkoxwxpwuun
Closed

feat(config): add support for loading MCP configuration from mcp.json#1170
delafthi wants to merge 1 commit into
anomalyco:devfrom
delafthi:push-spkoxwxpwuun

Conversation

@delafthi

@delafthi delafthi commented Jul 20, 2025

Copy link
Copy Markdown
Contributor

This PR adds support for loading MCP configuration from mcp.json files, enabling more flexible and backward-compatible configuration management.

Changes

  • Load MCP configuration from both global (~/.config/opencode/mcp.json) and local (.mcp.json) files.
  • Introduce a new McpConfig namespace dedicated to managing MCP server configurations.
  • Support typed and legacy MCP server formats, validated via Zod schemas to ensure correctness.
  • Implement variable and file expansion supporting {VAR} and {VAR:-default} syntax for enhanced configuration flexibility.
  • Merge global and local MCP configs into the main config state, converting legacy formats to the current structure for backward compatibility.
  • Note: The variable expansion logic currently exists in both mcp.ts and config.ts and could be refactored to reduce duplication.

Additional Notes

This PR was primarily generated by Claude Sonnet 4.

What do you guys think?

@delafthi
delafthi marked this pull request as ready for review July 20, 2025 14:21
-  Load MCP configuration from global (`~/.config/opencode/mcp.json`) and local (`.mcp.json`) files
-  Introduce `McpConfig` namespace to manage MCP server configurations
-  Support both typed and legacy MCP server formats with validation using Zod schemas
-  Implement variable and file expansion supporting `{VAR}` and `{VAR:-default}` syntax
-  Note: Variable expansion logic is duplicated in `mcp.ts` and `config.ts` and could be refactored
-  Merge global and local MCP configs into main config state, converting legacy formats for backward compatibility

This commit was primarily generated by Claude Sonnet4 using opencode 😉
@delafthi

delafthi commented Dec 7, 2025

Copy link
Copy Markdown
Contributor Author

Closing this exploratory PR—it's fallen significantly behind the current codebase and is no longer applicable.

@delafthi delafthi closed this Dec 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant