home / mcp / github mcp server

GitHub MCP Server

Queries GitHub data via MCP by running a local server and executing commands for user, repo, and authenticated user details.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "divyanshkushwaha-github-mcp-server-claude": {
      "url": "https://mcp.github.example/mcp",
      "headers": {
        "GITHUB_TOKEN": "YOUR_TOKEN"
      }
    }
  }
}

GitHub MCP Server is an API-based tool that uses the Modular Command Processor (MCP) framework to interact with GitHub’s REST API. It enables you to fetch user details, repository information, and authenticated user data by running commands through a dedicated MCP server, integrated with the Claude desktop workflow for quick data access.

How to use

You run the MCP server through a local runtime that executes the main script and communicates with your MCP client (such as Claude Desktop). The server reads your GitHub token from the environment and uses it to perform authenticated requests. To use it, start the MCP server configuration and then issue commands via your MCP client to fetch user data or repository details.

How to install

# Prerequisites
- Python >= 3.10
- GitHub personal access token for authenticated requests
- A virtual environment tool (venv) or conda

# 1. Create and activate a Python virtual environment
python -m venv venv
source venv/bin/activate

# 2. Install dependencies
pip install -r requirements.txt

# 3. Set up environment variable for GitHub token (later used by the MCP server)
# Create a file named .env in the project root and add:
GITHUB_TOKEN=your_personal_access_token

# 4. Create the Claude MCP config (see snippet below)

Additional content

The MCP setup is defined in a configuration file that specifies how to run the server locally. The example configuration uses a local Python script and a runtime command to launch the MCP server, enabling you to process commands from your MCP client.

Security notes: store your GitHub token securely and do not share your .env file. Use environment-specific token scopes appropriate for your needs. Monitor access to your MCP server to prevent unauthorized use of GitHub resources.

Configuration example shown below outlines how Claude Desktop will start the MCP server. It uses a local uv runtime to execute the main script.

Available tools

fetchUser

Fetch GitHub user details by username using the MCP server API.

fetchRepo

Retrieve details of a GitHub repository by repository name.

fetchAuthenticatedUser

Get details of the authenticated user using the GitHub personal access token.