Skip to main content

CANN GitCode MCP Server - GitCode platform tools for CANN developers

Project description

cann-gitcode-mcp

PyPI version Python License

CANN GitCode MCP 服务器 —— 为 CANN 开发者提供的 GitCode 平台 MCP 工具集。

简介

cann-gitcode-mcp 是一个基于 MCP(Model Context Protocol) 的服务器,将 GitCode API 操作封装为 MCP 工具,供 Claude Code 及其他 MCP 客户端直接调用。

CANN 社区的代码托管在 GitCode 平台,本项目为 CANN 开发者提供在 AI 助手中操作 GitCode 仓库(Pull Request、流水线、Issue 等)的能力,无需离开对话界面即可完成常见研发工作流。

安装

pip install cann-gitcode-mcp

配置

1. 获取 GitCode API Token

GitCode 用户设置 中生成个人访问令牌。

2. 设置环境变量

export GITCODE_API_TOKEN=your_token_here

3. 与 Claude Code 集成

在 Claude Code 的 MCP 配置文件中添加:

{
  "mcpServers": {
    "gitcode": {
      "command": "cann-gitcode-mcp",
      "env": {
        "GITCODE_API_TOKEN": "your_token_here"
      }
    }
  }
}

或使用模块方式:

{
  "mcpServers": {
    "gitcode": {
      "command": "python",
      "args": ["-m", "cann_gitcode_mcp"],
      "env": {
        "GITCODE_API_TOKEN": "your_token_here"
      }
    }
  }
}

配置完成后重启 Claude Code,即可在对话中使用所有 GitCode 工具。

可用工具

Pull Request

工具名 说明
create_pull_request 创建 Pull Request
list_pull_requests 列出仓库的 Pull Request(支持状态、排序等过滤)
get_pull_request 获取指定 PR 的详细信息
merge_pull_request 合并 Pull Request
comment_pull_request 在 PR 上发表评论
get_pull_request_files 获取 PR 的变更文件列表

环境变量

变量 必填 说明
GITCODE_API_TOKEN GitCode 个人访问令牌
GITCODE_API_BASE_URL API 地址覆盖(默认 https://gitcode.com/api/v5

路线图

  • Issue 工具:Issue 增删改查、评论管理
  • 仓库工具:分支管理、文件读取、提交历史
  • 流水线/CI 工具:触发 CANN CI 流水线、查询流水线状态

开发

# 安装开发依赖
pip install -e ".[dev]"

# 运行测试
pytest

# 构建包
python -m build

# 上传到 PyPI
twine upload dist/*

版本规则

本项目遵循 语义化版本

  • 0.x.y — 早期开发阶段,接口可能不兼容变更
  • 1.0.0 — 工具集稳定后的首个正式版本
  • MAJOR.MINOR.PATCH — 不兼容变更.新功能.修复

许可证

Apache License 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cann_gitcode_mcp-0.1.0.tar.gz (20.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cann_gitcode_mcp-0.1.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file cann_gitcode_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: cann_gitcode_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for cann_gitcode_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dae8db78430be6fd021e5e90bc31a58eb96edb7e99d3bfce2aa91d8edd5e6803
MD5 922963d23f354387732414742943221a
BLAKE2b-256 d8288b59591d60ceda1dbd227310b90849f96a09640f45fa05638905e8c8abf8

See more details on using hashes here.

File details

Details for the file cann_gitcode_mcp-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cann_gitcode_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2300a4c7abca55eb831247229923f931f47cb7e8129394dbcebf23c5d5c75a8c
MD5 68ccb816809f0a8c6dc4a5f8d12ee87b
BLAKE2b-256 a6f684dd90ccfc7a146c62b5d2ff6089cd7e6bce47685ef8c7d906c4437d2d03

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page