README
🚀 GitHub MCP 服务器
这是一个基于Model Context Protocol (MCP) 的服务器,它提供了与GitHub API交互的工具。目前,该服务器支持通过描述、主题标签和网站URL来创建仓库。
🚀 快速开始
GitHub MCP服务器提供了便捷的方式与GitHub API交互,助力你高效管理仓库。
✨ 主要特性
- 可依据描述自动生成名称来创建GitHub仓库。
- 能够为仓库添加主题标签/标签。
- 支持设置仓库主页。
- 会自动将仓库初始化为README文件。
📦 安装指南
- 克隆仓库。
- 安装依赖:
npm install
- 构建服务器:
npm run build
📚 详细文档
配置
该服务器需要一个具有仓库创建权限的GitHub个人访问令牌。请将以下内容添加到您的MCP设置文件中:
{
"mcpServers": {
"github": {
"command": "node",
"args": ["path/to/github-server/build/index.js"],
"env": {
"GITHUB_TOKEN": "your-github-token"
}
}
}
}
可用工具
create_repo
使用自然语言命令创建或更新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"的仓库。
- 设置描述为"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:创建仓库
- Update/change/set/modify:更新仓库
- "description to/as":更新描述
- "tags/topics to/as":更新标签
- "website/homepage/url to/as":更新网站
开发
要修改或扩展服务器:
- 修改
src/index.ts。 - 重新构建服务器:
npm run build
📄 许可证
本项目采用MIT许可证。
Scan to join WeChat group