Docs · 04

SDK and MCP.

Two MCP servers — one in the cloud, one on your computer — and two SDKs. Pick the one closest to where your agent runs.

Which one do I need?

you want an agent to…use
work with your cloud files, threads and account from anywherethe hosted MCP server
drive machines attached to your computer, under local grantsthe local MCP relay, commandagi mcp
script CommandAGI from your own programthe TypeScript or Python SDK

All three authenticate as a principal. None of them can create or widen a grant — that is always a person's act.

Hosted MCP server

https://api.commandagi.com/mcp — Streamable HTTP, stateless, JSON responses. Authenticate with an API key (cagi_…), created in the workbench from the account menu's API keys.

shell
claude mcp add --transport http commandagi https://api.commandagi.com/mcp \
  --header "Authorization: Bearer cagi_YOUR_KEY"

It exposes a large catalogue of tools — over three hundred — including threads (list_threads, create_thread, send_message, get_thread), files (list_drive, read_drive_file, write_drive_file), your account (whoami, get_credits, list_models), code (run_code), hosted sites (create_site, deploy_site), trading (trade_venues, trade_order, trade_account, trade_cancel) and paired hosts (list_hosts, host_call). Use search_tools to find the one you need.

Local MCP relay

On a computer running the host, commandagi mcp is a stdio MCP server that relays to the host's own endpoint. Give it the agent's host credential — in the environment or a file, never as an argument:

shell
claude mcp add commandagi -e COMMANDAGI_CREDENTIAL=cagp_… -- commandagi mcp
# or
claude mcp add commandagi -- commandagi mcp \
  --credential-file ~/.config/claude/commandagi.credential

Without a credential, a client can read and show things but cannot act. The host's endpoint answers on loopback only and refuses requests that carry a web page's origin. The same control tools also answer plain HTTP at POST /control/<tool> with Authorization: Bearer <credential>.

Local tools

grouptools
project and worldsget_project, project_status, list_worlds, get_world, save_world, list_devices, get_device
filesread_file, write_file (under a files grant), graph_query, graph_search
code and simulationevaluate_code (sandboxed, no network), sim_trials
the open workbenchlist_panes, open_file, show_world, thread_read, thread_say
controllist_grants, list_units, open_channel, arm, run_program, send_command, read_channel, stop, close_channel
other hostslist_hosts, host_call
outreachoutreach_apps, outreach_identify, outreach_start, outreach_send, outreach_reply, outreach_outcome, outreach_due, outreach_advance, outreach_status
marketsmarket_venues, market_order, market_account, market_cancel

The control tools follow every rule in Agents and standing grants: each needs the matching verb in a grant, stop needs any grant, and every action is recorded before it is sent.

TypeScript SDK

shell
npm i commandagi        # Node 22 or later
typescript
import { CommandAGI } from "commandagi";

const cagi = new CommandAGI(); // reads COMMANDAGI_API_KEY
const { threadId } = (await cagi.threads.create({
  intent: "Summarise this week's robotics news",
})) as { threadId: string };
await cagi.threads.send(threadId, "Add a link for each one.");

The commandagi command is another package, @commandagi/host (npm install -g @commandagi/host), which is also the local host: commandagi whoami, commandagi threads create --intent "…", commandagi call <tool> --json '{…}', and an interactive terminal when run on its own. Source: github.com/CommandAGI/commandagi-sdk-typescript.

Python SDK

shell
pip install commandagi   # Python 3.9 or later
python
from commandagi import CommandAGI

cagi = CommandAGI()  # reads COMMANDAGI_API_KEY
with cagi.launch("simulation/warehouse") as world:
    world.sim.ik(target=[0.3, 0.0, 0.4])
    jpeg = world.observe(fresh=True)

Source: github.com/CommandAGI/commandagi-sdk-python.

Environment

variablemeaning
COMMANDAGI_API_KEYyour API key, cagi_…
COMMANDAGI_BASE_URLthe API origin, default https://api.commandagi.com
COMMANDAGI_CREDENTIALa principal's credential for the local relay