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 平台。cann-gitcode-mcp 将 GitCode API 封装为 MCP 工具,让 CANN 开发者在 Claude Code 等 AI 助手中直接操作仓库的 Pull Request、Issue、流水线等,无需离开对话界面。

快速开始

1. 安装

pip install cann-gitcode-mcp

2. 配置 Claude Code

先在 GitCode 用户设置 中生成个人访问令牌,然后在 Claude Code 的 MCP 配置文件(~/.claude/settings.json 或项目级 .mcp.json)中添加:

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

重启 Claude Code 即可使用。

环境变量说明:Token 通过 MCP 配置的 env 字段传入即可,无需手动 export。如需覆盖 API 地址,可额外设置 GITCODE_API_BASE_URL(默认 https://gitcode.com/api/v5)。

可用工具

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 的变更文件列表
list_pull_request_comments 获取 PR 的所有评论

Pipeline(流水线)

工具名 说明
get_pr_pipeline_summary 获取 PR 的 CI/CD 流水线摘要(解析 cann-robot 评论)

get_pr_pipeline_summary 从 PR 评论中解析 cann-robot 发布的流水线结果,返回每个任务的名称、状态(SUCCESS/FAILED/ABORTED)、日志链接、构建产物下载链接,以及整体 CI 结论。无需 openLiBing token,仅使用 GitCode API。

路线图

当前处于早期开发阶段(0.x),已实现 PR 工具集和流水线摘要。后续将按 CANN 社区实际研发流程的优先级逐步扩展:

  1. Issue 工具 — Issue 增删改查、评论管理(CANN 社区日常协作最频繁的场景)
  2. 仓库工具 — 分支管理、文件读取、提交历史
  3. 流水线详情(Level 2) — 通过 openLiBing API 获取 stage/job/step 级别的详细信息和错误消息

欢迎在 Issue 中提出需求或反馈。

开发

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

# 运行测试
pytest

# 构建与发布
python -m build
twine upload dist/*

许可证

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.2.0.tar.gz (29.2 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.2.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cann_gitcode_mcp-0.2.0.tar.gz
  • Upload date:
  • Size: 29.2 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.2.0.tar.gz
Algorithm Hash digest
SHA256 869fdd70402cc3d0e39ada6e06f7f50bee8d0def4596b72b73ea6202f26d2c8f
MD5 6c831a3d46a2d74bfbe9d2259e8eac77
BLAKE2b-256 fe4e60bdad8519fbc0ca28d7c321e5b282cf7347f61c1415901db90242e23b63

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cann_gitcode_mcp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 072ced90345ef0b88599f7fce7d214e08e8feefe1a76bdd6ff7001794d1b1e5f
MD5 4c54b94f5ccbbcb3b1b177e1667a6694
BLAKE2b-256 74aabdaf79da065012dc38a0c9f3e84e2dab065f00101782e1bb839141c712e8

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