add_private_app
Add a private Git repository to Codemagic CI/CD using an SSH key. Provide the repository URL and base64-encoded private key.
Instructions
Add a new private repository to Codemagic using an SSH key.
Args: repository_url: The SSH URL of the private Git repository. ssh_key_data: Base64-encoded SSH private key. ssh_passphrase: Optional passphrase for the SSH key. project_type: Optional project type (e.g. "flutter-app", "react-native"). team_id: Optional team ID to add the app to.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repository_url | Yes | ||
| ssh_key_data | Yes | ||
| ssh_passphrase | No | ||
| project_type | No | ||
| team_id | No |
Implementation Reference
- codemagic_mcp/tools/apps.py:46-70 (handler)MCP tool handler that defines the 'add_private_app' tool, accepting repository_url, ssh_key_data, ssh_passphrase, project_type, and team_id as parameters, and delegates to CodemagicClient.add_private_app().
@mcp.tool() async def add_private_app( repository_url: str, ssh_key_data: str, ssh_passphrase: str | None = None, project_type: str | None = None, team_id: str | None = None, ) -> Any: """Add a new private repository to Codemagic using an SSH key. Args: repository_url: The SSH URL of the private Git repository. ssh_key_data: Base64-encoded SSH private key. ssh_passphrase: Optional passphrase for the SSH key. project_type: Optional project type (e.g. "flutter-app", "react-native"). team_id: Optional team ID to add the app to. """ async with CodemagicClient() as client: return await client.add_private_app( repository_url=repository_url, ssh_key_data=ssh_key_data, ssh_passphrase=ssh_passphrase, project_type=project_type, team_id=team_id, ) - codemagic_mcp/client.py:84-102 (helper)Client method that constructs the API payload and POSTs to /apps/new to add a private app. Builds the payload with repositoryUrl, sshKey (data and optional passphrase), optional projectType, and optional teamId.
async def add_private_app( self, repository_url: str, ssh_key_data: str, ssh_passphrase: str | None = None, project_type: str | None = None, team_id: str | None = None, ) -> Any: payload: dict[str, Any] = { "repositoryUrl": repository_url, "sshKey": {"data": ssh_key_data}, } if ssh_passphrase is not None: payload["sshKey"]["passphrase"] = ssh_passphrase if project_type is not None: payload["projectType"] = project_type if team_id is not None: payload["teamId"] = team_id return await self._post("/apps/new", json=payload) - codemagic_mcp/tools/apps.py:46-70 (registration)The tool is registered via the @mcp.tool() decorator on the add_private_app function inside the register() function in codemagic_mcp/tools/apps.py.
@mcp.tool() async def add_private_app( repository_url: str, ssh_key_data: str, ssh_passphrase: str | None = None, project_type: str | None = None, team_id: str | None = None, ) -> Any: """Add a new private repository to Codemagic using an SSH key. Args: repository_url: The SSH URL of the private Git repository. ssh_key_data: Base64-encoded SSH private key. ssh_passphrase: Optional passphrase for the SSH key. project_type: Optional project type (e.g. "flutter-app", "react-native"). team_id: Optional team ID to add the app to. """ async with CodemagicClient() as client: return await client.add_private_app( repository_url=repository_url, ssh_key_data=ssh_key_data, ssh_passphrase=ssh_passphrase, project_type=project_type, team_id=team_id, )