Skip to Content
GuidesUse from your product

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

  1. 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.

  2. Grant only what the product needs. A product that reads logs needs read; one that deploys needs exec too. Cap each machine with its ceiling as well.

  3. 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.

  4. Call tools from the backend. Find the machine with GET /api/v1/machines, the tools and their schemas with GET /api/v1/tools, then call with POST /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; }
  5. 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/call answer. 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

CodeYour backend should
busy, rate_limitedwait and retry, with backoff
timed_outretry only if the tool is safe to repeat; for long work use a task
deniedstop; the owner must change the grant or the ceiling
unauthorizedstop; the token was revoked or is wrong
paused, needs_presencestop; a person must act at the machine
bad_argsfix 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.

HTTP API · Tokens · Security model