返回市场
代码仓库-MCP

代码仓库-MCP

作者:gitcode-org-com4 星标更新:2025-03-31

项目介绍

GitCode MCP Go Server

这是GitCode MCP服务器的Go语言实现版本,提供了对GitCode API的标准MCP接口封装。

特性

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

安装要求

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

环境变量配置

项目使用.env文件来管理环境变量。你可以复制.env.example文件并重命名为.env,然后设置以下环境变量:

# GitCode API配置
GITCODE_TOKEN=<您的GitCode访问令牌>
GITCODE_API_URL=https://api.gitcode.com/api/v5

安装指南

方法1:使用安装脚本(推荐)

# 克隆仓库
git clone https://github.com/gitcode-org-com/gitcode-mcp.git
cd gitcode-m
cp

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

安装脚本会:

  1. 编译项目生成可执行文件
  2. 创建配置目录 ~/.gitcode_mcp
  3. 将配置文件复制到配置目录
  4. 提示输入你的GitCode访问令牌
  5. 将可执行文件安装到系统路径(需要管理员权限)或用户目录

安装后,你可以从任何地方运行 gitcode-mcp 命令。

方法2:使用Go Install

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

使用Go Install安装后,程序会被安装到 $GOPATH/bin 目录下。请确保该目录已添加到你的PATH环境变量中。

快速开始

  1. 运行MCP服务器
gitcode-mcp
  1. 配置AI平台

    项目docs目录提供了各种平台的配置文件参考:

    • Claude平台:claude_config.json
    • Cline平台:cline_config.json
    • Cursor平台:cursor_config.json
    • Windsurf平台:windsurf_config.json

MCP工具列表

GitCode 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 Requestsowner, repo
Get_pull request获取特定Pull Request的详细信息owner, repo, pull_numbers
create_pull_request创建新Pull Requestowner, repo, title, head, base, body?
Search_code搜索代码query
Searchable repositories搜索仓库query
search_issues搜索问题query
Search_users搜索用户Query

许可证

本项目采用MIT许可证。详情请参阅LICENSE文档。 </中文翻译>