Connecting an AI coding agent to Coolify on your VPS through MCP (Model Context Protocol) lets you create projects, manage environment variables, trigger deployments, inspect build logs and diagnose outages directly from Claude Code, Cursor or Codex without bouncing between your terminal and the web UI. In this tutorial you set up the open-source @fndchagas/coolify-mcp server (v2.3.1), compare it with Coolify's built-in /mcp endpoint and enable practical guardrails for production servers.
On this page
- Coolify's built-in `/mcp` endpoint vs `@fndchagas/coolify-mcp`
- Prerequisites
- Step 1: enable the API and create a Coolify token
- Step 2: connect Claude Code, Codex, Cursor or Claude Desktop
- Step 3: verify the connection in read-only mode
- Step 4: zero-to-production deployment workflow
- Step 5: diagnose failed deploys and runtime logs
- Production security guardrails
- Common setup issues and fixes
- Next steps
Every tool name, environment variable and command below was verified against the upstream source of frndchagas/coolify-mcp (v2.3.1, with schemas generated from the official Coolify v4.7.5 OpenAPI spec).
Coolify's built-in /mcp endpoint vs @fndchagas/coolify-mcp
There are two ways to let an AI agent operate Coolify on your VPS over MCP. Use this table to pick the right fit:
| Criteria | Coolify built-in /mcp endpoint |
@fndchagas/coolify-mcp (local stdio / HTTP MCP server) |
|---|---|---|
| Where it runs | Inside your Coolify instance (Streamable HTTP) | Locally via npx (stdio) or a dedicated HTTP process (127.0.0.1) |
| Initial activation | Disabled by default on self-hosted (Settings > Advanced) | Works over the Coolify API + token without exposing a new server endpoint |
| Client-side read-only lock | Depends solely on the Coolify token scope | Token scope plus local COOLIFY_ALLOW_WRITE=false switch |
| Aggregated diagnostics | Individual API calls | Composite tools (diagnoseApp, diagnoseServer, getInfrastructureOverview) |
| Documentation lookup | Requires external search | Bundled offline docs index (searchDocs), no network needed |
| Secrets and deletes | Controlled by client and token | Secrets masked by default plus human confirmation (elicitation) on deletes |

Running @fndchagas/coolify-mcp over stdio is the cleanest default for a self-hosted VPS: the MCP process starts on demand when your IDE or CLI needs it, talks only to your existing HTTPS Coolify API and never requires opening another firewall port on the server.
Prerequisites
- A Linux VPS running Coolify behind an HTTPS domain (for example
https://coolify.example.com). If you have not hardened the panel yet, start with How to install Coolify on an Ubuntu VPS safely. - Node.js 18 or newer on your local machine (where Claude Code, Cursor or Codex runs).
- A Coolify API token scoped to the minimum permissions needed for your workflow.
Step 1: enable the API and create a Coolify token
In your self-hosted Coolify dashboard:
- Open Settings → API (or Keys & Tokens → API Tokens, depending on your panel version) and verify that the API is enabled.
- Create a dedicated token for your AI client (such as
claude-code-prodorcursor-staging) so you can revoke it independently later. - Grant least-privilege scopes:
- Monitoring and log triage only: assign
readonly. - Routine deployments: assign
readanddeploy, leaving resource creation/deletion disabled while you validate the workflow. - Full zero-to-production provisioning: add
write, and keep human confirmation enabled in your MCP client.
- Monitoring and log triage only: assign
- Copy the token right away and store it in your password manager.
Step 2: connect Claude Code, Codex, Cursor or Claude Desktop
In the snippets below, replace https://coolify.example.com/api/v1 with your real Coolify API base URL (notice the /api/v1 suffix) and <your-token> with the token from Step 1.
Claude Code CLI
Register the MCP server directly from your shell:
claude mcp add coolify \
--env COOLIFY_BASE_URL="https://coolify.example.com/api/v1" \
--env COOLIFY_TOKEN="<your-token>" \
--env COOLIFY_ALLOW_WRITE="false" \
-- npx -y @fndchagas/coolify-mcpStart with COOLIFY_ALLOW_WRITE="false" to verify read access safely. Switch it to "true" once you are ready to run deployments and mutations.
OpenAI Codex CLI
From the Codex CLI:
codex mcp add coolify \
--env COOLIFY_BASE_URL="https://coolify.example.com/api/v1" \
--env COOLIFY_TOKEN="<your-token>" \
--env COOLIFY_ALLOW_WRITE="false" \
-- npx -y @fndchagas/coolify-mcpOr add it directly to ~/.codex/config.toml:
[mcp_servers.coolify]
command = "npx"
args = ["-y", "@fndchagas/coolify-mcp"]
env = { COOLIFY_BASE_URL = "https://coolify.example.com/api/v1", COOLIFY_TOKEN = "<your-token>", COOLIFY_ALLOW_WRITE = "false" }Cursor or manual JSON config (~/.mcp.json)
For clients that read standard MCP JSON config (such as Cursor, Windsurf or file-based Claude Code setups):
{
"mcpServers": {
"coolify": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@fndchagas/coolify-mcp"],
"env": {
"COOLIFY_BASE_URL": "https://coolify.example.com/api/v1",
"COOLIFY_TOKEN": "<your-token>",
"COOLIFY_ALLOW_WRITE": "false"
}
}
}
}One-click install on Claude Desktop (.mcpb)
If you use Claude Desktop and want zero JSON editing, download coolify-mcp.mcpb from the latest GitHub release and drag it into Settings → Extensions. Claude Desktop prompts for your Coolify URL and token automatically.
Step 3: verify the connection in read-only mode
Open your agent and run three read-only checks first. With COOLIFY_ALLOW_WRITE=false, every write, deploy or delete call is rejected by the MCP server itself:
- API health check: "Call
getHealthand confirm my Coolify API is reachable." - One-call estate overview: "Run
getInfrastructureOverviewand summarize my servers, projects, applications, databases, services and running deployments." - Offline docs search: "Use
searchDocsto check how Coolify healthchecks are configured."
Once the overview returns your VPS, projects and apps accurately, authentication is working. Change COOLIFY_ALLOW_WRITE to "true" when you want to allow writes and deploys.
Step 4: zero-to-production deployment workflow
With writes enabled, coolify-mcp handles the full deployment lifecycle — for both Git-backed applications and Docker Compose services:
1. listProjects / createProject → pick or create a project
2. listEnvironments / createEnvironment → select the environment (e.g. production)
3. listServers → resolve your VPS UUID
4. createApplication or createService → create a Git/Dockerfile app or Compose service
5. applicationEnvs (action: "upsert") → set env vars without exposing secrets
6. deploy (wait: true) → trigger the build and wait for terminal statusTwo Coolify v4 rules to keep in mind when prompting your agent:
- Docker Compose deployments are services, not applications: since Coolify v4.1, Compose stacks are created through
createServicewithdocker_compose_raw, whereascreateApplicationcoverspublicGit repos,private-github-app,private-deploy-key,dockerfileanddockerimagesources. - Synchronous deploys with failure logs: calling
deploywithwait: truepolls until the deployment finishes and automatically returns the failing log tail so your agent can diagnose and fix build errors in one loop.
A practical prompt in Claude Code or Cursor looks like this:
List my Coolify projects and servers. Create a public Git application for
https://github.com/my-org/my-api in the production environment on my VPS,
upsert NODE_ENV=production via applicationEnvs, and run deploy with wait=true.Step 5: diagnose failed deploys and runtime logs
Day to day, the biggest time saver in coolify-mcp is fast incident triage. Instead of clicking through multiple screens to correlate container status, deployment history and logs, use two composite diagnostic tools:
diagnoseApp: accepts an application UUID, name or domain and aggregates current status, recent deployments, failure log tails, recent runtime logs and suggested next actions in a single call.diagnoseServer: accepts a server UUID, name or IP and reports all running resources broken down by status alongside configured domains.
When a release breaks right after a push, simply ask: "Run diagnoseApp for api.example.com, identify why the last deployment failed and tell me whether the issue is in the Dockerfile or environment variables."
Production security guardrails
Giving an AI agent infrastructure access calls for concrete safety controls beyond prompt discipline. @fndchagas/coolify-mcp ships with four built-in protections:
| Variable / Feature | Default | What it protects in practice |
|---|---|---|
COOLIFY_ALLOW_WRITE |
true |
Set to false to block all creates, updates, deletes and deploys (read-only observability) |
| Secret masking | Enabled | applicationEnvs, getApplication, getDatabase, getService and getPrivateKey mask secrets unless showSecrets: true |
| Human confirmation (elicitation) | on |
On compatible clients (Claude Code, VS Code Copilot), asks you to confirm before deleting a project, app, database, service, server or SSH key |
| Hardened HTTP transport | 127.0.0.1 |
With MCP_TRANSPORT=http, binds loopback by default; exposing beyond loopback requires MCP_HTTP_TOKEN (Bearer auth) |
If you also rely on a VPS firewall, remember that Docker-published ports bypass plain ufw rules — keep the panel and internal ports locked down as covered in Docker port still open with ufw.
Common setup issues and fixes
401or403on every tool call: verify the token is still active under Settings → API in Coolify and has the required permissions (read,writeordeploy).404or HTML returned instead of JSON:COOLIFY_BASE_URLis almost always missing/api/v1at the end. Usehttps://coolify.example.com/api/v1, not justhttps://coolify.example.com.- Coolify version mismatch warning: on startup the server compares your Coolify version against the pinned OpenAPI spec (
v4.7.5). By default this logs a harmless warning and only aborts ifCOOLIFY_STRICT_VERSION=trueis set. - Delete tool fails in a specific MCP client: a few clients advertise elicitation support without implementing the confirmation prompt. If you hit that, set
COOLIFY_MCP_ELICITATION=offfor that client and restrict destructive scopes on the Coolify token instead.
Next steps
- Need a Linux VPS with SSH access, monthly billing and optional preinstalled Coolify? Check VPS for Coolify.
- Still setting up Coolify on a fresh Ubuntu VPS? Follow How to install Coolify on an Ubuntu VPS safely.
- Unsure how much RAM you need for Coolify plus your apps and databases? Read How much RAM and vCPU for n8n, Evolution API and Coolify or try the VPS sizing assistant.