> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chatbotplatform.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect MCP servers from chat

> Let the people chatting with your bot connect hosted MCP servers such as Linear, sign in once in their browser, and use those tools in every private chat

With **MCP connections** turned on, the person chatting with your bot can say *"add the Linear MCP"* or *"connect [https://mcp.linear.app/mcp](https://mcp.linear.app/mcp)"*. The bot replies with a sign-in link. The person signs in at that service in their browser, and from their next message on, the bot's agent can use the service's tools for them.

The person never types a token, API key or password into the chat. Their sign-in stays out of the message history that your integration and the model see.

MCP connections work with **AI agent** integrations (agent loops), which call tools before they answer. A custom webhook integration receives each connected server, **including the person's access token**, in its payload. Read [What your integration receives](#what-your-integration-receives) before you turn this on.

## Turn it on

**1. Open the Behavior page**

In the dashboard, open your bot and go to **Behavior**.

**2. Switch on MCP connections**

Under **Agent Context**, turn on **MCP connections**. The switch is **off by default**.

**3. Limit the servers (optional)**

In **Allowed servers**, enter one host per line, for example `mcp.linear.app`. A host also allows its subdomains. Leave the field empty to allow any public server.

**4. Save**

Click **Save Settings**. The next reply already has the connection tools.

When you turn the switch off, the tools disappear from new replies and connected servers are no longer added to them. The connections themselves are kept, so they work again when you turn the switch back on.

## How a person connects a server

**1. Ask in chat**

The person asks the bot to add a server: *"Add the Linear MCP server"* or *"Connect [https://mcp.linear.app/mcp](https://mcp.linear.app/mcp)"*. If the bot doesn't know the service's MCP server address, it asks for it.

**2. Open the sign-in link**

The bot answers with a sentence such as *"Open this link to sign in to linear: https\://…/connect/… (it works once and expires in 15 minutes)."* The link opens a page that shows the bot, the service and the chat it is for, with a **Continue to linear** button.

**3. Sign in at the service**

**Continue** opens the service's own sign-in and consent screen. After the person approves, they come back to a page that says **Connected to linear** and *"You can go back to … The bot can use linear from your next message."*

**4. Back in the chat**

The chat gets a short note, *"Connected to linear. I can use its tools from your next message."* From the next message on, the service's tools are available in every private chat that person has with the bot.

A server that needs no sign-in is connected at once, with no link: *"… is connected; it needs no sign-in. Its tools are available from your next message."*

> [!WARNING]
>
> Anyone who opens a sign-in link can attach **their own** account to the person who asked for it. That is why links work once, expire after 15 minutes, are only offered in private chats, and show what they are for before they redirect. The page tells the person to continue only if they asked for the link themselves.

### The sign-in link

| | |
| - | - |
| Valid for | 15 minutes, single use |
| Unused links per person | At most 3 at a time |
| Opened in another browser | The sign-in has to finish in the browser that pressed **Continue** |
| Cancelled at the service | The link stays usable until it expires |
| Used or expired | The page says so and asks the person to get a new link from the bot |

## Which servers can be connected

A server can be connected from chat when it is a hosted (remote) MCP server reachable at a public `https` address and one of these is true:

* **It needs no sign-in.** It answers MCP requests directly.
* **It follows the [MCP authorization spec](https://modelcontextprotocol.io/specification/latest/basic/authorization).** It answers `401` and publishes OAuth protected resource metadata, its authorization server supports the authorization code flow with PKCE (`S256`), and it supports **Dynamic Client Registration**, so the platform can register itself as an app there. Many hosted MCP servers, Linear's among them, work this way.

Servers on private or local addresses, servers that redirect, and servers that ask for a sign-in without saying where are refused, and the bot explains why.

### Servers without dynamic client registration

Some sign-in servers don't let apps register themselves. For those, a bot admin registers an app at the service once and enters it on the Behavior page:

**1. Register an app at the service**

Use the **redirect URL** shown in the **OAuth clients** block under **Behavior → Agent Context → MCP connections**.

**2. Enter the client**

In **Add or update a client**, enter the sign-in server's **Issuer** (exactly as its OAuth metadata lists it), the **Client ID**, the **Client secret**, and **How the secret is sent**: HTTP basic auth, in the request body, or a public client with no secret (PKCE only). Click **Save client**.

Saving an issuer that is already listed updates that client. An empty secret on an update keeps the saved one. Only team owners and members whose role can update the team can add or remove OAuth clients. If you remove a client, existing connections keep working until their sign-in needs renewing, then the person is asked to sign in again.

## Who can use a connection

A connection belongs to **the person** who signed in, not to one conversation:

* It works in every **private** chat of that person with the bot: the web widget for a signed-in user, a Telegram private chat, a Slack DM. When the person's channels are [linked](https://docs.chatbotplatform.io/bots/channels/user-skills.md), it works on all of them.
* It is **never used in group conversations** (Slack channels and threads, Telegram groups). The connection tools are not offered there either.
* One person can have up to **10** connected servers.

## Managing connections from chat

The agent has an **MCP Connections** server with these tools:

| Tool | What it does |
| - | - |
| `connect-mcp-server` | Connects a server by its URL (and an optional short name), or sends a new sign-in link for one whose sign-in expired |
| `list-mcp-connections` | Lists the person's connections: name, server URL, status, whether it is switched on, scopes, when it was last used |
| `disconnect-mcp-server` | Disconnects a server by name |
| `disable-mcp-connection` / `enable-mcp-connection` | Switches a connection off or on for all of the person's chats, without signing out |

So the person can say *"which services are connected?"*, *"pause Linear"* or *"disconnect Linear"*.

## Managing connections in the dashboard

Connections show up in two places, each with name, server, status, scopes, when it was last used, and a **Disconnect** button:

* **People**: open a person to see all their connections.
* **Conversations**: the **Connections** tab of a private conversation shows the connections of the person who owns it.

The status is **Connected**, **Connected · no sign-in**, **Paused** (switched off), or **Sign-in expired**. **Forget this person** on the People page disconnects and deletes all of that person's connections.

## Sign-in renewal, expiry and disconnecting

* **Renewal.** When a service gives a refresh token, the sign-in is renewed automatically shortly before it expires, before each reply is prepared, and once when the service refuses a token in the middle of a reply.
* **Sign-in expired.** If renewal fails (for example because the person revoked access at the service), the connection shows **Sign-in expired** and its tools are left out. The agent is told *"The sign-in to … has expired. Call `connect-mcp-server` …"*, sends the person a new link, and signing in again updates the same connection.
* **Disconnecting**, from chat or the dashboard, asks the service to revoke the tokens (when it supports that), deletes them on our side, and removes the server from replies right away, including a reply that is already running.

## What your integration receives

Connections travel to your integration the same way as the other MCP servers of a conversation.

> [!WARNING]
>
> **A webhook integration receives the person's access token** for every connected server, on every message of that person's private chats. Your own code then holds that token until it expires. Only turn MCP connections on for integrations you trust with it. Disconnecting can't call back a copy your integration already received; only the service's own revocation can.

Each active, switched-on connection is added to `mcp_servers` with an `Authorization` header. The conversation block also lists the person's connections, without tokens:

```json theme={null}
{
  "conversation": {
    "id": "9b6e…",
    "channel": "telegram",
    "connections": [
      { "name": "linear", "server_url": "https://mcp.linear.app/mcp", "status": "active", "enabled": true },
      { "name": "notes", "server_url": "https://mcp.example.com/mcp", "status": "needs_reauth", "enabled": true }
    ]
  },
  "mcp_servers": [
    {
      "name": "MCP Connections",
      "url": "https://app.chatbotplatform.io/mcp/connections",
      "headers": [{ "key": "Authorization", "value": "Bearer {conversation key}" }]
    },
    {
      "name": "linear",
      "url": "https://mcp.linear.app/mcp",
      "headers": [{ "key": "Authorization", "value": "Bearer {the person's access token}" }]
    }
  ]
}
```

* `conversation.connections` lists every connection that isn't disconnected, with `status` `active` or `needs_reauth` and `enabled`. It is left out when the person has none, in group conversations, and while the switch is off.
* `mcp_servers` gets only connections that are `active` and switched on. A server that needs no sign-in has no `Authorization` header.
* The token in the payload is always fresh: an expiring sign-in is renewed before the payload is built.
* When names clash, a connection wins over a server added in chat with `add-conversation-mcp`, and a server from your [MCP discovery webhook](https://docs.chatbotplatform.io/bots/channels/web-widget.md) wins over a connection.

## Error messages

The agent gets these messages and passes them on in its own words.

| Situation | Message |
| - | - |
| The switch is off | *Connecting MCP servers from chat is turned off for this bot.* |
| Host not in **Allowed servers** | *This bot only connects MCP servers on these hosts: …. … is not one of them.* |
| Not an MCP server | *… did not answer like an MCP server (HTTP …). Check that the address is the service's MCP server URL.* |
| Sign-in without OAuth metadata | *… asks for a sign-in but does not say where (no OAuth protected resource metadata). It does not follow the MCP authorization spec, so it cannot be connected from chat.* |
| No dynamic client registration | *The sign-in server … does not let apps register themselves, so this server needs its operator's app to be set up by the bot admin first. Ask the bot's admin to add an OAuth client for ….* |
| 10 connections already | *This person already has 10 connected MCP servers, the most allowed. Disconnect one first.* |
| 3 unused links already | *This person already has 3 unused sign-in links. Ask them to open one of those, or to wait until they expire (15 minutes after they were sent).* |
| Sign-in expired | *The sign-in to … has expired. Call `connect-mcp-server` with url … to send the person a new sign-in link, then try again after they have signed in.* |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.