← Home

Adding Xcode MCP to OpenCode and Pi Agent

Apple ships an MCP bridge (xcrun mcpbridge) that gives external agents access to Xcode. You can use it not only with Xcode’s own agent, but also with tools like OpenCode and Pi Agent. Here’s the config for each:

OpenCode~/.config/opencode/opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "xcode": {
      "type": "local",
      "command": ["/usr/bin/xcrun", "mcpbridge"],
      "enabled": true,
      "timeout": 15000
    }
  }
}

Pi Agent — in one of these files (~/.config/mcp/mcp.json, <Pi agent dir>/mcp.json, .mcp.json, or .pi/mcp.json):

{
  "mcpServers": {
    "xcode": {
      "command": "xcrun",
      "args": ["mcpbridge"]
    }
  }
}

The only difference between the two formats is whether the command is written as a single array (command) or as command + args. The bridge is the same; only the schema of the client calling it differs.

References