GitHub MCP Server
GitHub MCP Server
自定义 MCP(Model Context Protocol)服务器,使用 TypeScript 编写,将 Claude 连接到 GitHub REST API。
它的功能
提供 6 个 Claude 可以调用的工具(tools):
工具 | 描述 |
| 列出已认证用户的仓库 |
| 特定仓库的详细信息 |
| 列出某个仓库的 issues |
| 创建新的 issue |
| 读取仓库中文件的内容 |
| 在 GitHub 上搜索代码 |
Related MCP server: remote-mcp-oauth-github
1. 生成 GitHub Personal Access Token
访问 GitHub → Settings → Developer settings → Personal access tokens → Fine-grained tokens
创建具有最小必要权限的 token:
Contents: Read(用于get_file_content)Issues: Read and write(用于list_issues/create_issue)Metadata: Read(始终必需)
复制生成的 token(以
github_pat_...开头)
安全提示:切勿将 token 提交到仓库。请使用环境变量。
2. 安装并构建
npm install
npm run build这会生成 build/index.js,即服务器的可执行文件(通过 stdio 通信,这是 MCP 的标准协议)。
3. 本地测试(可选,无需 Claude)
export GITHUB_PERSONAL_ACCESS_TOKEN="seu_token_aqui"
npm start如果 stderr 中出现 GitHub MCP server rodando via stdio.,就说明它在正常工作。要以交互方式测试这些工具,请使用 MCP Inspector:
npx @modelcontextprotocol/inspector node build/index.js4. 连接到 Claude Desktop
编辑 Claude Desktop 的配置文件:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
添加:
{
"mcpServers": {
"github": {
"command": "node",
"args": ["/caminho/absoluto/para/github-mcp-server/build/index.js"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "seu_token_aqui"
}
}
}
}重启 Claude Desktop。GitHub 的相关工具应该会出现在对话的工具图标(🔨)中。
5. 后续步骤(扩展并强化作品集的想法)
添加写入类工具:
create_pull_request、merge_pull_request、create_branch添加真正的分页(基于 cursor),而不是只使用
per_page速率限制和缓存(GitHub 对已认证请求的限制为 5000 req/h)
使用 Vitest/Jest 编写自动化测试
使用 GitHub Actions 在每次推送时运行 lint + 测试 + build 的 CI
作为 npm 包发布(
npx github-mcp-server)将服务器 Docker 化(是与你其他 DevOps 项目集成的良好切入点)
项目结构
github-mcp-server/
├── src/
│ └── index.ts # lógica do servidor e definição das tools
├── build/ # gerado pelo `npm run build`
├── package.json
├── tsconfig.json
└── README.mdMaintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceConnects Claude Desktop to GitHub repositories, enabling users to perform git operations and GitHub API interactions through natural conversation.452
- AlicenseNot gradedqualityDmaintenanceEnables Claude to authenticate with GitHub OAuth and access tools for user information, calculations, and GitHub repositories.5MIT
- FlicenseAqualityBmaintenanceConnects Claude to GitHub, enabling listing repositories, browsing open pull requests, and inspecting PR diffs for code review.4
- FlicenseNot gradedqualityCmaintenanceEnables to interact with GitHub repositories directly from Claude, supporting actions like viewing repos, checking status, committing and pushing changes, and managing pull requests.
Related MCP Connectors
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Connect AI assistants to your GitHub-hosted Obsidian vault to seamlessly access, search, and analy…
Connect Claude to Fathom meeting recordings, transcripts, and summaries
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/luizHramoss/github-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server