DOC-MCP-001 · DEVELOPER

AdaptOrch MCP Server

Connect coding agents to the AdaptOrch control-plane over the Model Context Protocol — submit runs, poll status, fetch artifacts and traces, and request topology routing.

Server
adaptorch-mcp · 0.1.0
Protocol
MCP 2025-11-25
Transports
stdio · http+sse
Contact
ict03@rfems.com

§ 01

What the AdaptOrch MCP server does

AdaptOrch exposes its control-plane through the Model Context Protocol (MCP) so coding agents can submit runs, poll status, fetch artifacts and traces, and request topology routing.

The server is a direct JSON-RPC implementation (not FastMCP). Tools are published as static schemas, resources and prompts are listed alongside them, and every tool result is returned as a JSON string in content[0].text.

Protocol version 2025-11-25 is the default; 2024-11-05, 2025-03-26, and 2025-06-18 are also supported.

§ 02

Install

AdaptOrch MCP is a Python package (requires Python 3.11+). Install the client extra, then run the adaptorch-mcp console script.

# stdio MCP server (console script)
pip install 'adaptorch[mcp]'
adaptorch-mcp --transport stdio --base-url https://control-plane.example.com

# HTTP+SSE transport requires the api extra
pip install 'adaptorch[api]'
adaptorch-mcp --transport http --http-host 127.0.0.1 --http-port 8765

Note: uvx works only after a PyPI release (unverified in this repo). There is no npm/npx wrapper — this is a Python package only.

§ 03

Connect (mcp.json)

For Claude Desktop / Claude Code, add an entry to mcp.json. stdio is the default and recommended transport; HTTP+SSE is available for remote control planes.

stdio (default, recommended)

{
  "mcpServers": {
    "adaptorch": {
      "command": "adaptorch-mcp",
      "args": ["--transport", "stdio", "--base-url", "https://control-plane.example.com"],
      "env": { "ADAPTORCH_CONTROL_PLANE_TOKEN": "${ADAPTORCH_CONTROL_PLANE_TOKEN}" }
    }
  }
}

stdio via uvx (after a PyPI release)

{
  "mcpServers": {
    "adaptorch": {
      "command": "uvx",
      "args": ["--from", "adaptorch[mcp]", "adaptorch-mcp", "--base-url", "https://control-plane.example.com"],
      "env": { "ADAPTORCH_CONTROL_PLANE_TOKEN": "${ADAPTORCH_CONTROL_PLANE_TOKEN}" }
    }
  }
}

HTTP+SSE (Bearer)

{
  "mcpServers": {
    "adaptorch-http": {
      "url": "http://127.0.0.1:8765/mcp",
      "headers": { "Authorization": "Bearer ${ADAPTORCH_MCP_HTTP_AUTH_TOKEN}" }
    }
  }
}

Note: Supply every secret through an environment variable (${VAR}); never hard-code tokens. There is no npm/npx package — use the Python console script or uvx.

§ 04

Tool reference

The server publishes 10 tools. Each result is a JSON string in content[0].text; failures set isError. Badges reflect the MCP annotations (read-only, destructive, idempotent, open-world).

adaptorch_run

Submit a task payload to AdaptOrch control-plane and optionally wait.

WRITEnon-destructivenon-idempotentOPEN-WORLD

ParamTypeRequiredDefault
promptstringconditional
contextstringno
payloadobjectno
connector_namestringno"mcp"
synthesis_modestring (enum)no"robust"
modelstringno
tracebooleannofalse
budget_policyobjectno
wait_for_terminalbooleannotrue
timeout_secondsnumberno120.0
poll_interval_secondsnumberno1.0
verification_commandsstring[]no— (gated)
prefer_ensemble_singletonbooleannofalse
output_extractorstring (enum)no
{ "jsonrpc": "2.0", "id": 1, "method": "tools/call",
  "params": { "name": "adaptorch_run",
    "arguments": { "prompt": "${TASK_PROMPT}", "synthesis_mode": "robust",
                   "wait_for_terminal": true, "timeout_seconds": 120.0 } } }
// result text -> { "run_id": "${RUN_ID}", "status": "SUCCEEDED",
//                  "telemetry": { "ensemble": { "selected_model_id": "${MODEL}" } } }

adaptorch_get_run

Get run summary by run_id.

READ-ONLYnon-destructiveIDEMPOTENTOPEN-WORLD

ParamTypeRequiredDefault
run_idstringyes
{ "jsonrpc": "2.0", "id": 2, "method": "tools/call",
  "params": { "name": "adaptorch_get_run", "arguments": { "run_id": "${RUN_ID}" } } }
// result text -> { "run_id": "${RUN_ID}", "status": "RUNNING" }

adaptorch_get_artifacts

Get run artifacts by run_id.

READ-ONLYnon-destructiveIDEMPOTENTOPEN-WORLD

ParamTypeRequiredDefault
run_idstringyes
{ "jsonrpc": "2.0", "id": 3, "method": "tools/call",
  "params": { "name": "adaptorch_get_artifacts", "arguments": { "run_id": "${RUN_ID}" } } }
// result text -> { "run_id": "${RUN_ID}", "artifacts": { "${NAME}": "${URL}" } }

adaptorch_list_runs

List recent AdaptOrch control-plane runs, newest first.

READ-ONLYnon-destructivenon-idempotentOPEN-WORLD

ParamTypeRequiredDefault
limitinteger (1–100)no20
statusstringno
{ "jsonrpc": "2.0", "id": 4, "method": "tools/call",
  "params": { "name": "adaptorch_list_runs", "arguments": { "limit": 20, "status": "SUCCEEDED" } } }
// result text -> { "runs": [ ... ], "page": 1, "page_size": 20 }

adaptorch_get_traces

Get execution traces for a run by run_id.

READ-ONLYnon-destructiveIDEMPOTENTOPEN-WORLD

ParamTypeRequiredDefault
run_idstringyes
{ "jsonrpc": "2.0", "id": 5, "method": "tools/call",
  "params": { "name": "adaptorch_get_traces", "arguments": { "run_id": "${RUN_ID}" } } }
// result text -> { "run_id": "${RUN_ID}", "traces": [ ... ] }

adaptorch_cancel_run

Request cancellation of an in-flight run by run_id.

WRITEDESTRUCTIVEnon-idempotentOPEN-WORLD

ParamTypeRequiredDefault
run_idstringyes
{ "jsonrpc": "2.0", "id": 6, "method": "tools/call",
  "params": { "name": "adaptorch_cancel_run", "arguments": { "run_id": "${RUN_ID}" } } }
// result text -> { "run_id": "${RUN_ID}", "status": "CANCELLED" }

adaptorch_route_topology

Recommend an execution topology for a task DAG using the local TopologyRouter (no control-plane call).

READ-ONLYnon-destructiveIDEMPOTENTclosed-world

ParamTypeRequiredDefault
subtasksobject[]yes
dependenciesobject[]no
{ "jsonrpc": "2.0", "id": 7, "method": "tools/call",
  "params": { "name": "adaptorch_route_topology",
    "arguments": { "subtasks": [ { "id": "t1" }, { "id": "t2" } ],
                   "dependencies": [ { "from": "t1", "to": "t2" } ] } } }
// result text -> { "topology": "${TOPOLOGY}", "stages": [ ["t1"], ["t2"] ],
//                  "features": { "node_count": 2, "edge_count": 1 } }

adaptorch_server_metrics

Return redacted MCP tool-call counters and latency percentiles.

READ-ONLYnon-destructivenon-idempotentclosed-world

No arguments.

{ "jsonrpc": "2.0", "id": 8, "method": "tools/call",
  "params": { "name": "adaptorch_server_metrics", "arguments": {} } }
// result text -> { "tool_calls": 0, "tool_errors": 0, "p50_latency_ms": 0.0, "p95_latency_ms": 0.0 }

adaptorch_capabilities

Return supported synthesis modes, connectors, and server capabilities.

READ-ONLYnon-destructiveIDEMPOTENTclosed-world

No arguments.

{ "jsonrpc": "2.0", "id": 9, "method": "tools/call",
  "params": { "name": "adaptorch_capabilities", "arguments": {} } }
// result text -> { "synthesis_modes": ["paper","robust","robust_lite","stable_hybrid","fourier_aggressive"], ... }

adaptorch_plan_catalog

Return the current AdaptOrch hosted cloud plan catalog: Starter $0, Pro $39, Team $149.

READ-ONLYnon-destructiveIDEMPOTENTOPEN-WORLD

No arguments.

{ "jsonrpc": "2.0", "id": 10, "method": "tools/call",
  "params": { "name": "adaptorch_plan_catalog", "arguments": {} } }
// result text -> { "schemaVersion": "adaptorch.cloud_plan_catalog.v1", "plans": [ ... ] }

§ 05

Authentication

stdio relies on a local trust model plus a control-plane token. HTTP+SSE adds bearer auth, origin allow-listing, protocol-version checks, and a payload size cap. All tokens are injected through environment variables and are never hard-coded.

Environment variableDefaultPurpose
ADAPTORCH_CONTROL_PLANE_TOKENrequiredControl-plane bearer token (stdio + http)
ADAPTORCH_CONTROL_PLANE_BASE_URLhttp://127.0.0.1:8000Control-plane base URL
ADAPTORCH_MCP_HTTP_AUTH_TOKENfalls back to control-plane tokenBearer expected on HTTP requests
ADAPTORCH_MCP_ALLOWED_ORIGINSlocalhost, 127.0.0.1, ::1Allowed Origin header values
ADAPTORCH_MCP_MAX_PAYLOAD_SIZE_BYTES1048576Max HTTP request body (else 413)
ADAPTORCH_MCP_ALLOW_VERIFICATION_COMMANDSoffGate for verification_commands

HTTP responses: 401 for a missing or invalid bearer token, 403 for a disallowed origin, 413 when the payload exceeds the size cap. Tokens are compared with hmac.compare_digest and are never logged.

§ 06

Workflows

Three common flows cover most agent integrations.

1 · Run and collect

Call adaptorch_run with wait_for_terminal, then read the result with adaptorch_get_run, adaptorch_get_artifacts, and adaptorch_get_traces.

{ "name": "adaptorch_run",
  "arguments": { "prompt": "${TASK_PROMPT}", "wait_for_terminal": true } }
// then
{ "name": "adaptorch_get_artifacts", "arguments": { "run_id": "${RUN_ID}" } }

2 · Pre-route a DAG

adaptorch_route_topology computes a recommended topology locally — it does not call the control-plane.

{ "name": "adaptorch_route_topology",
  "arguments": { "subtasks": [ { "id": "t1" }, { "id": "t2" } ],
                 "dependencies": [ { "from": "t1", "to": "t2" } ] } }

3 · Operate

List recent runs with adaptorch_list_runs and stop an in-flight run with adaptorch_cancel_run. The adaptorch_run_prompt and adaptorch_get_run_prompt prompts wrap these calls for agents.

§ 07

Troubleshooting

  • Launcher not found: use the adaptorch-mcp console script or scripts/run_adaptorch_mcp.sh.
  • Token missing: set ADAPTORCH_CONTROL_PLANE_TOKEN; a remote --base-url requires it.
  • Framing mismatch: match --stdio-framing (newline default vs content-length).
  • HTTP 401 / 403: check the bearer token and the Origin allow-list.
  • HTTP 413: the request body exceeds the payload size cap.
  • verification_commands rejected: disabled unless ADAPTORCH_MCP_ALLOW_VERIFICATION_COMMANDS is set.
  • Smoke test: GET /mcp/health and GET /mcp/sse?once=true.