Skip to main content
Glama

Codemagic MCP 服务器

MCP Registry

一个本地 Python MCP 服务器,将 Codemagic CI/CD REST API 公开为 Claude 可调用的工具。无需离开聊天界面,即可从 Claude Code 或 Claude Desktop 触发构建、管理应用、下载构建产物并清除缓存。

Codemagic MCP server

CodemagicMcp MCP server MCP Badge License: MIT

工具

应用

工具

描述

list_apps

列出 Codemagic 账户中的所有应用

get_app

获取特定应用的详细信息

add_app

将公共仓库添加到 Codemagic

add_private_app

使用 SSH 密钥添加私有仓库

delete_app ⚠️

从 Codemagic 中删除应用

构建

工具

描述

list_builds

列出构建,可选择按应用过滤

get_build

获取包含步骤计数摘要的构建详情;传入 include_steps=True 可获取完整步骤列表

trigger_build

为应用触发新构建

cancel_build ⚠️

取消正在运行的构建

get_build_logs

获取构建的步骤状态摘要(可按状态过滤)

get_step_logs

获取原始日志(内联显示)或为特定构建步骤创建/更新托管的临时文件

get_step_log_artifact

检查特定构建步骤的托管本地步骤日志产物是否存在

list_build_artifacts

列出构建产生的所有产物

产物

工具

描述

get_artifact_url

获取构建产物的下载 URL

create_artifact_public_url

为产物创建有时效的公共 URL

缓存

工具

描述

list_caches

列出应用的所有构建缓存

delete_cache ⚠️

删除特定构建缓存

delete_all_caches ⚠️

删除应用的所有构建缓存

环境变量

工具

描述

list_variables

列出应用的所有环境变量

add_variable

为应用添加环境变量

update_variable

更新现有环境变量

delete_variable ⚠️

删除环境变量

Webhooks

工具

描述

list_webhooks

列出应用的所有 Webhook

add_webhook

为应用添加 Webhook

delete_webhook ⚠️

删除 Webhook

⚠️ 这些工具被标记为破坏性操作,执行前会提示确认。

Related MCP server: claudecode-mcp

快速入门

使用 Claude Code 运行的最快方法 — 无需单独的安装步骤:

# 1. Add the server (uses uvx to run it on-demand)
claude mcp add codemagic -e CODEMAGIC_API_KEY=your-api-key-here -- uvx codemagic-mcp

# 2. Restart Claude Code — tools will appear in /tools

就是这样。有关可选设置(如 CODEMAGIC_DEFAULT_APP_ID),请参阅 配置


安装

要求: Python 3.11+

选项 1 — uvx(推荐,无需安装)

uvx codemagic-mcp

选项 2 — pip

pip install codemagic-mcp

选项 3 — 从源码安装

git clone https://github.com/AgiMaulana/CodemagicMcp.git
cd CodemagicMcp
python3 -m venv .venv
.venv/bin/pip install -e .

配置

Codemagic 用户设置 → 集成 → Codemagic API 获取您的 API 令牌。

您可以通过环境变量或 .env 文件提供设置:

# .env
CODEMAGIC_API_KEY=your-api-key-here

# Optional: set a default app so you don't have to specify it every time
CODEMAGIC_DEFAULT_APP_ID=your-app-id-here

# Optional: customize managed temp log storage for get_step_logs(..., delivery="file")
CODEMAGIC_LOG_TEMP_DIR=/tmp/codemagic-mcp
CODEMAGIC_LOG_TTL_SECONDS=3600
CODEMAGIC_LOG_CLEANUP_INTERVAL_SECONDS=300
CODEMAGIC_LOG_MAX_TOTAL_BYTES=524288000
CODEMAGIC_LOG_MAX_FILE_COUNT=200

默认应用 ID

CODEMAGIC_DEFAULT_APP_ID 是可选的,但如果您主要处理一个应用,建议设置。设置后,当工具需要 app_id 且未指定时,AI 将自动使用它。如果未设置,AI 将:

  1. 调用 list_apps 来发现可用应用。

  2. 如果只有一个应用,则自动使用该应用。

  3. 如果找到多个应用,则列出它们并要求您选择。

步骤日志文件交付

get_step_logs 支持两种交付模式:

  • delivery="file" 是默认模式,将日志写入托管的本地临时文件,并返回元数据,如 artifact_idfile_pathbytesline_countexpires_at

  • delivery="inline" 直接返回原始步骤日志文本。

当步骤日志太大而无法方便地内联返回时,本地文件模式非常有用。托管日志文件存储在 CODEMAGIC_LOG_TEMP_DIR 下,过期文件会在写入新日志文件时被清理。默认保留窗口由 CODEMAGIC_LOG_TTL_SECONDS 控制,默认为 3600 秒。

服务器还会运行启动清理过程和周期性后台清理循环。循环间隔由 CODEMAGIC_LOG_CLEANUP_INTERVAL_SECONDS 控制,默认为 300 秒。作为额外的安全保障,托管临时目录受 CODEMAGIC_LOG_MAX_TOTAL_BYTESCODEMAGIC_LOG_MAX_FILE_COUNT 限制;当超过任一上限时,最旧的文件将被优先清除。

get_step_log_artifact(build_id, step_id) 会检查该托管产物是否存在,而无需再次调用 Codemagic 或返回文件内容。产物元数据包含此格式的确定性 artifact_id

artifact_<build_id>_<step_id>

如果产物丢失,服务器将返回 status="missing" 和原因 not_generated_or_expired,这意味着文件从未生成或已过期并被删除。

在 Claude Code 中注册

运行以下命令添加服务器:

claude mcp add codemagic -- codemagic-mcp

然后在 MCP 环境变量配置中设置您的 API 密钥,或者在启动 Claude Code 之前在 shell 中导出它:

export CODEMAGIC_API_KEY=your-api-key-here

或者,手动将其添加到 ~/.claude.json

{
  "mcpServers": {
    "codemagic": {
      "command": "codemagic-mcp",
      "env": {
        "CODEMAGIC_API_KEY": "your-api-key-here",
        "CODEMAGIC_DEFAULT_APP_ID": "your-app-id-here"
      }
    }
  }
}

使用 uvx(无需预先安装)

{
  "mcpServers": {
    "codemagic": {
      "command": "uvx",
      "args": ["codemagic-mcp"],
      "env": {
        "CODEMAGIC_API_KEY": "your-api-key-here",
        "CODEMAGIC_DEFAULT_APP_ID": "your-app-id-here"
      }
    }
  }
}

重启 Claude Code — 工具将出现在 /tools 中。

在 Claude Desktop 中注册

添加到 ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) 或 %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "codemagic": {
      "command": "codemagic-mcp",
      "env": {
        "CODEMAGIC_API_KEY": "your-api-key-here",
        "CODEMAGIC_DEFAULT_APP_ID": "your-app-id-here"
      }
    }
  }
}

重启 Claude Desktop 以应用更改。

项目结构

codemagic_mcp/
├── config.py        # pydantic-settings config (validates API key at startup)
├── client.py        # httpx async client, one method per endpoint
├── server.py        # FastMCP instance
└── tools/
    ├── apps.py
    ├── builds.py
    ├── artifacts.py
    ├── caches.py
    ├── variables.py
    └── webhooks.py

添加新工具

  1. client.py 中添加一个方法

  2. 将工具函数添加到相关的 tools/*.py 文件中

  3. 完成 — server.py 无需更改

Install Server
A
license - permissive license
A
quality
B
maintenance

Maintenance

Maintainers
1hResponse time
4dRelease cycle
9Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    F
    maintenance
    A Python-based MCP server that allows Claude and other LLMs to execute arbitrary Python code directly through your desktop Claude app, enabling data scientists to connect LLMs to APIs and executable code.
    26
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    Local MCP server that wraps the headless Claude Code CLI as MCP tools, providing stateless access to Claude's coding capabilities through prompt-based interactions. It enables users to execute Claude Code commands with various prompt formats and structured outputs directly from MCP clients.
    3
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    MCP server for the Codemagic CI/CD API, enabling app management, build operations, artifact handling, cache control, and team management through natural language.
    20
    3
    MIT

View all related MCP servers

Related MCP Connectors

  • Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer

  • Real-time chat hub for AI agents — Claude Code, Cursor, Cline, Codex over MCP or REST.

  • An MCP server that let you interact with Cycloid.io Internal Development Portal and Platform

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AgiMaulana/CodemagicMcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server