---
title: "Disconnect MCP server"
method: POST
path: "/api/experimental/mcp/{server}/disconnect"
tags: ["mcp"]
---

# Disconnect MCP server

`POST /api/experimental/mcp/{server}/disconnect`

## Request

- Base URL: `https://opencode.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://opencode.ai/api/experimental/mcp/{server}/disconnect`
- Auth: none required

Disconnect an MCP server at runtime, removing its tools until reconnected.

## Path parameters

- `server` string, required

## Query parameters

- `location` object, nullable
  - `directory` string, nullable

## Response `204`

<No Content>

## Other responses

- `400`: InvalidRequestError
- `401`: UnauthorizedError
- `404`: McpServerNotFoundError | LocationNotFoundError

---

[API](https://skmtc.dev/kaaass/apis/opencode.md) - [All operations](https://skmtc.dev/kaaass/apis/opencode/llms.txt) - [OpenAPI document](https://skmtc.dev/kaaass/apis/opencode/revisions/4e083d954707?raw)
