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

# Set up GitHub MCP Server

> Connect GitHub as a managed MCP server on the TrueFoundry MCP Gateway so agents can work with repositories, issues, pull requests, and workflows.

[GitHub](https://github.com) is a code hosting and collaboration platform whose remote MCP server exposes tools for repositories, issues, pull requests, users, Actions workflows, and code security findings. TrueFoundry provisions it as a [TrueFoundry Managed MCP](/docs/ai-gateway/mcp/tfy-managed-mcp-server) - the platform manages the server URL, auth, scopes and credentials, so your agents can use GitHub without any configuration or infrastructure setup on your end.

## Using GitHub through the MCP Gateway

The [TrueFoundry MCP Gateway](/docs/ai-gateway/mcp/mcp-overview) centralizes access to GitHub - agents connect through one endpoint instead of maintaining separate server configurations per client. As a [TrueFoundry Managed MCP](/docs/ai-gateway/mcp/tfy-managed-mcp-server), GitHub's URL, outbound auth, scopes, and credentials are owned and kept current by the platform.

When you use GitHub MCP server through the AI Gateway, TrueFoundry provides:

* **Authentication** - Clients [authenticate inbound](/docs/ai-gateway/mcp/mcp-gateway-auth-security#inbound-authentication) to the AI Gateway with a Personal Access Token, Virtual Account, or IDE OAuth flow. For outbound access, the AI Gateway runs the [OAuth2 Authorization Code flow](/docs/ai-gateway/mcp/mcp-gateway-auth-security#outbound-authentication) so each user authorizes their own GitHub account; tokens are stored, refreshed and injected per user on tool calls.
* **Tool-level access control** - You can selectively enable or disable individual GitHub tools from the TrueFoundry UI.
* **Access control** - [Collaborators and role-based policies](/docs/ai-gateway/mcp/mcp-gateway-auth-security#access-control) define who can use the server and which tools they can invoke. Enable or disable individual GitHub tools from the server detail page.
* **Observability** - Tool calls are traced with caller identity, tool name, inputs, and latency. Monitor server- and tool-level usage in [MCP Metrics](/docs/ai-gateway/analytics-mcp-metrics) and export traces to your observability stack via OpenTelemetry.
* **Guardrails** - Apply [pre-tool and post-tool guardrails](/docs/ai-gateway/guardrails-overview) on MCP tool calls.

## Adding GitHub MCP server to TrueFoundry

<Steps>
  <Step title="Open the MCP Server catalog">
    Navigate to **MCP Servers** in the TrueFoundry sidebar and click **Add new MCP Server**. On the next screen, select **Connect TrueFoundry Managed MCPs** - this opens the catalog of pre-vetted, fully configured MCP servers managed by TrueFoundry.
  </Step>

  <Step title="Add GitHub">
    Find **github** in the catalogue and click **+ Add**. TrueFoundry provisions the server with no additional configuration and opens the GitHub MCP server detail page.

    <Frame>
      <img src="https://mintcdn.com/truefoundry/jyc1A4wSStpQVwOT/images/docs/ai-gateway/github-step1-catalog.png?fit=max&auto=format&n=jyc1A4wSStpQVwOT&q=85&s=b535fdba2f9f1e0e97f1afeede533d51" alt="GitHub entry in the TrueFoundry managed MCP catalog with the Add button" width="1996" height="1980" data-path="images/docs/ai-gateway/github-step1-catalog.png" />
    </Frame>
  </Step>

  <Step title="Authenticate">
    To authenticate, click **Connect Now**. A popup appears, review the details and click **Approve** to complete the authorization flow. You'll then be redirected to GitHub to authorize access to your account.

    <Note>
      TrueFoundry does not receive your GitHub credentials - the authorization is between your account and GitHub directly.
    </Note>
  </Step>

  <Step title="Verify tools">
    After approving, the **Tools** tab lists GitHub's available tools (repositories, issues, pull requests, users, Actions workflows, and more). Click **Try** on any tool to test it and inspect the JSON output before using it in an agent.
  </Step>
</Steps>

## Connecting to an MCP Client

Open the **How To Use** tab on the GitHub server detail page for your tenant-specific Gateway URL and ready-to-paste client snippets - don't build the endpoint manually.

The tab includes snippets for Claude Code, VS Code, Claude Web, Claude Desktop, Cursor, Windsurf, Codex, and the Python and TypeScript MCP SDKs. Use **Show API Key** if your client requires a Gateway token in a header.

## Using the Tool Playground

Before deploying an agent, you can test any GitHub MCP server tool directly in TrueFoundry:

<Steps>
  <Step title="Open a tool">
    On the GitHub MCP server detail page, click **Try** next to any tool - for example `get_pull_request`.
  </Step>

  <Step title="Fill in the inputs">
    For `get_pull_request`, enter the repository **owner**, **repo**, and the **pullNumber**.
  </Step>

  <Step title="Execute and inspect">
    Click **Execute Tool** and inspect the JSON output in the right panel.
  </Step>
</Steps>

## Tool Metrics

The **Tool Metrics** tab on the GitHub server detail page tracks how agents use each tool:

* **Invocation count** - which tools are called most often
* **Latency** - how long each tool takes to respond
* **Error rates** - which tools are failing in production

See [MCP Metrics](/docs/ai-gateway/analytics-mcp-metrics) for server- and tool-level dashboards across your Gateway.

## Disabling Individual Tools

On the **Tools** tab, toggle off any GitHub tools your agents don't need:

* **Disabled tools** are hidden from MCP clients and cannot be invoked.
* **Enabled tools** remain available to agents as usual.

For example, disable write-capable tools to keep an agent read-only.
