feat: add n8n integration with MCP Client Tool support

- Add N8N_MODE environment variable for n8n-specific behavior
- Implement HTTP Streamable transport with multiple session support
- Add protocol version endpoint (GET /mcp) for n8n compatibility
- Support multiple initialize requests for stateless n8n clients
- Add Docker configuration for n8n deployment
- Add test script with persistent volume support
- Add comprehensive unit tests for n8n mode
- Fix session management to handle per-request transport pattern

BREAKING CHANGE: Server now creates new transport for each initialize request
when running in n8n mode to support n8n's stateless client architecture

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
czlonkowski
2025-08-01 00:34:31 +02:00
parent a4053de998
commit a597ef5a92
23 changed files with 2395 additions and 481 deletions

View File

@@ -15,10 +15,14 @@
"start": "node dist/mcp/index.js",
"start:http": "MCP_MODE=http node dist/mcp/index.js",
"start:http:fixed": "MCP_MODE=http USE_FIXED_HTTP=true node dist/mcp/index.js",
"start:n8n": "N8N_MODE=true MCP_MODE=http node dist/mcp/index.js",
"http": "npm run build && npm run start:http:fixed",
"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:mcp-endpoint": "node scripts/test-mcp-endpoint.js",
"test:mcp-endpoint:curl": "./scripts/test-mcp-endpoint.sh",
"test:mcp-stdio": "npm run build && node scripts/test-mcp-stdio.js",
"test": "vitest",
"test:ui": "vitest --ui",
"test:run": "vitest run",
@@ -109,6 +113,7 @@
"@vitest/coverage-v8": "^3.2.4",
"@vitest/runner": "^3.2.4",
"@vitest/ui": "^3.2.4",
"axios": "^1.11.0",
"axios-mock-adapter": "^2.1.0",
"fishery": "^2.3.1",
"msw": "^2.10.4",
@@ -120,7 +125,6 @@
"dependencies": {
"@modelcontextprotocol/sdk": "^1.13.2",
"@n8n/n8n-nodes-langchain": "^1.103.1",
"axios": "^1.10.0",
"dotenv": "^16.5.0",
"express": "^5.1.0",
"n8n": "^1.104.1",