get/mcp/indexSearch ⌘K

How to add an MCP server to OpenCode

To add an MCP server to OpenCode, run opencode mcp add <name> --env KEY=value -- <command> for a local package.

Steps

  1. Run opencode mcp add <name> --env KEY=value -- <command> for a local package.
  2. Or add it under mcp in opencode.json: "type": "local" with a command array, or "type": "remote" with a url.

Checked against OpenCode's official MCP documentation on 2026-12-01.

Copy-paste examples

Example: Playwright MCP (local package)

OpenCode
opencode mcp add playwright-mcp -- npx -y @playwright/mcp
OpenCode (opencode.json)
{
  "mcp": {
    "playwright-mcp": {
      "type": "local",
      "command": [
        "npx",
        "-y",
        "@playwright/mcp"
      ]
    }
  }
}

From the Playwright MCP server page.

Example: GitHub (hosted (remote) server)

OpenCode (opencode.json)
{
  "mcp": {
    "github-mcp-server": {
      "type": "remote",
      "url": "https://api.githubcopilot.com/mcp/"
    }
  }
}

From the GitHub server page.

Find a server

Every server page on getmcpindex has a ready-made setup for OpenCode under Set up in your MCP client. Search all servers, browse categories or remote servers.