Skip to content

Conversation

delafthi
Copy link
Contributor

@delafthi delafthi commented Jul 20, 2025

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
@delafthi delafthi force-pushed the push-spkoxwxpwuun branch from 1d41f44 to 4e4a3fe Compare August 8, 2025 12:18
-  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 force-pushed the push-spkoxwxpwuun branch from 4e4a3fe to 94c204c Compare August 8, 2025 12:20
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