src/gaia/mcp/ (n8n uses the MCP Server)GAIA n8n Integration Guide
This guide explains how to integrate GAIA’s AI capabilities into n8n workflows using the GAIA MCP Server.Overview
n8n can leverage GAIA’s AI agents (LLM, Chat) through HTTP requests to the MCP server. This enables powerful AI-driven workflow automation without writing code.Architecture
How It Works
External Services
n8n Workflows
GAIA MCP Server
GAIA Agents
LLM Backend
AI Text Processing
Conversational Chat
Prerequisites
1. Set up GAIA MCP Server
Follow the MCP Server Documentation to:- Install GAIA with MCP support
- Start the Lemonade LLM server
- Start the MCP bridge server
- Verify it’s running with
gaia mcp status
2. Install and Run n8n Locally
- Using npx (No Installation)
- Global Installation
http://localhost:5678
Getting Started: Step-by-Step
Step 1: Verify MCP Server is Running
Before creating workflows, verify the MCP server is accessible:Step 2: Create Your First n8n Workflow
Open n8n
http://localhost:5678Create New Workflow
Follow Examples
Available Endpoints
The MCP bridge provides the following HTTP endpoints:Health Check
- GET
/health- Basic health check - Returns:
{"status": "healthy", "service": "GAIA MCP Bridge (HTTP)", "agents": 4, "tools": 5}
Status (Detailed)
- GET
/status- Comprehensive status with all agents, tools, and endpoints - Returns: Detailed JSON with agents, tools, capabilities, and available endpoints
Tool Listing
- GET
/tools- List all available GAIA tools - Returns: Array of tool definitions with names, descriptions, and input schemas
Direct Agent Endpoints
- LLM Queries
- Chat Interface
/llm - Direct LLM queries (no conversation context)JSON-RPC Endpoint
POST/ - Standard JSON-RPC 2.0 interface for MCP protocol
Supports methods:
initialize- Initialize MCP connectiontools/list- List available toolstools/call- Execute a specific tool. Checkresult.isError: it istruewhen the tool ran but failed
Integration Examples: From Simple to Complex
Example 1: Simple Health Check (GET Request)
Add HTTP Request Node
Configure Node
- Method:
GET - URL:
http://localhost:8765/health
Execute
Example 2: Get Detailed Status (GET Request)
Add HTTP Request Node
Configure
- Method:
GET - URL:
http://localhost:8765/status
Execute
Example 3: Simple Chat (POST Request)
Add HTTP Request Node
Configure
- Method:
POST - URL:
http://localhost:8765/chat - Body Content Type:
JSON - JSON Body:
Execute
Example 4: LLM Analysis (POST Request)
Add HTTP Request Node
Configure
- Method:
POST - URL:
http://localhost:8765/llm - Body Content Type:
JSON - JSON Body:
Building Complete Workflows
Workflow 1: Daily Standup Assistant
Components: Manual Trigger → Source HTTP Request → LLM Summarize → OutputAdd Manual Trigger
Add Source HTTP Request
Add LLM HTTP Request
Add Output Node
Workflow 2: Smart Issue Triage
Components: Webhook Trigger → LLM Analysis → Issue Tracker UpdateAdd Webhook Node
Add LLM Analysis
Update Issue Tracker
Import Pre-built Workflow
Navigate to Import
Select File
src/gaia/mcp/n8n.jsonReview Workflow
Tips for Building Workflows
Using Variables in Requests
n8n allows you to reference data from previous nodes:Error Handling
Rate Limiting
Testing Workflows
Use Manual Trigger
Test Individually
Pin Data
Switch to Production
Understanding Responses
Successful Responses
Each endpoint returns different data structures:- GET Endpoints
- POST Endpoints
- Return status information directly
- No
successfield needed
Handling Errors
Best Practices
Start Simple
Use localhost
localhost for local server connectionsTest Incrementally
Handle Errors
success fieldSet Timeouts
Log Responses
Troubleshooting
MCP Bridge Not Accessible / "Service refused the connection"
MCP Bridge Not Accessible / "Service refused the connection"
ECONNREFUSED ::1:8765 error:QUICK FIX: Ensure the MCP server is running with gaia mcp start and use http://localhost:8765 for connections.For detailed MCP server troubleshooting (ports, processes, Docker/WSL), see the MCP Server Documentation.n8n-Specific Connection Issues
n8n-Specific Connection Issues
- Error:
connect ECONNREFUSED ::1:8765means the MCP server may not be running - FIX: Ensure MCP server is running with
gaia mcp startand usehttp://localhost:8765 - If issues persist, check firewall settings or try
http://127.0.0.1:8765as an alternative
- Deploy GAIA MCP to AWS/Azure/Heroku
- Use the public URL in n8n.cloud
LLM Queries Slow
LLM Queries Slow
- Ensure Lemonade server is running
- Check if model is loaded in memory
- Consider using smaller models for faster responses
n8n Connection Issues
n8n Connection Issues
- First try: Ensure MCP server is running and use
http://localhost:8765 - Verify n8n can reach the MCP bridge
- Browser-based n8n on another origin is refused (403) by the bridge; add that
origin to
GAIA_MCP_ALLOWED_ORIGINS(comma-separated) beforegaia mcp start - Test with curl first to isolate issues
Advanced Configuration
For custom ports and other advanced MCP server configuration options, see the MCP Server Documentation.Security Considerations
Authentication
HTTPS
Rate Limiting
Input Validation
Network Isolation
Example Production Setup
Using nginx reverse proxy:Support
- Documentation: See other GAIA docs in
/docs - Issues: Report issues on GitHub
- Examples: Check
/examplesfolder for more workflows
Next Steps
Set up MCP Server
Import Example Workflow
src/gaia/mcp/n8n.jsonBuild Custom Workflows
Share Workflows