Skip to content

Connect GitHub MCP (remote) to OpenCode

GitHub's hosted MCP server. Agents read code, issues and pull requests and open PRs with nothing to run on your machine, connecting with a personal access token.

MCP serverOfficialChecked 2026-11-16

Before you start

  • OpenCode installed (see its MCP documentation (opens in a new tab)).
  • GitHub MCP (remote) is available on macOS, Windows, Linux and the web.
  • Create a fine-grained personal access token with only the repositories and permissions you need, and set it as GITHUB_PERSONAL_ACCESS_TOKEN in your environment. For read-only tools, end the URL with /readonly. GitHub Enterprise Server doesn't support the hosted server.
  1. Step 1: Add GitHub MCP (remote) to OpenCode

    Add it from the terminal

    Run this in your project folder. It saves the server to the project's opencode.json.

    Terminal
    opencode mcp add github-remote --url https://api.githubcopilot.com/mcp/ --header 'Authorization=Bearer {env:GITHUB_PERSONAL_ACCESS_TOKEN}'

    Or edit the config file

    Add this to opencode.json at the project root.

    opencode.json
    {
      "$schema": "https://opencode.ai/config.json",
      "mcp": {
        "github-remote": {
          "type": "remote",
          "url": "https://api.githubcopilot.com/mcp/",
          "enabled": true,
          "oauth": false,
          "headers": {
            "Authorization": "Bearer {env:GITHUB_PERSONAL_ACCESS_TOKEN}"
          }
        }
      }
    }
    Good to know
    • OpenCode's background service reads GITHUB_PERSONAL_ACCESS_TOKEN when it starts, not from the terminal you're in. Set the variable, then run opencode service restart.
  2. Step 2: Check it's connected

    Terminal
    opencode mcp list

    Start OpenCode in the project; the server's tools are available to the agent straight away.

  3. Step 3: Try a first request

    Ask OpenCode something that only works with GitHub MCP (remote) connected:

    Say to OpenCode
    List the open issues in this repository that mention design and group them by label.

If it doesn't work

  • OpenCode reads opencode.json from the project root, or ~/.config/opencode/opencode.json for every project.
  • Environment variables use the {env:NAME} syntax inside the config file.
  • Servers that need a sign-in: run opencode mcp auth <name>.