MCP server for GitHub operations. Provides tools for repository management, issues, pull requests and code search.
pip install -r requirements.txtfrom mcpgithub import GitHubServer
server = GitHubServer(token="ghp_...")
server.run()- Repository listing and management
- Issue and PR operations
- Code and repository search
- File read and write operations
- Branch management
List repositories for a user or organization.
{
"name": "list_repos",
"arguments": {
"owner": "username",
"type": "all"
}
}Get contents of a file from a repository.
{
"name": "get_file",
"arguments": {
"owner": "username",
"repo": "repo-name",
"path": "src/main.py"
}
}Create a new issue.
{
"name": "create_issue",
"arguments": {
"owner": "username",
"repo": "repo-name",
"title": "Bug report",
"body": "Description..."
}
}Search for code across repositories.
{
"name": "search_code",
"arguments": {
"query": "function authenticate",
"language": "python"
}
}Create a pull request.
{
"name": "create_pr",
"arguments": {
"owner": "username",
"repo": "repo-name",
"title": "Add feature",
"head": "feature-branch",
"base": "main"
}
}server = GitHubServer(
token="ghp_...",
default_owner="myorg"
)Environment variables:
GITHUB_TOKEN=ghp_...
GITHUB_DEFAULT_OWNER=myorg{
"mcpServers": {
"github": {
"command": "python",
"args": ["-m", "mcpgithub"],
"env": {
"GITHUB_TOKEN": "ghp_..."
}
}
}
}MIT