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

# MCP Agent Workflow

> Export an n8n AI Agent workflow that uses your Blueprints as tools via MCP.

Leapter can generate an n8n workflow that creates an AI agent with access to all your project's Blueprints as tools. The agent uses the Model Context Protocol (MCP) to call your Blueprints, so users can interact with your logic through a chat interface.

## What this creates

The MCP Agent Workflow is a 4-node n8n workflow:

| Node              | Purpose                                                                              |
| :---------------- | :----------------------------------------------------------------------------------- |
| **Chat Trigger**  | Provides a chat interface for users to interact with the agent                       |
| **AI Agent**      | The AI agent that reasons about user messages and calls tools                        |
| **MCP Client**    | Connects to your Leapter project via MCP, exposing all published Blueprints as tools |
| **Simple Memory** | Maintains conversation context across messages                                       |

## Export the workflow

1. Open any Blueprint in the editor.
2. Click the **Share** button in the toolbar.
3. Select **n8n**.
4. In the Export to n8n dialog, select the **MCP Agent Workflow** tab.
5. Click **Copy to Clipboard**.

<img src="https://mintcdn.com/leapter/n-gCe0s55i-T1r4S/images/n8n-mcp-agent-workflow.png?fit=max&auto=format&n=n-gCe0s55i-T1r4S&q=85&s=8bd204ff4113d2bf5640e8bd870d7ac2" alt="The Export to n8n dialog showing the MCP Agent Workflow tab" width="896" height="974" data-path="images/n8n-mcp-agent-workflow.png" />

## Import into n8n

1. Open your n8n instance.
2. Create a new workflow.
3. Click the **three-dot menu** (or use **Ctrl+V** / **Cmd+V**) and select **Import from clipboard**.
4. The 4-node workflow appears on the canvas.

## Post-import setup

After importing, you need to configure two things before the workflow can run.

### Connect an AI model

1. Open the **AI Agent** node.
2. Connect an AI model (OpenAI, Anthropic, Google, or any supported provider).
3. Configure the model credentials if you have not already set them up in n8n.

### Configure the MCP Client

1. Open the **MCP Client** node.
2. Create a **Header Auth** credential:
   * **Header name:** `X-API-Key`
   * **Header value:** your Leapter API key
3. Save the credential.

See [API Keys](/fundamentals/api-keys) to create a key if you have not already.

## Run the workflow

1. Click **Test Workflow** (or **Chat** in the bottom panel) to open the chat interface.
2. Type a message that relates to your Blueprint's logic.
3. The AI agent decides which Blueprint(s) to call, executes them via MCP, and returns a natural language response.

All published Blueprints in your project are available as tools — the agent automatically discovers them through the MCP connection.

## What to do next

* **[HTTP Workflow](/executing-blueprints/n8n-http)** — export a workflow that calls a specific Blueprint via HTTP
* **[Code Workflow](/executing-blueprints/n8n-code)** — run Blueprint logic directly in n8n
* **[AI Protocol (MCP)](/executing-blueprints/connect-mcp)** — connect other MCP clients to your Blueprints
