Skip to main content
Glama
CapRover MCP

CapRover MCP

by minhvip08

CapRover MCP

An MCP server for CapRover that lets AI agents (Claude Code, Codex, any MCP client) read your apps' config and logs and change config without breaking apps: every change is planned, confirmed, backed up, verified and rolled back automatically if the app does not come back.

Comes with a plugin for Claude Code and Codex that bundles the MCP connection and skills for reading config, reading logs, updating config, rolling back, troubleshooting and auditing projects.

Tested against CapRover 1.14 and 1.16.

Features

  • Read: apps, apps grouped by project with dependency and risk analysis, full app config (env values masked), runtime status, runtime logs (Docker stream decoded, sorted, secrets redacted), build logs.

  • Change safely: env vars (set/unset), instance count, container HTTP port, force HTTPS, websocket, internal-only, host port mappings, description.

    • Two steps: plan returns a diff and warnings; apply runs only with that plan_id.

    • Sends the full app definition. CapRover's update API resets every omitted field (env vars, instance count, App Token), so partial updates break apps.

    • Backs up before writing, re-reads and compares every stored field, then waits for the app to be healthy (Swarm task status on CapRover ≥ 1.16, plus an HTTP probe). Rolls back on any failure.

    • Refuses risky edits: CapRover/Swarm host ports, port conflicts, >1 instance for persistent apps, Force HTTPS without an SSL domain, stale plans, apps that are building.

  • Auth: logs in with the dashboard password (TOTP 2FA supported), caches the token (0600 file) and logs in again when it expires; or uses a fixed token. Over HTTP, clients authenticate with per-user bearer tokens, and each change records who applied it.

Tool

Purpose

caprover_auth_status

Connection and auth state (no secrets)

caprover_list_apps

Apps with image, instances, domains

caprover_list_projects

Apps by project, dependencies (srv-captain--<app> references), findings

caprover_get_app_config

One app's config, env values masked

caprover_get_app_status

Swarm task state, failures, history (CapRover ≥ 1.16)

caprover_get_app_logs

Runtime logs, filterable, secrets redacted

caprover_get_build_logs

Latest build/deploy log

caprover_plan_config_change

Validate a change, return diff + plan_id

caprover_plan_restore_backup / caprover_list_config_backups

Undo from backups

caprover_apply_config_change

Apply a confirmed plan (the only write tool)

The MCP cannot create/delete apps, deploy images, or change domains, SSL, volumes or nginx config.

Related MCP server: Coolify MCP Server

Quick start (local, stdio)

git clone https://github.com/minhvip08/caprover-mcp && cd caprover-mcp
make install
cp .env.example .env        # set CAPROVER_URL and CAPROVER_PASSWORD
claude mcp add caprover -- "$PWD/.venv/bin/python" -m caprover_mcp   # or any MCP client

Python 3.14+. Values in .env are read by make run; for claude mcp add pass them with -e KEY=VALUE or export them.

Deploy to CapRover (HTTP, shared by a team)

  1. Create an app (e.g. caprover-mcp) with Has Persistent Data, container HTTP port 8000, a persistent directory at /data (token cache and backups), HTTPS enabled and forced.

  2. Set env vars in App Configs:

    Variable

    Value

    CAPROVER_URL

    http://captain-captain:3000 (internal), or your dashboard URL

    CAPROVER_PASSWORD

    dashboard password

    MCP_AUTH_TOKENS

    alice:<token>,bob:<token> (openssl rand -hex 32, ≥ 32 chars each)

    CAPROVER_PROTECTED_APPS

    caprover-mcp (the MCP never edits itself)

  3. Deploy. The repo ships a GitHub Actions workflow: push to main runs CI, builds ghcr.io/<owner>/<repo> and deploys with caprover/deploy-from-github. Enable the app's App Token, then put CAPROVER_SERVER, CAPROVER_APP_NAME, CAPROVER_APP_TOKEN in a GitHub environment named caprover (scripts/setup-github.sh does it with gh). Or build the Dockerfile any other way.

  4. Check https://<app-domain>/health. MCP endpoint: https://<app-domain>/mcp.

Run a single instance: plans live in process memory.

Plugin for Claude Code and Codex

See plugins/caprover.

# Claude Code: asks for the MCP URL and your token (stored in secure storage)
/plugin marketplace add minhvip08/caprover-mcp
/plugin install caprover@caprover-mcp

# Codex: bearer token from $CAPROVER_MCP_TOKEN
codex plugin marketplace add minhvip08/caprover-mcp
codex plugin add caprover@caprover-mcp

Configuration

All settings are env vars, validated at startup; see .env.example.

Variable

Default

CAPROVER_URL

required

Dashboard/API URL

CAPROVER_PASSWORD / CAPROVER_AUTH_TOKEN

one required

CapRover auth

CAPROVER_OTP_SECRET

Base32 TOTP secret if 2FA is on

MCP_TRANSPORT

stdio (http in the image)

MCP_AUTH_TOKEN / MCP_AUTH_TOKENS

required for HTTP

Client bearer tokens

CAPROVER_PROTECTED_APPS

Apps that cannot be changed

CAPROVER_READ_ONLY

false

Disable writes

CAPROVER_ALLOW_SECRET_REVEAL

false

Allow reveal_secrets

CAPROVER_VERIFY_TIMEOUT

120

Seconds to wait for health before rolling back

CAPROVER_HEALTH_PROBE

auto

internal (srv-captain--<app>), public (app domain) or off

CAPROVER_MCP_STATE_DIR

~/.local/state/caprover-mcp (/data in the image)

Token cache and backups (secrets, 0600)

Calling captain over plain http://…:3000 works with Force HTTPS on: the client sends X-Forwarded-Proto: https as nginx does.

Development

make ci                     # ruff + pytest
scripts/mcp_client.py tools # talk to the server like an MCP client does
scripts/mcp_client.py call caprover_plan_config_change '{"app_name":"my-app","set_env":{"A":"1"}}' \
                      call caprover_apply_config_change '{"plan_id":"{plan_id}"}'

Tests run against an in-memory CapRover (tests/fake_caprover.py) that mirrors the real API's behaviour (omitted fields reset on update, token expiry, Docker log framing, no runtime API on old versions). See AGENTS.md for code layout and rules.

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to manage self-hosted Coolify v4 instances, including listing applications, safely handling environment variables with masking and dry runs, deploying, restarting, and reading logs.
      20
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables managing a self-hosted Coolify PaaS from Claude, Cursor, or any MCP client through 45 tools for deploying, rolling back, debugging, and operating applications, databases, services, projects, and environments in plain English. Destructive operations pause for human confirmation and secrets stay masked.
      MIT
    • A
      license
      C
      quality
      A
      maintenance
      Enables AI agents to manage Docker environments through DPanel by exposing MCP tools for containers, compose projects, images, networks, volumes, files, cron tasks, backups, and system information. Supports read-only, read-write, and admin capability tiers, with sensitive-value redaction and fail-closed confirmation for destructive operations.
      99
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables AI agents to deploy and roll back applications, read build and runtime logs, diagnose broken apps, and run commands inside containers. It also manages environment variables, PostgreSQL databases, domains, cron jobs, marketplace services, and backups on a PaaS platform, with safety annotations so clients can confirm destructive actions.
      58
      MIT