GitHubMcpServer
Exposes GitHub REST API operations as AI-ready tools for managing repositories, tracking push history, and updating settings. It enables LLM agents to perform tasks like creating repositories, retrieving metadata, and monitoring branch activity through a standardized interface.
README
GitHubMcpServer
<div align="center">
A Custom GitHub MCP (Model Context Protocol) Server that exposes GitHub API operations as AI-ready tools for LLM agents and applications.
Overview • Features • Installation • Tools • Configuration • Usage
</div>
📖 Overview
GitHubMcpServer is a lightweight, high-performance MCP server built with FastMCP that bridges AI models and the GitHub REST API. It allows AI agents (such as Claude, GPT-4, etc.) to interact with GitHub repositories directly — fetching metadata, managing settings, tracking activity, listing and creating repositories — all through a standardized MCP interface over HTTP.
┌──────────────────────────┐ ┌───────────────────────────┐
│ AI Agent / LLM Client │ ──────▶│ GitHubMcpServer │
│ (Claude, GPT, etc.) │◀────── │ FastMCP • Port 10000 │
└──────────────────────────┘ └──────────────┬────────────┘
│
┌───────────▼────────────┐
│ GitHub REST API v3 │
│ api.github.com │
└────────────────────────┘
✨ Features
| Feature | Description |
|---|---|
| 🔍 Get Repository Info | Fetch detailed metadata for any repository |
| ✏️ Update Repository Settings | Modify name, description, visibility, merge strategies & more |
| 📊 Track Repository Activity | Query push history, branch changes, merges with filtering |
| 📂 List All Repositories | Paginate and sort all user repositories |
| 🆕 Create Repositories | Spin up new repos with custom configuration |
| ⚡ Async & Non-blocking | Built with httpx and async/await for high performance |
| 🌐 CORS Enabled | Ready for browser-based or cross-origin MCP clients |
| 🔒 Secure Auth | Token-based authentication via .env file |
📋 Prerequisites
- Python 3.10+
- A GitHub Personal Access Token (PAT) with required scopes
uv(recommended) orpip
Required GitHub Token Scopes
| Scope | Purpose |
|---|---|
repo |
Full access to public & private repositories |
read:user |
Read authenticated user profile data |
💡 Generate your token at: GitHub → Settings → Developer Settings → Personal Access Tokens
🚀 Installation
1. Clone the Repository
git clone https://github.com/moksh555/GitHUbMcpServer.git
cd GitHUbMcpServer
2. Install Dependencies
Using uv (recommended):
uv sync
Using pip:
pip install "fastmcp>=3.1.1" httpx pydantic-settings
⚙️ Configuration
Create a .env file in the project root:
GITHUB_ACCESS_TOKEN=ghp_your_personal_access_token_here
OWNER_NAME=your_github_username
| Variable | Required | Description |
|---|---|---|
GITHUB_ACCESS_TOKEN |
✅ | Your GitHub Personal Access Token |
OWNER_NAME |
✅ | Your GitHub username (repository owner) |
⚠️ Never commit your
.envfile to version control. It is already listed in.gitignore.
▶️ Running the Server
uv run python gitHubMcpServer.py
The server starts on http://localhost:10000 using HTTP transport with CORS support.
🛠️ Available MCP Tools
getUserRepo
Retrieves detailed information for a specific GitHub repository.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
repoName |
string |
✅ | The name of the repository |
Returns: ID, name, URL, privacy status, description, creation/update timestamps, primary language, open issues count.
updateRepo
Updates settings for an existing repository. Only provide fields you want to change.
Parameters:
| Name | Type | Description |
|---|---|---|
repoName |
string |
✅ Current repository name |
name |
string |
New repository name |
description |
string |
New description |
homepage |
string |
Homepage URL |
private |
bool |
true for private, false for public |
visibility |
string |
public or private |
has_issues |
bool |
Enable/disable Issues tab |
has_projects |
bool |
Enable/disable Projects tab |
has_wiki |
bool |
Enable/disable Wiki tab |
default_branch |
string |
Change default branch name |
allow_squash_merge |
bool |
Allow squash merging |
archived |
bool |
Archive the repository |
getRepoActivity
Fetches a list of recent activities (pushes, merges, branch changes) for a repository.
Parameters:
| Name | Type | Description |
|---|---|---|
repoName |
string |
✅ Repository name |
direction |
string |
asc or desc |
ref |
string |
Git reference (e.g. refs/heads/main) |
actor |
string |
Filter by username |
timePeriod |
string |
day, week, or month |
activityType |
string |
push, force_push, branch_creation, etc. |
Returns: Activity ID, user, type, branch, before/after SHA, timestamp.
geAllUserRepo
Lists all repositories for the authenticated user with pagination and sorting.
Parameters:
| Name | Type | Description |
|---|---|---|
per_page |
int |
Results per page (default: 30) |
page |
int |
Page number for pagination |
sort |
string |
Sort by: created, updated, pushed, full_name |
createRepository
Creates a new GitHub repository under the authenticated user.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string |
✅ Repository name |
description |
string |
Short description |
private |
bool |
true for private (default: false) |
auto_init |
bool |
Initialize with a README |
🔌 Connecting an AI Client
Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"github": {
"url": "http://localhost:10000/mcp",
"transport": "http"
}
}
}
Python MCP Client
from mcp import ClientSession
from mcp.client.http import http_client
async with http_client("http://localhost:10000/mcp") as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
result = await session.call_tool("getUserRepo", {"repoName": "my-repo"})
print(result)
📁 Project Structure
GitHUbMcpServer/
├── gitHubMcpServer.py # Main MCP server & all tool definitions
├── config.py # Pydantic settings & .env loader
├── pyproject.toml # Project metadata & dependencies
├── .python-version # Python version pin
├── .gitignore # Git ignore rules
├── uv.lock # Locked dependency versions
└── README.md # Project documentation
🤝 Contributing
Contributions, issues and feature requests are welcome!
- Fork the repository
- Create your feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m "Add amazing feature" - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
👤 Author
moksh555 · GitHub Profile
<div align="center">
Built with ❤️ using <a href="https://github.com/jlowin/fastmcp">FastMCP</a> & Python
⭐ Star this repo if you find it helpful!
</div>
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。