Load VS Code's MCP servers in a project folder #259

Open
opened 2026-02-16 17:25:57 -05:00 by yindo · 4 comments
Owner

Originally created by @scaryrawr on GitHub (Jun 24, 2025).

Originally assigned to: @thdxr on GitHub.

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.

Originally created by @scaryrawr on GitHub (Jun 24, 2025). Originally assigned to: @thdxr on GitHub. [VSCode MCP Support](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) 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](https://code.visualstudio.com/docs/reference/variables-reference) 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.
Author
Owner

@delafthi commented on GitHub (Jul 20, 2025):

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 commented on GitHub (Jul 20, 2025): 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`.
Author
Owner

@delafthi commented on GitHub (Jul 20, 2025):

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 commented on GitHub (Jul 20, 2025): 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.
Author
Owner

@nikhilmaddirala commented on GitHub (Aug 1, 2025):

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 commented on GitHub (Aug 1, 2025): It would be great to also have support for a global ~/.config/opencode/mcp.json so that it can be symlinked to other places.
Author
Owner

@R44VC0RP commented on GitHub (Dec 18, 2025):

I have updated a PR for this on #5739

@R44VC0RP commented on GitHub (Dec 18, 2025): I have updated a PR for this on #5739
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#259