Personal GitHub MCP
A personal GitHub engineering assistant that enables repository management, project publishing, code and engineering-memory search, Project Euler solution workflows, and repo analysis through natural language.
README
Personal GitHub MCP
A production-grade Model Context Protocol server that acts as a personal GitHub engineering assistant.
Instead of exposing raw GitHub API calls, it provides high-level tools that represent real user intentions — publish the project you are working in, upload a Project Euler solution with an auto-generated README, find where you used a library, or search your entire engineering memory.
Built with Python 3.12+, the official MCP Python SDK (v2), PyGithub, GitPython, Pydantic v2, and uv.
Features
- Repository management — list, summarize, create, and inspect your repositories.
- Publishing —
publish_current_projectpublishes the directory you are in with an auto-generated README and.gitignore;publish_project/backup_projectcover the rest. - Project Euler flagship workflow —
publish_euler_solutiondetects the problem from the current directory, infers the language, generates a professional README (LLM or static analysis), and pushes both to your solutions repo. - Search — GitHub code/repo search plus
search_my_engineering_memory, which ranks hits across your repositories, READMEs, architecture docs, and source code. - Analysis — explain a repo in plain language, compare repos, recommend what to work on, detect stale repos, and summarize a local project's dependencies and architecture.
- Structured, typed errors — the server never crashes; every failure is returned as a structured envelope.
- Structured JSON logging with per-tool timing.
Every tool returns the same envelope:
{ "ok": true, "data": { ... } }
or
{ "ok": false, "error": { "kind": "repository_not_found", "message": "..." } }
Architecture
src/
├── server.py # MCP server assembly + tool registration wiring
├── main.py # CLI entry point (uv run personal-github-mcp)
├── config.py # Settings loaded from .env (pydantic-settings)
├── models.py # Pydantic response models for every tool
├── github_client.py # Thin PyGithub wrapper (exception mapping)
├── git_client.py # Thin GitPython wrapper (exception mapping)
├── dependencies.py # Service container / dependency wiring
├── tools/ # Tool registration only (thin, one concern per file)
│ ├── repo.py # repository listing/summary/create + reporting
│ ├── publish.py # publish_project, publish_current_project, backup_project
│ ├── search.py # search_code, search_repository, where_did_i_use,
│ │ # search_my_engineering_memory
│ ├── euler.py # upload_euler_solution, publish_euler_solution, update_progress
│ └── analyze.py # compare_repositories, dependency_summary, ...
├── services/ # Business logic (SOLID, no raw API calls here)
│ ├── github_service.py # core GitHub CRUD (list/summary/create/exists)
│ ├── report_service.py # statistics, explain, stale report, recommend, compare
│ ├── git_service.py # local git + project analysis
│ ├── search_service.py # code/repo search + engineering memory search
│ ├── euler_service.py # Project Euler detection, upload, publish, progress
│ ├── project_service.py # publish / backup workflows
│ ├── readme_service.py # README generation (static analysis + optional LLM)
│ ├── scaffold_service.py# README + .gitignore scaffolding for projects
│ └── llm_service.py # optional OpenAI-compatible client (never required)
└── utils/
├── logging.py # Structured JSON logging
└── errors.py # Typed errors + tool_handler decorator
Layering is strict:
tools (MCP registration only)
→ services (business logic, returns Pydantic models)
→ clients (PyGithub / GitPython wrappers, raise typed errors)
→ utils (shared errors + logging)
This keeps tool files small, makes the business logic unit-testable, and keeps the server module free of implementation details. Services are dependency-injected and model-backed so they can be lifted straight into LangGraph agents later.
Installation
Prerequisites: Python 3.12+, git, and uv.
git clone <your-repo-url> personal-github-mcp
cd personal-github-mcp
# Install dependencies and the package (editable dev install)
uv sync --all-extras
# Configure secrets
cp .env.example .env
# edit .env and set GITHUB_TOKEN
Configuration
Copy .env.example to .env and fill in at least GITHUB_TOKEN.
| Variable | Required | Default | Description |
|---|---|---|---|
GITHUB_TOKEN |
yes | — | GitHub Personal Access Token (classic repo scope, or a fine-grained token with read/write on your repos). PERSONAL_GITHUB_TOKEN is accepted as an alias. |
GITHUB_USERNAME |
no | token owner | Account used to scope searches/repo listing. |
EULER_REPOSITORY |
no | project-euler |
Repo that stores Project Euler solutions. |
DEFAULT_VISIBILITY |
no | private |
Visibility for new repos (private/public). |
DEFAULT_BRANCH |
no | main |
Branch used when initializing new repos. |
GIT_AUTHOR_NAME |
no | Personal GitHub MCP |
Author for local git commits. |
GIT_AUTHOR_EMAIL |
no | personal-github-mcp@users.noreply.github.com |
Committer email for local commits. |
LOG_LEVEL |
no | INFO |
DEBUG, INFO, WARNING, ERROR. |
MAX_RESULTS |
no | 20 |
Default result cap for list/search tools (1–100). |
OPENAI_API_KEY |
no | — | Optional OpenAI-compatible API key for LLM-generated READMEs (LLM_API_KEY also accepted). |
OPENAI_BASE_URL |
no | https://api.openai.com/v1 |
Base URL for an OpenAI-compatible chat/completions endpoint (LLM_BASE_URL also accepted). |
OPENAI_MODEL |
no | gpt-4o-mini |
Model used for README generation (LLM_MODEL also accepted). |
Never commit
.env. It is git-ignored. If the token is missing at startup the server prints a clear message and exits with a non-zero code.README generation never fails without an LLM. When no
OPENAI_API_KEYis set (or the call fails), READMEs are generated deterministically from static analysis of the project/solution.
Tools
Repository
| Tool | Description |
|---|---|
list_repositories(visibility, sort, limit) |
List your repos, optionally filtered by private/public and sorted by pushed/updated/created/full_name. |
repository_summary(name) |
High-level summary: languages, topics, last commit, top-level structure. |
create_repository(name, description, private) |
Create a repo under your account (auto-initialized with a README). |
project_statistics(name) |
Language breakdown, commits per author, open issues/PRs. |
explain_repository(name) |
Plain-language explanation of what a repo is about. |
stale_repository_report(threshold_days, limit) |
Repos not pushed to for a while. |
recommend_project(interests, limit) |
Ranked suggestions for what to work on next. |
Publishing
| Tool | Description |
|---|---|
publish_current_project(repo_name, description, private, commit_message, branch) |
Publish the current working directory. Detects the project, generates a README and .gitignore when missing, initializes git, creates the GitHub repo if needed, commits and pushes. Returns the repo URL. |
publish_project(path, repo_name, description, private, commit_message, branch) |
Publish a local directory as a new GitHub repo (init → commit → create repo → push). |
backup_project(path, commit_message) |
Commit local changes and push to an existing repo (creates the repo only if no remote exists). |
Publishing handles every combination: existing repos, not-yet-created repos, repos with a remote, and repos without one.
Search
| Tool | Description |
|---|---|
search_code(keyword, language, owner, limit) |
GitHub code search. |
search_repository(name, owner, limit) |
GitHub repository search by name. |
where_did_i_use(keyword, language, limit) |
Find where you used a keyword in your own repos. |
search_my_engineering_memory(keyword, limit) |
Search across your repositories, README files, architecture documentation, and source code, returning ranked results. |
Project Euler
| Tool | Description |
|---|---|
publish_euler_solution(path, commit_message) |
Flagship workflow. Detects the problem in the current directory (folders like 001/ or problem_023/), infers the language and source file, generates a professional README, and uploads the solution + README to your Euler repo. |
upload_euler_solution(problem_number, file_path, commit_message) |
Upload a solution as problem_<NNN>/<filename> in your Euler repo. |
update_progress() |
Solved problems, totals, and the next unsolved problem number. |
Generated Euler READMEs include: Problem Number, Problem Statement (placeholder — the official statement is copyright and cannot be reproduced), Approach, Complexity (time & space), Key Insights, and Files.
Analysis
| Tool | Description |
|---|---|
compare_repositories(repository_a, repository_b) |
Compare two repos and summarize differences. |
dependency_summary(path) |
Detect and list a local project's dependencies. |
architecture_summary(path) |
Languages, structure, and entry points of a local project. |
Example usage
// publish the project you're currently in (detects cwd, writes README + .gitignore)
publish_current_project(description: "my notes app")
// → { "ok": true, "data": { "repository": "me/notes-app", "url": "https://github.com/me/notes-app",
// "created": true, "readme_generated": true, "gitignore_generated": true, ... } }
// flagship Project Euler workflow (run from inside "ProjectEuler/023/")
publish_euler_solution()
// → { "ok": true, "data": { "problem_number": 23, "path_in_repo": "problem_023/solution.py",
// "readme_url": "https://github.com/me/project-euler/...", ... } }
// search your entire engineering memory
search_my_engineering_memory(keyword: "sieve")
// → { "ok": true, "data": { "query": "\"sieve\" user:me", "items": [
// { "kind": "repository", "repository": "me/algo", ... },
// { "kind": "source", "repository": "me/algo", "path": "sieve.py", ... } ] } }
// publish a local project by path
publish_project(path: "/Users/me/projects/notes", repo_name: "notes", private: true)
// → { "ok": true, "data": { "repository": "me/notes", "url": "https://github.com/me/notes", "created": true, ... } }
// upload a Project Euler solution
upload_euler_solution(problem_number: 25, file_path: "/Users/me/euler/p025.py")
// → { "ok": true, "data": { "problem_number": 25, "path_in_repo": "problem_025/p025.py", ... } }
Connecting from Claude Desktop
Add this to your Claude Desktop config (claude_desktop_config.json):
{
"mcpServers": {
"personal-github-mcp": {
"command": "uv",
"args": ["--directory", "/absolute/path/to/personal-github-mcp", "run", "personal-github-mcp"],
"env": {
"GITHUB_TOKEN": "ghp_xxxx"
}
}
}
}
If your token is already in the project's .env, you can omit env — the server loads .env itself.
Connecting from Cursor
In Cursor, add an MCP server (Settings → MCP) with the stdio type:
{
"mcpServers": {
"personal-github-mcp": {
"type": "stdio",
"command": "uv",
"args": ["--directory", "/absolute/path/to/personal-github-mcp", "run", "personal-github-mcp"],
"env": {
"GITHUB_TOKEN": "ghp_xxxx"
}
}
}
}
The same pattern works for other MCP clients (Claude Code, VS Code Copilot, etc.): point the client at uv --directory <path> run personal-github-mcp.
Screenshots
| Area | Placeholder |
|---|---|
| Claude Desktop tools | docs/screenshots/claude-tools.png |
publish_euler_solution result |
docs/screenshots/euler-publish.png |
| Engineering memory search | docs/screenshots/memory-search.png |
Troubleshooting
"GitHub token is required" and the server exits with code 2
Set GITHUB_TOKEN in .env (or export it) and retry. The server deliberately
refuses to start without a token.
publish_euler_solution says "No Project Euler problem detected"
The tool expects to run inside (or above) a folder named like 001,
problem_023, or ProjectEuler/023, and that folder must contain a recognized
source file (solution.py, main.cpp, etc.). Supported extensions: .py,
.cpp, .cc, .cxx, .c, .rs, .go, .js, .ts, .java, .rb, .cs,
.php, .swift, .kt, .hs, .lua, .zig, .ml.
"Git push failed"
A remote may point to a repository you cannot write to, or the branch has
diverged. Run git remote -v and git log to diagnose; backup_project is
the safe way to push to an existing remote.
GitHub API / rate-limit errors
GitHub rate limits apply. Wait and retry, or reduce limit/MAX_RESULTS.
Fine-grained tokens need read/write access to the repos you manage.
READMEs look generic
No LLM is configured, so READMEs come from static analysis. Set
OPENAI_API_KEY (and optionally OPENAI_BASE_URL/OPENAI_MODEL) to get
LLM-written READMEs. Any LLM failure falls back to static analysis silently.
Logs are JSON lines
Set LOG_LEVEL=DEBUG for more detail. Per-tool timing and error kinds are
logged to stderr.
Testing
uv run pytest
The suite covers GitHub services (with in-memory fakes), reporting/analysis services, git services (real repos in temp dirs, including pushes to a local bare remote), the full publish/backup workflows, Project Euler detection and publishing, README/.gitignore scaffolding, search, MCP tool registration and response envelopes.
Development
uv sync --all-extras # install everything
uv run ruff format src tests
uv run ruff check src tests
uv run pytest
Roadmap
- LangGraph integration — services are deliberately dependency-injected and model-backed so they can be lifted straight into LangGraph agents/nodes.
- Project Euler templates — generate solution scaffolds per problem.
- PR automation — raise pull requests from local branches.
- SSE / HTTP transport — support
transport="streamable-http"for remote clients. - Issues triage — list and label open issues across repositories.
- Auth UX — OAuth device flow as an alternative to a PAT.
- Fuzzy "where did I use" — tokenized search across clone history, not just the API.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。