Deploy/deploy_private_repo
Tool · Deploy

deploy_private_repo

Deploy a private SSH Git repository to one domain on one of the caller's hosting services using a pre-installed per-repo deploy key (generated via generate_deploy_key). The repository MUST contain a .cpanel.yml file at its root — the deployment is driven by it (it defines where files land); a repository without one returns no_cpanel_yml. The repository is cloned over SSH and deployed following .cpanel.yml to the target domain. Call generate_deploy_key first (which needs the cpanel:uapi scope) to provision the SSH key for this (service_id, repo_ssh_url) pair, then add the returned public key to the repository's deploy keys on GitHub/GitLab/Bitbucket before calling this tool. An omitted branch deploys the repository default branch (HEAD). This is a state-changing, destructive, non-idempotent write — it requires the write:deploy scope. Step-up auth enforcement is deferred to the Phase-2 step-up mechanism. TIP — verifying success: a subsequent "Repository not found" from get_private_repo_deploy_status can be a red herring — the status command re-contacts the remote, but the clone + .cpanel.yml deploy may have already landed; confirm by listing the docroot (list_website_domains gives its path) rather than trusting that error. TIP — a FAILED clone leaves a hidden .git under /home/<user>/repositories/<domain>/, and a later retry then fails with "directory already contains files"; cPanel VersionControl delete does NOT remove these files and Fileman cannot delete — the user must clear that directory in cPanel File Manager (enable Show Hidden Files) before retrying.

DestructiveOpen‑worldscope write:deploy

Invoked over the MCP transport with a tools/call request naming this tool.

Authorization #

Requires a valid OAuth 2.1 bearer access_token whose grant includes the write:deploy scope — Deploy websites from a git repository — a public URL or a private SSH repo — to your hosting (overwrites the target site). The broker resolves the caller from the token and returns only records the account owns.

Parameters #

service_idintegerRequired
The hosting service ID to deploy to. Obtain it via list_services.
repo_ssh_urlstringRequired
SSH clone URL of the private repository (e.g. git@github.com:org/repo.git). A deploy key for this URL must have been generated via generate_deploy_key for this service first.
target_domainstringRequired
The hosted domain to deploy to. Must belong to the hosting service (discover it via list_website_domains).
branchstringOptional
Optional branch, tag, or commit to deploy. Omit for the repository default branch (resolves to HEAD).

Response #

200 · application/json

deployobject
statusstring
commit_shastring
refstring
service_idinteger
target_domainstring
repository_rootstring
deployment_idstring
module_versionstring
statusstring
repository_rootstring
messagestring

Errors #

ResultWhen
{ "error": "invalid_target_domain" }See the tool description for when this result is returned.
{ "error": "invalid_repo_url" }See the tool description for when this result is returned.