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

# Connecting an MCP server

> Connect any MCP server and enable its tools per agent.

Via an **MCP server** (Model Context Protocol) you connect any external system without msg having to define a fixed interface for it. The agent **reads the server's tools automatically**; you decide per agent which of them it may use. This is the most flexible way to connect your own domain logic.

<Note>
  The MCP integration is **live**: the agent calls your server's tools for real at runtime.
</Note>

## Requirements for the server

<CardGroup cols={2}>
  <Card title="Transport" icon="arrow-right-arrow-left">
    The server must provide the **Streamable-HTTP** interface of MCP (JSON or SSE responses are detected automatically).
  </Card>

  <Card title="Authentication" icon="key">
    **Static header auth** via Bearer token or API key. OAuth flows are not supported.
  </Card>
</CardGroup>

## Adding an MCP server

In the **Connectors** tab of an agent you choose the type **MCP server (generic)**. You can add this type **multiple times** – each configured server is its own instance.

<Steps>
  <Step title="Enter the base URL">
    The Streamable-HTTP address of your server, e.g. `https://mcp.kunde.de/mcp`.
  </Step>

  <Step title="Choose authentication">
    * **Bearer token** → sent as `Authorization: Bearer <Token>`.
    * **API key** → sent as the header `X-API-Key: <Key>`.

    Secret values are stored encrypted.
  </Step>

  <Step title="Read out tools (preview)">
    Before creating it, the portal reads the server's available tools live and shows them with name and description. This way you see **in advance** what the server offers.
  </Step>

  <Step title="Enable tools">
    Selectively activate the tools the agent may use. Only enabled tools are available in the flow.
  </Step>
</Steps>

<Warning>
  If the address is unreachable or not a valid MCP server, the portal reports the discovery as an error – **nothing is created**. Correct the address or credentials and trigger the preview again.
</Warning>

## Keeping tools up to date

If your server's tool offering changes, you update the stored list via **Update tools**. The portal reads out anew and replaces the stored selection.

<Note>
  If an update would remove a tool that is still **actively enabled** on an agent, it is rejected. First remove the tool from the agent, then update again.
</Note>

## Results in the flow

Each MCP tool returns two possible results in the flow that you branch on:

| Response code | Meaning                       |
| ------------- | ----------------------------- |
| `SUCCESS`     | The call succeeded.           |
| `ERROR`       | The server reported an error. |

The actual domain result (the content the server returns) flows to the agent separately for conducting the conversation.

<Tip>
  Treat an MCP server like an external trust boundary: only enable tools the agent really needs, and check the behavior with a [test call](/en/agenten-testen) before you go live.
</Tip>
