用于 Gitee 的 MCP 工具服务器,支持仓库文件/分支、Issues 和 Pull Requests 的管理。
version-control
1.6k 查看 · 2026-07-07 更新
简介
用于 Gitee 的 MCP 工具服务器,支持仓库文件/分支、Issues 和 Pull Requests 的管理。
简介
用于 Gitee 的 MCP 工具服务器,支持仓库文件/分支、Issues 和 Pull Requests 的管理。
Gitee MCP Server
让 AI 通过 MCP 为你操作 Gitee 仓库/Issues/Pull Requests
支持的 AI 操作
| 类别 | MCP 工具 | 描述 |
|---|---|---|
| 仓库操作 | create_repository | 创建一个 Gitee 仓库 |
fork_repository | Fork 一个 Gitee 仓库 | |
| 分支操作 | create_branch | 在 Gitee 仓库中创建一个新的分支 |
list_branches | 列出 Gitee 仓库中的分支 | |
get_branch | 获取 Gitee 仓库中特定分支的详细信息 | |
| 文件操作 | get_file_contents | 获取 Gitee 仓库中文件或目录的内容 |
create_or_update_file | 在 Gitee 仓库中创建或更新文件 | |
push_files | 将多个文件推送到 Gitee 仓库 | |
| Issue 操作 | create_issue | 在 Gitee 仓库中创建一个 Issue |
list_issues | 列出 Gitee 仓库中的 Issues | |
get_issue | 获取 Gitee 仓库中特定 Issue 的详细信息 | |
update_issue | 更新 Gitee 仓库中的一个 Issue | |
add_issue_comment | 向 Gitee 仓库中的一个 Issue 添加评论 | |
| Pull Request 操作 | create_pull_request | 在 Gitee 仓库中创建一个 Pull Request |
list_pull_requests | 列出 Gitee 仓库中的 Pull Requests | |
get_pull_request | 获取 Gitee 仓库中特定 Pull Request 的详细信息 | |
update_pull_request | 更新 Gitee 仓库中的一个 Pull Request | |
merge_pull_request | 合并 Gitee 仓库中的一个 Pull Request | |
| 用户操作 | get_user | 获取 Gitee 用户信息 |
get_current_user | 获取已认证的 Gitee 用户信息 |
使用方法
通过 Smithery 安装
要通过 Smithery 自动安装适用于 Claude Desktop 的 Gitee MCP Server:
npx -y @smithery/cli install @normal-coder/gitee-mcp-server --client claude
配置
GITEE_API_BASE_URL: 可选,Gitee OpenAPI 端点,默认为https://gitee.com/api/v5GITEE_PERSONAL_ACCESS_TOKEN: 必填,Gitee 账户个人访问令牌 (PAT),可以从 Gitee 账户设置中的 Personal Access Tokens 获取DEBUG: 可选,设置为true以启用调试日志,默认禁用
通过 NPX 运行 MCP 服务器
{ "mcpServers": { "Gitee": { "command": "npx", "args": [ "-y", "gitee-mcp-server" ], "env": { "GITEE_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>" } } } }
通过 Docker 容器运行 MCP 服务器
- 获取 Docker 镜像
# Get from DockerHub docker pull normalcoder/gitee-mcp-server # Build locally docker build -t normalcoder/gitee-mcp-server .
- 配置 MCP 服务器
{ "mcpServers": { "Gitee": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "GITEE_PERSONAL_ACCESS_TOKEN", "normalcoder/gitee-mcp-server" ], "env": { "GITEE_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>" } } } }
开发指南
安装依赖
npm install
构建
npm run build
构建成功后,/dist 目录将包含可运行的 MCP 服务器。
运行服务器
npm start
MCP 服务器将在标准输入输出上运行,允许它被 MCP 客户端作为子进程使用。
构建 Docker 镜像
您也可以使用 Docker 来运行服务器:
docker build -t normalcoder/gitee-mcp-server .
使用 Docker 运行 MCP 服务器:
docker run -e GITEE_PERSONAL_ACCESS_TOKEN=<YOUR_TOKEN> normalcoder/gitee-mcp-server
调试 MCP 服务器
您可以使用 @modelcontextprotocol/inspector 进行调试:
在根目录下创建一个 .env 文件来设置环境变量:
GITEE_API_BASE_URL=https://gitee.com/api/v5 GITEE_PERSONAL_ACCESS_TOKEN=<YOUR_TOKEN>
运行调试工具以启动服务和 Web 调试界面:
npx @modelcontextprotocol/inspector npm run start --env-file=.env
项目中包含了一个 debug() 函数用于打印调试信息,用法如下:
import { debug } from './common/utils.js'; debug('Message to log'); debug('Message with data:', { key: 'value' });
只有当 DEBUG 环境变量被设置为 true 时才会打印调试日志。
依赖项
@modelcontextprotocol/sdk: 用于实现服务器的 MCP SDKuniversal-user-agent: 用于生成用户代理字符串zod: 用于模式验证zod-to-json-schema: 用于将 Zod 模式转换为 JSON 模式
许可证
本软件根据 MIT 许可证授权。您可以自由地使用、修改和分发该软件,但需遵守 MIT 许可证中的条款和条件。更多详情,请参见项目仓库中的 LICENSE 文件。
相关链接
服务配置
[{'mcpServers': {'Gitee': {'args': ['-y', 'gitee-mcp-server'], 'command': 'npx', 'env': {'GITEE_PERSONAL_ACCESS_TOKEN': '<YOUR_TOKEN>'}}}}]
来源
- 来源:github
- 链接:https://github.com/normal-coder/gitee-mcp-server