---
docId: doc_8b4730a274654707b360734cb0339fd9
title: 'MCP servers'
description: "Connect an MCP server, install its tools, and assign them to agents."
---

<script>
  import { Ways, Collapsible } from '$lib/components';
</script>

# MCP servers

Connect a public [MCP](https://modelcontextprotocol.io) server to the workspace. Discover its tools and choose which ones to install in the [catalog](/api-reference/tools/list). Then connect the tools to the agents that need them.

## Quick example

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
# 1. Connect the server (it is also tested if no credential is missing)
curl -X POST https://api.platic.ai/v1/tools/mcp \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Internal docs", "url": "https://mcp.example.com/mcp"}'

# 2. Install the discovered tools in the catalog
curl -X POST https://api.platic.ai/v1/tools/mcp/$MCP_ID/tools/sync \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"tools": ["search_docs"]}'
```

</Ways.Way>
<Ways.Way name="sdk">

```ts
// 1. Connect the server (if it is public or comes with secrets, it is also tested on create)
const server = await platic.tools.mcp.create({
  name: 'Internal docs',
  url: 'https://mcp.example.com/mcp',
  auth: { type: 'bearer' },
  secrets: { 'auth.token': secretId }
});

// 2. Choose which tools enter the catalog and connect them to the agent
const synced = await platic.tools.mcp.syncTools(server.id, { tools: ['search_docs'] });
await platic.agents.tools.connect(agentId, synced.installedTools[0].id);
```

</Ways.Way>
</Ways>

## What you need to know

- **Authentication:** `none` (public), `bearer` / `apikey-header` ([bind a secret](/api-reference/mcp-servers/bind-secret) to `auth.token`), headers that carry credentials (`header:<name>`), or `oauth2` (authorize with [start OAuth](/api-reference/mcp-servers/start-oauth); with your own client use `auth.clientSecret`). Sending credentials directly answers `400 SECRET_REFERENCE_REQUIRED`.
- **Statuses:** `pending_config` (a credential, a test, or the tool choice is missing), `pending_auth` (waiting for OAuth), `connected` (ready), `needs_reauth` (OAuth expired), and `error` (`lastError`).
- **Editing resets verification:** when you [update the server](/api-reference/mcp-servers/update), it goes back to `pending_config`, its tools leave the catalog, and its secrets become `needs_authorization`. Bind again, [test](/api-reference/mcp-servers/test), and [choose tools](/api-reference/mcp-servers/select-tools) (connections to agents are recovered when you reinstall the tools).
- **Security:** public URLs only (`https` is required to use secrets). Installing a tool in the catalog does not connect it to any agent automatically.

## Endpoints

| Method | Endpoint | What it does |
|--------|----------|--------------|
| `GET` / `POST` | [`/v1/tools/mcp`](/api-reference/mcp-servers/list) | List, or [connect](/api-reference/mcp-servers/connect), an MCP server |
| `GET` / `PATCH` / `DELETE` | [`/v1/tools/mcp/{mcpId}`](/api-reference/mcp-servers/get) | Get, [update](/api-reference/mcp-servers/update), or [delete](/api-reference/mcp-servers/delete) |
| `POST` | [`/v1/tools/mcp/{mcpId}/secrets`](/api-reference/mcp-servers/bind-secret) | Bind a secret to a slot |
| `POST` | [`/v1/tools/mcp/{mcpId}/oauth/start`](/api-reference/mcp-servers/start-oauth) | Get the OAuth authorization URL |
| `POST` | [`/v1/tools/mcp/{mcpId}/test`](/api-reference/mcp-servers/test) | Test the connection and discover tools |
| `POST` | [`/v1/tools/mcp/{mcpId}/tools/sync`](/api-reference/mcp-servers/select-tools) | Choose which tools to install in the catalog |

## Errors

<Collapsible summary="Show error codes and fixes">

Read `details.code` to identify the error. The response uses `{ code, error, details: { code, message, ... } }`. See [Errors](/api-reference/errors).

| Status | `details.code` | When it happens |
|--------|----------------|-----------------|
| `400` | `INVALID_REQUEST` | The body or parameters fail validation, or the credential covers several workspaces and `workspace` is missing. `details.issues` has the list of problems |
| `401` | `UNAUTHENTICATED` | The credential is missing, revoked, or expired |
| `400` | `INVALID_CONFIG` | The name, URL, authentication, or headers are not valid |
| `400` | `SECRET_REFERENCE_REQUIRED` | You sent a credential inside the connection. When it applies, `details.slot` names the slot |
| `400` | `SECRET_SLOT_INVALID` | That slot does not exist in the server's current connection |
| `400` | `SECRET_DESTINATION_INVALID` | The server URL is not `https` or is not valid |
| `400` | `TOOLS_REQUIRED` | The list of tools to choose is not valid |
| `403` | `FORBIDDEN` | The person behind the token does not have access to Integrations |
| `404` | `NOT_FOUND` | The server does not exist in this workspace |
| `404` | `SECRET_NOT_FOUND` | The secret does not exist in this workspace |
| `409` | `RESOURCE_CHANGED` | `expectedVersion` does not match, or the server changed while it was being saved. Get it again and retry |
| `409` | `NAME_CONFLICT` | A tool would produce a name another tool in the workspace already uses |
| `409` | `VERIFICATION_REQUIRED` | There is no current test. [Test](/api-reference/mcp-servers/test) and retry |
| `409` | `AUTHORIZATION_REQUIRED` | A credential is missing: a slot without a secret, or an OAuth server that is not authorized |
| `409` | `MCP_REAUTH_REQUIRED` | The server needs to be authorized again from Platica |
| `409` | `MCP_CONNECTION_CHANGED` | The server changed during the test. Repeat the call |
| `409` | `NOT_OAUTH` | You asked to start OAuth on a server that does not use it |
| `409` | `UNKNOWN_TOOL` | A name is not among the tools the server offered in the last test |
| `409` | `TOO_MANY_TOOLS`, `INVALID_CAPABILITY` or `CAPABILITY_TOO_LARGE` | The server offers too many tools, repeated or invalid names, or a list that is too large |
| `409` | `SECRET_USE_REVOKED` | The secret is revoked or expired |
| `409` | `SECRET_CHANGED` | The secret changed while it was being bound. Repeat the call |
| `409` | `SECRET_BINDING_LIMIT` | The server already has the maximum number of bound secrets |
| `409` | `DELETION_IN_PROGRESS` | The deletion is already in progress. Repeat the call to continue it |
| `410` | `PREVIEW_REMOVED` | `POST /v1/tools/mcp/preview` no longer exists: connect the server and [test it](/api-reference/mcp-servers/test) |
| `503` | `OPERATION_UNCONFIRMED` | The test could not be completed, for example because the server did not respond. Get the server before retrying |

Slot states are in [Secrets](/api-reference/secrets#slot-states) and AI tools in [Tools MCP](/mcp/tools#tools).

</Collapsible>
