[FEATURE]: Add Project-level MCP Support #7136

Closed
opened 2026-02-16 18:06:16 -05:00 by yindo · 4 comments
Owner

Originally created by @magicds on GitHub (Jan 21, 2026).

Originally assigned to: @thdxr on GitHub.

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Background

Currently, OpenCode uses global MCP server configuration, but there are limitations:

  1. Project-specific MCPs: Some MCP servers are only relevant to specific projects
  2. Per-project authentication: Different projects may require different authentication configurations for the same MCP server (e.g., GitLab MCP with different tokens for different repositories)

Solution

OpenCode should support project-level MCP configuration, similar to Claude Code's implementation documented at https://code.claude.com/docs/en/mcp#project-scope

Users should be able to create a .mcp.json file in the project root directory with project-specific MCP server configurations.

Example .mcp.json file:

{
  "mcpServers": {
    "gitlab": {
      "command": "npx",
      "args": ["-y", "@zereight/mcp-gitlab"],
      "env": {
        "GITLAB_TOKEN": "project-specific-token"
      }
    },
    "custom-tool": {
      "command": "node",
      "args": ["/path/to/project-specific/mcp/server"],
      "env": {}
    }
  }
}
Originally created by @magicds on GitHub (Jan 21, 2026). Originally assigned to: @thdxr on GitHub. ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request ## Background Currently, OpenCode uses global MCP server configuration, but there are limitations: 1. **Project-specific MCPs**: Some MCP servers are only relevant to specific projects 2. **Per-project authentication**: Different projects may require different authentication configurations for the same MCP server (e.g., GitLab MCP with different tokens for different repositories) ## Solution OpenCode should support project-level MCP configuration, similar to Claude Code's implementation documented at https://code.claude.com/docs/en/mcp#project-scope Users should be able to create a `.mcp.json` file in the project root directory with project-specific MCP server configurations. Example `.mcp.json` file: ```json { "mcpServers": { "gitlab": { "command": "npx", "args": ["-y", "@zereight/mcp-gitlab"], "env": { "GITLAB_TOKEN": "project-specific-token" } }, "custom-tool": { "command": "node", "args": ["/path/to/project-specific/mcp/server"], "env": {} } } } ```
yindo added the discussion label 2026-02-16 18:06:16 -05:00
yindo closed this issue 2026-02-16 18:06:16 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 21, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #9801: How can I disable a specific MCP service for a specific model? (addresses model-specific MCP configuration needs)
  • #9634: Running multiple instances of same MCP server with different configs? (addresses per-project MCP instance management)
  • #9472: Allow configuring project-specific LSP servers (similar pattern for project-level tool configuration)
  • #9696: Add @ mention syntax for one-time MCP server activation (alternative approach for project/request-specific MCP control)

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 21, 2026): This issue might be a duplicate of existing issues. Please check: - #9801: How can I disable a specific MCP service for a specific model? (addresses model-specific MCP configuration needs) - #9634: Running multiple instances of same MCP server with different configs? (addresses per-project MCP instance management) - #9472: Allow configuring project-specific LSP servers (similar pattern for project-level tool configuration) - #9696: Add @ mention syntax for one-time MCP server activation (alternative approach for project/request-specific MCP control) Feel free to ignore if none of these address your specific case.
Author
Owner

@magicds commented on GitHub (Jan 21, 2026):

I couldn't find a related feature request Issue, but I did locate an already implemented pull request for this functionality.
722

@magicds commented on GitHub (Jan 21, 2026): I couldn't find a related feature request Issue, but I did locate an already implemented pull request for this functionality. [722](https://github.com/anomalyco/opencode/pull/722)
Author
Owner

@sunxyw commented on GitHub (Jan 22, 2026):

I believe you are able to do so by putting a opencode.json with mcps config in your project root, which will be merged with the global config.

@sunxyw commented on GitHub (Jan 22, 2026): I believe you are able to do so by putting a opencode.json with mcps config in your project root, which will be merged with the global config.
Author
Owner

@magicds commented on GitHub (Jan 22, 2026):

I believe you are able to do so by putting a opencode.json with mcps config in your project root, which will be merged with the global config.

Thank you so much! This is incredibly helpful.

@magicds commented on GitHub (Jan 22, 2026): > I believe you are able to do so by putting a opencode.json with mcps config in your project root, which will be merged with the global config. Thank you so much! This is incredibly helpful.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7136