mcp-gitee
Gitee MCP 服务器是用于 Gitee 的模型上下文协议(Model Context Protocol,MCP)服务器实现。它提供了一系列与 Gitee API 交互的工具,使 AI 助手能够管理仓库、问题、拉取请求等。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"gitee": {
"args": [
"-y",
"@gitee/mcp-gitee@latest"
],
"command": "npx",
"env": {
"GITEE_ACCESS_TOKEN": "\u003cyour personal access token\u003e"
}
}
}
}
该服务需要配置环境变量:GITEE_ACCESS_TOKEN
可用工具 (26 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
comment_issue 4 个参数 需填 4 项
Create a comment on a repository issue
必填参数:owner、repo、number、body
comment_pull 4 个参数 需填 4 项
Create a comment on a pull request
必填参数:owner、repo、number、body
create_enterprise_repo 7 个参数 需填 2 项
Create a enterprise repository
必填参数:name、enterprise
create_issue 11 个参数 需填 3 项
Create an issue
必填参数:owner、repo、title
create_org_repo 7 个参数 需填 2 项
Create a org repository
必填参数:name、org
create_pull 14 个参数 需填 5 项
Create a pull request
必填参数:owner、repo、title、head、base
create_release 7 个参数 需填 6 项
Create a release
必填参数:owner、repo、tag_name、name、body、target_commitish
create_user_repo 6 个参数 需填 1 项
Create a user repository
必填参数:name
fork_repository 5 个参数 需填 2 项
Fork a repository
必填参数:owner、repo
get_diff_files 3 个参数 需填 3 项
Get a pull request diff files
必填参数:owner、repo、number
get_file_content 4 个参数 需填 3 项
Get the content of the specified file in the repository
必填参数:owner、repo、path
get_pull_detail 3 个参数 需填 3 项
Get a pull request detail
必填参数:owner、repo、number
get_repo_issue_detail 3 个参数 需填 3 项
Get the detail of an issue
必填参数:number、owner、repo
get_user_info
This is a tool from the gitee MCP server. Get information about the authenticated user
该工具无需必填参数,直接调用即可
list_issue_comments 7 个参数 需填 3 项
Get all comments for a repository issue
必填参数:owner、repo、number
list_pull_comments 7 个参数 需填 3 项
List all comments for a pull request
必填参数:owner、repo、number
list_releases 5 个参数 需填 2 项
List repository releases
必填参数:owner、repo
list_repo_issues 15 个参数 需填 2 项
List all issues in a repository
必填参数:owner、repo
list_repo_pulls 15 个参数 需填 2 项
List repository pulls
必填参数:owner、repo
list_user_notifications 7 个参数
List all notifications for authorized user
该工具无需必填参数,直接调用即可
list_user_repos 8 个参数
List user authorized repositories
该工具无需必填参数,直接调用即可
merge_pull 8 个参数 需填 3 项
Merge a pull request
必填参数:owner、repo、number
search_open_source_repositories 4 个参数 需填 1 项
Search open source repositories on Gitee
必填参数:q
search_users 3 个参数 需填 1 项
Search users on Gitee
必填参数:q
update_issue 13 个参数 需填 4 项
Update an issue
必填参数:number、owner、repo、title
update_pull 14 个参数 需填 3 项
Update a pull request
必填参数:owner、repo、number
服务介绍
Gitee MCP 服务器
Gitee MCP 服务器是用于 Gitee 的模型上下文协议(Model Context Protocol,MCP)服务器实现。它提供了一系列与 Gitee API 交互的工具,使 AI 助手能够管理仓库、问题、拉取请求等。
功能特点
- 与 Gitee 仓库、Issue、Pull Request 和通知进行交互
- 可配置的 API 基础 URL,支持不同的 Gitee 实例
- 命令行标志,便于配置
- 支持个人、组织和企业操作
- 支持动态启用/禁用工具集
- 获取当前仓库 Issues

- 根据 Issue 详情实现编码 & 创建 Pull Request

- 评论&关闭 Issue

安装(npx 启动可直接跳过该步骤)
前提条件
- Go 1.23.0 或更高版本
- 拥有访问令牌的 Gitee 账户,前往获取
从源代码构建
- 克隆仓库:
git clone https://gitee.com/oschina/mcp-gitee.git cd mcp-gitee - 构建项目:
将 ./bin/mcp-gitee 移动至系统环境变量make build
使用 go install 安装
go install gitee.com/oschina/mcp-gitee@latest
使用方法
检查 mcp-gitee 版本:
mcp-gitee --version
MCP Hosts 配置
配置示例:点击查看更多应用配置
- 连接官方 remote mcp-gitee server(免安装)
{
"mcpServers": {
"gitee": {
"url": "https://api.gitee.com/mcp",
"headers": {
"Authorization": "Bearer <your personal access token>"
}
}
}
}
- npx 启动
{
"mcpServers": {
"gitee": {
"command": "npx",
"args": [
"-y",
"@gitee/mcp-gitee@latest"
],
"env": {
"GITEE_API_BASE": "https://gitee.com/api/v5",
"GITEE_ACCESS_TOKEN": "<your personal access token>"
}
}
}
}
- 可执行文件启动
{
"mcpServers": {
"gitee": {
"command": "mcp-gitee",
"env": {
"GITEE_API_BASE": "https://gitee.com/api/v5",
"GITEE_ACCESS_TOKEN": "<your personal access token>"
}
}
}
}
命令行选项
--token:Gitee 访问令牌--api-base:Gitee API 基础 URL(默认:https://gitee.com/api/v5)--version:显示版本信息--transport:传输类型(stdio、sse 或 http,默认:stdio)--address:启动服务器的主机和端口(默认:localhost:8000)--enabled-toolsets: 逗号分隔的要启用的工具列表(如果指定,则只启用这些工具)--disabled-toolsets: 逗号分隔的要禁用的工具列表
环境变量
您也可以使用环境变量配置服务器:
GITEE_ACCESS_TOKEN:Gitee 访问令牌GITEE_API_BASE:Gitee API 基础 URLENABLED_TOOLSETS: 逗号分隔的要启用的工具列表DISABLED_TOOLSETS: 逗号分隔的要禁用的工具列表
工具集管理
工具集管理支持两种模式:
-
启用指定工具(白名单模式):
- 使用
--enabled-toolsets参数或ENABLED_TOOLSETS环境变量 - 指定后,只有列出的工具会被启用,其他工具都会被禁用
- 例如:
--enabled-toolsets="update_enterprise_issue,list_enterprise_repositories"
- 使用
-
禁用指定工具(黑名单模式):
- 使用
--disabled-toolsets参数或DISABLED_TOOLSETS环境变量 - 指定后,列出的工具会被禁用,其他工具保持启用
- 例如:
--disabled-toolsets="update_enterprise_issue,list_enterprise_repositories"
- 使用
注意:
- 如果同时指定了
enabled-toolsets和disabled-toolsets,则enabled-toolsets优先 - 工具名称区分大小写
许可证本项目采用 MIT 许可证。有关更多详细信息,请参阅 LICENSE 文件。
可用工具
服务器提供了各种与 Gitee 交互的工具:
| 工具 | 类别 | 描述 |
|---|---|---|
| list_user_repos | 仓库 | 列出用户授权的仓库 |
| get_file_content | 仓库 | 获取仓库中文件的内容 |
| create_user_repo | 仓库 | 创建用户仓库 |
| create_org_repo | 仓库 | 创建组织仓库 |
| create_enter_repo | 仓库 | 创建企业仓库 |
| fork_repository | 仓库 | Fork 仓库 |
| create_release | 仓库 | 为仓库创建发行版 |
| list_releases | 仓库 | 列出仓库发行版 |
| search_open_source_repositories | 仓库 | 搜索开源仓库 |
| list_repo_pulls | Pull Request | 列出仓库中的拉取请求 |
| merge_pull | Pull Request | 合并拉取请求 |
| create_pull | Pull Request | 创建拉取请求 |
| update_pull | Pull Request | 更新拉取请求 |
| get_pull_detail | Pull Request | 获取拉取请求的详细信息 |
| comment_pull | Pull Request | 评论拉取请求 |
| list_pull_comments | Pull Request | 列出拉取请求的所有评论 |
| get_diff_files | Pull Request | 获取拉取请求的差异文件 |
| create_issue | Issue | 创建 Issue |
| update_issue | Issue | 更新 Issue |
| get_repo_issue_detail | Issue | 获取仓库 Issue 的详细信息 |
| list_repo_issues | Issue | 列出仓库 Issue |
| comment_issue | Issue | 评论 Issue |
| list_issue_comments | Issue | 列出 Issue 的评论 |
| get_user_info | 用户 | 获取当前认证用户信息 |
| search_users | 用户 | 搜索用户 |
| list_user_notifications | 通知 | 列出用户通知 |
贡献
我们欢迎开源社区的贡献!如果您想为这个项目做出贡献,请按照以下指南操作:
- Fork 这个仓库。
- 为您的功能或 bug 修复创建一个新分支。
- 进行更改,并确保代码有良好的文档。
- 提交一个 pull request,并附上清晰的更改描述。
更多信息,请参阅 CONTRIBUTING 文件。