GitHub MCP Server
Enables LLM agents to search, read, and create GitHub issues and pull requests via natural language, using the GitHub API.
README
Kage — GitHub MCP Server
Kage (影, shadow) acts as the invisible layer between an LLM and GitHub — an AI agent can command it without ever touching a UI.
What is this?
Kage is a custom Model Context Protocol (MCP) server that exposes GitHub repository operations as structured, schema-validated tools that any MCP-compatible LLM agent (Claude Desktop, Claude Code, etc.) can call autonomously.
Instead of writing hardcoded scripts that chain GitHub API calls, an agent connected to Kage can think, plan, and act — searching for issues, reading their context, and creating new ones — all in one natural language conversation.
Why MCP instead of a plain REST API?
A REST API requires a human (or hardcoded client) to know exactly what endpoints to call. MCP is different: the server advertises its capabilities at runtime via JSON-RPC. An LLM can query the server for what tools exist, read their schemas, and decide autonomously how to use them. No hardcoding, no predefined flows.
Architecture
┌─────────────────────────┐ JSON-RPC 2.0 over stdio
│ LLM Agent │◄────────────────────────────────►│ Kage MCP Server (Python) │
│ (Claude Desktop / Code) │ │ │
└─────────────────────────┘ │ FastMCP Framework │
│ ↓ │
│ Pydantic Validation │
│ ↓ │
│ PyGithub Client │
│ ↓ │
│ GitHub REST API │
└──────────────────────────┘
sequenceDiagram
participant Agent as LLM Agent (Claude)
participant Kage as Kage MCP Server
participant GH as GitHub API
Agent->>Kage: tools/list → "What can you do?"
Kage-->>Agent: Returns tool names + JSON Schemas
Agent->>Kage: tools/call → search_issues(repo, query)
Note over Kage: Pydantic validates inputs
Kage->>GH: Authenticated search request
GH-->>Kage: Raw issue data
Note over Kage: Formats + limits to top 10 results
Kage-->>Agent: Structured JSON result
Agent->>Kage: tools/call → create_issue(repo, title, body)
Note over Kage: Validates min_length constraints
Kage->>GH: POST /repos/{owner}/{repo}/issues
GH-->>Kage: Created issue data
Kage-->>Agent: { "html_url": "..." }
Available Tools
| Tool | Description | Type |
|---|---|---|
test_connection |
Verifies the server is alive and reachable | Read |
search_issues |
Search for issues/PRs in a repo using GitHub search syntax | Read |
get_issue_details |
Fetch title, body, author, state, and last 5 comments of an issue | Read |
create_issue |
Create a new issue with a validated title and body | Write |
Tool Schemas
search_issues
{
"repo": "owner/repo",
"query": "is:issue is:open label:bug"
}
get_issue_details
{
"repo": "owner/repo",
"issue_number": 42
}
create_issue
{
"repo": "owner/repo",
"title": "Min 5 characters required",
"body": "Min 10 characters required"
}
Security Design
- Least-Privilege Tokens: Uses GitHub Fine-Grained Personal Access Tokens (PAT) scoped to a single repository with only Issues read/write permission. A compromised token cannot touch any other repo or perform any other action.
- Pydantic Input Validation: Every tool input is validated against a strict schema before any API call is made. If an LLM hallucinates a bad payload (e.g., an empty issue title), the server rejects it locally with a clear error — no wasted API call, no garbage data in your repo.
- Additive-Only Writes: The only write tool (
create_issue) is additive. Destructive operations (delete, close, edit) are deliberately not exposed — preventing an LLM hallucination from causing irreversible damage. - Secret Management: The GitHub token is loaded from a
.envfile (never hardcoded) and the.envis in.gitignore.
Project Structure
Kage-The-MCP/
├── server.py # MCP server: all tool definitions and GitHub integration
├── requirements.txt # Python dependencies
├── .env.example # Template for environment variables (copy to .env)
├── .gitignore # Ensures .env and venv are never committed
├── start_inspector.bat # One-click script to launch MCP Inspector for local testing
└── LICENSE # MIT License
Setup & Local Testing
Prerequisites
- Python 3.10+
- Node.js (for MCP Inspector)
- A GitHub account and a test repository
1. Clone & Install
git clone https://github.com/YourUsername/Kage-The-MCP.git
cd Kage-The-MCP
python -m venv venv
.\venv\Scripts\activate
pip install -r requirements.txt
2. Configure Your Token
Create a GitHub Fine-Grained PAT with:
- Repository access: Your test repo only
- Permissions: Issues → Read and write, Metadata → Read-only
Then create a .env file:
GITHUB_TOKEN=github_pat_your_token_here
3. Run the MCP Inspector
.\start_inspector.bat
Open the URL shown in your terminal (e.g., http://localhost:6274), set Command to python and Arguments to server.py, then click Connect.
Stack
Python · FastMCP (MCP SDK 1.28) · PyGithub · Pydantic v2 · python-dotenv · MCP Inspector
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。