View all articles
n8nmcpai-agentstutorialautomation

n8n + MCP: Connect Your AI Agents to Any Business Tool

JG
Jacobo González Jaspe
|

Reviewed:

Abstract illustration: stepped platforms with a small amber light on the highest one. Deployment
Illustration generated with AI on our own machine.
This article is also available in Spanish:n8n + MCP: conecta tus agentes de IA a cualquier herramienta

The Model Context Protocol (MCP) solved a problem that held back AI agents for years: how does an AI model talk to your tools? Before MCP, every integration was custom. You needed one connector for Slack, another for your database, and another for your CRM. Each broke independently, required separate maintenance, and locked you into a specific AI provider.

MCP changed that. By December 2025 it had over 97 million monthly SDK downloads and 10,000 active servers, according to Anthropic. It is now the common standard adopted by Claude, ChatGPT, Gemini, Copilot, VS Code, and, critically for automation, n8n.

This tutorial shows you how to combine n8n’s workflow engine with MCP to build AI agents that use your actual business tools.

n8n MCP integration

What MCP Does (30-Second Version)

MCP is a standard protocol that lets AI models discover and use external tools. Think of it as USB for AI: plug in a tool, and any AI model can use it.

flowchart LR
    AI["AI Model<br/>(Ollama, Claude, GPT)"]
    MCP["MCP Protocol"]
    AI <--> MCP
    MCP <--> DB["Database"]
    MCP <--> CRM["CRM"]
    MCP <--> DOCS["Documents"]
    MCP <--> API["Your APIs"]
    
    style AI fill:#F5A623,color:#0B1628
    style MCP fill:#059669,color:#FAFAFA
Diagram

Without MCP, you write custom integration code for each tool + each AI model. With MCP, you write one MCP server per tool, and every AI model can use it.

Why n8n + MCP Is Powerful

n8n brings three things MCP alone doesn’t provide:

  1. Workflow orchestration: MCP connects AI to tools. n8n orchestrates multi-step workflows that use those connections, “fetch the document, analyze it, update the CRM, notify the team.”
  2. Visual design: Build agent workflows by dragging nodes, not writing code.
  3. Self-hosted: Your n8n instance runs locally. Combined with Ollama for inference, the entire pipeline stays on your hardware.

Building an MCP-Powered Agent Workflow

Prerequisites

  • n8n installed (self-hosted recommended)
  • Ollama running with a capable model (qwen2.5:7b or better)
  • An MCP server for your tool (see “Available MCP Servers” below)

Step 1: Set Up an MCP Server

MCP servers expose your tools to AI models. Here’s an example using the filesystem MCP server (lets AI read/search your documents):

bash
# Run the official filesystem MCP server (stdio)
npx -y @modelcontextprotocol/server-filesystem /path/to/your/documents

The package is @modelcontextprotocol/server-filesystem on npm (checked 2026-10-09); there is no @anthropic-ai/mcp-server-filesystem. It speaks stdio, while n8n’s MCP Client Tool node asks for an SSE endpoint. To bridge the two, wrap it with supergateway:

bash
npx -y supergateway \
  --stdio "npx -y @modelcontextprotocol/server-filesystem /path/to/your/documents" \
  --port 8000 --baseUrl http://localhost:8000 \
  --ssePath /sse --messagePath /message
# n8n MCP Client Tool -> SSE endpoint: http://localhost:8000/sse

This starts a server that exposes file reading, searching, and listing as MCP tools. Your AI agent can now ask “find all contracts mentioning renewal clauses” and the MCP server translates that into filesystem operations.

Step 2: Create the n8n Workflow

In n8n, build a workflow with these nodes:

  1. Webhook Trigger: receives queries from users or other systems
  2. AI Agent Node: connects to Ollama + MCP tools
  3. Code Node: processes the agent’s response
  4. Output Node: sends results (email, Slack, webhook response)

The AI Agent node is where MCP integration happens. Configure it with:

  • Model: Your Ollama endpoint (http://localhost:11434)
  • Tools: Your MCP server endpoints
  • System prompt: Define the agent’s role and tool usage instructions

Step 3: Define the Agent’s Behavior

The system prompt determines how your agent uses MCP tools:

text
You are a document analyst for a law firm. You have access to the firm's 
document repository via MCP tools. When asked a question:

1. Search for relevant documents using the search tool
2. Read the most relevant documents
3. Analyze the content and provide a sourced answer
4. Always cite the document name and section

Never make up information. If you can't find relevant documents, say so.

Step 4: Test and Deploy

Run a test query through the webhook:

bash
curl -X POST http://localhost:5678/webhook/mcp-agent \
  -H "Content-Type: application/json" \
  -d '{"query": "What are the payment terms in the Martinez contract?"}'

The agent will: receive the query → search documents via MCP → read relevant files → analyze with Ollama → return a sourced answer. All locally.

Available MCP Servers (10,000+)

The MCP ecosystem now has 10,000+ public servers. Key ones for businesses:

MCP ServerWhat It DoesUse Case
FilesystemRead/search local filesDocument Q&A, contract analysis
PostgreSQLQuery databasesBusiness intelligence, reporting
SlackSend/read messagesTeam notifications, escalations
Google DriveAccess cloud docsShared document analysis
GitHubManage repos, issues, PRsDevelopment workflow automation
NotionRead/write pagesKnowledge base management
StripeManage paymentsInvoice processing, reconciliation

Real Example: Document Intelligence Agent

Here’s a complete workflow we deploy for law firms and consulting businesses:

flowchart TD
    QUERY["User Query<br/>'What are the liability caps<br/>in our vendor contracts?'"]
    QUERY --> AGENT["n8n AI Agent"]
    AGENT --> SEARCH["MCP: Search<br/>Documents"]
    SEARCH --> READ["MCP: Read<br/>Top 5 Results"]
    READ --> ANALYZE["Ollama: Analyze<br/>(DeepSeek R1 14B)"]
    ANALYZE --> FORMAT["Format Response<br/>with Citations"]
    FORMAT --> DELIVER["Email + Slack<br/>Notification"]
    
    style QUERY fill:#1E293B,color:#FAFAFA
    style AGENT fill:#F5A623,color:#0B1628
    style ANALYZE fill:#059669,color:#FAFAFA
    style DELIVER fill:#059669,color:#FAFAFA
Diagram

The key differentiator: DeepSeek R1 with its chain-of-thought reasoning shows how it reached its analysis, not just the conclusion. For legal and financial use cases, this auditability is essential.

The Privacy Architecture

This is where local MCP + n8n + Ollama beats cloud alternatives:

ComponentWhere It RunsData Leaves?
n8n workflow engineYour serverNo
MCP serverYour serverNo
Ollama inferenceYour hardwareNo
Document storageYour filesystemNo
Total data exposureZero

Compare this to using ChatGPT + cloud MCP: your documents travel to OpenAI’s servers for processing. Under GDPR and the EU AI Act, local deployment eliminates the data transfer risk entirely.

Getting Started

  1. Install n8n: docker run -it --rm -p 5678:5678 n8nio/n8n
  2. Install Ollama: curl -fsSL https://ollama.com/install.sh | sh && ollama pull qwen2.5:7b
  3. Pick an MCP server: Start with filesystem for document Q&A
  4. Build your first workflow: Use the AI Agent node with MCP tools configured
  5. Test with real queries: Feed it actual business questions

For a simpler starting point, see our n8n + Ollama RAG tutorial which covers the basics of document Q&A without MCP.


Want us to build this for you? Schedule a free 15-minute assessment: we’ll evaluate your tool landscape and design an MCP-powered agent workflow tailored to your business.

Related tutorials: n8n AI Automation | n8n + Ollama RAG Pipeline | AI Code Review Workflow


Sources: MCP Official Specification | Anthropic: donating MCP to the Agentic AI Foundation | Why MCP Won (The New Stack) | n8n AI Agents | MCP Roadmap 2026


Next steps

  • Install n8n using Docker on your local server
  • Set up Ollama with a capable model like qwen2.5:7b
  • Select an MCP server from the available ecosystem to connect your tools
  • Follow the workflow steps to build your first document intelligence agent

Work with us

We size the model and the machine by measuring, not by guessing. If you want to see your own task running on real hardware, book a 15-minute call or see how we work in consulting.

Diagram
Share: LinkedIn X
Veredicto semanal

Get new guides before anyone else

Subscribe and we tell you when new guides, templates and workflows go up. One email a week, no spam.

Already published: 69 guides and 25 templates. All free, no signup.

Bonus: the local-AI starter pack PDF when you subscribe
Once a week No spam Unsubscribe anytime

See what you get

The EU AI Act now applies: a checklist you can complete

Tell us what you want to run

Tell us what you want to run and on what budget. We will tell you which hardware you need, which model fits, and what to expect from it, before you spend anything.

First call free, 15 min Local-first: your data stays on your network Open tools and guides

69 free guides · 17 compliance templates