> ## Documentation Index
> Fetch the complete documentation index at: https://docs.runlayer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Adding GitHub MCP server

> Add the GitHub MCP server via the OAuth Broker (hosted) or a pre-registered OAuth app (self-hosted)

<Info>
  **Hosted by a third party.** This MCP server is built and hosted by the
  vendor, not Runlayer. This guide covers connecting it through Runlayer for
  governance, policies, and audit.
</Info>

There are two ways to add the GitHub MCP server, depending on your deployment:

* **OAuth Broker** — the default on Runlayer-hosted instances. GitHub works automatically with no setup.
* **Pre-Registered Client** — for self-hosted deployments (where the broker isn't available) or when you want to bring your own GitHub OAuth app.

## OAuth Broker

On Runlayer-hosted instances, GitHub works automatically through the [OAuth Broker](/oauth-broker) — no OAuth app, client ID, or secret required. The broker handles all OAuth flows transparently using an allow-listed redirect URI.

<Steps>
  <Step title="Add the GitHub connector">
    1. In your Runlayer instance, go to **Connectors** → **Add Connector** → **GitHub** → **Create New**
    2. Leave **Registration** set to **OAuth Broker** (the default) — no credentials are required
    3. Click **Create Hosted MCP**
  </Step>

  <Step title="Authorize GitHub Access">
    1. After creating the server, you'll be redirected to the server details page
    2. Under **Missing Authorization**, click **Connect**
    3. This opens GitHub's OAuth authorization page
    4. Review the requested permissions and select repositories
    5. Click **Authorize** to complete the flow
  </Step>

  <Step title="Verify Connection">
    After successful authorization, you'll be redirected back to Runlayer. The server will now show:

    * **Active** status
    * List of available tools (e.g., `create_branch`, `add_issue_comment`, etc.)
    * **Revoke access** option in the server settings
  </Step>
</Steps>

## Pre-Registered Client

Use this path if you **self-host** Runlayer (where the broker isn't available) or you want to **bring your own** GitHub OAuth app for dedicated rate limits, custom scopes, or organization-specific compliance.

### Prerequisites

* Access to your Runlayer instance
* GitHub organization admin permissions
* Admin permissions in Runlayer (to add servers)

### Setup Steps

<Steps>
  <Step title="Create GitHub OAuth Application">
    1. Go to your organization's [Developer Settings](https://github.com/organizations/YOUR-ORG/settings/applications/new)
       * Navigate to **Settings** → **Developer settings** → **OAuth Apps** → **New OAuth app**

    <img className="block" src="https://mintcdn.com/anysource/6y8VzDSWjckfUDpB/images/github-setup/github-org-oauth-apps-list.png?fit=max&auto=format&n=6y8VzDSWjckfUDpB&q=85&s=d26b3f0741b384bbad3e6492525569f2" alt="GitHub Organization OAuth Apps List" width="2674" height="1810" data-path="images/github-setup/github-org-oauth-apps-list.png" />

    2. Fill in the details:
       * **Application name**: Choose a name (e.g., `Runlayer MCP`)
       * **Homepage URL**: Your Runlayer instance URL
       * **Authorization callback URL**: `https://<your-tenant-url>.runlayer.com/oauth/callback/`
         * For self-hosted: Use your exact tenant URL
    3. Click **Register application**

    <img className="block" src="https://mintcdn.com/anysource/6y8VzDSWjckfUDpB/images/github-setup/github-register-oauth-app.png?fit=max&auto=format&n=6y8VzDSWjckfUDpB&q=85&s=301b0ce20c111a52e832b64b2259ceb6" alt="GitHub OAuth App Registration Form" width="2674" height="1810" data-path="images/github-setup/github-register-oauth-app.png" />
  </Step>

  <Step title="Generate Client Secret">
    1. After creating the app, you'll see the **Client ID** (save this)
    2. Click **Generate a new client secret**
    3. Copy the **Client Secret** immediately (it's only shown once)
    4. Save both credentials temporarily in a secure location

    <img className="block" src="https://mintcdn.com/anysource/6y8VzDSWjckfUDpB/images/github-setup/github-client-credentials.png?fit=max&auto=format&n=6y8VzDSWjckfUDpB&q=85&s=7b7ce7d7b3153b2e5927333bb435313f" alt="GitHub Client Credentials Page" width="2674" height="1810" data-path="images/github-setup/github-client-credentials.png" />
  </Step>

  <Step title="Add GitHub Server in Runlayer">
    1. In your Runlayer instance, go to **Connectors** → **Add Connector** → **GitHub** → **Create New**
    2. In the server configuration form:
       * Expand advanced settings
       * Select **Pre-registered Client** in **Registration**
       * Enter your **Client ID** and **Client Secret**
    3. Click **Create Hosted MCP**

    <img className="block" src="https://mintcdn.com/anysource/6y8VzDSWjckfUDpB/images/github-setup/catalog-github-custom-oauth.png?fit=max&auto=format&n=6y8VzDSWjckfUDpB&q=85&s=bb93a259f337ce7b38493aedbe3103ba" alt="GitHub Server Configuration with Custom OAuth" width="3130" height="2170" data-path="images/github-setup/catalog-github-custom-oauth.png" />
  </Step>

  <Step title="Authorize GitHub Access">
    1. After creating the server, you'll be redirected to the server details page
    2. Under **Missing Authorization**, click **Connect**

    <img className="block" src="https://mintcdn.com/anysource/6y8VzDSWjckfUDpB/images/github-setup/github-server-missing-auth.png?fit=max&auto=format&n=6y8VzDSWjckfUDpB&q=85&s=c3cc75c5c360bbd1b09df5fdf55c37db" alt="GitHub Server Missing Authorization" width="3130" height="2170" data-path="images/github-setup/github-server-missing-auth.png" />

    3. This opens GitHub's OAuth authorization page

    <img className="block" src="https://mintcdn.com/anysource/6y8VzDSWjckfUDpB/images/github-setup/github-authorize-permissions.png?fit=max&auto=format&n=6y8VzDSWjckfUDpB&q=85&s=c42df3afdcaae6b431afe3043fc4640c" alt="GitHub OAuth Authorization Page" width="1372" height="1776" data-path="images/github-setup/github-authorize-permissions.png" />

    4. Review the requested permissions and select repositories
    5. Click **Authorize** to complete the flow
  </Step>

  <Step title="Verify Connection">
    After successful authorization, you'll be redirected back to Runlayer. The server will now show:

    * **Active** status
    * List of available tools (e.g., `create_branch`, `add_issue_comment`, etc.)
    * **Revoke access** option in the server settings

    <img className="block" src="https://mintcdn.com/anysource/6y8VzDSWjckfUDpB/images/github-setup/github-server-tools-list.png?fit=max&auto=format&n=6y8VzDSWjckfUDpB&q=85&s=45f7cc1499a3c24288c54c230665c723" alt="GitHub Server with Available Tools" width="3130" height="2170" data-path="images/github-setup/github-server-tools-list.png" />
  </Step>
</Steps>

## Troubleshooting

<Accordion title="Redirect URI mismatch error">
  **Error**: "The redirect\_uri is not associated with this application."

  <img className="block" src="https://mintcdn.com/anysource/6y8VzDSWjckfUDpB/images/github-setup/github-invalid-redirect-uri.png?fit=max&auto=format&n=6y8VzDSWjckfUDpB&q=85&s=3d1f601eccbe9a12d39432c98b2d56ed" alt="GitHub Invalid Redirect URI Error" width="1224" height="1548" data-path="images/github-setup/github-invalid-redirect-uri.png" />

  **Solution**:

  * Verify the callback URL in your GitHub OAuth app matches exactly: `https://<your-tenant-url>.runlayer.com/oauth/callback/`
  * For self-hosted instances, ensure you're using the exact tenant URL
  * The URL must include the trailing slash
</Accordion>

<Accordion title="Authorization successful but Failed to Connect">
  **Issue**: Authorization popup completes successfully, but you see a "Failed to Connect" error in Runlayer.

  <img className="block" src="https://mintcdn.com/anysource/6y8VzDSWjckfUDpB/images/github-setup/server-failed-to-connect.png?fit=max&auto=format&n=6y8VzDSWjckfUDpB&q=85&s=bfb2e86502624fa5f0d963f2d181f2e2" alt="Failed to Connect Error" width="2848" height="1848" data-path="images/github-setup/server-failed-to-connect.png" />

  **Cause**: This occurs when the OAuth authorization succeeds, but the token exchange fails due to invalid Client ID or Client Secret.

  **Solution**:

  * Verify your Client ID and Client Secret are correct in the server configuration
  * Check that you copied the Client Secret correctly (it's only shown once)
  * Regenerate the Client Secret in GitHub if needed
  * Ensure the credentials match the OAuth app you're using
  * Try disconnecting and reconnecting the server with updated credentials
</Accordion>

<Accordion title="Invalid client credentials">
  **Error**: "Invalid client credentials" or authentication fails

  **Solution**:

  * Double-check your Client ID and Client Secret are correct
  * Ensure the Client Secret hasn't expired (regenerate if needed)
  * Verify the OAuth app is active in your organization's Developer Settings
</Accordion>

<Accordion title="Tools not showing after authorization">
  **Issue**: Server shows as connected but no tools are visible

  **Solution**:

  * Refresh the page
  * Check that you authorized the required scopes in GitHub
  * Try revoking and re-authorizing the connection
  * Verify the server status shows "Active"
</Accordion>

## Next Steps

Once your GitHub MCP server is set up and authorized:

* **Connect to your MCP client**: Use the "Add to Client" section to integrate with Cursor, VS Code, or other supported clients
* **Review available tools**: Browse the 40+ GitHub tools available for repository management, issue tracking, and more
* **Manage permissions**: You can revoke access at any time from the Connection section

<CardGroup cols={2}>
  <Card title="OAuth Broker Guide" icon="key" href="/oauth-broker">
    Learn more about OAuth Broker and BYOC
  </Card>

  <Card title="MCP Custom Servers" icon="server" href="/mcp-custom-servers">
    Create other custom MCP servers
  </Card>
</CardGroup>
