Compare commits

...

2 Commits

Author SHA1 Message Date
Romuald Członkowski
c7e7bda505 fix: remove historical migration info from tools documentation (v2.26.5) (#448)
- Remove "Replaces X, Y, Z..." sentences from full.description in:
  - get_node, validate_node, search_templates, n8n_executions, n8n_get_workflow
- Remove version/issue references from n8n_update_partial_workflow
- Clean up consolidation comments in index.ts
- Documentation now starts directly with functional content
- Estimated token savings: ~128 tokens per full documentation request

Conceived by Romuald Członkowski - www.aiadvisors.pl/en

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

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-27 13:50:45 +01:00
Romuald Członkowski
bac4936c6d fix: add n8n 1.121 availableInMCP and callerPolicy settings support (v2.26.4) (#445)
* fix: add n8n 1.121 availableInMCP and callerPolicy settings support (v2.26.4)

n8n 1.121 introduced a new workflow setting `availableInMCP` (boolean)
that controls whether a workflow is "Available in MCP". The sanitization
whitelist was missing this field, causing it to be silently stripped
during workflow updates.

Changes:
- Added `availableInMCP` to Zod schema in workflowSettingsSchema
- Added `availableInMCP` and `callerPolicy` to safeSettingsProperties whitelist
- Both settings are now preserved during workflow updates
- Settings can be toggled via updateSettings operation

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

Co-Authored-By: Claude <noreply@anthropic.com>
Conceived by Romuald Członkowski - www.aiadvisors.pl/en

* test: update tests for callerPolicy and availableInMCP whitelist changes

Updated 5 tests in n8n-validation.test.ts that expected callerPolicy
to be filtered out. Since callerPolicy and availableInMCP are now
whitelisted (n8n 1.121+), the tests now verify these settings are
preserved during workflow updates.

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

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-26 20:17:34 +01:00
13 changed files with 67 additions and 48 deletions

View File

@@ -7,6 +7,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [2.26.5] - 2025-11-27
### 🔧 Fixed
- **Tools Documentation: Runtime Token Optimization**
- Removed historical migration information from tool descriptions (e.g., "Replaces X, Y, Z...")
- Removed version-specific references (v2.21.1, issue #357) that are not needed at runtime
- Cleaned up consolidation comments in index.ts
- Documentation now starts directly with functional content for better AI agent efficiency
- Estimated savings: ~128 tokens per full documentation request
- Affected tools: `get_node`, `validate_node`, `search_templates`, `n8n_executions`, `n8n_get_workflow`, `n8n_update_partial_workflow`
**Conceived by Romuald Członkowski - [AiAdvisors](https://www.aiadvisors.pl/en)**
## [2.26.4] - 2025-11-26
### 🔧 Fixed
- **n8n 1.121 Compatibility**: Added support for new workflow settings introduced in n8n 1.121
- Added `availableInMCP` (boolean) to settings whitelist - controls "Available in MCP" toggle
- Added `callerPolicy` to settings whitelist - was already in schema but missing from sanitization
- Both settings are now preserved during workflow updates instead of being silently stripped
- Settings can be toggled via `updateSettings` operation: `{type: "updateSettings", settings: {availableInMCP: true}}`
**Conceived by Romuald Członkowski - [AiAdvisors](https://www.aiadvisors.pl/en)**
## [2.26.3] - 2025-11-26
### 🔧 Fixed

Binary file not shown.

View File

@@ -1,6 +1,6 @@
{
"name": "n8n-mcp",
"version": "2.26.3",
"version": "2.26.5",
"description": "Integration between n8n workflow automation and Model Context Protocol (MCP)",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View File

@@ -1,6 +1,6 @@
{
"name": "n8n-mcp-runtime",
"version": "2.26.3",
"version": "2.26.4",
"description": "n8n MCP Server Runtime Dependencies Only",
"private": true,
"dependencies": {

View File

@@ -17,9 +17,7 @@ export const getNodeDoc: ToolDocumentation = {
]
},
full: {
description: `Unified tool for all node information needs. Replaces get_node_info, get_node_essentials, get_node_documentation, and search_node_properties with a single versatile API.
**Detail Levels (mode="info", default):**
description: `**Detail Levels (mode="info", default):**
- minimal (~200 tokens): Basic metadata only - nodeType, displayName, description, category
- standard (~1-2K tokens): Essential properties + operations - recommended for most tasks
- full (~3-8K tokens): Complete node schema - use only when standard insufficient

View File

@@ -25,7 +25,6 @@ import {
} from './workflow_management';
// Combine all tool documentations into a single object
// Total: 19 tools after v2.26.0 consolidation
export const toolsDocumentation: Record<string, ToolDocumentation> = {
// System tools
tools_documentation: toolsDocumentationDoc,
@@ -37,20 +36,20 @@ export const toolsDocumentation: Record<string, ToolDocumentation> = {
// Discovery tools
search_nodes: searchNodesDoc,
// Configuration tools (consolidated)
get_node: getNodeDoc, // Replaces: get_node_info, get_node_essentials, get_node_documentation, search_node_properties
// Configuration tools
get_node: getNodeDoc,
// Validation tools (consolidated)
validate_node: validateNodeDoc, // Replaces: validate_node_operation, validate_node_minimal
validate_workflow: validateWorkflowDoc, // Options replace: validate_workflow_connections, validate_workflow_expressions
// Validation tools
validate_node: validateNodeDoc,
validate_workflow: validateWorkflowDoc,
// Template tools (consolidated)
// Template tools
get_template: getTemplateDoc,
search_templates: searchTemplatesDoc, // Modes replace: list_node_templates, search_templates_by_metadata, get_templates_for_task
search_templates: searchTemplatesDoc,
// Workflow Management tools (n8n API)
n8n_create_workflow: n8nCreateWorkflowDoc,
n8n_get_workflow: n8nGetWorkflowDoc, // Modes replace: n8n_get_workflow_details, n8n_get_workflow_structure, n8n_get_workflow_minimal
n8n_get_workflow: n8nGetWorkflowDoc,
n8n_update_full_workflow: n8nUpdateFullWorkflowDoc,
n8n_update_partial_workflow: n8nUpdatePartialWorkflowDoc,
n8n_delete_workflow: n8nDeleteWorkflowDoc,
@@ -58,8 +57,8 @@ export const toolsDocumentation: Record<string, ToolDocumentation> = {
n8n_validate_workflow: n8nValidateWorkflowDoc,
n8n_autofix_workflow: n8nAutofixWorkflowDoc,
n8n_trigger_webhook_workflow: n8nTriggerWebhookWorkflowDoc,
n8n_executions: n8nExecutionsDoc, // Actions replace: n8n_get_execution, n8n_list_executions, n8n_delete_execution
n8n_workflow_versions: n8nWorkflowVersionsDoc // Modes: list, get, rollback, delete, prune, truncate
n8n_executions: n8nExecutionsDoc,
n8n_workflow_versions: n8nWorkflowVersionsDoc
};
// Re-export types

View File

@@ -16,9 +16,7 @@ export const searchTemplatesDoc: ToolDocumentation = {
]
},
full: {
description: `Unified template search tool with four search modes. Replaces search_templates, list_node_templates, search_templates_by_metadata, and get_templates_for_task.
**Search Modes:**
description: `**Search Modes:**
- keyword (default): Full-text search across template names and descriptions
- by_nodes: Find templates that use specific node types
- by_task: Get curated templates for predefined task categories

View File

@@ -16,9 +16,7 @@ export const validateNodeDoc: ToolDocumentation = {
]
},
full: {
description: `Unified node configuration validator. Replaces validate_node_operation and validate_node_minimal with a single tool.
**Validation Modes:**
description: `**Validation Modes:**
- full (default): Comprehensive validation with errors, warnings, suggestions, and automatic structure validation
- minimal: Quick check for required fields only - fast but less thorough

View File

@@ -16,9 +16,7 @@ export const n8nExecutionsDoc: ToolDocumentation = {
]
},
full: {
description: `Unified execution management tool. Replaces n8n_get_execution, n8n_list_executions, and n8n_delete_execution.
**Actions:**
description: `**Actions:**
- get: Retrieve execution details by ID with configurable detail level
- list: List executions with filtering and pagination
- delete: Remove an execution record from history

View File

@@ -16,9 +16,7 @@ export const n8nGetWorkflowDoc: ToolDocumentation = {
]
},
full: {
description: `Unified workflow retrieval with configurable detail levels. Replaces n8n_get_workflow, n8n_get_workflow_details, n8n_get_workflow_structure, and n8n_get_workflow_minimal.
**Modes:**
description: `**Modes:**
- full (default): Complete workflow including all nodes with parameters, connections, and settings
- details: Full workflow plus execution statistics (success/error counts, last execution time)
- structure: Nodes and connections only - useful for topology analysis

View File

@@ -90,7 +90,6 @@ Full support for all 8 AI connection types used in n8n AI workflows:
**Important Notes**:
- **AI nodes do NOT require main connections**: Nodes like OpenAI Chat Model, Postgres Chat Memory, Embeddings OpenAI, and Supabase Vector Store use AI-specific connection types exclusively. They should ONLY have connections like \`ai_languageModel\`, \`ai_memory\`, \`ai_embedding\`, or \`ai_tool\` - NOT \`main\` connections.
- **Fixed in v2.21.1**: Validation now correctly recognizes AI nodes that only have AI-specific connections without requiring \`main\` connections (resolves issue #357).
**Best Practices**:
- Always specify \`sourceOutput\` for AI connections (defaults to "main" if omitted)

View File

@@ -62,6 +62,7 @@ export const workflowSettingsSchema = z.object({
executionTimeout: z.number().optional(),
errorWorkflow: z.string().optional(),
callerPolicy: z.enum(['any', 'workflowsFromSameOwner', 'workflowsFromAList']).optional(),
availableInMCP: z.boolean().optional(),
});
// Default settings for workflow creation
@@ -181,7 +182,9 @@ export function cleanWorkflowForUpdate(workflow: Workflow): Partial<Workflow> {
'executionTimeout',
'errorWorkflow',
'timezone',
'executionOrder'
'executionOrder',
'callerPolicy',
'availableInMCP',
];
if (cleanedWorkflow.settings && typeof cleanedWorkflow.settings === 'object') {

View File

@@ -403,45 +403,47 @@ describe('n8n-validation', () => {
settings: {
executionOrder: 'v1' as const,
saveDataSuccessExecution: 'none' as const,
callerPolicy: 'workflowsFromSameOwner' as const, // Filtered out (not in OpenAPI spec)
callerPolicy: 'workflowsFromSameOwner' as const, // Now whitelisted (n8n 1.121+)
timeSavedPerExecution: 5, // Filtered out (UI-only property)
},
} as any;
const cleaned = cleanWorkflowForUpdate(workflow);
// Unsafe properties filtered out, safe properties kept
// Unsafe properties filtered out, safe properties kept (callerPolicy now whitelisted)
expect(cleaned.settings).toEqual({
executionOrder: 'v1',
saveDataSuccessExecution: 'none'
saveDataSuccessExecution: 'none',
callerPolicy: 'workflowsFromSameOwner'
});
expect(cleaned.settings).not.toHaveProperty('callerPolicy');
expect(cleaned.settings).not.toHaveProperty('timeSavedPerExecution');
});
it('should filter out callerPolicy (Issue #248 - API limitation)', () => {
it('should preserve callerPolicy and availableInMCP (n8n 1.121+ settings)', () => {
const workflow = {
name: 'Test Workflow',
nodes: [],
connections: {},
settings: {
executionOrder: 'v1' as const,
callerPolicy: 'workflowsFromSameOwner' as const, // Filtered out
callerPolicy: 'workflowsFromSameOwner' as const, // Now whitelisted
availableInMCP: true, // New in n8n 1.121
errorWorkflow: 'N2O2nZy3aUiBRGFN',
},
} as any;
const cleaned = cleanWorkflowForUpdate(workflow);
// callerPolicy filtered out (causes API errors), safe properties kept
// callerPolicy and availableInMCP now whitelisted (n8n 1.121+)
expect(cleaned.settings).toEqual({
executionOrder: 'v1',
callerPolicy: 'workflowsFromSameOwner',
availableInMCP: true,
errorWorkflow: 'N2O2nZy3aUiBRGFN'
});
expect(cleaned.settings).not.toHaveProperty('callerPolicy');
});
it('should filter all settings properties correctly (Issue #248 - API design)', () => {
it('should preserve all whitelisted settings properties including callerPolicy (Issue #248 - updated for n8n 1.121)', () => {
const workflow = {
name: 'Test Workflow',
nodes: [],
@@ -455,14 +457,14 @@ describe('n8n-validation', () => {
saveExecutionProgress: false,
executionTimeout: 300,
errorWorkflow: 'error-workflow-id',
callerPolicy: 'workflowsFromAList' as const, // Filtered out (not in OpenAPI spec)
callerPolicy: 'workflowsFromAList' as const, // Now whitelisted (n8n 1.121+)
availableInMCP: false, // New in n8n 1.121
},
} as any;
const cleaned = cleanWorkflowForUpdate(workflow);
// Safe properties kept, unsafe properties filtered out
// See: https://community.n8n.io/t/api-workflow-update-endpoint-doesnt-support-setting-callerpolicy/161916
// All whitelisted properties kept including callerPolicy and availableInMCP
expect(cleaned.settings).toEqual({
executionOrder: 'v0',
timezone: 'UTC',
@@ -471,9 +473,10 @@ describe('n8n-validation', () => {
saveManualExecutions: false,
saveExecutionProgress: false,
executionTimeout: 300,
errorWorkflow: 'error-workflow-id'
errorWorkflow: 'error-workflow-id',
callerPolicy: 'workflowsFromAList',
availableInMCP: false
});
expect(cleaned.settings).not.toHaveProperty('callerPolicy');
});
it('should handle workflows without settings gracefully', () => {
@@ -494,7 +497,6 @@ describe('n8n-validation', () => {
nodes: [],
connections: {},
settings: {
callerPolicy: 'workflowsFromSameOwner' as const, // Filtered out
timeSavedPerExecution: 5, // Filtered out (UI-only)
someOtherProperty: 'value', // Filtered out
},
@@ -514,19 +516,19 @@ describe('n8n-validation', () => {
connections: {},
settings: {
executionOrder: 'v1' as const, // Whitelisted
callerPolicy: 'workflowsFromSameOwner' as const, // Filtered out
callerPolicy: 'workflowsFromSameOwner' as const, // Now whitelisted (n8n 1.121+)
timezone: 'America/New_York', // Whitelisted
someOtherProperty: 'value', // Filtered out
},
} as any;
const cleaned = cleanWorkflowForUpdate(workflow);
// Should keep only whitelisted properties
// Should keep only whitelisted properties (callerPolicy now whitelisted)
expect(cleaned.settings).toEqual({
executionOrder: 'v1',
callerPolicy: 'workflowsFromSameOwner',
timezone: 'America/New_York'
});
expect(cleaned.settings).not.toHaveProperty('callerPolicy');
expect(cleaned.settings).not.toHaveProperty('someOtherProperty');
});
});