# API: MCP servers

| Method | Path | What it does | Scope |
|---|---|---|---|
| GET | `/v1/mcp-servers` | Remote MCP servers your agents may use, with their tools and how each is classified | `agents:read` |
| POST | `/v1/mcp-servers` | Connect a remote MCP server (Streamable HTTP, https), optionally sending an organization secret in a header; its tools are discovered (web app only) | `security:write` |
| DELETE | `/v1/mcp-servers/:id` | Disconnect an MCP server | `security:write` |
| POST | `/v1/mcp-servers/:id/discover` | Read the server's tools again (new tools start as writes that need a person) | `security:write` |
| PATCH | `/v1/mcp-servers/:id/tools/:tool` | Classify a tool (read: agents may call it through mcp.read without review) or turn it off (web app only) | `security:write` |

## Examples

### GET /v1/mcp-servers

Remote MCP servers your agents may use, with their tools and how each is classified

```bash
curl -s "https://api.closefinch.com/v1/mcp-servers" \
  -H "Authorization: Bearer $RA_API_KEY"
```

```js
const res = await fetch(`https://api.closefinch.com/v1/mcp-servers`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}` },
});
const data = await res.json();
```

### DELETE /v1/mcp-servers/$ID

Disconnect an MCP server

```bash
curl -s -X DELETE "https://api.closefinch.com/v1/mcp-servers/$ID" \
  -H "Authorization: Bearer $RA_API_KEY"
```

```js
const res = await fetch(`https://api.closefinch.com/v1/mcp-servers/${id}`, {
  method: "DELETE",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}` },
});
const data = await res.json();
```

### POST /v1/mcp-servers/$ID/discover

Read the server's tools again (new tools start as writes that need a person)

```bash
curl -s -X POST "https://api.closefinch.com/v1/mcp-servers/$ID/discover" \
  -H "Authorization: Bearer $RA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.closefinch.com/v1/mcp-servers/${id}/discover`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.RA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

Request and response schemas: [https://www.closefinch.com/openapi.json](https://www.closefinch.com/openapi.json). All resources: [API reference](https://www.closefinch.com/docs/api).
