mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-01-30 14:32:04 +00:00
Compare commits
2 Commits
deprecate-
...
v2.31.9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce2c94c1a5 | ||
|
|
861005eeed |
@@ -37,9 +37,11 @@ MCP_SERVER_HOST=localhost
|
||||
# Server mode: stdio (local) or http (remote)
|
||||
MCP_MODE=stdio
|
||||
|
||||
# Use fixed HTTP implementation (recommended for stability)
|
||||
# Set to true to bypass StreamableHTTPServerTransport issues
|
||||
USE_FIXED_HTTP=true
|
||||
# DEPRECATED: USE_FIXED_HTTP is deprecated as of v2.31.8
|
||||
# The fixed HTTP implementation does not support SSE streaming required by
|
||||
# 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)
|
||||
PORT=3000
|
||||
|
||||
6860
CHANGELOG.md
6860
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 IS_DOCKER=true
|
||||
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 TRUST_PROXY=1
|
||||
ENV HOST=0.0.0.0
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"node-similarity-service.d.ts","sourceRoot":"","sources":["../../src/services/node-similarity-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAG7D,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE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BAAmB,CAAK;IAChD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAiB;IAC1D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAO;IAElD,OAAO,CAAC,UAAU,CAAiB;IACnC,OAAO,CAAC,cAAc,CAAsC;IAC5D,OAAO,CAAC,SAAS,CAAsB;IACvC,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,YAAY,CAAa;gBAErB,UAAU,EAAE,cAAc;IAStC,OAAO,CAAC,wBAAwB;IAkDhC,OAAO,CAAC,yBAAyB;IAuB3B,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,GAAE,MAAU,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAiEzF,OAAO,CAAC,mBAAmB;IA0E3B,OAAO,CAAC,wBAAwB;IAuEhC,OAAO,CAAC,gBAAgB;IA2BxB,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,eAAe;YAgDT,cAAc;IAqCrB,eAAe,IAAI,IAAI;IAUjB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ1C,uBAAuB,CAAC,WAAW,EAAE,cAAc,EAAE,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM;IA8BnF,aAAa,CAAC,UAAU,EAAE,cAAc,GAAG,OAAO;IAQlD,UAAU,IAAI,IAAI;CAGnB"}
|
||||
17
dist/services/node-similarity-service.js
vendored
17
dist/services/node-similarity-service.js
vendored
@@ -2,6 +2,7 @@
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NodeSimilarityService = void 0;
|
||||
const logger_1 = require("../utils/logger");
|
||||
const tool_variant_generator_1 = require("./tool-variant-generator");
|
||||
class NodeSimilarityService {
|
||||
constructor(repository) {
|
||||
this.nodeCache = null;
|
||||
@@ -67,6 +68,22 @@ class NodeSimilarityService {
|
||||
if (!invalidType || invalidType.trim() === '') {
|
||||
return [];
|
||||
}
|
||||
if (tool_variant_generator_1.ToolVariantGenerator.isToolVariantNodeType(invalidType)) {
|
||||
const baseNodeType = tool_variant_generator_1.ToolVariantGenerator.getBaseNodeType(invalidType);
|
||||
if (baseNodeType) {
|
||||
const baseNode = this.repository.getNode(baseNodeType);
|
||||
if (baseNode) {
|
||||
return [{
|
||||
nodeType: invalidType,
|
||||
displayName: `${baseNode.displayName} Tool`,
|
||||
confidence: 0.98,
|
||||
reason: `Dynamic AI Tool variant of ${baseNode.displayName}`,
|
||||
category: baseNode.category,
|
||||
description: 'Runtime-generated Tool variant for AI Agent integration'
|
||||
}];
|
||||
}
|
||||
}
|
||||
}
|
||||
const suggestions = [];
|
||||
const mistakeSuggestion = this.checkCommonMistakes(invalidType);
|
||||
if (mistakeSuggestion) {
|
||||
|
||||
2
dist/services/node-similarity-service.js.map
vendored
2
dist/services/node-similarity-service.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/services/workflow-validator.d.ts.map
vendored
2
dist/services/workflow-validator.d.ts.map
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"workflow-validator.d.ts","sourceRoot":"","sources":["../../src/services/workflow-validator.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAatE,UAAU,YAAY;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3B,UAAU,EAAE,GAAG,CAAC;IAChB,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,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AO,CAAC,mBAAmB;IA4F3B,OAAO,CAAC,wBAAwB;IA2BhC,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,qBAAqB;IAgG7B,OAAO,CAAC,qBAAqB;IA8C7B,OAAO,CAAC,mBAAmB;IA4E3B,OAAO,CAAC,sBAAsB;IAyT9B,OAAO,CAAC,yBAAyB;IAqCjC,OAAO,CAAC,gCAAgC;IA8BxC,OAAO,CAAC,gCAAgC;IAsFxC,OAAO,CAAC,gBAAgB;IA4CxB,OAAO,CAAC,2BAA2B;CAmEpC"}
|
||||
29
dist/services/workflow-validator.js
vendored
29
dist/services/workflow-validator.js
vendored
@@ -236,7 +236,31 @@ class WorkflowValidator {
|
||||
}
|
||||
}
|
||||
const normalizedType = node_type_normalizer_1.NodeTypeNormalizer.normalizeToFullForm(node.type);
|
||||
const nodeInfo = this.nodeRepository.getNode(normalizedType);
|
||||
let nodeInfo = this.nodeRepository.getNode(normalizedType);
|
||||
if (!nodeInfo && tool_variant_generator_1.ToolVariantGenerator.isToolVariantNodeType(normalizedType)) {
|
||||
const baseNodeType = tool_variant_generator_1.ToolVariantGenerator.getBaseNodeType(normalizedType);
|
||||
if (baseNodeType) {
|
||||
const baseNodeInfo = this.nodeRepository.getNode(baseNodeType);
|
||||
if (baseNodeInfo) {
|
||||
result.warnings.push({
|
||||
type: 'warning',
|
||||
nodeId: node.id,
|
||||
nodeName: node.name,
|
||||
message: `Node type "${node.type}" is inferred as a dynamic AI Tool variant of "${baseNodeType}". ` +
|
||||
`This Tool variant is created by n8n at runtime when connecting "${baseNodeInfo.displayName}" to an AI Agent.`,
|
||||
code: 'INFERRED_TOOL_VARIANT'
|
||||
});
|
||||
nodeInfo = {
|
||||
...baseNodeInfo,
|
||||
nodeType: normalizedType,
|
||||
displayName: `${baseNodeInfo.displayName} Tool`,
|
||||
isToolVariant: true,
|
||||
toolVariantOf: baseNodeType,
|
||||
isInferred: true
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!nodeInfo) {
|
||||
const suggestions = await this.similarityService.findSimilarNodes(node.type, 3);
|
||||
let message = `Unknown node type: "${node.type}".`;
|
||||
@@ -310,6 +334,9 @@ class WorkflowValidator {
|
||||
if (normalizedType.startsWith('nodes-langchain.')) {
|
||||
continue;
|
||||
}
|
||||
if (nodeInfo.isInferred) {
|
||||
continue;
|
||||
}
|
||||
const paramsWithVersion = {
|
||||
'@version': node.typeVersion || 1,
|
||||
...node.parameters
|
||||
|
||||
2
dist/services/workflow-validator.js.map
vendored
2
dist/services/workflow-validator.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -12,7 +12,8 @@ services:
|
||||
environment:
|
||||
# Mode configuration
|
||||
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}
|
||||
|
||||
# Application settings
|
||||
|
||||
@@ -21,7 +21,6 @@ cd n8n-mcp
|
||||
# Create .env file with auth token
|
||||
cat > .env << EOF
|
||||
AUTH_TOKEN=$(openssl rand -base64 32)
|
||||
USE_FIXED_HTTP=true
|
||||
EOF
|
||||
|
||||
# Start the server
|
||||
@@ -46,7 +45,6 @@ docker pull ghcr.io/czlonkowski/n8n-mcp:latest
|
||||
docker run -d \
|
||||
--name n8n-mcp \
|
||||
-e MCP_MODE=http \
|
||||
-e USE_FIXED_HTTP=true \
|
||||
-e AUTH_TOKEN=your-secure-token \
|
||||
-p 3000:3000 \
|
||||
ghcr.io/czlonkowski/n8n-mcp:latest
|
||||
|
||||
@@ -67,7 +67,6 @@ Claude Desktop → mcp-remote → https://your-server.com
|
||||
# 1. Create environment file
|
||||
cat > .env << EOF
|
||||
AUTH_TOKEN=$(openssl rand -base64 32)
|
||||
USE_FIXED_HTTP=true
|
||||
MCP_MODE=http
|
||||
PORT=3000
|
||||
# Optional: Enable n8n management tools
|
||||
@@ -106,7 +105,6 @@ npm run rebuild
|
||||
|
||||
# 2. Configure environment
|
||||
export MCP_MODE=http
|
||||
export USE_FIXED_HTTP=true # Important: Use fixed implementation
|
||||
export AUTH_TOKEN=$(openssl rand -base64 32)
|
||||
export PORT=3000
|
||||
|
||||
@@ -144,7 +142,6 @@ Skip HTTP entirely and use stdio mode directly:
|
||||
| Variable | Description | Example |
|
||||
|----------|-------------|------|
|
||||
| `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 |
|
||||
|
||||
### Optional Settings
|
||||
@@ -417,7 +414,6 @@ services:
|
||||
environment:
|
||||
# Core configuration
|
||||
MCP_MODE: http
|
||||
USE_FIXED_HTTP: true
|
||||
NODE_ENV: production
|
||||
|
||||
# Security - Using file-based secret
|
||||
@@ -500,7 +496,6 @@ WorkingDirectory=/opt/n8n-mcp
|
||||
# Use file-based secret
|
||||
Environment="AUTH_TOKEN_FILE=/etc/n8n-mcp/auth_token"
|
||||
Environment="MCP_MODE=http"
|
||||
Environment="USE_FIXED_HTTP=true"
|
||||
Environment="NODE_ENV=production"
|
||||
Environment="TRUST_PROXY=1"
|
||||
Environment="BASE_URL=https://n8n-mcp.example.com"
|
||||
@@ -772,8 +767,8 @@ sudo ufw status # Linux
|
||||
```
|
||||
|
||||
**"Stream is not readable":**
|
||||
- Ensure `USE_FIXED_HTTP=true` is set
|
||||
- Fixed in v2.3.2+
|
||||
- This issue was fixed in v2.3.2+ with the SingleSessionHTTPServer
|
||||
- No additional configuration needed
|
||||
|
||||
**Bridge script not working:**
|
||||
```bash
|
||||
|
||||
@@ -18,7 +18,6 @@ The fastest way to get n8n-MCP running:
|
||||
# Using Docker (recommended)
|
||||
cat > .env << EOF
|
||||
AUTH_TOKEN=$(openssl rand -base64 32)
|
||||
USE_FIXED_HTTP=true
|
||||
EOF
|
||||
docker compose up -d
|
||||
```
|
||||
@@ -49,7 +48,6 @@ docker compose up -d
|
||||
|
||||
environment:
|
||||
MCP_MODE: ${MCP_MODE:-http}
|
||||
USE_FIXED_HTTP: ${USE_FIXED_HTTP:-true}
|
||||
AUTH_TOKEN: ${AUTH_TOKEN:?AUTH_TOKEN is required}
|
||||
NODE_ENV: ${NODE_ENV:-production}
|
||||
LOG_LEVEL: ${LOG_LEVEL:-info}
|
||||
|
||||
@@ -98,7 +98,6 @@ These are automatically set by the Railway template:
|
||||
|----------|--------------|-------------|
|
||||
| `AUTH_TOKEN` | `REPLACE_THIS...` | **⚠️ CHANGE IMMEDIATELY** |
|
||||
| `MCP_MODE` | `http` | Required for cloud deployment |
|
||||
| `USE_FIXED_HTTP` | `true` | Stable HTTP implementation |
|
||||
| `NODE_ENV` | `production` | Production optimizations |
|
||||
| `LOG_LEVEL` | `info` | Balanced logging |
|
||||
| `TRUST_PROXY` | `1` | Railway runs behind proxy |
|
||||
|
||||
@@ -40,7 +40,6 @@ Key configuration options:
|
||||
| Variable | Description | Default |
|
||||
|----------|-------------|---------|
|
||||
| `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 |
|
||||
| `PORT` | HTTP server port | `3000` |
|
||||
| `LOG_LEVEL` | Logging verbosity | `info` |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "n8n-mcp",
|
||||
"version": "2.31.7",
|
||||
"version": "2.31.9",
|
||||
"description": "Integration between n8n workflow automation and Model Context Protocol (MCP)",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
@@ -22,9 +22,9 @@
|
||||
"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: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",
|
||||
"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: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",
|
||||
|
||||
@@ -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: {
|
||||
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',
|
||||
PORT: '3005',
|
||||
BASE_URL: 'https://fixed.example.com'
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Fixed HTTP server for n8n-MCP that properly handles StreamableHTTPServerTransport initialization
|
||||
* This implementation ensures the transport is properly initialized before handling requests
|
||||
* @deprecated This fixed HTTP server is deprecated as of v2.31.8.
|
||||
* 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 { 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() {
|
||||
// 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();
|
||||
|
||||
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);
|
||||
|
||||
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') {
|
||||
// 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');
|
||||
await startFixedHTTPServer();
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { NodeRepository } from '../database/node-repository';
|
||||
import { logger } from '../utils/logger';
|
||||
import { ToolVariantGenerator } from './tool-variant-generator';
|
||||
|
||||
export interface NodeSuggestion {
|
||||
nodeType: string;
|
||||
@@ -126,6 +127,25 @@ export class NodeSimilarityService {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Check if this is a Tool variant and base node exists (Issue #522)
|
||||
// Dynamic AI Tool variants like googleDriveTool are created at runtime by n8n
|
||||
if (ToolVariantGenerator.isToolVariantNodeType(invalidType)) {
|
||||
const baseNodeType = ToolVariantGenerator.getBaseNodeType(invalidType);
|
||||
if (baseNodeType) {
|
||||
const baseNode = this.repository.getNode(baseNodeType);
|
||||
if (baseNode) {
|
||||
return [{
|
||||
nodeType: invalidType,
|
||||
displayName: `${baseNode.displayName} Tool`,
|
||||
confidence: 0.98,
|
||||
reason: `Dynamic AI Tool variant of ${baseNode.displayName}`,
|
||||
category: baseNode.category,
|
||||
description: 'Runtime-generated Tool variant for AI Agent integration'
|
||||
}];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const suggestions: NodeSuggestion[] = [];
|
||||
|
||||
// First, check for exact common mistakes
|
||||
|
||||
@@ -398,7 +398,39 @@ export class WorkflowValidator {
|
||||
const normalizedType = NodeTypeNormalizer.normalizeToFullForm(node.type);
|
||||
|
||||
// Get node definition using normalized type (needed for typeVersion validation)
|
||||
const nodeInfo = this.nodeRepository.getNode(normalizedType);
|
||||
let nodeInfo = this.nodeRepository.getNode(normalizedType);
|
||||
|
||||
// Check if this is a dynamic Tool variant (e.g., googleDriveTool, googleSheetsTool)
|
||||
// n8n creates these at runtime when ANY node is used in an AI Agent's tool slot,
|
||||
// but they don't exist in npm packages. We infer validity if the base node exists.
|
||||
// See: https://github.com/czlonkowski/n8n-mcp/issues/522
|
||||
if (!nodeInfo && ToolVariantGenerator.isToolVariantNodeType(normalizedType)) {
|
||||
const baseNodeType = ToolVariantGenerator.getBaseNodeType(normalizedType);
|
||||
if (baseNodeType) {
|
||||
const baseNodeInfo = this.nodeRepository.getNode(baseNodeType);
|
||||
if (baseNodeInfo) {
|
||||
// Valid inferred tool variant - base node exists
|
||||
result.warnings.push({
|
||||
type: 'warning',
|
||||
nodeId: node.id,
|
||||
nodeName: node.name,
|
||||
message: `Node type "${node.type}" is inferred as a dynamic AI Tool variant of "${baseNodeType}". ` +
|
||||
`This Tool variant is created by n8n at runtime when connecting "${baseNodeInfo.displayName}" to an AI Agent.`,
|
||||
code: 'INFERRED_TOOL_VARIANT'
|
||||
});
|
||||
|
||||
// Create synthetic nodeInfo for validation continuity
|
||||
nodeInfo = {
|
||||
...baseNodeInfo,
|
||||
nodeType: normalizedType,
|
||||
displayName: `${baseNodeInfo.displayName} Tool`,
|
||||
isToolVariant: true,
|
||||
toolVariantOf: baseNodeType,
|
||||
isInferred: true
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!nodeInfo) {
|
||||
|
||||
@@ -494,6 +526,13 @@ export class WorkflowValidator {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip PARAMETER validation for inferred tool variants (Issue #522)
|
||||
// They have a different property structure (toolDescription added at runtime)
|
||||
// that doesn't match the base node's schema. TypeVersion validation above still runs.
|
||||
if ((nodeInfo as any).isInferred) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Validate node configuration
|
||||
// Add @version to parameters for displayOptions evaluation (supports _cnd operators)
|
||||
const paramsWithVersion = {
|
||||
|
||||
@@ -599,4 +599,294 @@ describe('WorkflowValidator - Tool Variant Validation', () => {
|
||||
expect(invalidToolErrors.length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('validateAllNodes - Inferred Tool Variants (Issue #522)', () => {
|
||||
/**
|
||||
* Tests for dynamic AI Tool nodes that are created at runtime by n8n
|
||||
* when ANY node is used in an AI Agent's tool slot.
|
||||
*
|
||||
* These nodes (e.g., googleDriveTool, googleSheetsTool) don't exist in npm packages
|
||||
* but are valid when the base node exists.
|
||||
*/
|
||||
|
||||
beforeEach(() => {
|
||||
// Update mock repository to include Google nodes
|
||||
mockRepository.getNode = vi.fn((nodeType: string) => {
|
||||
// Base node with Tool variant
|
||||
if (nodeType === 'nodes-base.supabase') {
|
||||
return {
|
||||
nodeType: 'nodes-base.supabase',
|
||||
displayName: 'Supabase',
|
||||
isAITool: true,
|
||||
hasToolVariant: true,
|
||||
isToolVariant: false,
|
||||
isTrigger: false,
|
||||
properties: []
|
||||
};
|
||||
}
|
||||
|
||||
// Tool variant in database
|
||||
if (nodeType === 'nodes-base.supabaseTool') {
|
||||
return {
|
||||
nodeType: 'nodes-base.supabaseTool',
|
||||
displayName: 'Supabase Tool',
|
||||
isAITool: true,
|
||||
hasToolVariant: false,
|
||||
isToolVariant: true,
|
||||
toolVariantOf: 'nodes-base.supabase',
|
||||
isTrigger: false,
|
||||
properties: []
|
||||
};
|
||||
}
|
||||
|
||||
// Google Drive base node (exists, but no Tool variant in DB)
|
||||
if (nodeType === 'nodes-base.googleDrive') {
|
||||
return {
|
||||
nodeType: 'nodes-base.googleDrive',
|
||||
displayName: 'Google Drive',
|
||||
isAITool: false, // Not marked as AI tool in npm package
|
||||
hasToolVariant: false, // No Tool variant in database
|
||||
isToolVariant: false,
|
||||
isTrigger: false,
|
||||
properties: [],
|
||||
category: 'files'
|
||||
};
|
||||
}
|
||||
|
||||
// Google Sheets base node (exists, but no Tool variant in DB)
|
||||
if (nodeType === 'nodes-base.googleSheets') {
|
||||
return {
|
||||
nodeType: 'nodes-base.googleSheets',
|
||||
displayName: 'Google Sheets',
|
||||
isAITool: false,
|
||||
hasToolVariant: false,
|
||||
isToolVariant: false,
|
||||
isTrigger: false,
|
||||
properties: [],
|
||||
category: 'productivity'
|
||||
};
|
||||
}
|
||||
|
||||
// AI Agent node
|
||||
if (nodeType === 'nodes-langchain.agent') {
|
||||
return {
|
||||
nodeType: 'nodes-langchain.agent',
|
||||
displayName: 'AI Agent',
|
||||
isAITool: false,
|
||||
hasToolVariant: false,
|
||||
isToolVariant: false,
|
||||
isTrigger: false,
|
||||
properties: []
|
||||
};
|
||||
}
|
||||
|
||||
return null; // Unknown node
|
||||
}) as any;
|
||||
});
|
||||
|
||||
it('should pass validation for googleDriveTool when googleDrive exists', async () => {
|
||||
const workflow = {
|
||||
nodes: [
|
||||
{
|
||||
id: 'drive-tool-1',
|
||||
name: 'Google Drive Tool',
|
||||
type: 'n8n-nodes-base.googleDriveTool',
|
||||
typeVersion: 3,
|
||||
position: [250, 300] as [number, number],
|
||||
parameters: {}
|
||||
}
|
||||
],
|
||||
connections: {}
|
||||
};
|
||||
|
||||
const result = await validator.validateWorkflow(workflow);
|
||||
|
||||
// Should NOT have "Unknown node type" error
|
||||
const unknownErrors = result.errors.filter(e =>
|
||||
e.message && e.message.includes('Unknown node type')
|
||||
);
|
||||
expect(unknownErrors).toHaveLength(0);
|
||||
|
||||
// Should have INFERRED_TOOL_VARIANT warning
|
||||
const inferredWarnings = result.warnings.filter(e =>
|
||||
(e as any).code === 'INFERRED_TOOL_VARIANT'
|
||||
);
|
||||
expect(inferredWarnings).toHaveLength(1);
|
||||
expect(inferredWarnings[0].message).toContain('googleDriveTool');
|
||||
expect(inferredWarnings[0].message).toContain('Google Drive');
|
||||
});
|
||||
|
||||
it('should pass validation for googleSheetsTool when googleSheets exists', async () => {
|
||||
const workflow = {
|
||||
nodes: [
|
||||
{
|
||||
id: 'sheets-tool-1',
|
||||
name: 'Google Sheets Tool',
|
||||
type: 'n8n-nodes-base.googleSheetsTool',
|
||||
typeVersion: 4,
|
||||
position: [250, 300] as [number, number],
|
||||
parameters: {}
|
||||
}
|
||||
],
|
||||
connections: {}
|
||||
};
|
||||
|
||||
const result = await validator.validateWorkflow(workflow);
|
||||
|
||||
// Should NOT have "Unknown node type" error
|
||||
const unknownErrors = result.errors.filter(e =>
|
||||
e.message && e.message.includes('Unknown node type')
|
||||
);
|
||||
expect(unknownErrors).toHaveLength(0);
|
||||
|
||||
// Should have INFERRED_TOOL_VARIANT warning
|
||||
const inferredWarnings = result.warnings.filter(e =>
|
||||
(e as any).code === 'INFERRED_TOOL_VARIANT'
|
||||
);
|
||||
expect(inferredWarnings).toHaveLength(1);
|
||||
expect(inferredWarnings[0].message).toContain('googleSheetsTool');
|
||||
expect(inferredWarnings[0].message).toContain('Google Sheets');
|
||||
});
|
||||
|
||||
it('should report error for unknownNodeTool when base node does not exist', async () => {
|
||||
const workflow = {
|
||||
nodes: [
|
||||
{
|
||||
id: 'unknown-tool-1',
|
||||
name: 'Unknown Tool',
|
||||
type: 'n8n-nodes-base.nonExistentNodeTool',
|
||||
typeVersion: 1,
|
||||
position: [250, 300] as [number, number],
|
||||
parameters: {}
|
||||
}
|
||||
],
|
||||
connections: {}
|
||||
};
|
||||
|
||||
const result = await validator.validateWorkflow(workflow);
|
||||
|
||||
// Should have "Unknown node type" error
|
||||
const unknownErrors = result.errors.filter(e =>
|
||||
e.message && e.message.includes('Unknown node type')
|
||||
);
|
||||
expect(unknownErrors).toHaveLength(1);
|
||||
|
||||
// Should NOT have INFERRED_TOOL_VARIANT warning
|
||||
const inferredWarnings = result.warnings.filter(e =>
|
||||
(e as any).code === 'INFERRED_TOOL_VARIANT'
|
||||
);
|
||||
expect(inferredWarnings).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('should handle multiple inferred tool variants in same workflow', async () => {
|
||||
const workflow = {
|
||||
nodes: [
|
||||
{
|
||||
id: 'drive-tool-1',
|
||||
name: 'Google Drive Tool',
|
||||
type: 'n8n-nodes-base.googleDriveTool',
|
||||
typeVersion: 3,
|
||||
position: [250, 300] as [number, number],
|
||||
parameters: {}
|
||||
},
|
||||
{
|
||||
id: 'sheets-tool-1',
|
||||
name: 'Google Sheets Tool',
|
||||
type: 'n8n-nodes-base.googleSheetsTool',
|
||||
typeVersion: 4,
|
||||
position: [250, 400] as [number, number],
|
||||
parameters: {}
|
||||
},
|
||||
{
|
||||
id: 'agent-1',
|
||||
name: 'AI Agent',
|
||||
type: '@n8n/n8n-nodes-langchain.agent',
|
||||
typeVersion: 1.7,
|
||||
position: [450, 300] as [number, number],
|
||||
parameters: {}
|
||||
}
|
||||
],
|
||||
connections: {
|
||||
'Google Drive Tool': {
|
||||
ai_tool: [[{ node: 'AI Agent', type: 'ai_tool', index: 0 }]]
|
||||
},
|
||||
'Google Sheets Tool': {
|
||||
ai_tool: [[{ node: 'AI Agent', type: 'ai_tool', index: 0 }]]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const result = await validator.validateWorkflow(workflow);
|
||||
|
||||
// Should NOT have "Unknown node type" errors
|
||||
const unknownErrors = result.errors.filter(e =>
|
||||
e.message && e.message.includes('Unknown node type')
|
||||
);
|
||||
expect(unknownErrors).toHaveLength(0);
|
||||
|
||||
// Should have 2 INFERRED_TOOL_VARIANT warnings
|
||||
const inferredWarnings = result.warnings.filter(e =>
|
||||
(e as any).code === 'INFERRED_TOOL_VARIANT'
|
||||
);
|
||||
expect(inferredWarnings).toHaveLength(2);
|
||||
});
|
||||
|
||||
it('should prefer database record over inference for supabaseTool', async () => {
|
||||
const workflow = {
|
||||
nodes: [
|
||||
{
|
||||
id: 'supabase-tool-1',
|
||||
name: 'Supabase Tool',
|
||||
type: 'n8n-nodes-base.supabaseTool',
|
||||
typeVersion: 1,
|
||||
position: [250, 300] as [number, number],
|
||||
parameters: {}
|
||||
}
|
||||
],
|
||||
connections: {}
|
||||
};
|
||||
|
||||
const result = await validator.validateWorkflow(workflow);
|
||||
|
||||
// Should NOT have "Unknown node type" error
|
||||
const unknownErrors = result.errors.filter(e =>
|
||||
e.message && e.message.includes('Unknown node type')
|
||||
);
|
||||
expect(unknownErrors).toHaveLength(0);
|
||||
|
||||
// Should NOT have INFERRED_TOOL_VARIANT warning (it's in database)
|
||||
const inferredWarnings = result.warnings.filter(e =>
|
||||
(e as any).code === 'INFERRED_TOOL_VARIANT'
|
||||
);
|
||||
expect(inferredWarnings).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('should include helpful message in warning', async () => {
|
||||
const workflow = {
|
||||
nodes: [
|
||||
{
|
||||
id: 'drive-tool-1',
|
||||
name: 'Google Drive Tool',
|
||||
type: 'n8n-nodes-base.googleDriveTool',
|
||||
typeVersion: 3,
|
||||
position: [250, 300] as [number, number],
|
||||
parameters: {}
|
||||
}
|
||||
],
|
||||
connections: {}
|
||||
};
|
||||
|
||||
const result = await validator.validateWorkflow(workflow);
|
||||
|
||||
const inferredWarning = result.warnings.find(e =>
|
||||
(e as any).code === 'INFERRED_TOOL_VARIANT'
|
||||
);
|
||||
|
||||
expect(inferredWarning).toBeDefined();
|
||||
expect(inferredWarning!.message).toContain('inferred as a dynamic AI Tool variant');
|
||||
expect(inferredWarning!.message).toContain('nodes-base.googleDrive');
|
||||
expect(inferredWarning!.message).toContain('Google Drive');
|
||||
expect(inferredWarning!.message).toContain('AI Agent');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user