本项目实现了 Model Context Protocol (MCP) 服务器,可让人工智能助手(如 Claude)与 GitHub 仓库、问题和拉取请求进行交互,极大提升了 AI 与 GitHub 生态的协作效率。
本服务器能使人工智能助手与 GitHub 仓库、问题和拉取请求进行交互。启动前,请确保满足以下先决条件:
git clone https://github.com/yourusername/github-mcp-server.git
cd github-mcp-server
pip install -r requirements.txt
export GITHUB_TOKEN=your_github_token_here
python server.py
服务器将在 http://localhost:5000 上启动。
MCP 服务器提供以下端点:
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"
}
}'
服务器遵循 Model Context Protocol 规范,以允许 AI 助手:
你可以通过以下方式扩展服务器:
discover() 函数中添加新的端点execute() 函数中的路由请参阅演示视频了解服务器功能的 walkthrough。
本项目采用 MIT License。
有关问题或支持,请在此仓库上打开问题。