GitCode MCP Go Server

GitCode MCP Go Server

site icon
2025.03.31 1
GoGitCode API封装代码仓库管理开发效率
GitCode MCP Go Server 是一个基于Go语言实现的GitCode API标准MCP接口封装服务。它提供了完整的GitCode API功能支持,基于标准MCP协议实现,支持STDIO和SSE两种传输方式,具有轻量级、响应速度快、并发处理能力强等特点,适合高负载场景。
View on GitHub

Overview

基本能力

产品定位

GitCode MCP Go Server 是一个GitCode API的标准MCP接口封装服务,旨在为开发者提供便捷的GitCode API访问能力。

核心功能

  • 完整支持GitCode API的主要功能
  • 基于标准MCP协议实现,使用mark3labs/mcp-go SDK
  • 支持STDIO和SSE两种传输方式
  • 轻量级,响应速度快
  • 并发处理能力强,适合高负载场景
  • 模块化的代码结构,便于扩展和维护

适用场景

  • 需要批量操作GitCode仓库的开发团队
  • 需要自动化GitCode API调用的CI/CD流程
  • 需要集成GitCode功能到其他系统的开发者

MCP工具清单

工具名称 描述 参数
list_repositories 列出当前用户的仓库
get_repository 获取特定仓库的详细信息 owner, repo
create_repository 创建新仓库 name, description?, private?
list_branches 列出仓库的分支 owner, repo
get_branch 获取特定分支的详细信息 owner, repo, branch
create_branch 创建新分支 owner, repo, branch, ref
list_issues 列出仓库的Issues owner, repo
get_issue 获取特定Issue的详细信息 owner, repo, issue_number
create_issue 创建新Issue owner, repo, title, body?
list_pull_requests 列出仓库的Pull Requests owner, repo
get_pull_request 获取特定Pull Request的详细信息 owner, repo, pull_number
create_pull_request 创建新Pull Request owner, repo, title, head, base, body?
search_code 搜索代码 query
search_repositories 搜索仓库 query
search_issues 搜索Issues query
search_users 搜索用户 query

使用教程

使用依赖

  • Go 1.16+
  • 网络连接以访问GitCode API

环境变量配置

项目使用.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-mcp

# 运行安装脚本
./install.sh

方法二:使用 Go Install

# 安装最新版本
go install github.com/gitcode-org-com/gitcode-mcp@latest

调试方式

  1. 运行MCP服务器
gitcode-mcp
  1. 配置AI平台 项目docs目录下提供了各平台的配置文件参考:
  2. Claude平台: claude_config.json
  3. Cline平台: cline_config.json
  4. Cursor平台: cursor_config.json
  5. Windsurf平台: windsurf_config.json

许可证

该项目遵循 MIT 开源许可条款。