opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Load VS Code's MCP servers in a project folder

Open scaryrawr opened this issue 6 months ago • 4 comments

VSCode MCP Support

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.

scaryrawr avatar Jun 24 '25 14:06 scaryrawr

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.

delafthi avatar Jul 20 '25 12:07 delafthi

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.

delafthi avatar Jul 20 '25 14:07 delafthi

It would be great to also have support for a global ~/.config/opencode/mcp.json so that it can be symlinked to other places.

nikhilmaddirala avatar Aug 01 '25 13:08 nikhilmaddirala

I have updated a PR for this on #5739

R44VC0RP avatar Dec 18 '25 13:12 R44VC0RP