# Disconnect an agent

> Page: https://docs.plotwork.dev/api/delete-user-mcp-connections-key-id. Index of every page: https://docs.plotwork.dev/llms.txt

Ends the connection at once: its key stops working, so the next call from the agent is refused.

`DELETE /user/mcp/connections/{keyId}`

## TL;DR

| Question | Answer |
|---|---|
| What does it do? | Disconnect an agent. |
| What does it take? | `keyId` in the path. |
| What does it return? | Status 204 with no body. |
| What can go wrong? | `401` not signed in; `403` the request came from an origin that may not make changes; `404` no such connection; `429` too many requests. Every failure uses the one error envelope. |

## What it does

Ends the connection at once: its key stops working, so the next call from the agent is refused. A connection that is not yours, or is already ended, is a 404.

## Path parameters

| Field | Type | Required | Description |
|---|---|---|---|
| `keyId` | `string` | yes |  |

## Responses

| Status | Meaning | Body |
|---|---|---|
| 204 | Disconnected. | none |
| 401 | Not signed in. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 403 | The request came from an origin that may not make changes. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 404 | No such connection. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 429 | Too many requests. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |

## See also

| Doc | Why |
|---|---|
| [API reference](https://docs.plotwork.dev/api/reference.md) | Every endpoint, and the error envelope |
| [Schemas](https://docs.plotwork.dev/api/schemas.md) | Every request and response type |
| [Tool reference](https://docs.plotwork.dev/mcp/tools.md) | The operations as callable tools |
