home / mcp / github mcp server

GitHub MCP Server

Connects AI tools to GitHub context to read repos, manage issues/PRs, analyze code, and automate workflows via natural language prompts.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "github-github-mcp-server": {
      "url": "https://api.githubcopilot.com/mcp/",
      "headers": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "YOUR_TOKEN"
      }
    }
  }
}

You connect AI tools directly to GitHub to read repositories, manage issues and PRs, analyze code, and automate workflows through natural language interactions. This MCP server enables you to access GitHub context from your AI tools, empowering you to perform code searches, issue triage, workflow analysis, and repository operations with simple prompts.

How to use

You will run this MCP server as either a remote HTTP service or a local, containerized process. Your MCP client (such as an IDE integration or agent) talks to the server to perform GitHub actions in natural language. Start with a remote server for quick setup, or run a local server if you prefer hosting everything on your machine.

Once connected, you can ask your AI agent to list issues, read repository trees, inspect pull requests, search code, or monitor actions and security alerts. You can also enable or disable groups of capabilities (toolsets) to tailor the available actions to your needs. If you enable read-only mode, only non-destructive operations will be exposed.

How to install

Choose a method that matches your environment. You can connect via a remote MCP server or run a local MCP server on your host. Below are concrete steps for both approaches. Follow the exact commands and example configurations to ensure proper operation.

Configuration

Two primary connection methods are supported: HTTP (remote) and STDIO (local). Use the following configuration blocks as exact templates in your MCP host or IDE integration. The HTTP method points to the remote GitHub MCP server; the STDIO method runs the server locally via Docker.

Security and best practices

Handle GitHub Personal Access Tokens (PATs) securely. Store tokens in environment variables when possible, avoid committing tokens, and scope tokens to the minimum permissions needed. Rotate tokens regularly and keep them out of version control. If you are using an IDE or host that supports it, prefer token references via environment variables rather than embedding tokens directly in configuration files.

Troubleshooting and notes

If you encounter startup errors, verify that the MCP server command or URL is correct and that tokens or headers are configured as shown in examples. Ensure your MCP host supports the chosen connection type and that network access to the remote server is permitted. If you are using Docker, confirm the container image ghcr.io/github/github-mcp-server is accessible and that your token is valid.

Available tools

actions_get

Get details of GitHub Actions resources such as workflows, workflow runs, jobs, and artifacts. Requires repo scope.

actions_list

List GitHub Actions workflows in a repository. Supports pagination and filtering by workflow or run IDs.

actions_run_trigger

Trigger a GitHub Actions workflow with inputs. Requires repo scope.

get_job_logs

Fetch logs for a GitHub Actions workflow job. Can return actual content or URLs and supports filtering by run and job.

get_code_scanning_alert

Retrieve a specific code scanning alert by number. Requires security_events scope.

list_code_scanning_alerts

List code scanning alerts with optional filters like severity and state.

get_me

Get details about your own GitHub user profile.

get_repository_tree

Fetch the file tree for a repository, with optional recursive traversal.

get_file_contents

Read contents of a file or directory in a repository with optional ref or sha.

list_branches

List branches for a repository with pagination support.

list_issues

List issues in a repository with filters for state, labels, and date ranges.

issue_read

Read issue details, comments, or labels with multiple operation modes.

issue_write

Create or update an issue, including assignees, labels, and milestones.

search_code

Search code across repositories using GitHub code search syntax.

search_repositories

Search repositories with options for minimal output, sort, and pagination.

list_pull_requests

List pull requests with filters for base, head, state, and pagination.

pull_request_read

Get details about a pull request, including files, reviews, and comments.

create_pull_request

Open a new pull request with base, head, title, and optional body.

update_pull_request

Edit pull request properties such as title, body, state, and reviewers.

get_latest_release

Fetch the latest release for a repository.

get_tag

Retrieve details for a specific tag in a repository.

list_releases

List releases for a repository with pagination.

list_tags

List all tags for a repository with pagination.

push_files

Push files to a repository by creating or updating files with a commit message.