Experimental-MCP-Server-created-by-Github-MCP
This project sets up a GitHub Model Context Protocol (MCP) server for AI-assisted development workflows, enabling AI models to perform GitHub operations like repository management, issue handling, and file access. It requires Node.js and a GitHub Personal Access Token for configuration.
GitHub 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.json
in your user directory (e.g.,~/.cursor/mcp.json
orC:\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_here
with 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.