Skip to Content
ReferenceSDKSDK

SDK

The machine tools as a library for your own program: the same tools an agent calls through MCP, under the same grant and ceiling, each call recorded under the agent whose token the program holds.

LanguagePackagePage
TypeScript, Node 20+npm @cmdop/sdkTypeScript
Python 3.10+PyPI cmdopPython

The current version is the one npm and PyPI show; what changed in each: changelog.

Source: github.com/commandoperator/cmdop-sdk . License: MIT.

What both have

  • A typed method per tool on a machine, with the arguments and result of its tool page, also under its group (box.fs.read). A tool added to CMDOP comes with the next SDK version.
  • run and stream for commands: run waits for the result; stream gives the output as it comes, then the same result. Leaving the loop early stops the command.
  • call(tool, args) reaches any tool by name.
  • The contour’s own tools as methods of the client, with no machine: machines_list, tasks_list, history_search and showtime_guide, the guide an agent follows for a short live demo on your machines. They are the same tools an agent sees over MCP.
  • A deadline per call. The call keeps the shorter of yours and the tool’s own time; past it the answer is timed_out.
  • One error type with the error code as code. Decide by the code, never by the message. A connection that breaks is a separate error, not a result.

Before you start

A machine online on your page and an agent token for your program from the Agents tab, in the environment as CMDOP_TOKEN; your page’s address (https://<address>.cmdop.dev) as CMDOP_URL. The token is held to the agent’s grant. Never put it in code you commit, in a URL or in a log.

The SDK uses the HTTP API: /api/v1/machines, /api/v1/call and /api/v1/call/stream. Calls from a paired client, encrypted end to end, are not in the published packages yet: sealed calls.

The same tools over MCP

CMDOP is also an MCP server. An agent reaches the same tools at https://<address>.cmdop.dev/mcp (streamable HTTP) with an agent token as Authorization: Bearer: the kind of token the SDK takes, held to the same grant, each call recorded the same way. Give each program and each agent its own token, so the record says which one acted. The command or settings for each client: Connect an agent.

Versions

One version for both languages. Within a major version, tools, arguments, result fields and error codes are only added; a program written against 3.x keeps working. A machine with an older cmdop program answers a tool it does not have yet with unknown_tool.