fix: implement Single-Session architecture to resolve MCP stream errors

- Add ConsoleManager to prevent console output interference with StreamableHTTPServerTransport
- Implement SingleSessionHTTPServer with persistent session reuse
- Create N8NMCPEngine for clean service integration
- Add automatic session expiry after 30 minutes of inactivity
- Update logger to be HTTP-aware during active requests
- Maintain backward compatibility with existing deployments

This fixes the "stream is not readable" error by implementing the Hybrid
Single-Session architecture as documented in MCP_ERROR_FIX_PLAN.md

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
czlonkowski
2025-06-14 15:02:49 +02:00
parent 88dd66bb7a
commit 2cb264fd56
13 changed files with 1894 additions and 51 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "n8n-mcp",
"version": "2.3.0",
"version": "2.3.1",
"description": "Integration between n8n workflow automation and Model Context Protocol (MCP)",
"main": "dist/index.js",
"scripts": {
@@ -11,9 +11,11 @@
"test-nodes": "node dist/scripts/test-nodes.js",
"start": "node dist/mcp/index.js",
"start:http": "MCP_MODE=http node dist/mcp/index.js",
"start:http:legacy": "MCP_MODE=http node dist/http-server.js",
"http": "npm run build && npm run start:http",
"dev": "npm run build && npm run rebuild && npm run validate",
"dev:http": "MCP_MODE=http nodemon --watch src --ext ts --exec 'npm run build && npm run start:http'",
"test:single-session": "./scripts/test-single-session.sh",
"test": "jest",
"lint": "tsc --noEmit",
"typecheck": "tsc --noEmit",