Use CMDOP from your product
Your product’s backend can run tools on your machines over HTTPS, the same calls an MCP agent makes, under the same grant and ceiling.
Preview. The /api/v1 routes with agent tokens ship with the next server release. The SDKs are not published yet.
Before you start
A first call working from your machine: quick start for a developer.
Steps
-
Add one agent per product and environment on the Agents tab (
shop-staging,shop-prod). Each call is recorded under that name, and you can revoke one without touching the others. -
Grant only what the product needs. A product that reads logs needs
read; one that deploys needsexectoo. Cap each machine with its ceiling as well. -
Keep the token on your server. Read it from the environment or your secret store. Never send it to a browser or a mobile app, never put it in a URL, and never log it.
-
Call tools from the backend. Find the machine with
GET /api/v1/machines, the tools and their schemas withGET /api/v1/tools, then call withPOST /api/v1/call:async function callTool(machine: string, tool: string, args: object) { const res = await fetch(`https://${CONTOUR}.cmdop.ai/api/v1/call`, { method: "POST", headers: { Authorization: `Bearer ${process.env.CMDOP_TOKEN}`, "Content-Type": "application/json" }, body: JSON.stringify({ machine, tool, args }), }); const answer = (await res.json()) as { ok?: unknown; error?: { code: string; message: string } }; if (answer.error) throw new CmdopError(answer.error.code, answer.error.message); return answer.ok; } -
Stream long output with
POST /api/v1/call/stream: newline-delimited JSON, one{"chunk": {"stream", "data"}, "seq": n}line per piece of output, then one last line shaped like the/api/v1/callanswer. The status is 200 once the call is sent; how it ended is in the last line. For work longer than ten minutes, start a task and poll its output instead.
Act on errors by code
| Code | Your backend should |
|---|---|
busy, rate_limited | wait and retry, with backoff |
timed_out | retry only if the tool is safe to repeat; for long work use a task |
denied | stop; the owner must change the grant or the ceiling |
unauthorized | stop; the token was revoked or is wrong |
paused, needs_presence | stop; a person must act at the machine |
bad_args | fix the call against the tool’s schema |
Every code: Errors.
Check
Your product’s calls appear under its agent name in the record on your page, and only with the risk classes you granted it.