The TrueFoundry MCP Server for GitHub lets you securely connect LLMs to your GitHub account or organization using a GitHub App.

Prerequisites

  1. Deploy your MCP Server and note the endpoint URL.
  2. Register a GitHub App in your GitHub account or organization.

Step 1: Deploy the GitHub MCP Server

  • MCP Server code: GitHub MCP Server Repository
  • Deploy it as a service on the TrueFoundry platform.
  • Copy the deployment Endpoint URL—you’ll need it soon.

Deploying the GitHub MCP Server


Step 2: Register Your GitHub App

  • Go to GitHub Apps settings (personal) or organization apps (org).
  • Click New GitHub App.
  • Fill out the form:
    • App name: Pick a unique, clear name (max 34 chars).
    • Description: (Optional) Add a short description.
    • Homepage URL: Link to your app’s website or repo.
    • Callback URL:
https://<tfy-control-plane-base-url>/api/svc/v1/llm-gateway/mcp-servers/oauth2/callback

Replace <tfy-control-plane-base-url> with your TrueFoundry control plane URL.

  • (Optional) Add more callback URLs if needed.
  • (Optional) Set up Webhook URL, secret, etc. as needed.
  • Permissions: Select only what you need (see table below).
  • Subscribe to events: Pick webhook events if required.
  • Install options: Choose who can install the app.
  • Click Create GitHub App.
  • Click Generate a new client secret and save the Client ID and Client Secret.
  • Install the App: Click Install App and pick the account or organization. You must select at least one repository (all or specific). You can change this later in settings.

Admin Approval: Installing the app on an organization may require admin approval. If you don’t have permission, ask your GitHub admin to approve it.

Registering a GitHub App


Step 3: Set Redirect URL, OAuth2, and Permissions

  • Make sure the redirect URL is set as above.
  • Set the permissions your use case needs:

Recommended Permissions

CategoryPermissionAccessDescription
RepositoryContentsRead/WriteCode, branches, releases, merges
RepositoryIssuesRead/WriteIssues, comments, labels, milestones
RepositoryPull requestsRead/WritePRs, comments, merges
RepositoryDiscussionsRead/WriteDiscussions and comments
RepositoryProjectsRead/WriteClassic projects
RepositoryCustom propertiesRead/WriteCustom property values
RepositoryMetadataRead-onlyRepo metadata (mandatory)
OrganizationMembersRead-onlyOrg members and teams
AccountEmail addressesRead-onlyUser email addresses
AccountEventsRead-onlyUser activity events
AccountGistsRead/WriteUser gists and comments
  • For a full list, see GitHub App Permissions.
  • Changing permissions later will prompt users to re-authorize the app.

Step 4: Register MCP Server on AI Gateway

  • Go to the MCP Server tab in AI Gateway.
  • Click Add New MCP Server Group (if needed).
  • Add a new MCP Server:
    • Endpoint URL: Your deployed MCP Server URL
    • Authentication Type: OAuth2
    • Client ID: Your GitHub app’s Client ID
    • Client Secret: Your GitHub app’s Client Secret
    • Scopes: The permissions you set
  • See GitHub Docs for more details.

Adding GitHub MCP Server to AI Gateway

For security, store OAuth2 credentials as secrets using FQN references instead of plain text values.


Step 5: Test Your MCP Server

  1. Go to the MCP Server tab in AI Gateway.
  2. Find and select your GitHub MCP Server.
  3. Click Connect Now to start authorization.
  4. Authorize with your GitHub credentials in the popup.
  5. Once connected, your MCP Server will show up in the list.
  6. Select the tools you want and click Select Tools.
  7. You can now use the GitHub MCP Server and its tools in the AI Gateway Playground to interact with GitHub via LLMs.