GitHub MCP 服务器
一个模型上下文协议 (MCP) 服务器,提供与 GitHub API 交互的工具。目前支持创建包含描述、主题和网站 URL 的仓库。
特征
- 使用根据描述自动生成的名称创建 GitHub 存储库
- 向存储库添加主题/标签
- 设置存储库主页
- 使用 README 文件自动初始化存储库
安装
- 克隆存储库
- 安装依赖项:
- 构建服务器:
配置
该服务器需要具有仓库创建权限的 GitHub 个人访问令牌。将以下内容添加到您的 MCP 设置文件中:
{
"mcpServers": {
"github": {
"command": "node",
"args": ["path/to/github-server/build/index.js"],
"env": {
"GITHUB_TOKEN": "your-github-token"
}
}
}
}
可用工具
创建仓库
使用自然语言命令创建或更新 GitHub 存储库。
命令格式
该工具接受用于不同操作的自然语言命令:
创建存储库:
Create a repository for [description] with tags [tag1 tag2 tag3] website [url]
或者
Make a new repository called [description] tagged with [tag1, tag2, tag3]
更新存储库描述:
Update [owner/repo] description to [new description]
或者
Change [repo-name] description as [new description]
更新存储库标签:
Update [owner/repo] tags to [tag1 tag2 tag3]
或者
Set [repo-name] topics as [tag1, tag2, tag3]
更新存储库网站:
Update [owner/repo] website to [url]
或者
Set [repo-name] homepage as [url]
示例用法
创建新的存储库:
const result = await use_mcp_tool({
server_name: "github",
tool_name: "create_repo",
arguments: {
command: "Create a repository for my machine learning image classifier with tags python tensorflow computer-vision website https://example.com/docs"
}
});
这将:
- 创建名为“my-machine-learning-image-classifier”的存储库
- 将描述设置为“我的机器学习图像分类器”
- 添加“python”、“tensorflow”和“computer-vision”作为存储库主题
- 将网站设置为“ https://example.com/docs ”
- 使用 README 文件初始化
更新存储库描述:
const result = await use_mcp_tool({
server_name: "github",
tool_name: "create_repo",
arguments: {
command: "Update username/existing-repo description to Updated ML project for image classification"
}
});
更新存储库标签:
const result = await use_mcp_tool({
server_name: "github",
tool_name: "create_repo",
arguments: {
command: "Update username/existing-repo tags to machine-learning python updated"
}
});
更新存储库网站:
const result = await use_mcp_tool({
server_name: "github",
tool_name: "create_repo",
arguments: {
command: "Update username/existing-repo website to https://example.com/new-docs"
}
});
该工具可以理解各种自然语言模式和关键词:
- Create/make/new 用于创建存储库
- 更新/更改/设置/修改以更新存储库
- “description to/as”用于更新描述
- “tags/topics to/as”用于更新标签
- “website/homepage/url to/as”用于更新网站
发展
要修改或扩展服务器:
- 修改
src/index.ts
- 重建服务器:
执照
麻省理工学院