MCP-Inspector-v0.6.0
GitHub MCP 服务器
模型上下文协议 (MCP) 服务器使 Claude 等 AI 助手能够与 GitHub 存储库、问题和拉取请求进行交互。
特征
存储库搜索:根据搜索查询查找 GitHub 存储库
问题管理:获取、创建和评论问题
拉取请求处理:查看和管理拉取请求
存储库分析:获取有关存储库的统计数据和见解
Related MCP server: GitHub MCP Server
安装
先决条件
Python 3.8+
GitHub API 令牌
步骤
克隆此存储库:
git clone https://github.com/yourusername/github-mcp-server.git cd github-mcp-server安装依赖项:
pip install -r requirements.txt将您的 GitHub 令牌设置为环境变量:
export GITHUB_TOKEN=your_github_token_here运行服务器:
python server.py
服务器将开始在http://localhost:5000上运行。
用法
端点
MCP 服务器提供以下端点:
GET /mcp/discover :返回可用的操作及其参数
POST /mcp/execute :根据提供的参数执行操作
示例请求
发现
curl -X GET http://localhost:5000/mcp/discover
执行存储库搜索
curl -X POST http://localhost:5000/mcp/execute \
-H "Content-Type: application/json" \
-d '{
"endpoint": "search_repositories",
"parameters": {
"query": "machine learning"
}
}'
获取存储库问题
curl -X POST http://localhost:5000/mcp/execute \
-H "Content-Type: application/json" \
-d '{
"endpoint": "get_repo_issues",
"parameters": {
"owner": "openai",
"repo": "whisper"
}
}'
建筑学
该服务器遵循模型上下文协议规范,允许 AI 助手:
发现可用的操作
使用适当的参数执行操作
以结构化格式处理并返回结果
扩展服务器
您可以通过以下方式扩展此服务器:
在
discover()函数中添加新的端点实现相应的处理函数
在
execute()函数中更新路由
安全注意事项
服务器使用 API 令牌与 GitHub 进行身份验证
实施速率限制以防止滥用
为所有参数添加输入验证
考虑实施 OAuth 以实现更安全的令牌管理
演示
观看演示视频,了解服务器的功能。
执照
MIT 许可证
接触
如有疑问或需要支持,请在此存储库上打开一个问题。