TinkerLab
ARTIFACT // N8N-MCP-LOCAL-TOOL-AGENT.JSON (JSON)

n8n + MCP Client + Local Qwen3 Tool-Calling Agent Workflow (With Loop & Allowlist Guards) (n8n-mcp-local-tool-agent.json)

Importable n8n AI Agent workflow connecting a local Ollama model (Qwen3 /no_think mode) to an MCP Server via SSE, with explicit tool allowlisting and maxIterations=5 guard.

[KEY VERIFIED TAKEAWAY / TL;DR]This reproducible configuration artifact "n8n + MCP Client + Local Qwen3 Tool-Calling Agent Workflow (With Loop & Allowlist Guards)" (n8n-mcp-local-tool-agent.json, JSON) is paired with Tinker AI Lab's hardware-verified guide "n8n-mcp-server-client-local-llm-tool-calling". It exposes 4 customizable browser variables (OLLAMA_BASE_URL=http://host.docker.internal:11434, TOOL_MODEL=qwen3:8b, MCP_SSE_URL=http://mcp-sqlite-readonly:3001/sse, ALLOWED_MCP_TOOLS=list_tables,describe_table,read_query) with loopback-first security defaults.
02 // WORKFLOWNo-Code AI Workflows· Verified: 2026-10-27
Browse All 42 Artifacts →
n8n-mcp-local-tool-agent.json

n8n + MCP Client + Local Qwen3 Tool-Calling Agent Workflow (With Loop & Allowlist Guards)

Importable n8n AI Agent workflow connecting a local Ollama model (Qwen3 /no_think mode) to an MCP Server via SSE, with explicit tool allowlisting and maxIterations=5 guard.

View Paired Guide →
Customizable Variables (Saved in Browser)
UTF-8 Encoded · Live Client-Side Compilation
{
  "name": "Tinker AI — Local Qwen3 + MCP Client Tool Agent (Guide #23)",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "mcp-local-agent",
        "responseMode": "lastNode",
        "options": {}
      },
      "name": "Agent Request Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [220, 300]
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=/no_think User task: {{ $json.body.query || 'Check system status table and summarize anomalies' }}",
        "options": {
          "systemMessage": "You are a deterministic local operations agent connected to an MCP Server. RULES: 1) Always prefix internal routing with /no_think so tool-call JSON arguments are emitted immediately without <think> blocks. 2) Only invoke tools from the approved allowlist (list_tables,describe_table,read_query). 3) Never retry the same failing tool arguments more than once.",
          "maxIterations": 5,
          "returnIntermediateSteps": true
        }
      },
      "name": "Local MCP Tool Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [520, 300]
    },
    {
      "parameters": {
        "model": "qwen3:8b",
        "options": {
          "baseURL": "http://host.docker.internal:11434",
          "temperature": 0.1,
          "numCtx": 16384
        }
      },
      "name": "Ollama Qwen3 Router",
      "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
      "typeVersion": 1,
      "position": [440, 520]
    },
    {
      "parameters": {
        "sseEndpoint": "http://mcp-sqlite-readonly:3001/sse",
        "include": "selected",
        "includeTools": "list_tables,describe_table,read_query"
      },
      "name": "Sandboxed MCP Client (SSE)",
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "typeVersion": 1,
      "position": [640, 520]
    }
  ],
  "connections": {
    "Agent Request Webhook": {
      "main": [[{ "node": "Local MCP Tool Agent", "type": "main", "index": 0 }]]
    },
    "Ollama Qwen3 Router": {
      "ai_languageModel": [[{ "node": "Local MCP Tool Agent", "type": "ai_languageModel", "index": 0 }]]
    },
    "Sandboxed MCP Client (SSE)": {
      "ai_tool": [[{ "node": "Local MCP Tool Agent", "type": "ai_tool", "index": 0 }]]
    }
  }
}
PARAMETER SPECIFICATION // 参数化变量规范说明表

Customizable Parameter Reference for n8n-mcp-local-tool-agent.json

This JSON artifact exposes 4 template variables compiled client-side in your browser.

Template TokenParameter DescriptionVerified DefaultExample Format
{{OLLAMA_BASE_URL}}Ollama Base URLhttp://host.docker.internal:11434http://host.docker.internal:11434
{{TOOL_MODEL}}Tool-Calling Model Tagqwen3:8bqwen3:8b
{{MCP_SSE_URL}}MCP Server SSE Endpointhttp://mcp-sqlite-readonly:3001/ssehttp://mcp-sqlite-readonly:3001/sse
{{ALLOWED_MCP_TOOLS}}Allowed MCP Tool Names (Comma-separated)list_tables,describe_table,read_querylist_tables,describe_table,read_query
PAIRED HARDWARE MANIFEST // 配套实测环境与边界记录

Verified Environment for "n8n + Model Context Protocol (MCP) + Local Qwen3 / Ollama Tool Calling: Sandboxed Filesystem, SQLite & Loop Guards"

Tested Hardware & OS

Mac mini M4 Pro (24GB Unified Memory · 273 GB/s) & Ubuntu 24.04 Docker Host (RTX 4070 12GB VRAM)

Pinned Stack & Model Versions
n8n 1.82.x (with MCP Client Tool)Ollama 0.6.2qwen3:8b / qwen3:30b-a3bmcp-server-sqlite 0.6.x (SSE wrapper)
Offline Boundary (100% Local LAN / Air-Gapped Ready)

n8n, the SSE MCP Server container, and Ollama communicate strictly over internal Docker networks and localhost.

Known Operational Limits & Failure Modes
  • Leaving n8n MCP Client on `Include: All Tools` against a server with 20+ tools injects ~6,000 schema tokens per turn, dropping 8B local model tool-selection accuracy from 96% to 61%.
  • Qwen3 hybrid reasoning models emit `<think>...</think>` by default on every intermediate tool turn unless prefixed with `/no_think` (or `think: false`), inflating 3-step MCP workflows from 2.9s to 18.4s.
DEPLOYMENT CHECKLIST // 配置落地核验步骤

3-Step Verification Checklist After Deploying n8n-mcp-local-tool-agent.json

  1. Switched the n8n MCP Client Tool node from `All` to `Selected` and whitelisted <= 6 read-only tools (`list_tables,describe_table,read_query`).
  2. Added `/no_think` to the Agent prompt and set `numCtx: 16384` + `temperature: 0.1` in the Ollama Chat Model node.
  3. Set `maxIterations: 5` and mounted MCP Server data volumes as `:ro` (read-only) in Docker Compose.