MCP and HTTP

MCP stdio

agent-exec mcp exposes run, status, tail, wait, and kill. A disconnected client does not stop the managed job; reconnect with its job_id.

AGENT_EXEC="$(command -v agent-exec)"
"$AGENT_EXEC" mcp

HTTP server

agent-exec serve binds to 127.0.0.1:19263 by default. --port changes only the loopback port. A non-loopback --bind requires --insecure and a nonempty AGENT_EXEC_SERVE_TOKEN.

The token uses Authorization: Bearer authentication only for POST /exec and POST /kill/{id}. It does not protect read endpoints, so keep the default loopback bind or add a firewall, private network, or authenticating reverse proxy. Do not expose the server directly to the public internet.

--allow-origin permits one explicit CORS origin. The wildcard * is rejected.

MethodEndpointEquivalent
GET/healthHealth envelope
POST/execrun
GET/status/{id}status
GET/tail/{id}tail
GET/wait/{id}wait --forever
POST/kill/{id}kill

Documented handler responses use the CLI schema_version, ok, and type envelope. Router-level unmatched paths and methods are outside this response contract. POST /exec requires a nonempty command array of strings. Optional fields are cwd (string), env (string-to-string object), timeout (seconds), wait (default true), until (default 10), and max_bytes (default 65536). Unknown fields are rejected.

curl -X POST http://127.0.0.1:19263/exec \
  -H 'Content-Type: application/json' \
  -d '{"command":["sh","-c","echo hello"]}'