api.mcp

disconnect()

api.mcp.disconnect(name) → Promise<{ ok: true }>

Removes the connection and its token. Nothing is told to the server — it has no idea it was connected.

removes the tokennothing is toldruns lose it immediately
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

await api.mcp.disconnect("example");   // { ok: true }
api.mcp.disconnect("example")   # {"ok": True}

What goes

  • The address, the label and the category.
  • The token.
  • The recorded catalogue and the allowed list.

The server is not notified

A connection is a record on our side

There is no session to end: the protocol revision this client speaks is stateless, so « connected » only ever meant « we have its address and a token ». Revoking the token itself is done where it was issued.

Running agents lose it at their next run

The server list is re-read at the start of every run, so a disconnection takes effect on the next one — and a run already in flight keeps what it loaded.

The gentler version

update(name, { tools: [] }) keeps the connection and declares nothing. Prefer it when you want to stop a server reaching your runs without losing the credential.

Errors

A name that is not connected answers 404. There is nothing else to go wrong — no request leaves for the server.