Skip to main content
Back to the GitHub MCP server

MCP Gateway · OpenCode

GitHub icon

Connect GitHub to OpenCode

OpenCode users who live in the shell can keep GitHub there too. Added as a remote server in OpenCode's mcp config, the official GitHub MCP server lets the agent manage issues, pull requests and workflows while it edits code. Speakeasy's OpenCode plugin allows or denies every prompt and tool call before it runs, and token and cost totals are reported per turn.

Category
Developer tools
OpenCode
Terminal

Behind the MCP Gateway

Run GitHub MCP behind the MCP Gateway

One URL for every agent, sign-in through your IdP, RBAC down to the tool, and every GitHub call inspected and logged.

Deploy on MCP Gateway

Before you start

What GitHub needs first

A GitHub organization administrator; an organization owner if the org restricts OAuth apps does the GitHub side of the setup.

  • You need admin access to the GitHub organization that will own the OAuth app.
  • The guide covers standard GitHub.com only, not Enterprise Cloud with data residency or Enterprise Server.
  • Orgs that restrict OAuth apps need an owner to approve the app.

In GitHub

  1. Open the organization's Developer settings > OAuth apps.
  2. Register an OAuth app with the Speakeasy callback URL.
  3. Copy the Client ID and generate a client secret.
  4. If the org restricts OAuth apps, have an owner approve the access request.
Full GitHub setup guide in the docs

Set up

Add GitHub to OpenCode in 4 steps

  1. 01

    Add GitHub from the catalog

    An admin finds GitHub in the MCP Catalog (MCP Gateway > MCP > Catalog) and clicks Add. Speakeasy registers the vendor's server as a remote MCP server and proxies sessions to it. Nothing is copied or re-hosted.

    Where MCP-scoped policies are enabled, the install offers a recommended risk policy for the new server that detects secrets and PII and inspects tool requests and responses.

  2. 02

    Choose who can use GitHub

    Give teams the mcp:connect scope on the GitHub server through team access or a role. OpenCode connects to the GitHub server's own URL, and the server's authorization decides who can connect and which tools they can call.

  3. 03

    Connect OpenCode

    Add the server to OpenCode's own mcp config block as a remote server.

    Copy the server's URL from its hosted install page in Speakeasy.

    Add it to the mcp block of your OpenCode config with type set to remote.

    Restart OpenCode and sign in when prompted.

    {
      "mcp": {
        "<server slug>": {
          "type": "remote",
          "url": "<URL from the hosted install page>"
        }
      }
    }
  4. 04

    Sign in and use GitHub from OpenCode

    The first time OpenCode connects, it opens a browser so the person can sign in to Speakeasy through your identity provider.

    From then on, GitHub's tools appear in OpenCode, limited to what the person's access allows, and every call lands in the gateway's tool logs.

OpenCode doesn't receive MCP servers from plugins. The observability package is installed separately, from a ZIP or with speakeasy-hooks install --provider=opencode, and the device agent can maintain it.

Use cases

What OpenCode users do with GitHub

Check pull requests waiting on you

Ask OpenCode which pull requests in your repositories need your review and summarize each one, so you can pick the first to look at without opening a browser.

Close out issues after a release

Once a release ships, OpenCode goes through the GitHub issues it fixed, comments on each with the release version, and closes them.

Manage repository workflows

Keep your CI workflows in step with the code by having OpenCode manage the repository's GitHub workflows during the same terminal session where you change them.

Control

What Speakeasy can see and stop in OpenCode

The gateway covers every client the same way. The rest depends on what OpenCode exposes to Speakeasy.

Tool logs

Gateway

Every GitHub call is logged with the person and the client that made it.

Access by role

Gateway

People reach only the GitHub tools their team or role allows.

Request and response blocking

Gateway

A risk policy scoped to GitHub can reject a tool request before it reaches the server, or withhold a result from OpenCode. MCP-scoped policies are enabled per organization.

Prompt and tool-call blocking

OpenCode

The OpenCode plugin sends each prompt and tool call to Speakeasy, which allows or denies it before it runs.

Usage telemetry

OpenCode

Token and cost totals flow through the plugin, reported per turn.

Device agent

OpenCode

The device agent installs and maintains the observability package.

  • OpenCode has no OpenTelemetry exporter, so session data comes through the plugin.
  • Tool output is blocked at the gateway rather than in OpenCode's hooks.

Questions

Frequently asked questions

Where is GitHub tool output blocked for OpenCode?
Tool output is blocked at the gateway rather than in OpenCode's hooks. Prompt injection detection and PII redaction run on every GitHub tool call there.
Does Speakeasy's GitHub setup work with GitHub Enterprise Server?
The setup guide covers standard GitHub.com only. GitHub Enterprise Cloud with data residency and GitHub Enterprise Server aren't covered.
How do OpenCode users get GitHub?
An admin adds GitHub from the Speakeasy MCP Catalog and grants access by team or role. Add the server to OpenCode's own mcp config block as a remote server. Each person then sees only the GitHub tools their access allows.
Are GitHub calls from OpenCode logged?
Yes. GitHub calls go through the MCP Gateway, which logs each tool call and attributes it to the person and the client that made it.

Connect more

GitHub in other clients

AI everywhere.

Control here.