{
  "markdown": "# Codemagic MCP Server\n\n[![MCP Registry](https://img.shields.io/badge/MCP_Registry-listed-blue)](https://registry.modelcontextprotocol.io/servers/io.github.AgiMaulana/CodemagicMcp)\n\nA local Python MCP server that exposes the [Codemagic CI/CD REST API](https://docs.codemagic.io/rest-api/overview/) as Claude-callable tools. Trigger builds, manage apps, download artifacts, and clear caches — all from Claude Code or Claude Desktop without leaving the chat.\n\n[![Codemagic MCP server](https://glama.ai/mcp/servers/AgiMaulana/CodemagicMcp/badges/card.svg)](https://glama.ai/mcp/servers/AgiMaulana/CodemagicMcp)\n\n[![CodemagicMcp MCP server](https://glama.ai/mcp/servers/AgiMaulana/CodemagicMcp/badges/score.svg)](https://glama.ai/mcp/servers/AgiMaulana/CodemagicMcp)\n[![MCP Badge](https://lobehub.com/badge/mcp/agimaulana-codemagicmcp)](https://lobehub.com/mcp/agimaulana-codemagicmcp)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n\n## Tools\n\n### Apps\n| Tool | Description |\n|------|-------------|\n| `list_apps` | List all applications in your Codemagic account |\n| `get_app` | Get details of a specific application |\n| `add_app` | Add a public repository to Codemagic |\n| `add_private_app` | Add a private repository using an SSH key |\n| `delete_app` ⚠️ | Delete an application from Codemagic |\n\n### Builds\n| Tool | Description |\n|------|-------------|\n| `list_builds` | List builds, optionally filtered by app |\n| `get_build` | Get build details with step count summary; pass `include_steps=True` for full step list |\n| `trigger_build` | Trigger a new build for an application |\n| `cancel_build` ⚠️ | Cancel a running build |\n| `get_build_logs` | Get a step-by-step status summary of a build (filterable by status) |\n| `get_step_logs` | Get raw logs inline or create/update a managed temp file for a specific build step |\n| `get_step_log_artifact` | Check whether a managed local step-log artifact still exists for a specific build step |\n| `list_build_artifacts` | List all artifacts produced by a build |\n\n### Artifacts\n| Tool | Description |\n|------|-------------|\n| `get_artifact_url` | Get the download URL for a build artifact |\n| `create_artifact_public_url` | Create a time-limited public URL for an artifact |\n\n### Caches\n| Tool | Description |\n|------|-------------|\n| `list_caches` | List all build caches for an application |\n| `delete_cache` ⚠️ | Delete a specific build cache |\n| `delete_all_caches` ⚠️ | Delete all build caches for an application |\n\n### Environment Variables\n| Tool | Description |\n|------|-------------|\n| `list_variables` | List all environment variables for an application |\n| `add_variable` | Add an environment variable to an application |\n| `update_variable` | Update an existing environment variable |\n| `delete_variable` ⚠️ | Delete an environment variable |\n\n### Webhooks\n| Tool | Description |\n|------|-------------|\n| `list_webhooks` | List all webhooks for an application |\n| `add_webhook` | Add a webhook to an application |\n| `delete_webhook` ⚠️ | Delete a webhook |\n\n> ⚠️ These tools are marked as destructive and will prompt for confirmation before executing.\n\n## Quick Start\n\nThe fastest way to get running with Claude Code — no separate install step needed:\n\n```bash\n# 1. Add the server (uses uvx to run it on-demand)\nclaude mcp add codemagic -e CODEMAGIC_API_KEY=your-api-key-here -- uvx codemagic-mcp\n\n# 2. Restart Claude Code — tools will appear in /tools\n```\n\nThat's it. See [Configuration](#configuration) for optional settings like `CODEMAGIC_DEFAULT_APP_ID`.\n\n---\n\n## Installation\n\n**Requirements:** Python 3.11+\n\n### Option 1 — uvx (recommended, no install needed)\n\n```bash\nuvx codemagic-mcp\n```\n\n### Option 2 — pip\n\n```bash\npip install codemagic-mcp\n```\n\n### Option 3 — from source\n\n```bash\ngit clone https://github.com/AgiMaulana/CodemagicMcp.git\ncd CodemagicMcp\npython3 -m venv .venv\n.venv/bin/pip install -e .\n```\n\n## Configuration\n\nGet your API token from [Codemagic User Settings → Integrations → Codemagic API](https://codemagic.io/settings).\n\nYou can provide settings as environment variables or via a `.env` file:\n\n```bash\n# .env\nCODEMAGIC_API_KEY=your-api-key-here\n\n# Optional: set a default app so you don't have to specify it every time\nCODEMAGIC_DEFAULT_APP_ID=your-app-id-here\n\n# Optional: customize managed temp log storage for get_step_logs(..., delivery=\"file\")\nCODEMAGIC_LOG_TEMP_DIR=/tmp/codemagic-mcp\nCODEMAGIC_LOG_TTL_SECONDS=3600\nCODEMAGIC_LOG_CLEANUP_INTERVAL_SECONDS=300\nCODEMAGIC_LOG_MAX_TOTAL_BYTES=524288000\nCODEMAGIC_LOG_MAX_FILE_COUNT=200\n```\n\n### Default App ID\n\n`CODEMAGIC_DEFAULT_APP_ID` is optional but recommended if you work primarily with one app. When set, the AI will use it automatically whenever a tool requires an `app_id` and none was specified. If it is not set, the AI will:\n\n1. Call `list_apps` to discover available apps.\n2. Use the app automatically if only one exists.\n3. Present the list and ask you to choose if multiple apps are found.\n\n### Step Log File Delivery\n\n`get_step_logs` supports two delivery modes:\n\n- `delivery=\"file\"` is the default and writes the log to a managed local temp file, returning metadata such as `artifact_id`, `file_path`, `bytes`, `line_count`, and `expires_at`.\n- `delivery=\"inline\"` returns the raw step log text directly.\n\nThe local file mode is useful when a step log is too large to comfortably return inline. Managed log files are stored under `CODEMAGIC_LOG_TEMP_DIR` and expired files are cleaned up opportunistically whenever a new log file is written. The default retention window is controlled by `CODEMAGIC_LOG_TTL_SECONDS` and defaults to `3600` seconds.\n\nThe server also runs a startup cleanup pass and a periodic background cleanup loop. The loop interval is controlled by `CODEMAGIC_LOG_CLEANUP_INTERVAL_SECONDS` and defaults to `300` seconds. As an additional safety backstop, the managed temp directory is capped by `CODEMAGIC_LOG_MAX_TOTAL_BYTES` and `CODEMAGIC_LOG_MAX_FILE_COUNT`; when either cap is exceeded, the oldest files are evicted first.\n\n`get_step_log_artifact(build_id, step_id)` checks whether that managed artifact still exists without calling Codemagic again or returning the file contents. The artifact metadata includes a deterministic `artifact_id` in this format:\n\n```text\nartifact_<build_id>_<step_id>\n```\n\nIf the artifact is missing, the server returns `status=\"missing\"` with reason `not_generated_or_expired`, which means the file was either never generated or it expired and was deleted.\n\n## Register with Claude Code\n\nRun the following command to add the server:\n\n```bash\nclaude mcp add codemagic -- codemagic-mcp\n```\n\nThen set your API key in the MCP env config, or export it in your shell before starting Claude Code:\n\n```bash\nexport CODEMAGIC_API_KEY=your-api-key-here\n```\n\nAlternatively, add it manually to `~/.claude.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"codemagic\": {\n      \"command\": \"codemagic-mcp\",\n      \"env\": {\n        \"CODEMAGIC_API_KEY\": \"your-api-key-here\",\n        \"CODEMAGIC_DEFAULT_APP_ID\": \"your-app-id-here\"\n      }\n    }\n  }\n}\n```\n\n### Using uvx (no prior installation needed)\n\n```json\n{\n  \"mcpServers\": {\n    \"codemagic\": {\n      \"command\": \"uvx\",\n      \"args\": [\"codemagic-mcp\"],\n      \"env\": {\n        \"CODEMAGIC_API_KEY\": \"your-api-key-here\",\n        \"CODEMAGIC_DEFAULT_APP_ID\": \"your-app-id-here\"\n      }\n    }\n  }\n}\n```\n\nRestart Claude Code — the tools will appear in `/tools`.\n\n## Register with Claude Desktop\n\nAdd to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\\Claude\\claude_desktop_config.json` (Windows):\n\n```json\n{\n  \"mcpServers\": {\n    \"codemagic\": {\n      \"command\": \"codemagic-mcp\",\n      \"env\": {\n        \"CODEMAGIC_API_KEY\": \"your-api-key-here\",\n        \"CODEMAGIC_DEFAULT_APP_ID\": \"your-app-id-here\"\n      }\n    }\n  }\n}\n```\n\nRestart Claude Desktop to pick up the changes.\n\n## Project Structure\n\n```\ncodemagic_mcp/\n├── config.py        # pydantic-settings config (validates API key at startup)\n├── client.py        # httpx async client, one method per endpoint\n├── server.py        # FastMCP instance\n└── tools/\n    ├── apps.py\n    ├── builds.py\n    ├── artifacts.py\n    ├── caches.py\n    ├── variables.py\n    └── webhooks.py\n```\n\n## Adding New Tools\n\n1. Add a method to `client.py`\n2. Add the tool function to the relevant `tools/*.py` file\n3. That's it — `server.py` never needs to change\n",
  "bytes": 8388,
  "sha": "66dcfef07339b493fee7057573687b87e24bbee94f879ce69cc5380dc16115e2",
  "repo_slug": "agimaulana/codemagicmcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_agimaulana_codemagicmcp_74f9e909/readme"
}