A connection belongs to the account, not to an agent: it is an address, a credential and a decision about which of its tools may be used. An agent then says which servers it wants, and api.mcp.tools() hands the same declarations to anyone writing their own loop.
The surface
| Call | Does |
|---|---|
| connect(options) | Checks the address, shakes hands, lists its tools, saves the connection. |
| list() | Every connected server, without tokens. |
| get(name, { refresh }) | One, with its tools. refresh re-reads them from the server. |
| update(name, changes) | Allowed tools, category, token, label, address. |
| call(name, tool, args) | Runs one tool, without an agent. |
| disconnect(name) | Removes the connection. |
| tools(names) | Declarations for models.turn({ tools }). |
| forAgent(names) | Servers ready for the engine, tokens included. |
await api.mcp.connect({
url: "https://mcp.example.com/sse",
name: "example",
token: process.env.EXAMPLE_TOKEN,
tools: ["search_docs", "get_issue"], // nothing is allowed without this
category: "read",
});
const agent = api.agents.create({
runtime: "local", machine: pc, model: "gemini-3.5-flash",
mcp: ["example"],
});import os
api.mcp.connect(
url="https://mcp.example.com/sse",
name="example",
token=os.environ["EXAMPLE_TOKEN"],
tools=["search_docs", "get_issue"], # nothing is allowed without this
category="read",
)
agent = api.agents.create(
runtime="local", machine=pc, model="gemini-3.5-flash",
mcp=["example"],
)The client lives in the package
A provider that runs the tool round trips inside its turn gives no exact pre-authorisation, no permission asked per call, and no budget that bites. Here an MCP tool is one more declaration — so it works on every provider, and it needed no route of ours to execute.
Five things that are deliberate
| Why | Page | |
|---|---|---|
exec by default | The protocol's read-only hint is declared by the server itself — not proof. | connect() |
| No tool allowed unless listed | Each declaration costs tokens on every turn. | Allowed tools |
| Schemas are sanitised | A raw schema can fail the whole turn, not just that tool. | sanitizeSchema() |
| The address is checked first | Before the package ever contacts it. | Address check |
| The token is encrypted at rest | And returned only to its owner. | Tokens |
One transport
Streamable HTTP over https. The revision this client speaks made the protocol core stateless, so a call is an ordinary request and response — nothing to hold open, nothing to resume when the process carrying the package restarts.