这是GitCode MCP服务器的Go语言实现版本,提供了对GitCode API的标准MCP接口封装。
项目使用.env文件来管理环境变量。你可以复制.env.example文件并重命名为.env,然后设置以下环境变量:
# GitCode API配置
GITCODE_TOKEN=<您的GitCode访问令牌>
GITCODE_API_URL=https://api.gitcode.com/api/v5
# 克隆仓库
git clone https://github.com/gitcode-org-com/gitcode-mcp.git
cd gitcode-m
cp
# 运行安装脚本
./install.sh
安装脚本会:
~/.gitcode_mcp安装后,你可以从任何地方运行 gitcode-mcp 命令。
# 安装最新版本
go install github.com/gitcode-org-com/gitcode-mcp@latest
使用Go Install安装后,程序会被安装到 $GOPATH/bin 目录下。请确保该目录已添加到你的PATH环境变量中。
gitcode-mcp
配置AI平台
项目docs目录提供了各种平台的配置文件参考:
claude_config.jsoncline_config.jsoncursor_config.jsonwindsurf_config.jsonGitCode MCP提供以下工具:
| 工具名称 | 描述 | 参数 |
|---|---|---|
| List_depositories | 列出当前用户的仓库 | 无 |
| Get_repository | 获取特定仓库的详细信息 | owner, repository |
| create_repository | 创建新仓库 | name, description?, private? |
| List Branches | 列出仓库的分支 | Owner, repo |
| Get_branch | 获取特定分支的详细信息 | owner, repo, branch |
| create_branch | 创建新分支 | owner, repo, branch, ref |
| List_issues | 列出仓库的问题 | owner, repo |
| Get_issue | 获取特定问题的详细信息 | owner, repo, issue_number |
| create_issue | 创建新问题 | owner, repo, title, body? |
| list_pull_requests | 列出仓库的Pull Requests | owner, repo |
| Get_pull request | 获取特定Pull Request的详细信息 | owner, repo, pull_numbers |
| create_pull_request | 创建新Pull Request | owner, repo, title, head, base, body? |
| Search_code | 搜索代码 | query |
| Searchable repositories | 搜索仓库 | query |
| search_issues | 搜索问题 | query |
| Search_users | 搜索用户 | Query |
本项目采用MIT许可证。详情请参阅LICENSE文档。 </中文翻译>