GitHub Meta MCP Server(模型上下文协议服务器)
一种模型上下文协议服务器,使人工智能模型能够与GitHub的API进行交互,通过自然语言命令实现带有描述、主题和网站URL的存储库创建和管理。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"github": {
"args": [
"path/to/github-server/build/index.js"
],
"command": "node",
"env": {
"GITHUB_TOKEN": "your-github-token"
}
}
}
}
该服务需要配置环境变量:GITHUB_TOKEN
服务介绍
GitHub MCP 服务器
这是一个提供与 GitHub API 交互工具的 Model Context Protocol (MCP) 服务器。当前支持创建带有描述、主题和网站 URL 的仓库。
功能
- 从描述自动生成名称来创建 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