# remove_connection

URL: https://codepanel.ai/docs/mcp-server/remove_connection

The CodePanel MCP tool that removes an MCP connection and returns it as it was, so add_connection can bring it back.

`remove_connection` removes an MCP connection by name. Runs that start after it are not offered its tools. It needs the `agents:write` scope.

## When to call it

- **To stop runs using a server**, or one you no longer trust.
- **To undo** [`add_connection`](/docs/mcp-server/add_connection) of a new connection.

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes | Connection name, unique per account: 1-32 lower-case letters, digits and single dashes. A run sees its tools as mcp__<name>__<tool>. |

It writes: the server marks it `readOnlyHint: false` and `destructiveHint: true` (it can change what is already there), so a client that asks before writes asks here.

## What it returns

`{ removed }`: the connection as [`list_connections`](/docs/mcp-server/list_connections) showed it just before. To bring it back, call [`add_connection`](/docs/mcp-server/add_connection) with those values.

## The same step without MCP

| Surface | Form |
| --- | --- |
| HTTP API | `POST /autopilot/connections/remove` with the `agents:write` scope |
| CLI | `codepanel connections remove <name>` |

## What the server tells your agent

The description your agent reads when it lists the tools:

> Use it to stop agent app runs calling a server. Remove an MCP connection by name; runs that start after it are no longer offered its tools. Needs agents:write. Returns { removed }: the connection with every field, so add_connection with those values brings it back.

## Related

- [`list_connections`](/docs/mcp-server/list_connections): read what is approved.
- [Scopes](/docs/mcp-server#scopes): what `agents:write` allows.
- [MCP server](/docs/mcp-server): install, sign-in and every other tool.
