# MCP server

Connect the agent to a remote Model Context Protocol server and let it call any of the server's tools.

## Overview

The **Model Context Protocol** (MCP) is an open standard that lets servers expose tools, resources, and prompts to LLMs in a uniform way. Notion, Linear, GitHub, Slack, internal company knowledge bases — all increasingly ship MCP endpoints. Attaching an MCP tool to your agent means:

1. We connect to the MCP server URL you provide.
2. We call `list_tools` to discover what's available.
3. We register **each remote tool as its own function** on the agent (e.g. `mcp_notion_search`, `mcp_notion_create_page`), so the LLM can pick one directly.
4. When the LLM calls one, we forward the arguments over MCP and feed the response back.

This is the same UX as the dedicated **MCP node** — in fact the agent's MCP tool modal reuses the MCP node's configuration panel under the hood. The difference is *agency*: the MCP node executes one tool deterministically; the MCP **agent tool** lets the LLM choose which tool to call (and whether to call one at all) on each turn.

## Configuration

| Field | Type | Notes |
| --- | --- | --- |
| Server URL | URL | The MCP endpoint (often `https://.../sse` or `https://.../mcp`). |
| Credential | optional | Stored token; we attach it as the configured auth header. |
| Auth header name | string | Default `Authorization`. |
| Auth header scheme | string | Default `Bearer`. Some servers want `Token` or nothing. |
| Tool filter | `auto` or specific name | `auto` exposes every remote tool. Set a specific name to expose only that one. |

The modal also offers a **connector catalogue** (Notion, Slack, Gmail, ...) that pre-fills the URL and the OAuth flow for popular servers — same panel the MCP node uses.

## Discovery & naming

Remote tool names are normalized into OpenAI-safe identifiers before being exposed to the LLM:

```
remote name       →  exposed name
search            →  mcp_<label>_search
create_page       →  mcp_<label>_create_page
```

The original remote name is preserved in routing metadata, so the dispatcher knows which tool to call when the LLM picks `mcp_notion_create_page`.

## Example

Configured:

- Server URL: `https://mcp.notion.com/sse`
- Credential: `notion-prod-token` → sent as `Authorization: Bearer ntn_...`
- Tool filter: `auto`

At agent init, we discover (abbreviated): `notion-search`, `notion-fetch`, `notion-create-pages`, `notion-update-page`.

User turn: *"Create a Notion page in my Engineering DB titled ‘Q3 retro' and put today's date in it."*

LLM calls `mcp_notion_notion_create_pages` with arguments matching the server's published schema, the MCP transport forwards them, Notion responds with the new page URL, the agent replies with the link.

## Best practices

- **Trust the catalog when you can.** For Notion / Slack / Gmail / Drive, use the in-modal connector instead of typing the URL — OAuth, header scheme, and quirks (Notion auth, Slack rate limits) are pre-wired.
- **Filter when the server is chatty.** Some MCP servers expose 50+ tools. Pinning the tool filter to one operation keeps the agent's tool list short and the LLM more focused.
- **Match credentials to scope.** Mint an MCP token with the narrowest scope that still lets the workflow succeed.
- **Use the dedicated MCP node for one-shot operations.** If your workflow always calls the same tool with templated arguments, the MCP node is cheaper and more predictable than handing the choice to an LLM.

## Gotchas

- Discovery happens **at agent init**, once per execution. If you add a new tool on the remote server, the running agent won't see it until the next run.
- The MCP transport is HTTPS only. Self-signed certs are rejected.
- A remote tool that returns a very large payload (e.g. a Notion page tree) will balloon the LLM's context — consider a follow-up summarization step or a tighter `limit` argument.
- Some MCP servers (notably older Notion deployments) require quirks in the body envelope; the runtime handles known cases automatically. If a call fails with a 400, check the execution log for the raw response.

---

*Source: https://agentbuilder.systalink.sn/docs/tool-mcp — human documentation.*
*Other language: [/docs-md/fr/tool-mcp.md](/docs-md/fr/tool-mcp.md).*
*Machine-readable index: [/llms.txt](/llms.txt).*
