Gitee MCP服务器
让AI通过MCP为您操作Gitee存储库/问题/拉取请求
](./package.json)
 ](https://smithery.ai/server/@normal-coder/gitee-mcp-server)
[](https://glama.ai/mcp/servers/Cck9XigM1d)
______________________________________________________________________
支持的AI操作
| 类别 | MCP工具 | 说明 |
|---|---|---|
| 存储库操作 | create_repository | 创建Gitee仓库 |
fork_repository | 分叉Gitee仓库 | |
| 分行运营 | create_branch | 在Gitee仓库中创建一个新分支 |
list_branches | 列出Gitee存储库中的分支 | |
get_branch | 获取Gitee存储库中特定分支的详细信息 | |
| 文件操作 | get_file_contents | 获取Gitee存储库中文件或目录的内容 |
create_or_update_file | 在Gitee存储库中创建或更新文件 | |
push_files | 将多个文件推送到Gitee存储库 | |
| 问题操作 | create_issue | 在Gitee仓库中创建Issue |
list_issues | 在Gitee仓库中列出问题 | |
get_issue | 在Gitee仓库中获取特定问题的详细信息 | |
update_issue | 在Gitee仓库中更新问题 | |
add_issue_comment | 在Gitee仓库中为Issue添加评论 | |
| 拉取请求操作 | create_pull_request | 在Gitee仓库中创建Pull Request |
list_pull_requests | 在Gitee仓库中列出Pull请求 | |
get_pull_request | 在Gitee仓库中获取特定Pull Request的详细信息 | |
update_pull_request | 在Gitee仓库中更新Pull Request | |
merge_pull_request | 将Pull Request合并到Gitee存储库中 | |
| 用户操作 | get_user | 获取Gitee用户信息 |
get_current_user | 获取经过身份验证的Gitee用户信息 |
用法
通过Smithery安装
通过以下方式自动安装Gitee MCP Server for Claude Desktop 史密瑟里:
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账户设置中获取 个人访问令牌DEBUG:可选,设置为true要启用调试日志记录,请禁用默认值
通过NPX运行MCP服务器
{
"mcpServers": {
"Gitee": {
"command": "npx",
"args": [
"-y",
"gitee-mcp-server"
],
"env": {
"GITEE_PERSONAL_ACCESS_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": ""
}
}
}
}开发指南
再进行
npm install构建
npm run build在成功构建之后, /dist 将包含可运行的MCP服务器。
运行服务器
npm startMCP服务器将在stdio上运行,允许MCP客户端将其用作子进程。
构建Docker镜像
您还可以使用Docker运行服务器:
docker build -t normalcoder/gitee-mcp-server .使用Docker运行MCP服务器:
docker run -e GITEE_PERSONAL_ACCESS_TOKEN= normalcoder/gitee-mcp-server调试MCP服务器
您可以使用 @modelcontextprotocol/inspector 用于调试:
创建一个 .env 环境变量根目录中的文件:
GITEE_API_BASE_URL=https://gitee.com/api/v5
GITEE_PERSONAL_ACCESS_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许可证的条款和条件自由使用、修改和分发软件。有关更多详细信息,请参阅 许可证 项目存储库中的文件。
