-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Description
I'm following the N8N deployment guide here: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/N8N_DEPLOYMENT.md#quick-test-script
The AI Agent in N8N cannot connect to the MCP Server, even though it seems both are running.
The error that it shows in N8N when I try to send a chat message to the agent is
Error in sub-node ‘MCP Client‘ Could not connect to your MCP server
The n8n-mcp server logs show the following:
[2025-09-12T16:01:43.146Z] [n8n-mcp] [INFO] GET /mcp { ip: '127.0.0.1', userAgent: 'node', contentLength: undefined }
[2025-09-12T16:01:43.146Z] [n8n-mcp] [INFO] SSE stream request received - establishing SSE connection
[2025-09-12T16:01:43.146Z] [n8n-mcp] [INFO] Closing previous session for SSE { sessionId: '35647f18-07ae-452d-9db4-552abd27be67' }
[2025-09-12T16:01:43.147Z] [n8n-mcp] [INFO] Creating new N8NDocumentationMCPServer for SSE...
[2025-09-12T16:01:43.147Z] [n8n-mcp] [INFO] Node.js version: v21.7.3
[2025-09-12T16:01:43.147Z] [n8n-mcp] [INFO] Platform: darwin arm64
[2025-09-12T16:01:43.147Z] [n8n-mcp] [INFO] Attempting to use better-sqlite3...
[2025-09-12T16:01:43.147Z] [n8n-mcp] [INFO] Initializing n8n Documentation MCP server
[2025-09-12T16:01:43.148Z] [n8n-mcp] [INFO] MCP server initialized with 39 tools (n8n API: configured)
[2025-09-12T16:01:43.148Z] [n8n-mcp] [INFO] Creating SSEServerTransport...
[2025-09-12T16:01:43.148Z] [n8n-mcp] [INFO] Connecting server to SSE transport...
[2025-09-12T16:01:43.148Z] [n8n-mcp] [WARN] Failed to initialize better-sqlite3, falling back to sql.js Error: Failed to create better-sqlite3 adapter: Error: Cannot find module 'better-sqlite3'
Require stack:
- /Users/jacobbeauchamp/n8n-mcp/dist/database/database-adapter.js
- /Users/jacobbeauchamp/n8n-mcp/dist/mcp/server.js
- /Users/jacobbeauchamp/n8n-mcp/dist/mcp/index.js
at createBetterSQLiteAdapter (/Users/jacobbeauchamp/n8n-mcp/dist/database/database-adapter.js:96:15)
at createDatabaseAdapter (/Users/jacobbeauchamp/n8n-mcp/dist/database/database-adapter.js:55:31)
at N8NDocumentationMCPServer.initializeDatabase (/Users/jacobbeauchamp/n8n-mcp/dist/mcp/server.js:116:74)
at new N8NDocumentationMCPServer (/Users/jacobbeauchamp/n8n-mcp/dist/mcp/server.js:97:33)
at SingleSessionHTTPServer.resetSessionSSE (/Users/jacobbeauchamp/n8n-mcp/dist/http-server-single-session.js:353:28)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /Users/jacobbeauchamp/n8n-mcp/dist/http-server-single-session.js:524:21
[2025-09-12T16:01:43.154Z] [n8n-mcp] [INFO] Loaded existing database from /Users/jacobbeauchamp/n8n-mcp/data/nodes.db
[2025-09-12T16:01:43.154Z] [n8n-mcp] [INFO] Successfully initialized sql.js adapter (pure JavaScript, no native dependencies)
[2025-09-12T16:01:43.156Z] [n8n-mcp] [INFO] FTS5 not available, using LIKE search for templates
[2025-09-12T16:01:43.156Z] [n8n-mcp] [INFO] Initialized database from: /Users/jacobbeauchamp/n8n-mcp/data/nodes.db
[2025-09-12T16:01:43.157Z] [n8n-mcp] [INFO] MCP Server connected { transportType: 'SSEServerTransport' }
[2025-09-12T16:01:43.157Z] [n8n-mcp] [INFO] Created new SSE session successfully { sessionId: 'd1096a17-3bc6-4b57-b459-f2be840d2a09' }
[2025-09-12T16:01:43.157Z] [n8n-mcp] [INFO] SSE connection established successfully
[2025-09-12T16:01:43.162Z] [n8n-mcp] [INFO] POST /mcp { ip: '127.0.0.1', userAgent: 'node', contentLength: '193' }
[2025-09-12T16:01:43.163Z] [n8n-mcp] [INFO] POST /mcp request received - DETAILED DEBUG {
headers: {
host: 'host.docker.internal:3001',
connection: 'keep-alive',
authorization: 'Bearer test-token-for-n8n-testing-minimum-32-chars',
'content-type': 'application/json',
accept: '*/*',
'accept-language': '*',
'sec-fetch-mode': 'cors',
'user-agent': 'node',
'accept-encoding': 'gzip, deflate',
'content-length': '193'
},
readable: false,
readableEnded: true,
complete: true,
bodyType: 'object',
bodyContent: '{\n' +
' "method": "initialize",\n' +
' "params": {\n' +
' "protocolVersion": "2025-03-26",\n' +
' "capabilities": {\n' +
' "tools": {}\n' +
' },\n' +
' "clientInfo": {\n' +
' "name": "@n8n/n8n-nodes-langchain.mcpClientTool",\n' +
' "version": "1"\n' +
' }\n' +
' },\n' +
' "jsonrpc": "2.0",\n' +
' "id": 0\n' +
'}',
contentLength: '193',
contentType: 'application/json',
userAgent: 'node',
ip: '127.0.0.1',
method: 'POST',
url: '/mcp?sessionId=f93a62c4-f4fd-4121-b28f-62f1899c644a',
originalUrl: '/mcp?sessionId=f93a62c4-f4fd-4121-b28f-62f1899c644a'
}
[2025-09-12T16:01:43.163Z] [n8n-mcp] [INFO] Authentication successful - proceeding to handleRequest { hasSession: true, sessionType: 'SSE', sessionInitialized: false }
[2025-09-12T16:01:43.172Z] [n8n-mcp] [INFO] POST /mcp request completed - checking response status {
responseHeadersSent: true,
responseStatusCode: 406,
responseFinished: true
}
The N8N docker logs show the following:
Permissions 0644 for n8n settings file /home/node/.n8n/config are too wide. This is ignored for now, but in the future n8n will attempt to change the permissions automatically. To automatically enforce correct permissions now set N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true (recommended), or turn this check off set N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=false.
Initializing n8n process
Error tracking disabled because this release is older than 6 weeks.
n8n ready on ::, port 5678
There is a deprecation related to your environment variables. Please take the recommended actions to update your configuration:
- N8N_RUNNERS_ENABLED -> Running n8n without task runners is deprecated. Task runners will be turned on by default in a future version. Please set `N8N_RUNNERS_ENABLED=true` to enable task runners now and avoid potential issues in the future. Learn more: https://docs.n8n.io/hosting/configuration/task-runners/
[license SDK] Skipping renewal on init because renewal is not due yet or cert is not initialized
Version: 1.103.1
Editor is now accessible via:
http://localhost:5678
McpClientTool: Failed to connect to MCP Server
McpClientTool: Failed to connect to MCP Server
I verified that I've set the API key, URL, Bearer Token, etc.
leonardomjq
Metadata
Metadata
Assignees
Labels
No labels