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

# MCP Node

> Attach external MCP tool servers to Agent tools

## Overview

The **MCP Node** lets an Agent use tools exposed by a remote MCP server.
It acts as a **tool provider**, not a normal execution step in the main flow.

## What Users Can Do

With MCP connected to an Agent, users can:

* call external tools exposed by an MCP server
* augment Agent responses with real-time/tool-backed data
* combine MCP tools with internal tools (query, mutation, http, code, etc.)

Common use cases:

* web search (for example Exa MCP)
* retrieval from external systems
* domain-specific tool catalogs exposed via MCP

## Required Configuration

* **Label:** display name
* **MCP URL:** server endpoint (required)
* **Auth Type:** `none | bearer`
* **Bearer Token:** optional/required depending on server auth

## Connection Rules (Canonical)

MCP must be connected through Agent tools using this direction:

```json theme={null}
{
  "source": "agentNodeId",
  "sourceHandle": "tools",
  "target": "mcpNodeId",
  "targetHandle": "input"
}
```

Rules:

* MCP should only be connected through Agent tools edges.
* MCP is not part of the primary execution dependency chain.
* Tools edges are separate from normal `input/output` orchestration edges.

## Runtime Behavior

When Agent runs:

1. MCP client is created using MCP URL/auth
2. tools are discovered from `mcpClient.tools()`
3. discovered MCP tools are merged into Agent tool map
4. MCP client is closed during finalization/cleanup

## Example: Exa MCP

* URL: `https://mcp.exa.ai/mcp`
* Auth Type: `none` (or `bearer` if your server requires token auth).
* Connect:
  * `agent.tools -> mcp.input`

## Example: MCP with Bearer Auth

MCP node:

```json theme={null}
{
  "nodeType": "mcp",
  "label": "Private MCP",
  "url": "https://your-private-mcp.com/mcp",
  "authType": "bearer",
  "bearerToken": "YOUR_MCP_BEARER_TOKEN"
}
```

Tools edge:

```json theme={null}
{
  "source": "agentNodeId",
  "sourceHandle": "tools",
  "target": "mcpNodeId",
  "targetHandle": "input"
}
```

Notes:

* Keep bearer token in environment/secret management; avoid hardcoding in shared templates.
* If your MCP token rotates, update node config and redeploy/re-generate as needed.

## Tips

* Keep Agent `toolConfig.maxSteps` sufficient for multi-step tool calls (default `10`).
* If old flows were created before canonical tools direction, reconnect MCP edges to match:
  * `sourceHandle: "tools"` on Agent
  * `targetHandle: "input"` on MCP
