Skip to main content

GitHub MCP server guide

Overview

The official GitHub MCP server provides access to the GitHub API, allowing AI agents to interact with GitHub repositories, issues, pull requests, and more.

Metadata

Error: Failed to fetch metadata for MCP server "github".
Error details
# Error fetching data for github
# Failed to fetch MCP server data. See logs for details.
# Please check that the server exists in the registry and thv command is available

Usage

Select the github MCP server in the ToolHive registry. In the Secrets section, add your GitHub personal access token to authenticate with the GitHub API, or select an existing secret that contains the token.

Review the optional environment variables to customize the server's behavior. For example, you might want to limit the active toolsets or enable read-only mode. Refer to the documentation for the current list of toolsets.

Security tip

Enable outbound network filtering on the Network Isolation tab to restrict the server's network access using the default profile contained in the registry.

GitHub Enterprise

If you're working with a GitHub Enterprise instance, enter the instance URL in the GITHUB_HOST environment variable and update the network isolation settings to allow access to the enterprise domain.

Sample prompts

Here are some sample prompts you can use to interact with the GitHub MCP server:

  • "List all repositories for the organization my-org"
  • "Create a new issue in the repository my-org/my-repo with the title 'Bug report' and the body 'There is a bug in the code'"
  • "Get the latest pull requests for the repository my-org/my-repo"
  • Scope your GitHub personal access token to the minimum permissions required for your use case.
  • Regularly rotate your GitHub personal access token and update the secret in ToolHive.
  • Enable network isolation to restrict the server's outbound network access.
  • Limit the active toolsets to reduce context overload and improve performance, or use dynamic tool discovery if supported by your client.