[PR #5739] feat: add mcp.json support for Claude/Cursor compatibility #11558

Closed
opened 2026-02-16 18:16:24 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/5739

State: closed
Merged: No


Summary

  • Add support for loading MCP servers from standalone mcp.json files, enabling compatibility with Claude Code, Cursor, VS Code, and other tools that use the mcp.json format
  • Users no longer need to manually transform their existing mcp.json configurations to opencode.json format

Supported Locations

Loads mcp.json from these locations (in order of priority, lowest to highest):

Global:

  1. ~/.cursor/mcp.json
  2. ~/.claude/mcp.json
  3. ~/.config/opencode/mcp.json
  4. ~/.opencode/mcp.json

Project:
5. <project>/.cursor/mcp.json
6. <project>/.claude/mcp.json
7. <project>/.opencode/mcp.json
8. <project>/mcp.json

Features

  • Automatic transformation from mcp.json format to OpenCode format
  • Support for both local (stdio) and remote (HTTP/SSE) servers
  • Environment variable syntax normalization (${env:VAR} -> {env:VAR})
  • opencode.json mcp config takes priority over mcp.json for same-named servers

Example

mcp.json (Claude/Cursor format):

{
  "mcpServers": {
    "my-server": {
      "command": "npx",
      "args": ["-y", "mcp-server"],
      "env": {
        "API_KEY": "${env:MY_API_KEY}"
      }
    },
    "remote-server": {
      "url": "https://api.example.com/mcp",
      "headers": {
        "Authorization": "Bearer ${env:MY_TOKEN}"
      }
    }
  }
}

This is automatically transformed to OpenCode's internal format and merged with any existing mcp config in opencode.json.


OC Session: https://opncd.ai/share/3fw3GKgV

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/5739 **State:** closed **Merged:** No --- ## Summary - Add support for loading MCP servers from standalone `mcp.json` files, enabling compatibility with Claude Code, Cursor, VS Code, and other tools that use the mcp.json format - Users no longer need to manually transform their existing mcp.json configurations to opencode.json format ## Supported Locations Loads mcp.json from these locations (in order of priority, lowest to highest): **Global:** 1. `~/.cursor/mcp.json` 2. `~/.claude/mcp.json` 3. `~/.config/opencode/mcp.json` 4. `~/.opencode/mcp.json` **Project:** 5. `<project>/.cursor/mcp.json` 6. `<project>/.claude/mcp.json` 7. `<project>/.opencode/mcp.json` 8. `<project>/mcp.json` ## Features - Automatic transformation from mcp.json format to OpenCode format - Support for both local (stdio) and remote (HTTP/SSE) servers - Environment variable syntax normalization (`${env:VAR}` -> `{env:VAR}`) - `opencode.json` mcp config takes priority over mcp.json for same-named servers ## Example **mcp.json (Claude/Cursor format):** ```json { "mcpServers": { "my-server": { "command": "npx", "args": ["-y", "mcp-server"], "env": { "API_KEY": "${env:MY_API_KEY}" } }, "remote-server": { "url": "https://api.example.com/mcp", "headers": { "Authorization": "Bearer ${env:MY_TOKEN}" } } } } ``` This is automatically transformed to OpenCode's internal format and merged with any existing mcp config in opencode.json. --- OC Session: https://opncd.ai/share/3fw3GKgV
yindo added the pull-request label 2026-02-16 18:16:24 -05:00
yindo closed this issue 2026-02-16 18:16:24 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11558