GitHub MCP Server
GitHub MCP Server 🚀
一个基于 Node.js 和 TypeScript 构建的自定义 Model Context Protocol(MCP)服务器。该服务器允许任何兼容 MCP 的 AI 助手(如 Gemini Code Assist、Claude Desktop、Roo Code 等)直接与你的 GitHub 账户交互。
✨ 功能(可用工具)
该服务器向你的 AI 助手暴露了 7 个强大的工具:
create_repository:创建一个新的公共或私有仓库。get_my_repositories:列出已认证用户最近更新的仓库。get_repository:获取某个特定仓库的详细信息。get_file_content:读取仓库内任意文件的准确内容,用于代码分析。search_code:跨仓库搜索函数、关键字或语法。create_issue:在特定仓库中打开一个新 issue。list_issues:查看仓库中所有处于打开状态的 issue。
🛠️ 安装与设置
克隆仓库:
git clone [https://github.com/YOUR_USERNAME/mcp-github-server.git](https://github.com/YOUR_USERNAME/mcp-github-server.git) cd mcp-github-server Install dependencies:
Bash npm install 构建项目:
Bash npm run build
🔑 如何获取你的 GitHub Token
要让此服务器代表你执行操作,你需要一个来自 GitHub 的 Personal Access Token(PAT)。
前往你的 GitHub 账户设置。
导航并点击"Developer settings"(位于左侧边栏底部)。
点击"Personal access tokens"->"。令牌(经典)"。
点击"Generate new token (classic)"。
为你的 Token 添加一条备注(例如 "MCP Server")。
所需权限:
勾选 repo 权限(这授予对复制仓库的完全控制权,包括私有仓库,它是创建仓库、读取文件和管理 issues 所必需的)。
滚动到页面底部,点击 "Generate token"。
立即复制 Token(它以 ghp_... 开头)。
设置环境
在项目根目录下创建一个 .env 文件:
Bash
touch .env
将你的 Token 添加到 .env 文件中:
代码片段 GITHUB_TOKEN=your_generated_token_here
🔌 连接你的 IDE / AI 客户端
要将此服务器与支持 MCP 的 IDE 或扩展配合使用,你需要配置客户端的 MCP 设置(通常是一个 mcp.json 或 mcp_config.json 文件),使其指向构建产物 index.js 文件。
示例配置:
JSON { "mcpServers": { "github-mcp": { "command": "node", "args": [ "--no-warnings", "ABSOLUTE_PATH_TO_YOUR_PROJECT/dist/index.js" ], "env": { "GITHUB_TOKEN": "your_generated_token_here" } } } }
注意:请务必将 ABSOLUTE_PATH_TO_YOUR_PROJECT 替换为你机器上的实际路径。
🤝 贡献
这是一个小型教育项目!如果你想添加更多工具(如拉取请求管理或提交读取),欢迎 fork 此仓库并提交 Pull Request。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
An MCP server that gives your AI access to the source code and docs of all public github repos
Driflyte MCP server which lets AI assistants query topic-specific knowledge from web and GitHub.
An MCP server that integrates with Discord to provide AI-powered features.
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/amedmohmed925/MCP-Server-to-Github'
If you have feedback or need assistance with the MCP directory API, please join our Discord server