git-mcp
git-mcp
A Model Context Protocol (MCP) server in Python that connects to GitHub via the REST API.
git-mcp lets Cursor (or any MCP-compatible AI client) talk to GitHub directly — search repos, read files, list issues, inspect pull requests, and more — without copying data into chat manually.
How it works
Cursor starts the server as a background process via your MCP config.
The server communicates over stdio (standard input/output).
When you ask something like “show open issues in my repo”, Cursor calls a tool on the server.
The server uses PyGithub and your GitHub token to call the GitHub REST API and returns JSON to the AI.
Cursor / AI ──stdio MCP──▶ git-mcp server ──REST API──▶ GitHub
│
└── GITHUB_TOKEN (.env)Tools are actions the AI can take. Resources (github://user, github://repos) are read-only context the AI can pull in automatically.
Features
Tools
Tool | Description |
| Repository metadata |
| Branch list |
| Read a file (or list a directory) |
| Recent commits |
| Issues (excludes PRs) |
| Issue details + comments |
| Create an issue |
| Pull request list |
| PR details, reviews, and files |
| Repository search |
| Code search |
| User profile |
Resources
github://user— authenticated user profilegithub://repos— repositories you can access
Setup
1. Create a GitHub token
Create a Personal Access Token with scopes needed for your workflow (typically repo for private repos, or public_repo for public-only).
2. Install
cd git-mcp
python -m venv .venv
pip install -e .Activate the venv if you prefer (optional on Windows):
# Windows
.venv\Scripts\activate
# macOS/Linux
source .venv/bin/activateOn Windows, if Activate.ps1 is blocked by execution policy, skip activation and use the venv Python directly:
.\.venv\Scripts\python.exe -m git_mcp.serverCopy .env.example to .env and set your token:
cp .env.example .env3. Run locally
git-mcp
# or
python -m git_mcp.serverCursor configuration
Add to your Cursor MCP settings (Settings → MCP → Add new MCP server, or edit ~/.cursor/mcp.json):
{
"mcpServers": {
"github": {
"command": "E:\\mission-x\\cursorWork\\git-mcp\\.venv\\Scripts\\python.exe",
"args": ["-m", "git_mcp.server"],
"env": {
"GITHUB_TOKEN": "ghp_your_token_here"
}
}
}
}Adjust the Python path to your virtual environment. You can also rely on a .env file in the project root instead of putting the token in mcp.json.
Example tool calls
list_issues(owner="octocat", repo="Hello-World", state="open", limit=5)
get_pull_request(owner="octocat", repo="Hello-World", pr_number=1)
search_code(query="FastMCP in:file language:python")Ask in Cursor:
List the 5 most recent open issues in
myorg/myrepoand summarize them.
Cursor calls list_issues, gets structured JSON back, and summarizes — no manual tab switching.
git-mcp vs git vs GitHub CLI
git-mcp |
|
| |
Purpose | AI ↔ GitHub via MCP | Local repo operations | GitHub from terminal |
Used by | Cursor agent automatically | You in terminal | You in terminal |
Good for | Issues, PRs, search, remote files | Commit, push, branch locally | GitHub workflows from shell |
git-mcp is GitHub API integration for AI, not a replacement for local git commands like commit or push.
Requirements
Python 3.10+
mcp(Python SDK, v1.x)PyGithubpython-dotenv
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/rkjavait/rk-git-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server