Skip to content

About

MCP server wrapping the DeployEx Agent API - check rollout status, read logs, and operate an app without the dashboard

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

deployex-agent-api-mcp

An MCP server that wraps DeployEx's Agent API, so an agent can check rollout status, read logs, and operate an app without the dashboard.

Why

The Agent API guide already says what it's for: "Scripts, CI pipelines and other tools use it to read the state of the host and the logs of its apps without the dashboard, and to restart an app, clear its ghosted versions or set its mode." An agent talking to Claude Desktop, Claude Code, or any other MCP client is one more such tool - it just needs the HTTP calls turned into MCP tools instead of a script.

This wraps every resource in the Agent API's OpenAPI document one-to-one, plus one tool that isn't in the HTTP API at all: check_rollout, which polls every configured host the way a deploy pipeline would (see the guide's "Check a rollout from a pipeline"), instead of leaving an agent to call get_app on each host itself and do the comparison by hand.

Prerequisites

  • The Agent API turned on (agent_api.enabled: true in deployex.yaml) on every host you want to reach.
  • A token from DEPLOYEX_API_TOKENS, with the read scope for the read-only tools, and operate for restart_app, remove_ghosted_version, clear_ghosted_versions, and set_app_mode. A read-only token still works - those four tools just get a 403 from the Agent API, the same as any other caller without the scope.
  • Python 3.10+.

Install and configure

uvx deployex-agent-api-mcp

or, from a local checkout:

uv run --directory /path/to/agent-api-mcp deployex-agent-mcp

Point an MCP client at it with its own config, for example Claude Code's .mcp.json or Claude Desktop's claude_desktop_config.json:

{
  "mcpServers": {
    "deployex": {
      "command": "uvx",
      "args": ["deployex-agent-api-mcp"],
      "env": {
        "DEPLOYEX_AGENT_API_URL": "http://10.0.1.11:5002",
        "DEPLOYEX_AGENT_API_TOKEN": "the-token-from-DEPLOYEX_API_TOKENS"
      }
    }
  }
}
Variable Required Default Meaning
DEPLOYEX_AGENT_API_TOKEN Yes - The bearer token. Its scopes decide which tools can succeed.
DEPLOYEX_AGENT_API_URL No http://localhost:5002 The primary host - every tool but check_rollout talks to just this one.
DEPLOYEX_AGENT_API_HOSTS No the primary host alone A comma-separated list of hosts for check_rollout to poll, e.g. http://10.0.1.11:5002,http://10.0.1.12:5002. The first host doubles as the primary host, in place of DEPLOYEX_AGENT_API_URL.
DEPLOYEX_AGENT_API_TIMEOUT No 10.0 Per-request timeout, in seconds.

Each host answers for itself only - a DeployEx host never speaks for another one, even when several are connected (see Fleet: more than one replica). DEPLOYEX_AGENT_API_HOSTS exists because check_rollout is the one tool where that matters: checking a single host after a rollout says nothing about the rest.

Tools

Tool Agent API resource Scope
get_node GET /v1/node read
get_node_versions GET /v1/node/versions read
get_node_relup GET /v1/node/relups/{from}/{to} read
list_apps GET /v1/apps read
get_app GET /v1/apps/{name} read
get_app_versions GET /v1/apps/{name}/versions read
get_app_relup GET /v1/apps/{name}/relups/{from}/{to} read
get_app_ghosted GET /v1/apps/{name}/ghosted read
get_app_logs GET /v1/apps/{name}/logs read
restart_app POST /v1/apps/{name}/restart operate
remove_ghosted_version DELETE /v1/apps/{name}/ghosted/{version} operate
clear_ghosted_versions POST /v1/apps/{name}/ghosted/clear operate
set_app_mode PUT /v1/apps/{name}/mode operate
check_rollout polls GET /v1/apps/{name} on every host in DEPLOYEX_AGENT_API_HOSTS read

A tool's docstring, visible to the MCP client, carries the same detail the Agent API guide gives each resource - an agent reading the tool list does not need the guide open at the same time, though the OpenAPI document remains the source of truth for the HTTP shape underneath.

What this does not do (yet)

  • No event stream. The Agent API's Phoenix Channels socket (events, apps, logs:<sname>:<type>) is not representable as MCP tools the way the HTTP resources are, and stays out of scope here. get_app_logs with since covers polling for an agent that does not need push updates.
  • No fleet-wide operate. restart_app, remove_ghosted_version, clear_ghosted_versions, and set_app_mode all act on the primary host only, the same as the Agent API itself - there's no fan-out to every host in DEPLOYEX_AGENT_API_HOSTS. Each host's operate calls already write their own audit line, so fanning out from here would still need per-host confirmation, not a single call.
  • No current.json write-back. check_rollout reports a ghosted version; it does not write the release storage pointer back to the previous one, the way rollout-guard or a pipeline's own step would. That is deliberate - an agent deciding to roll back a release is a different, larger action than an agent reading its status.

Development

uv sync --extra dev
uv run pytest

Tests mock the Agent API's HTTP responses with httpx.MockTransport - no real DeployEx host is needed to run them.

smoke_test.py is a separate, manual end-to-end check: it starts the real server over stdio, a fake Agent API over plain HTTP, and a real MCP client, then calls list_tools and a few tools through the actual transport - the part the mocked unit tests never exercise. Run it with uv run python smoke_test.py.

About

MCP server wrapping the DeployEx Agent API - check rollout status, read logs, and operate an app without the dashboard

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages