mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-01-30 06:22:04 +00:00
* fix: deprecate USE_FIXED_HTTP for SSE streaming support (Issue #524) The fixed HTTP implementation does not support SSE streaming required by clients like OpenAI Codex. This commit deprecates USE_FIXED_HTTP and makes SingleSessionHTTPServer the default. Changes: - Add deprecation warnings in src/mcp/index.ts and src/http-server.ts - Remove USE_FIXED_HTTP from docker-compose.yml and Dockerfile.railway - Update .env.example with deprecation notice - Rename npm script to start:http:fixed:deprecated - Update all documentation to remove USE_FIXED_HTTP references - Mark test case as deprecated Users should unset USE_FIXED_HTTP to use the modern SingleSessionHTTPServer which supports both JSON-RPC and SSE streaming. Closes #524 Concieved by Romuald Członkowski - www.aiadvisors.pl/en 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: bump version to 2.31.8 and add CHANGELOG entry - Fix comment inaccuracy: "deprecated" not "deprecated and removed" - Bump version from 2.31.7 to 2.31.8 - Add CHANGELOG entry documenting USE_FIXED_HTTP deprecation - Update all deprecation messages to reference v2.31.8 Concieved by Romuald Członkowski - www.aiadvisors.pl/en 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Romuald Członkowski <romualdczlonkowski@MacBook-Pro-Romuald.local> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
7b0ff990ec
commit
861005eeed
@@ -37,9 +37,11 @@ MCP_SERVER_HOST=localhost
|
|||||||
# Server mode: stdio (local) or http (remote)
|
# Server mode: stdio (local) or http (remote)
|
||||||
MCP_MODE=stdio
|
MCP_MODE=stdio
|
||||||
|
|
||||||
# Use fixed HTTP implementation (recommended for stability)
|
# DEPRECATED: USE_FIXED_HTTP is deprecated as of v2.31.8
|
||||||
# Set to true to bypass StreamableHTTPServerTransport issues
|
# The fixed HTTP implementation does not support SSE streaming required by
|
||||||
USE_FIXED_HTTP=true
|
# clients like OpenAI Codex. Use the default SingleSessionHTTPServer instead.
|
||||||
|
# See: https://github.com/czlonkowski/n8n-mcp/issues/524
|
||||||
|
# USE_FIXED_HTTP=true # DO NOT USE - deprecated
|
||||||
|
|
||||||
# HTTP Server Configuration (only used when MCP_MODE=http)
|
# HTTP Server Configuration (only used when MCP_MODE=http)
|
||||||
PORT=3000
|
PORT=3000
|
||||||
|
|||||||
6835
CHANGELOG.md
6835
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
@@ -74,7 +74,8 @@ ENV AUTH_TOKEN="REPLACE_THIS_AUTH_TOKEN_32_CHARS_MIN_abcdefgh"
|
|||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
ENV IS_DOCKER=true
|
ENV IS_DOCKER=true
|
||||||
ENV MCP_MODE=http
|
ENV MCP_MODE=http
|
||||||
ENV USE_FIXED_HTTP=true
|
# NOTE: USE_FIXED_HTTP is deprecated. SingleSessionHTTPServer is now the default.
|
||||||
|
# See: https://github.com/czlonkowski/n8n-mcp/issues/524
|
||||||
ENV LOG_LEVEL=info
|
ENV LOG_LEVEL=info
|
||||||
ENV TRUST_PROXY=1
|
ENV TRUST_PROXY=1
|
||||||
ENV HOST=0.0.0.0
|
ENV HOST=0.0.0.0
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
# Mode configuration
|
# Mode configuration
|
||||||
MCP_MODE: ${MCP_MODE:-http}
|
MCP_MODE: ${MCP_MODE:-http}
|
||||||
USE_FIXED_HTTP: ${USE_FIXED_HTTP:-true} # Use fixed implementation for stability
|
# NOTE: USE_FIXED_HTTP is deprecated. SingleSessionHTTPServer is now the default.
|
||||||
|
# See: https://github.com/czlonkowski/n8n-mcp/issues/524
|
||||||
AUTH_TOKEN: ${AUTH_TOKEN:?AUTH_TOKEN is required for HTTP mode}
|
AUTH_TOKEN: ${AUTH_TOKEN:?AUTH_TOKEN is required for HTTP mode}
|
||||||
|
|
||||||
# Application settings
|
# Application settings
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ cd n8n-mcp
|
|||||||
# Create .env file with auth token
|
# Create .env file with auth token
|
||||||
cat > .env << EOF
|
cat > .env << EOF
|
||||||
AUTH_TOKEN=$(openssl rand -base64 32)
|
AUTH_TOKEN=$(openssl rand -base64 32)
|
||||||
USE_FIXED_HTTP=true
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Start the server
|
# Start the server
|
||||||
@@ -46,7 +45,6 @@ docker pull ghcr.io/czlonkowski/n8n-mcp:latest
|
|||||||
docker run -d \
|
docker run -d \
|
||||||
--name n8n-mcp \
|
--name n8n-mcp \
|
||||||
-e MCP_MODE=http \
|
-e MCP_MODE=http \
|
||||||
-e USE_FIXED_HTTP=true \
|
|
||||||
-e AUTH_TOKEN=your-secure-token \
|
-e AUTH_TOKEN=your-secure-token \
|
||||||
-p 3000:3000 \
|
-p 3000:3000 \
|
||||||
ghcr.io/czlonkowski/n8n-mcp:latest
|
ghcr.io/czlonkowski/n8n-mcp:latest
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ Claude Desktop → mcp-remote → https://your-server.com
|
|||||||
# 1. Create environment file
|
# 1. Create environment file
|
||||||
cat > .env << EOF
|
cat > .env << EOF
|
||||||
AUTH_TOKEN=$(openssl rand -base64 32)
|
AUTH_TOKEN=$(openssl rand -base64 32)
|
||||||
USE_FIXED_HTTP=true
|
|
||||||
MCP_MODE=http
|
MCP_MODE=http
|
||||||
PORT=3000
|
PORT=3000
|
||||||
# Optional: Enable n8n management tools
|
# Optional: Enable n8n management tools
|
||||||
@@ -106,7 +105,6 @@ npm run rebuild
|
|||||||
|
|
||||||
# 2. Configure environment
|
# 2. Configure environment
|
||||||
export MCP_MODE=http
|
export MCP_MODE=http
|
||||||
export USE_FIXED_HTTP=true # Important: Use fixed implementation
|
|
||||||
export AUTH_TOKEN=$(openssl rand -base64 32)
|
export AUTH_TOKEN=$(openssl rand -base64 32)
|
||||||
export PORT=3000
|
export PORT=3000
|
||||||
|
|
||||||
@@ -144,7 +142,6 @@ Skip HTTP entirely and use stdio mode directly:
|
|||||||
| Variable | Description | Example |
|
| Variable | Description | Example |
|
||||||
|----------|-------------|------|
|
|----------|-------------|------|
|
||||||
| `MCP_MODE` | Must be set to `http` | `http` |
|
| `MCP_MODE` | Must be set to `http` | `http` |
|
||||||
| `USE_FIXED_HTTP` | **Important**: Set to `true` for stable implementation | `true` |
|
|
||||||
| `AUTH_TOKEN` or `AUTH_TOKEN_FILE` | Authentication method | See security section |
|
| `AUTH_TOKEN` or `AUTH_TOKEN_FILE` | Authentication method | See security section |
|
||||||
|
|
||||||
### Optional Settings
|
### Optional Settings
|
||||||
@@ -417,7 +414,6 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
# Core configuration
|
# Core configuration
|
||||||
MCP_MODE: http
|
MCP_MODE: http
|
||||||
USE_FIXED_HTTP: true
|
|
||||||
NODE_ENV: production
|
NODE_ENV: production
|
||||||
|
|
||||||
# Security - Using file-based secret
|
# Security - Using file-based secret
|
||||||
@@ -500,7 +496,6 @@ WorkingDirectory=/opt/n8n-mcp
|
|||||||
# Use file-based secret
|
# Use file-based secret
|
||||||
Environment="AUTH_TOKEN_FILE=/etc/n8n-mcp/auth_token"
|
Environment="AUTH_TOKEN_FILE=/etc/n8n-mcp/auth_token"
|
||||||
Environment="MCP_MODE=http"
|
Environment="MCP_MODE=http"
|
||||||
Environment="USE_FIXED_HTTP=true"
|
|
||||||
Environment="NODE_ENV=production"
|
Environment="NODE_ENV=production"
|
||||||
Environment="TRUST_PROXY=1"
|
Environment="TRUST_PROXY=1"
|
||||||
Environment="BASE_URL=https://n8n-mcp.example.com"
|
Environment="BASE_URL=https://n8n-mcp.example.com"
|
||||||
@@ -772,8 +767,8 @@ sudo ufw status # Linux
|
|||||||
```
|
```
|
||||||
|
|
||||||
**"Stream is not readable":**
|
**"Stream is not readable":**
|
||||||
- Ensure `USE_FIXED_HTTP=true` is set
|
- This issue was fixed in v2.3.2+ with the SingleSessionHTTPServer
|
||||||
- Fixed in v2.3.2+
|
- No additional configuration needed
|
||||||
|
|
||||||
**Bridge script not working:**
|
**Bridge script not working:**
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ The fastest way to get n8n-MCP running:
|
|||||||
# Using Docker (recommended)
|
# Using Docker (recommended)
|
||||||
cat > .env << EOF
|
cat > .env << EOF
|
||||||
AUTH_TOKEN=$(openssl rand -base64 32)
|
AUTH_TOKEN=$(openssl rand -base64 32)
|
||||||
USE_FIXED_HTTP=true
|
|
||||||
EOF
|
EOF
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
```
|
```
|
||||||
@@ -49,7 +48,6 @@ docker compose up -d
|
|||||||
|
|
||||||
environment:
|
environment:
|
||||||
MCP_MODE: ${MCP_MODE:-http}
|
MCP_MODE: ${MCP_MODE:-http}
|
||||||
USE_FIXED_HTTP: ${USE_FIXED_HTTP:-true}
|
|
||||||
AUTH_TOKEN: ${AUTH_TOKEN:?AUTH_TOKEN is required}
|
AUTH_TOKEN: ${AUTH_TOKEN:?AUTH_TOKEN is required}
|
||||||
NODE_ENV: ${NODE_ENV:-production}
|
NODE_ENV: ${NODE_ENV:-production}
|
||||||
LOG_LEVEL: ${LOG_LEVEL:-info}
|
LOG_LEVEL: ${LOG_LEVEL:-info}
|
||||||
|
|||||||
@@ -98,7 +98,6 @@ These are automatically set by the Railway template:
|
|||||||
|----------|--------------|-------------|
|
|----------|--------------|-------------|
|
||||||
| `AUTH_TOKEN` | `REPLACE_THIS...` | **⚠️ CHANGE IMMEDIATELY** |
|
| `AUTH_TOKEN` | `REPLACE_THIS...` | **⚠️ CHANGE IMMEDIATELY** |
|
||||||
| `MCP_MODE` | `http` | Required for cloud deployment |
|
| `MCP_MODE` | `http` | Required for cloud deployment |
|
||||||
| `USE_FIXED_HTTP` | `true` | Stable HTTP implementation |
|
|
||||||
| `NODE_ENV` | `production` | Production optimizations |
|
| `NODE_ENV` | `production` | Production optimizations |
|
||||||
| `LOG_LEVEL` | `info` | Balanced logging |
|
| `LOG_LEVEL` | `info` | Balanced logging |
|
||||||
| `TRUST_PROXY` | `1` | Railway runs behind proxy |
|
| `TRUST_PROXY` | `1` | Railway runs behind proxy |
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ Key configuration options:
|
|||||||
| Variable | Description | Default |
|
| Variable | Description | Default |
|
||||||
|----------|-------------|---------|
|
|----------|-------------|---------|
|
||||||
| `MCP_MODE` | Server mode: `stdio` or `http` | `stdio` |
|
| `MCP_MODE` | Server mode: `stdio` or `http` | `stdio` |
|
||||||
| `USE_FIXED_HTTP` | Use fixed HTTP implementation (v2.3.2+) | `true` |
|
|
||||||
| `AUTH_TOKEN` | Authentication token for HTTP mode | Required |
|
| `AUTH_TOKEN` | Authentication token for HTTP mode | Required |
|
||||||
| `PORT` | HTTP server port | `3000` |
|
| `PORT` | HTTP server port | `3000` |
|
||||||
| `LOG_LEVEL` | Logging verbosity | `info` |
|
| `LOG_LEVEL` | Logging verbosity | `info` |
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "n8n-mcp",
|
"name": "n8n-mcp",
|
||||||
"version": "2.31.7",
|
"version": "2.31.8",
|
||||||
"description": "Integration between n8n workflow automation and Model Context Protocol (MCP)",
|
"description": "Integration between n8n workflow automation and Model Context Protocol (MCP)",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
@@ -22,9 +22,9 @@
|
|||||||
"test-nodes": "node dist/scripts/test-nodes.js",
|
"test-nodes": "node dist/scripts/test-nodes.js",
|
||||||
"start": "node dist/mcp/index.js",
|
"start": "node dist/mcp/index.js",
|
||||||
"start:http": "MCP_MODE=http 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:http:fixed:deprecated": "echo 'DEPRECATED: USE_FIXED_HTTP is deprecated. Use npm run start:http instead.' && 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",
|
"start:n8n": "N8N_MODE=true MCP_MODE=http node dist/mcp/index.js",
|
||||||
"http": "npm run build && npm run start:http:fixed",
|
"http": "npm run build && npm run start:http",
|
||||||
"dev": "npm run build && npm run rebuild && npm run validate",
|
"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'",
|
"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:single-session": "./scripts/test-single-session.sh",
|
||||||
|
|||||||
@@ -71,10 +71,12 @@ const testCases: TestCase[] = [
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Fixed HTTP implementation',
|
// DEPRECATED: This test case tests the deprecated fixed HTTP implementation
|
||||||
|
// See: https://github.com/czlonkowski/n8n-mcp/issues/524
|
||||||
|
name: 'Fixed HTTP implementation (DEPRECATED)',
|
||||||
env: {
|
env: {
|
||||||
MCP_MODE: 'http',
|
MCP_MODE: 'http',
|
||||||
USE_FIXED_HTTP: 'true',
|
USE_FIXED_HTTP: 'true', // DEPRECATED: Will be removed in future version
|
||||||
AUTH_TOKEN: 'test-token-for-testing-only',
|
AUTH_TOKEN: 'test-token-for-testing-only',
|
||||||
PORT: '3005',
|
PORT: '3005',
|
||||||
BASE_URL: 'https://fixed.example.com'
|
BASE_URL: 'https://fixed.example.com'
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
/**
|
/**
|
||||||
* Fixed HTTP server for n8n-MCP that properly handles StreamableHTTPServerTransport initialization
|
* @deprecated This fixed HTTP server is deprecated as of v2.31.8.
|
||||||
* This implementation ensures the transport is properly initialized before handling requests
|
* Use SingleSessionHTTPServer from http-server-single-session.ts instead.
|
||||||
|
*
|
||||||
|
* This implementation does not support SSE streaming required by clients like OpenAI Codex.
|
||||||
|
* See: https://github.com/czlonkowski/n8n-mcp/issues/524
|
||||||
|
*
|
||||||
|
* Original purpose: Fixed HTTP server for n8n-MCP that properly handles
|
||||||
|
* StreamableHTTPServerTransport initialization by bypassing it entirely.
|
||||||
|
* This implementation ensures the transport is properly initialized before handling requests.
|
||||||
*/
|
*/
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
||||||
@@ -125,7 +132,18 @@ async function shutdown() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use SingleSessionHTTPServer from http-server-single-session.ts instead.
|
||||||
|
* This function does not support SSE streaming required by clients like OpenAI Codex.
|
||||||
|
*/
|
||||||
export async function startFixedHTTPServer() {
|
export async function startFixedHTTPServer() {
|
||||||
|
// Log deprecation warning
|
||||||
|
logger.warn(
|
||||||
|
'DEPRECATION: startFixedHTTPServer() is deprecated as of v2.31.8. ' +
|
||||||
|
'Use SingleSessionHTTPServer which supports SSE streaming. ' +
|
||||||
|
'See: https://github.com/czlonkowski/n8n-mcp/issues/524'
|
||||||
|
);
|
||||||
|
|
||||||
validateEnvironment();
|
validateEnvironment();
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|||||||
@@ -124,9 +124,23 @@ Learn more: https://github.com/czlonkowski/n8n-mcp/blob/main/PRIVACY.md
|
|||||||
checkpoints.push(STARTUP_CHECKPOINTS.MCP_HANDSHAKE_STARTING);
|
checkpoints.push(STARTUP_CHECKPOINTS.MCP_HANDSHAKE_STARTING);
|
||||||
|
|
||||||
if (mode === 'http') {
|
if (mode === 'http') {
|
||||||
// Check if we should use the fixed implementation
|
// Check if we should use the fixed implementation (DEPRECATED)
|
||||||
if (process.env.USE_FIXED_HTTP === 'true') {
|
if (process.env.USE_FIXED_HTTP === 'true') {
|
||||||
// Use the fixed HTTP implementation that bypasses StreamableHTTPServerTransport issues
|
// DEPRECATION WARNING: Fixed HTTP implementation is deprecated
|
||||||
|
// It does not support SSE streaming required by clients like OpenAI Codex
|
||||||
|
logger.warn(
|
||||||
|
'DEPRECATION WARNING: USE_FIXED_HTTP=true is deprecated as of v2.31.8. ' +
|
||||||
|
'The fixed HTTP implementation does not support SSE streaming required by clients like OpenAI Codex. ' +
|
||||||
|
'Please unset USE_FIXED_HTTP to use the modern SingleSessionHTTPServer which supports both JSON-RPC and SSE. ' +
|
||||||
|
'This option will be removed in a future version. See: https://github.com/czlonkowski/n8n-mcp/issues/524'
|
||||||
|
);
|
||||||
|
console.warn('\n⚠️ DEPRECATION WARNING ⚠️');
|
||||||
|
console.warn('USE_FIXED_HTTP=true is deprecated as of v2.31.8.');
|
||||||
|
console.warn('The fixed HTTP implementation does not support SSE streaming.');
|
||||||
|
console.warn('Please unset USE_FIXED_HTTP to use SingleSessionHTTPServer.');
|
||||||
|
console.warn('See: https://github.com/czlonkowski/n8n-mcp/issues/524\n');
|
||||||
|
|
||||||
|
// Use the deprecated fixed HTTP implementation
|
||||||
const { startFixedHTTPServer } = await import('../http-server');
|
const { startFixedHTTPServer } = await import('../http-server');
|
||||||
await startFixedHTTPServer();
|
await startFixedHTTPServer();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user