About GitHub MCP Server Setup Guide
GitHub MCP Server Setup Guide is an experimental repository documenting setup of the GitHub MCP server for AI-assisted development. It is for developers who want an assistant to work with repositories, files, issues, and pull requests using a personal access token.
Key features
- 01Configure the GitHub MCP server
- 02Use a personal access token for permissions
- 03Access repository information and files
- 04Create and manage issues and pull requests
Use cases
- 01Set up GitHub access in an MCP-compatible assistant
- 02Fetch repository file contents
- 03Create a repository or issue
- 04Prepare and manage pull requests
MCP support
The guide explains how to configure `@modelcontextprotocol/server-github` so an MCP-compatible assistant can perform GitHub operations. The documented capabilities depend on the configured personal access token permissions.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
npx -y @modelcontextprotocol/server-githubGITHUB_PERSONAL_ACCESS_TOKENSecretLocal servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEGitHub MCP Server Setup Guide
This repository demonstrates how to set up and use a GitHub Model Context Protocol (MCP) server for AI-assisted development workflows.
What is MCP?
Model Context Protocol (MCP) enables AI assistants to interact with external systems and APIs through standardized interfaces. The GitHub MCP server specifically allows AI models to perform GitHub operations like:
- Creating/managing repositories
- Managing files and content
- Working with issues and pull requests
- Accessing repository information
- And more!
Setup Instructions
Prerequisites
- Node.js installed on your system
- A GitHub account
- A GitHub Personal Access Token (PAT) with appropriate permissions
Step 1: Create a GitHub Personal Access Token
- Go to GitHub Settings → Developer Settings → Personal Access Tokens
- Create a new fine-grained token with the following permissions:
- Repository: Read and write (Administration, Contents, Issues, Pull requests)
- User: Read-only
- Save your token securely - you'll need it for the configuration
Step 2: Set Up MCP Configuration
- Create a configuration file named
mcp.jsonin your user directory (e.g.,~/.cursor/mcp.jsonorC:\Users\YourUsername\.cursor\mcp.json) - Add the following configuration:
{
"mcpServers": {
"github": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-github"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "your_github_pat_here"
}
}
}
}
- Replace
your_github_pat_herewith your actual GitHub Personal Access Token
Step 3: Test Your MCP Server
- Install a compatible AI coding assistant that supports MCP (like Cursor)
- Ask the assistant to perform GitHub operations, such as:
- Creating repositories
- Fetching file contents
- Creating issues
- Making pull requests
Usage Examples
Here are some examples of operations you can perform with your GitHub MCP:
- Create a new repository:
Create a new GitHub repository named "my-project" - Push code to a repository:
Push this file to my repository - Create an issue:
Create an issue titled "Fix navigation bug" in my repository - Fetch repository contents:
Show me the contents of the main.js file from my repository
Troubleshooting
- Permission Errors: Ensure your GitHub PAT has the necessary permissions for the operations you're trying to perform
- Connection Issues: Check that your MCP server is properly configured and running
- Token Expiration: GitHub PATs can expire - check if you need to generate a new one
Resources
- Model Context Protocol (MCP) Documentation
- GitHub API Documentation
- NPM Package: @modelcontextprotocol/server-github
Note: Always keep your GitHub Personal Access Token secure and never commit it to public repositories.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.