Load VS Code's MCP servers in a project folder
VS Code can have a .vscode/mcp.json folder in a workspace directory.
When opencode starts up in a project folder, part of config loading could also check for a .vscode/mcp.json and also load those servers.
I think supporting VSCode Variables would be nice (I think the main one I care about is ${workspaceFolder} for servers that need a directory input).
This is useful for project specific MCP servers that I don't want for every opencode session.
Thanks for bringing this up! It seems like a lot of tools are settling on a common format—like the mcp.json file—for MCP configs. It’d be awesome if Opencode could also load global configs from something like ~/.config/opencode/mcp.json. That way, we wouldn’t have MCP settings scattered all over in different formats. Thus, in the future we could define the MCP config once and then just link to it to wherever it’s needed.
Also, supporting a local .mcp.json inside the project (not necessarily under .vscode) would be super helpful, since not everyone uses the VSCode folder (see https://docs.anthropic.com/en/docs/claude-code/mcp#project-scope).
All in all, if Opencode followed these conventions, it’d make things way easier and smoother to manage across different setups.
Regarding variable expansion and reading from VSCode configurations, I believe it would be simpler if VSCode directly read from .mcp.json using the default variable expansion (see https://docs.anthropic.com/en/docs/claude-code/mcp#environment-variable-expansion-in-mcp-json), rather than having other tools read from .vscode/mcp.json.
I have pushed a PR that implements loading the MCP configuration from both the global file (~/.config/opencode/mcp.json) and the local file (.mcp.json). See #1170 for details.
It would be great to also have support for a global ~/.config/opencode/mcp.json so that it can be symlinked to other places.
I have updated a PR for this on #5739