# Codemagic — how to use (mcp.ai)

Connect your Codemagic account and use 22 tools for developer tools straight from your AI agent. Connect with your own API key. Codemagic is a CI/CD platform focused on mobile app development.

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_codemagic?ms=1787295720000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `codemagic_add_application_from_private_repo`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/codemagic`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/codemagic/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/codemagic/add/application/from/private/repo` — Tool to create an application from a private repository using SSH key authentication. Use when you need to add a new private repository to Codemagic with SSH credentials.
  - body: { sshKey: object, teamId?: string, projectType?: string, repositoryUrl: string }
- `POST https://api.mcp.ai/api/codemagic/add/new/application` — Tool to add a Git repository to the applications list in Codemagic. Use when you need to add a new application to Codemagic from a repository URL.
  - body: { teamId?: string, repositoryUrl: string }
- `POST https://api.mcp.ai/api/codemagic/api/v3/meta/get/meta` — Tool to get metadata about Codemagic including public IP addresses in use (in CIDR notation). Use when you need to retrieve IP blocks for whitelisting build machines or simulator network requests.
- `POST https://api.mcp.ai/api/codemagic/api/v3/variable/groups/variable/group/id/get/group` — Tool to retrieve information about a specific variable group including its name and configuration settings. Use when you need to get details for a variable group by its ID.
  - body: { variable_group_id: string }
- `POST https://api.mcp.ai/api/codemagic/api/v3/variable/groups/variable/group/id/update` — Tool to change a variable group's name and security settings. Use when you need to update an existing variable group by its ID. Returns success confirmation on 204 No Content response.
  - body: { name?: string, advanced_security?: object, variable_group_id: string }
- `POST https://api.mcp.ai/api/codemagic/delete/all/application/caches` — Tool to delete all caches for a specific application. Use when clearing all cached data for an app. The deletion process is asynchronous and will complete after the API response is returned.
  - body: { id: string }
- `POST https://api.mcp.ai/api/codemagic/delete/specific/cache` — Tool to delete a specific cache from an application. Use when a cached build artifact needs to be removed. The deletion is performed asynchronously and returns immediately with a 202 Accepted status.
  - body: { app_id: string, cache_id: string }
- `POST https://api.mcp.ai/api/codemagic/get/all/builds` — Tool to list all builds with optional filters for appId, workflowId, and branch. Use when you need to retrieve build history or search for specific builds. Supports pagination via the skip parameter.
  - body: { skip?: integer, app_id?: string, branch?: string, workflow_id?: string }
- `POST https://api.mcp.ai/api/codemagic/get/api/key` — Tool to retrieve the API key for the authenticated user from the server. Use when you need to fetch the API key via the Codemagic API.
- `POST https://api.mcp.ai/api/codemagic/get/shorebird/meta` — Tool to retrieve information about Shorebird integration. Use when you need to check supported Flutter versions or the current Shorebird version.
- `POST https://api.mcp.ai/api/codemagic/get/user` — Tool to retrieve information about the currently authenticated user. Use when you need to get user ID, avatar URL, or check user permissions.
- `POST https://api.mcp.ai/api/codemagic/get/variable/groups` — Tool to retrieve paginated list of variable groups for an application. Use when you need to list or browse variable groups associated with a specific app.
  - body: { page?: integer, app_id: string, page_size?: integer }
- `POST https://api.mcp.ai/api/codemagic/get/variables` — Tool to retrieve paginated list of variables for a specific variable group. Use when you need to list or browse environment variables within a variable group.
  - body: { page?: integer, search?: string, page_size?: integer, variable_group_id: string }
- `POST https://api.mcp.ai/api/codemagic/invite/team/member` — Tool to invite a new team member to a Codemagic team. Use when you need to grant team access to a user. Requires team admin privileges. The 'developer' role corresponds to Member role and 'owner' role
  - body: { role: string, email: string, team_id: string }
- `POST https://api.mcp.ai/api/codemagic/receive/webhook` — Tool to receive webhook payloads from Git providers to trigger builds automatically. Use when repository events (commits, pull requests, tags) need to trigger Codemagic builds programmatically.
  - body: { ref: string, app_id: string, pusher: object, repository: object, additional_payload?: object }
- `POST https://api.mcp.ai/api/codemagic/remove/team/member` — Tool to remove a collaborator or revoke a pending invitation from a Codemagic team. Use when you need to revoke team access for a specific user or cancel a pending invitation. Supports both active mem
  - body: { team_id: string, user_id: string }
- `POST https://api.mcp.ai/api/codemagic/retrieve/all/applications` — Tool to retrieve all applications added to Codemagic. Use when you need to list or browse all applications in the Codemagic account.
- `POST https://api.mcp.ai/api/codemagic/retrieve/an/application` — Tool to retrieve a single application by its unique identifier. Use when you need to get application details including name, branches, and workflow configuration.
  - body: { id: string }
- `POST https://api.mcp.ai/api/codemagic/retrieve/caches/for/application` — Tool to retrieve a list of caches for a specific application. Use when you need to view cached data, check cache sizes, or manage application storage.
  - body: { id: string }
- `POST https://api.mcp.ai/api/codemagic/start/new/build` — Tool to start a new build for an application with specified workflow and branch or tag. Use when you need to trigger a build programmatically. Either branch or tag parameter must be provided.
  - body: { tag?: string, app_id: string, branch?: string, labels?: string[], environment?: object, workflow_id: string, instance_type?: string }
- `POST https://api.mcp.ai/api/codemagic/stop/preview` — Tool to stop an app preview. Use when you need to stop a running app preview by its identifier.
  - body: { preview_id: string }
- `POST https://api.mcp.ai/api/codemagic/update/variable` — Tool to update an existing variable within a specified variable group in Codemagic. Use when you need to modify a variable's name, value, or secure status.
  - body: { name?: string, value?: string, secure?: boolean, variable_id: string, variable_group_id: string }

## Example prompts
- "What can I do in Codemagic?"
- "Show me a summary of my Codemagic account"

## More
- Page: https://mcp.ai/codemagic
- Agent spec (llms.txt): https://mcp.ai/codemagic/llms.txt
- Postman collection: https://mcp.ai/codemagic/postman.json
