GitHub MCP Server
Provides tools for interacting with GitHub repositories, including creating issues, triggering repository dispatch events, and retrieving repository information.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@GitHub MCP ServerCreate an issue in octocat/Hello-World titled 'Fix typo in README'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
GitHub MCP Server
Overview
GitHub MCP Server is a Model Context Protocol (MCP) server that exposes GitHub API functionality to MCP-compatible clients like Claude Desktop, GPT, and other AI applications. It provides both MCP tools and a REST API interface for managing repositories, issues, and triggering repository dispatch events.
Related MCP server: git-mcp
Features
MCP Tool | Description |
| Trigger a repository_dispatch webhook event |
| Create a new issue in a repository |
| Get detailed information about a repository |
REST API Endpoints
POST /dispatch- Trigger repository_dispatch eventPOST /issue- Create an issueGET /health- Health check endpoint
Prerequisites
Python 3.11+
GitHub Personal Access Token (PAT) with appropriate scopes
pip or poetry for dependency management
Setup
1. Clone the Repository
git clone https://github.com/sasakiryuki/github-mcp.git
cd github-mcp2. Install Dependencies
Using Poetry (recommended):
poetry installOr using pip:
pip install -e .3. Configure Environment Variables
Copy .env.example to .env and add your GitHub PAT:
cp .env.example .envEdit .env:
GITHUB_PAT=ghp_xxxxxxxxxxxxxxxxxxxx
MCP_TRANSPORT=stdio
MCP_HOST=127.0.0.1
MCP_PORT=8000
LOG_LEVEL=INFOImportant: The .env file contains secrets and should never be committed to version control.
4. Verify Installation
poetry run python -c "from github_mcp import __version__; print(__version__)"Usage
MCP Mode (Default)
Run the MCP server for use with MCP-compatible clients:
poetry run github-mcpOr via stdio for Claude Desktop / GPT:
poetry run python -m github_mcp.core.serverREST API Mode
Run the FastAPI server on http://localhost:8000:
poetry run python -m github_mcp.api.rest_serverAccess the interactive API documentation at http://localhost:8000/docs
MCP Inspector (Testing)
npx @modelcontextprotocol/inspector poetry run python -m github_mcp.core.serverIntegration with AI Clients
Claude Desktop
Locate your Claude Desktop config file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
Add the GitHub MCP server to
mcpServers:
{
"mcpServers": {
"github": {
"command": "poetry",
"args": ["run", "python", "-m", "github_mcp.core.server"],
"cwd": "/absolute/path/to/github-mcp",
"env": {
"GITHUB_PAT": "your_github_pat_here"
}
}
}
}Restart Claude Desktop
GPT Custom GPT
Deploy the REST API server to a cloud service (e.g., Vercel, AWS Lambda, Google Cloud Run)
Create a Custom GPT in ChatGPT
Add the OpenAPI schema to your Custom GPT's actions configuration
Configure your GitHub PAT as a required header or authentication method
Example OpenAPI schema:
openapi: 3.0.0
info:
title: GitHub MCP API
version: 1.0.0
servers:
- url: https://your-deployment-url.com
paths:
/dispatch:
post:
operationId: triggerDispatch
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
owner:
type: string
repo:
type: string
event_type:
type: string
payload_json:
type: stringAPI Examples
Create an Issue
MCP Tool Call:
call_tool("create_issue", {
"owner": "sasakiryuki",
"repo": "github-mcp",
"title": "Fix broken link in docs",
"body": "The setup link on line 42 is broken.\n\nExpected: https://...\nActual: https://..."
})REST API:
curl -X POST http://localhost:8000/issue \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_GITHUB_PAT" \
-d '{
"owner": "sasakiryuki",
"repo": "github-mcp",
"title": "Fix broken link in docs",
"body": "The setup link on line 42 is broken."
}'Trigger Repository Dispatch
MCP Tool Call:
call_tool("trigger_repository_dispatch", {
"owner": "sasakiryuki",
"repo": "github-mcp",
"event_type": "deploy-production",
"payload_json": '{"version": "1.0.0", "environment": "production"}'
})REST API:
curl -X POST http://localhost:8000/dispatch \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_GITHUB_PAT" \
-d '{
"owner": "sasakiryuki",
"repo": "github-mcp",
"event_type": "deploy-production",
"payload_json": "{\"version\": \"1.0.0\", \"environment\": \"production\"}"
}'Get Repository Info
MCP Tool Call:
call_tool("get_repository_info", {
"owner": "sasakiryuki",
"repo": "github-mcp"
})Security Considerations
Token Management
Never hardcode tokens: Always use environment variables or secret managers
Use Personal Access Tokens (PAT): For user impersonation, PATs are safer than passwords
Minimal scopes: Create PATs with only required permissions (typically:
repo,workflow)Token rotation: Regularly rotate your tokens
Secret masking: The server automatically masks tokens in logs
Production Deployment
Use a Secret Manager (AWS Secrets Manager, Google Secret Manager, etc.)
Enable token encryption in transit (HTTPS)
Implement rate limiting
Add request authentication/authorization
Monitor and audit all API calls
Use temporary credentials when possible
Example with AWS Secrets Manager:
import boto3
def get_github_pat():
client = boto3.client('secretsmanager')
response = client.get_secret_value(SecretId='github-mcp-pat')
return response['SecretString']Development
Run Tests
# All tests
poetry run pytest
# With coverage
poetry run pytest --cov=src/github_mcp
# Specific test file
poetry run pytest tests/unit/test_config.py -vCode Quality
# Format code
poetry run black src/ tests/
# Lint
poetry run flake8 src/ tests/
# Type checking
poetry run mypy src/Architecture
Project Structure
github-mcp/
├── src/github_mcp/
│ ├── __init__.py
│ ├── core/
│ │ ├── server.py # MCP server implementation
│ │ ├── tools.py # MCP tools definitions
│ │ └── cli.py # CLI entry point
│ ├── api/
│ │ ├── rest_server.py # FastAPI server
│ │ └── schemas.py # Request/response schemas
│ ├── services/
│ │ └── github_service.py # GitHub API wrapper
│ ├── config.py # Configuration management
│ └── utils/
│ ├── encryption.py # Token encryption utilities
│ └── logging.py # Logging with masking
├── tests/
│ ├── unit/
│ ├── integration/
│ └── fixtures/
├── .env.example
├── README.md
├── pyproject.toml
└── LICENSEComponent Interaction
MCP Client (Claude Desktop/GPT)
↓
MCP Server (FastMCP)
↓
Tools Layer (trigger_repository_dispatch, create_issue, etc.)
↓
GitHub Service (PyGithub wrapper)
↓
GitHub REST APIFor REST API mode:
REST Client (Custom GPT, etc.)
↓
FastAPI Server
↓
GitHub Service
↓
GitHub REST APITroubleshooting
"Invalid GitHub PAT" Error
Verify the token is correctly set in
.envCheck token hasn't expired
Confirm token has required scopes:
repo,workflowTest token manually:
curl -H "Authorization: token YOUR_PAT" https://api.github.com/user
"Repository Not Found" Error
Verify owner and repo name are correct
Check the repository is public or you have access
Verify your PAT has appropriate permissions
MCP Connection Issues
Ensure the server is running in MCP mode
Check the transport type matches your client configuration
Verify environment variables are set correctly
Check logs for detailed error messages
REST API Port Already in Use
# Find process using port 8000
lsof -i :8000
# Use a different port
MCP_PORT=8001 poetry run python -m github_mcp.api.rest_serverPerformance & Rate Limiting
GitHub API has rate limits:
Authenticated requests: 5,000 per hour
Unauthenticated requests: 60 per hour
The server does not implement local rate limiting. For high-volume usage, consider:
Implementing request queuing
Using GitHub's conditional requests (ETags)
Batching API calls where possible
Testing
Live Testing Against GitHub
# Set this flag to enable tests that modify your GitHub account
RUN_LIVE_TESTS=1 poetry run pytest tests/integration/Mock Testing
# Default: uses mock data, safe to run
poetry run pytest tests/unit/Contributing
Contributions are welcome! Please:
Fork the repository
Create a feature branch
Add tests for new functionality
Ensure all tests pass
Submit a pull request
License
MIT License - see LICENSE file for details
Support
For issues, questions, or suggestions:
Open a GitHub issue
Check existing issues for solutions
See DEVELOPMENT.md for technical details
Changelog
v0.1.0 (Initial Release)
MCP server with tools: trigger_repository_dispatch, create_issue, get_repository_info
FastAPI REST server
Configuration management with environment variables
Token encryption utilities
Comprehensive logging with token masking
Unit and integration tests
Claude Desktop integration guide
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityAmaintenanceMCP server that exposes GitHub operations as tools for AI agents, enabling code search, issue management, and PR review.12MIT
- FlicenseBqualityCmaintenanceEnables AI clients to interact with GitHub repositories, issues, pull requests, and code search through the GitHub REST API.12
- FlicenseNot gradedqualityBmaintenanceEnables AI assistants to interact with GitHub issues, pull requests, and Actions workflows through MCP tools.
- FlicenseNot gradedqualityCmaintenanceEnables AI agents to interact with GitHub via MCP, managing repositories, issues, PRs, and analyzing repository health through tools like list_repositories, read_issues, create_issue, comment_on_pr, and analyze_repo_health.
Related MCP Connectors
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
GitHub MCP — wraps the GitHub public REST API (no auth required for public endpoints)
An MCP server that gives your AI access to the source code and docs of all public github repos
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ai-info-x/github-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server