GitHub MCP(模型上下文协议)服务器
嗨!这是我的第一个GitHub MCP 服务器,它允许像Claude这样的MCP 兼容LLM 与我的 MCP 服务器交互,从而与 GitHub API 交互。
要求
TypeScript(编程语言)
Octokit(用于向 GitHub 发出 API 请求)
模型上下文协议 SDK
在本地设置项目
克隆存储库
运行
npm install
添加
.env
文件,查看.env.example
文件中提供的示例要将 TypeScript 文件构建为 Javascript,请运行
npx tsc
要最终运行项目,请运行
node build/index.js
测试方法
您可以通过两种方式测试您的 MCP 服务器:
MCP检查员
克劳德桌面
使用 MCP 检查器进行测试
只需在终端中运行
npx @modelcontextprotocol/inspector node build/index.js
您现在可以看到MCP 检查器并进行测试。
使用 Claude Desktop 进行测试
从这里下载并安装 Claude Desktop
转到文件>设置...>开发人员>编辑配置
它应该打开 claude_desktop_config.json 文件的位置。
在代码编辑器中打开该文件并添加以下内容:
{ "mcpServers": { "gh": { "command": "node", "args": ["absolute\\path\\to\\your\\index.js\\file"], "env": { "GITHUB_TOKEN": "your-github-personal-access-token" } } } }退出并重新打开 Claude 桌面
功能
MCP主要支持两个功能:
工具(4)
create-issue
:在 GitHub 存储库中创建新问题get-repo-info
:获取有关特定 GitHub 存储库的信息list-issues
:列出 GitHub 存储库中的问题search-repos
:搜索 GitHub 存储库
提示(5)
create-issue-description
:为 GitHub 问题生成描述create-pull-request-description
:为 GitHub 拉取请求生成描述search-repos-prompt
:生成用于搜索 GitHub 存储库的查询create-issue-prompt
:生成用于创建 GitHub 问题的参数enhance-github-response
:格式化并增强原始 GitHub API 响应数据
您可以编写自己的提示,也可以从 Claude 桌面版 MCP 的“选择集成”选项下拉菜单中选择合适的提示
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
MCP 服务器允许 Claude 和其他与 MCP 兼容的 LLM 与 GitHub API 交互,支持创建问题、获取存储库信息、列出问题和搜索存储库等功能。
Related MCP Servers
- AsecurityAlicenseAqualityMCP Server for the GitHub API, enabling file operations, repository management, search functionality, and more.Last updated -22,57368,255MIT License
- AsecurityFlicenseAqualityMCP Server for the GitHub API, providing features for file operations, repository management, and advanced search, with automatic branch creation and comprehensive error handling.Last updated -1804
- AsecurityFlicenseAqualityAn MCP server that enables Claude and other compatible LLMs to interact with the GitHub API, supporting features like creating issues, retrieving repository information, listing issues, and searching repositories.Last updated -4
- -securityAlicense-qualityAn MCP server that wraps around the GitHub CLI tool, allowing AI assistants to interact with GitHub repositories through commands for pull requests, issues, and repository operations.Last updated -5MIT License