Commit Graph

130 Commits

Author SHA1 Message Date
czlonkowski
f3164e202f feat: add TypeScript type safety with strategic any assertions (v2.17.5)
Added comprehensive TypeScript type definitions for n8n node parsing while
maintaining zero compilation errors. Uses pragmatic "70% benefit with 0%
breakage" approach with strategic `any` assertions.

## Type Definitions (src/types/node-types.ts)
- NodeClass union type replaces `any` in method signatures
- Type guards: isVersionedNodeInstance(), isVersionedNodeClass()
- Utility functions for safe node handling

## Parser Updates
- node-parser.ts: All methods use NodeClass (15+ methods)
- simple-parser.ts: Strongly typed method signatures
- property-extractor.ts: Typed extraction methods
- 30+ method signatures improved

## Strategic Pattern
- Strong types in public method signatures (caller type safety)
- Strategic `as any` assertions for internal union type access
- Pattern: const desc = description as any; // Access union properties

## Benefits
- Better IDE support and auto-complete
- Compile-time safety at call sites
- Type-based documentation
- Zero compilation errors
- Bug prevention (would have caught v2.17.4 baseDescription issue)

## Test Updates
- All test files updated with `as any` for mock objects
- Zero compilation errors maintained

## Known Limitations
- ~70% type coverage (signatures typed, internal logic uses assertions)
- Union types (INodeTypeBaseDescription vs INodeTypeDescription) not fully resolved
- Future work: Conditional types or overloads for 100% type safety

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-07 22:16:59 +02:00
czlonkowski
b986beef2c fix: correct version extraction and typeVersion validation for langchain nodes
This commit fixes two critical bugs affecting AI Agent and other langchain nodes:

1. Version Extraction Bug (node-parser.ts)
   - AI Agent was returning version "3" instead of "2.2" (the defaultVersion)
   - Root cause: extractVersion() checked non-existent instance.baseDescription.defaultVersion
   - Fix: Updated priority to check currentVersion first, then description.defaultVersion
   - Impact: All VersionedNodeType nodes now return correct version

2. typeVersion Validation Bypass (workflow-validator.ts)
   - Langchain nodes with invalid typeVersion passed validation (even typeVersion: 99999)
   - Root cause: langchain skip happened before typeVersion validation
   - Fix: Moved typeVersion validation before langchain parameter skip
   - Impact: Invalid typeVersion values now properly caught for all nodes

Also includes:
- Database rebuilt with corrected version data (536 nodes)
- Version bump: 2.17.3 → 2.17.4
- Comprehensive CHANGELOG entry

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-07 20:16:45 +02:00
czlonkowski
e95ac7c335 fix: add validation for resourceLocator properties in AI model nodes
This fixes a critical validation gap where AI agents could create invalid
configurations for nodes using resourceLocator properties (primarily AI model
nodes like OpenAI Chat Model v1.2+, Anthropic, Cohere, etc.).

Before this fix, AI agents could incorrectly pass a string value like:
  model: "gpt-4o-mini"

Instead of the required object format:
  model: { mode: "list", value: "gpt-4o-mini" }

These invalid configs would pass validation but fail at runtime in n8n.

Changes:
- Added resourceLocator type validation in config-validator.ts (lines 237-274)
- Validates value is an object with required 'mode' and 'value' properties
- Provides helpful error messages with exact fix suggestions
- Added 10 comprehensive test cases (100% passing)
- Updated version to 2.17.3
- Added CHANGELOG entry

Affected nodes: OpenAI Chat Model (v1.2+), Anthropic, Cohere, DeepSeek,
Groq, Mistral, OpenRouter, xAI Grok Chat Models, and embeddings nodes.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-07 16:54:29 +02:00
czlonkowski
73fa494735 chore: bump version to 2.17.2 and update badges
- Version: 2.17.1 → 2.17.2
- Updated n8n badge: 1.113.3 → 1.114.3

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-07 14:26:19 +02:00
czlonkowski
710f054b93 chore: update n8n to v1.114.3 and optimize template fetching
Updates:
- Updated n8n from 1.113.3 to 1.114.3
- Updated n8n-core from 1.112.1 to 1.113.1
- Updated n8n-workflow from 1.110.0 to 1.111.0
- Updated @n8n/n8n-nodes-langchain from 1.112.2 to 1.113.1
- Rebuilt node database with 536 nodes
- Updated template database (2647 → 2653, +6 new templates)
- Sanitized 24 templates to remove API tokens

Performance Improvements:
- Optimized template update to fetch only last 2 weeks
- Reduced update time from 10+ minutes to ~60 seconds
- Added getMostRecentTemplateDate() to TemplateRepository
- Modified TemplateFetcher to support date-based filtering
- Update mode now fetches templates since (most_recent - 14 days)

All tests passing (933 unit, 249 integration)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-07 13:44:34 +02:00
czlonkowski
2bcd7c757b fix: Docker/cloud telemetry user ID stability (v2.17.1)
Fixes critical issue where Docker and cloud deployments generated new
anonymous user IDs on every container recreation, causing 100-200x
inflation in unique user counts.

Changes:
- Use host's boot_id for stable identification across container updates
- Auto-detect Docker (IS_DOCKER=true) and 8 cloud platforms
- Defensive fallback chain: boot_id → combined signals → generic ID
- Zero configuration required

Impact:
- Resolves ~1000x/month inflation in stdio mode
- Resolves ~180x/month inflation in HTTP mode (6 releases/day)
- Improves telemetry accuracy: 3,996 apparent users → ~2,400-2,800 actual

Testing:
- 18 new unit tests for boot_id functionality
- 16 new integration tests for Docker/cloud detection
- All 60 telemetry tests passing (100%)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-07 11:39:48 +02:00
czlonkowski
4cf8bb5c98 release: version 2.17.0 - AI workflow validation fixes
PHASE 4 COMPLETE: Documentation and version bump

### Documentation Updates
- README.md: Added AI workflow validation features section
  - Missing language model detection
  - AI tool connection validation
  - Streaming mode constraints
  - Memory and output parser checks

- CHANGELOG.md: Comprehensive v2.17.0 release notes
  - Fixed 4 critical bugs (HIGH-01, HIGH-04, HIGH-08, MEDIUM-02)
  - Node type normalization bug details
  - Streaming mode validation enhancements
  - Examples retrieval fix
  - All 25 AI validator tests passing

### Version Bump
- package.json: 2.16.3 → 2.17.0

### Impact Summary
This release fixes critical bugs that caused ALL AI validation to be
silently skipped. Before this fix, 0% of AI validation was functional.

**What's Fixed:**
-  Missing language model detection (HIGH-01)
-  AI tool connection detection (HIGH-04)
-  Streaming mode validation (HIGH-08)
-  get_node_essentials examples (MEDIUM-02)

**Test Results:**
- All 25 AI validator tests: PASS (100%)
- Overall test improvement: 37.5% → 62.5%+ (+67%)
- Debug scenarios: 3/3 PASS

**Breaking Change:**
AI validation now actually runs (was completely non-functional before)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 23:58:11 +02:00
czlonkowski
06cbb40213 feat: implement security audit fixes - rate limiting and SSRF protection (Issue #265 PR #2)
This commit implements HIGH-02 (Rate Limiting) and HIGH-03 (SSRF Protection)
from the security audit, protecting against brute force attacks and
Server-Side Request Forgery.

Security Enhancements:
- Rate limiting: 20 attempts per 15 minutes per IP (configurable)
- SSRF protection: Three security modes (strict/moderate/permissive)
- DNS rebinding prevention
- Cloud metadata blocking in all modes

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 15:40:07 +02:00
czlonkowski
36aedd5050 fix: correct version to 2.16.2 (patch release for security fixes)
Per Semantic Versioning, security fixes are backwards-compatible bug fixes
and should increment the PATCH version (2.16.1 → 2.16.2), not MINOR.

This resolves the version mismatch identified by code review.
2025-10-06 14:29:08 +02:00
czlonkowski
b106550520 security: fix CRITICAL timing attack and command injection vulnerabilities (Issue #265)
This commit addresses 2 critical security vulnerabilities identified in the
security audit.

## CRITICAL-02: Timing Attack Vulnerability (CVSS 8.5)

**Problem:** Non-constant-time string comparison in authentication allowed
timing attacks to discover tokens character-by-character through statistical
timing analysis (estimated 24-48 hours to compromise).

**Fix:** Implemented crypto.timingSafeEqual for all token comparisons

**Changes:**
- Added AuthManager.timingSafeCompare() constant-time comparison utility
- Fixed src/utils/auth.ts:27 - validateToken method
- Fixed src/http-server-single-session.ts:1087 - Single-session HTTP auth
- Fixed src/http-server.ts:315 - Fixed HTTP server auth
- Added 11 unit tests with timing variance analysis (<10% variance proven)

## CRITICAL-01: Command Injection Vulnerability (CVSS 8.8)

**Problem:** User-controlled nodeType parameter injected into shell commands
via execSync, allowing remote code execution, data exfiltration, and network
scanning.

**Fix:** Eliminated all shell execution, replaced with Node.js fs APIs

**Changes:**
- Replaced execSync() with fs.readdir() in enhanced-documentation-fetcher.ts
- Added multi-layer input sanitization: /[^a-zA-Z0-9._-]/g
- Added directory traversal protection (blocks .., /, relative paths)
- Added path.basename() for additional safety
- Added final path verification (ensures result within expected directory)
- Added 9 integration tests covering all attack vectors

## Test Results

All Tests Passing:
- Unit tests: 11/11  (timing-safe comparison)
- Integration tests: 9/9  (command injection prevention)
- Timing variance: <10%  (proves constant-time)
- All existing tests:  (no regressions)

## Breaking Changes

None - All changes are backward compatible.

## References

- Security Audit: Issue #265
- Implementation Plan: docs/local/security-implementation-plan-issue-265.md
- Audit Analysis: docs/local/security-audit-analysis-issue-265.md

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 14:09:06 +02:00
czlonkowski
b12a927a10 fix: harden signal handlers with robust container detection (Issue #277)
Production-ready improvements based on comprehensive code review:

Critical Fixes:
- Robust container detection: Checks multiple env vars (IS_DOCKER, IS_CONTAINER)
  with flexible formats (true/1/yes) and filesystem markers (/.dockerenv,
  /run/.containerenv) for Docker, Kubernetes, Podman, containerd support
- Fixed redundant exit calls: Removed immediate exit, use 1000ms timeout for
  graceful shutdown allowing cleanup to complete
- Added error handling for stdin registration with try-catch
- Added shutdown trigger logging (SIGTERM/SIGINT/SIGHUP/STDIN_END/STDIN_CLOSE)

Improvements:
- Increased timeout from 500ms to 1000ms for slower systems
- Added null safety for stdin operations
- Enhanced documentation explaining behavior in different environments
- More descriptive variable names (isDocker → isContainer)

Testing:
- Supports Docker, Kubernetes, Podman, and other container runtimes
- Graceful fallback if container detection fails
- Works in Claude Desktop, containers, and manual execution

Code Review: Approved by code-reviewer agent
All critical and warning issues addressed

Reported by: @Eddy-Chahed
Issue: #277

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 13:04:03 +02:00
czlonkowski
59e4cb85ac chore: bump version to 2.16.0 and update CHANGELOG
Version bump for Phase 1 release with breaking changes.

Changes:
- Version: 2.15.7 → 2.16.0 (breaking change: removed updateConnection)
- CHANGELOG: Comprehensive v2.16.0 entry covering:
  - Phase 1: rewireConnection operation + smart parameters
  - Issue #275: TypeError prevention (57.4% of production errors)
  - Issue #136: Partial workflow update failures (resolved by TypeError fix)
  - Critical bug fixes during Phase 1 implementation
  - Integration testing with real n8n API
  - Updated documentation

Breaking Changes:
- Removed updateConnection operation
- Migration: Use rewireConnection or removeConnection + addConnection

Impact:
- Production errors: -323 errors (-57.4%)
- Users helped: 127 (76.5% of affected users)
- Connection operations: 4.5/10 → 9.5/10 (+111%)

Issues Resolved:
- #272 Phase 1: Connection operations UX improvements
- #275: TypeError in getNodeTypeAlternatives
- #136: Partial workflow updates fail with "Cannot convert undefined or null"

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 07:56:09 +02:00
czlonkowski
2a85000411 chore: bump version to 2.15.7 and update CHANGELOG for Phase 0
Version: 2.15.6 → 2.15.7

Changes:
- Updated package.json version
- Updated package.runtime.json version
- Added comprehensive CHANGELOG.md entry for Phase 0 connection fixes

Phase 0 Summary:
- Fixed critical addConnection sourceIndex bug (Issue #272, #204)
- Fixed updateConnection runtime validation preventing crashes
- Overall rating improvement: 4.5/10 → 8.5/10 (+89%)
- 8 new comprehensive tests, all 126 tests passing

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-05 22:30:16 +02:00
czlonkowski
da593400d2 chore: bump version to 2.15.6 and update CHANGELOG for Issue #270 fix 2025-10-05 16:57:03 +02:00
czlonkowski
ae329c3bb6 chore: bump version to 2.15.5
Version bump due to functionality changes in Phase 5:

Changes:
- handleDeleteWorkflow now returns deleted workflow data
- handleListWorkflows tags parameter fixed (array → CSV string)
- N8nApiClient.deleteWorkflow return type fixed (void → Workflow)
- WorkflowListParams.tags type corrected (string[] → string)

These are bug fixes and enhancements, not just tests.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-04 23:46:06 +02:00
czlonkowski
4feb905bd0 chore: release v2.15.4
### Summary
Phase 4 integration tests complete with enhanced settings filtering

### Changes
- Bump version: 2.15.3 → 2.15.4
- Enhanced cleanWorkflowForUpdate to filter settings (whitelist approach)
- Fixed all Phase 4 integration tests to comply with n8n API requirements
- Removed invalid "Update Connections" test

### Key Improvements
- Settings updates now work while maintaining Issue #248 protection
- Whitelist-based filtering (more secure than blacklist)
- All 433 integration tests passing
- Backward compatibility maintained

### Test Coverage
- Unit tests: 72/72 passing (100%)
- Integration tests: 433/433 passing (Phase 4 complete)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-04 22:47:17 +02:00
czlonkowski
c3b691cedf feat(telemetry): capture error messages with security hardening
## Summary
Enhanced telemetry system to capture actual error messages for debugging
while implementing comprehensive security hardening to protect sensitive data.

## Changes
- Added optional errorMessage parameter to trackError() method
- Implemented sanitizeErrorMessage() with 7-layer security protection
- Updated all production and test call sites (atomic change)
- Added 18 new security-focused tests

## Security Fixes
- ReDoS Prevention: Early truncation + simplified regex patterns
- Full URL Redaction: Changed [URL]/path → [URL] to prevent leakage
- Credential Detection: AWS keys, GitHub tokens, JWT, Bearer tokens
- Correct Sanitization Order: URLs → credentials → emails → generic
- Error Handling: Try-catch wrapper with [SANITIZATION_FAILED] fallback

## Impact
- Resolves 272+ weekly errors with no error messages
- Protects against ReDoS attacks
- Prevents API structure and credential leakage
- 90.75% test coverage, 269 tests passing

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-03 15:53:13 +02:00
czlonkowski
2a9a3b9410 chore: release v2.15.2 with 100% test coverage
- Bump version to 2.15.2
- Add comprehensive changelog entry documenting all improvements
- Add 31 new unit tests achieving 100% coverage for changed code
- Fix flaky integration tests with deterministic ordering

Test Coverage Improvements:
- buildMetadataFilterConditions: All filter combinations (11 tests)
- Performance logging validation (3 tests)
- ID filtering edge cases (7 tests)
- getMetadataSearchCount: Shared helper usage (7 tests)
- Two-phase optimization verification (3 tests)

Coverage increased from 36.58% to 100% for patch

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-03 14:44:53 +02:00
czlonkowski
2305aaab9e feat: implement integration testing foundation (Phase 1)
Complete implementation of Phase 1 foundation for n8n API integration tests.
Establishes core utilities, fixtures, and infrastructure for testing all 17 n8n API handlers against real n8n instance.

Changes:
- Add integration test environment configuration to .env.example
- Create comprehensive test utilities infrastructure:
  * credentials.ts: Environment-aware credential management (local .env vs CI secrets)
  * n8n-client.ts: Singleton API client wrapper with health checks
  * test-context.ts: Resource tracking and automatic cleanup
  * cleanup-helpers.ts: Multi-level cleanup strategies (orphaned, age-based, tag-based)
  * fixtures.ts: 6 pre-built workflow templates (webhook, HTTP, multi-node, error handling, AI, expressions)
  * factories.ts: Dynamic node/workflow builders with 15+ factory functions
  * webhook-workflows.ts: Webhook workflow configs and setup instructions

- Add npm scripts:
  * test:integration:n8n: Run n8n API integration tests
  * test:cleanup:orphans: Clean up orphaned test resources

- Create cleanup script for CI/manual use

Documentation:
- Add comprehensive integration testing plan (550 lines)
- Add Phase 1 completion summary with lessons learned

Key Features:
- Automatic credential detection (CI vs local)
- Multi-level cleanup (test, suite, CI, orphan)
- 6 workflow fixtures covering common scenarios
- 15+ factory functions for dynamic test data
- Support for 4 HTTP methods (GET, POST, PUT, DELETE) via pre-activated webhook workflows
- TypeScript-first with full type safety
- Comprehensive error handling with helpful messages

Total: ~1,520 lines of production-ready code + 650 lines of documentation

Ready for Phase 2: Workflow creation tests

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-03 13:12:42 +02:00
czlonkowski
675989971c chore: bump version to 2.15.1
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-03 11:44:35 +02:00
czlonkowski
59e476fdf0 test(p0-r3): add comprehensive test suite for template configuration feature
Add 85+ tests covering all aspects of P0-R3 implementation:

**Integration Tests**
- Template node configs database operations (CREATE, READ, ranking, cleanup)
- End-to-end MCP tool testing with real workflows
- Cross-node validation with multiple node types

**Unit Tests**
- search_nodes with includeExamples parameter
- get_node_essentials with includeExamples parameter
- Template extraction from compressed workflows
- Node configuration ranking algorithm
- Expression detection accuracy

**Test Coverage**
- Database: template_node_configs table, ranked view, indexes
- Tools: backward compatibility, example quality, metadata accuracy
- Scripts: extraction logic, ranking, CLI flags
- Edge cases: missing tables, empty configs, malformed data

**Files Modified**
- tests/integration/database/template-node-configs.test.ts (529 lines)
- tests/integration/mcp/template-examples-e2e.test.ts (427 lines)
- tests/unit/mcp/search-nodes-examples.test.ts (271 lines)
- tests/unit/mcp/get-node-essentials-examples.test.ts (357 lines)
- tests/unit/scripts/fetch-templates-extraction.test.ts (456 lines)
- tests/fixtures/template-configs.ts (484 lines)
- P0-R3-TEST-PLAN.md (comprehensive test documentation)

**Test Results**
- Manual testing: 11/13 nodes validated with examples
- Code review: All JSON.parse calls properly wrapped in try-catch
- Performance: <1ms query time verified

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 22:28:23 +02:00
czlonkowski
997cc93a0a feat(p0-r3): implement pre-extracted template configurations system
Major Features:
- Pre-extracted 197 node configurations from 2,646 workflow templates
- Removed get_node_for_task tool (28% failure rate, 31 tasks)
- Enhanced search_nodes and get_node_essentials with includeExamples parameter
- 30-60x faster queries (<1ms vs 30-60ms)

Database Schema:
- New table: template_node_configs with optimized indexes
- New view: ranked_node_configs for top 5 configs per node
- Migration script: add-template-node-configs.sql

Template Processing:
- extractNodeConfigs: Extract configs from workflow templates
- detectExpressions: Identify n8n expressions ({{...}}, $json, $node)
- insertAndRankConfigs: Rank by popularity, keep top 10 per node

Tool Enhancements:
- search_nodes: Added includeExamples parameter (top 2 configs)
- get_node_essentials: Added includeExamples parameter (top 3 configs)

CLI Features:
- --extract-only: Extract configs without fetching new templates
- Automatic table creation if missing

Breaking Changes:
- Removed get_node_for_task tool
- Use search_nodes({includeExamples: true}) or get_node_essentials({includeExamples: true}) instead

Performance:
- Query time: <1ms for pre-extracted configs
- 85x more examples (2,646 vs 31)
- Database size increase: ~197 configs stored

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 20:24:09 +02:00
czlonkowski
aef9d983e2 chore: bump version to 2.14.7 and update CHANGELOG
Release v2.14.7 with critical P0 fixes:

- P0-R1: Universal node type normalization (80% error reduction)
- Issue #248: Settings validation error fix
- Issue #249: Enhanced addConnection error messages

Changes:
- Bump version from 2.14.6 to 2.14.7
- Add comprehensive CHANGELOG entry for v2.14.7
- Update PR #247 description with complete summary

Impact:
- Expected overall error rate reduction from 5-10% to <2%
- 183 tests passing (100% coverage for new code)
- All CI checks passing

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 15:29:21 +02:00
czlonkowski
cb5691f17d chore: bump version to 2.14.6 and update CHANGELOG
- Bump version from 2.14.5 to 2.14.6
- Add comprehensive CHANGELOG entry for webhook error message enhancements
- Document new error formatting functions
- Highlight benefits: fast, efficient, safe, actionable debugging guidance
2025-10-01 11:56:27 +02:00
czlonkowski
ec0d2e8a6e feat: add intelligent execution data filtering to n8n_get_execution tool
Implements comprehensive execution data filtering system to enable AI agents
to inspect large workflow executions without exceeding token limits.

Features:
- Preview mode: Shows structure, counts, and size estimates (~500 tokens)
- Summary mode: Returns 2 sample items per node (~2-5K tokens)
- Filtered mode: Granular control with itemsLimit and nodeNames
- Full mode: Complete data retrieval (explicit opt-in)
- Smart recommendations based on data size analysis
- Structure-only mode (itemsLimit: 0) for schema inspection
- 100% backward compatibility with legacy includeData parameter

Technical improvements:
- New ExecutionProcessor service with intelligent filtering logic
- Type-safe implementation with Record<string, unknown> over any
- Comprehensive validation and error handling
- 33 unit tests with 78% coverage
- Constants-based thresholds for easy tuning

Bug fixes:
- Fixed preview mode API data fetching to enable structure analysis
- Validates and caps itemsLimit to prevent abuse

Impact:
- Reduces token usage by 80-95% for large datasets (50+ items)
- Prevents token overflow when inspecting workflow executions
- Enables recommended workflow: preview → recommendation → targeted fetch

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-01 00:01:59 +02:00
czlonkowski
34cb8f8c44 feat: Add workflow cleanup and recovery operations (v2.14.4)
Implements 4 new features for n8n_update_partial_workflow:

New Operations:
- cleanStaleConnections: Auto-remove broken workflow connections
- replaceConnections: Replace entire connections object in one operation

Enhanced Features:
- removeConnection ignoreErrors flag: Graceful cleanup without failures
- continueOnError mode: Best-effort batch operations with detailed tracking

Impact:
- Reduces broken workflow fix time from 10-15 minutes to 30 seconds
- Token efficiency: 1 cleanStaleConnections vs 10+ manual operations
- 15 new tests added, all passing

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-30 14:05:17 +02:00
czlonkowski
fff47f9f9d feat: add incremental template updates and fix metadata generation
Template Updates:
- Add npm script for incremental template fetch (fetch:templates:update)
- Create MEMORY_TEMPLATE_UPDATE.md with comprehensive documentation
- Update 48 new templates (2598 → 2646 total)
- Latest template now from September 24, 2025

Metadata Generation Fixes:
- Update model from gpt-4o-mini to gpt-5-mini-2025-08-07
- Remove temperature parameter (not supported in batch API)
- Increase max_completion_tokens from 1000 to 3000
- Add comprehensive error file handling to batch-processor
- Process failed requests and assign default metadata
- Save error files for debugging (temp/batch/)

Test Updates:
- Update all test files to use gpt-5-mini-2025-08-07 model
- 3 test assertions updated in metadata-generator.test.ts
- 1 test option updated in batch-processor.test.ts

Documentation:
- Add troubleshooting section for metadata generation
- Include error handling examples
- Document incremental vs full rebuild modes

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-30 09:59:42 +02:00
czlonkowski
87cc84f593 chore: update n8n to v1.113.3
- Updated n8n from 1.112.3 to 1.113.3
- Updated n8n-core from 1.111.0 to 1.112.1
- Updated n8n-workflow from 1.109.0 to 1.110.0
- Updated @n8n/n8n-nodes-langchain from 1.111.1 to 1.112.2
- Rebuilt node database with 536 nodes
- Bumped version to 2.14.3
- Updated n8n version badge in README
- All validation tests passing

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-29 23:35:03 +02:00
czlonkowski
263753254a chore: bump version to 2.14.2 and update changelog
- Bumped version from 2.14.1 to 2.14.2
- Added comprehensive changelog entry for validation fixes
- Documents fixes for Google Drive fileFolder resource false positives
- Documents fixes for Code node expression validation false positives
- Documents enhanced error handling improvements from code review
2025-09-29 18:27:43 +02:00
czlonkowski
e14c647b7d fix: refactor telemetry system with critical improvements (v2.14.1)
Major improvements to telemetry system addressing code review findings:

Architecture & Modularization:
- Split 636-line TelemetryManager into 7 focused modules
- Separated concerns: event tracking, batch processing, validation, rate limiting
- Lazy initialization pattern to avoid early singleton creation
- Clean separation of responsibilities

Security & Privacy:
- Added comprehensive input validation with Zod schemas
- Sanitization of sensitive data (URLs, API keys, emails)
- Expanded sensitive key detection patterns (25+ patterns)
- Row Level Security on Supabase backend
- Added data deletion contact info (romuald@n8n-mcp.com)

Performance & Reliability:
- Sliding window rate limiter (100 events/minute)
- Circuit breaker pattern for network failures
- Dead letter queue for failed events
- Exponential backoff with jitter for retries
- Performance monitoring with overhead tracking (<5%)
- Memory-safe array limits in rate limiter

Testing:
- Comprehensive test coverage (87%+ for core modules)
- Unit tests for all new modules
- Integration tests for MCP telemetry
- Fixed test isolation issues

Data Management:
- Clear user consent in welcome message
- Batch processing with deduplication
- Automatic workflow flushing

BREAKING CHANGE: TelemetryManager constructor is now private, use getInstance()

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-26 16:10:54 +02:00
czlonkowski
6f21a717cd chore: bump version to 2.14.0
- Add anonymous telemetry system with Supabase integration
- Fix TypeErrors affecting 50% of tool calls
- Improve test coverage to 91%+
- Add comprehensive CHANGELOG

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-26 11:34:54 +02:00
czlonkowski
5960d2826e feat: add anonymous telemetry system with Supabase integration
- Implement telemetry manager for tracking tool usage and workflows
- Add workflow sanitizer to remove sensitive data before storage
- Create config manager with opt-in/opt-out mechanism
- Integrate telemetry tracking into MCP server and workflow handlers
- Add CLI commands for telemetry control (enable/disable/status)
- Show first-run notice with clear privacy information
- Add comprehensive unit tests for sanitization and config
- Track tool usage metrics, workflow patterns, and errors
- Ensure complete anonymity with deterministic user IDs
- Never collect URLs, API keys, or sensitive information
2025-09-26 09:06:18 +02:00
czlonkowski
f6160d43a0 feat: add operation and resource validation with intelligent suggestions
- Added OperationSimilarityService for validating operations with "Did you mean...?" suggestions
- Added ResourceSimilarityService for validating resources with plural/singular detection
- Implements Levenshtein distance algorithm for typo detection
- Pattern matching for common operation/resource mistakes
- 5-minute cache with automatic cleanup to prevent memory leaks
- Confidence scoring (30% minimum threshold) for suggestion quality
- Resource-aware operation filtering for contextual suggestions
- Safe JSON parsing with ValidationServiceError for proper error handling
- Type guards for safe property access
- Performance optimizations with early termination
- Comprehensive test coverage (37 new tests)
- Integration tested with n8n-mcp-tester agent

Example use cases:
- "listFiles" → suggests "search" for Google Drive
- "files" → suggests singular "file"
- "flie" → suggests "file" (typo correction)
- "downlod" → suggests "download"

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 23:57:25 +02:00
czlonkowski
3981b9108a chore: release v2.13.1 - remove 5-operation limit
- Remove 5-operation limit from n8n_update_partial_workflow
- Update CHANGELOG.md with version 2.13.1 entry
- Bump version in package.json to 2.13.1
- Remove static version badge from README.md (npm badge remains)

The workflow diff engine now supports unlimited operations per request,
enabling complex workflow refactoring in single API calls.
2025-09-24 15:59:38 +02:00
czlonkowski
27339ec78d chore: release v2.13.0 - webhook autofixer and enhanced node suggestions
## 🎉 Release Highlights

###  New Features
- **Webhook Path Autofixer**: Automatically generates UUIDs for webhook nodes missing path configuration
- **Enhanced Node Type Suggestions**: Intelligent node type correction with similarity matching
- **n8n_autofix_workflow Tool**: New MCP tool for automatic workflow error correction

### 🔒 Security & Performance
- Eliminated ReDoS vulnerability in NodeSimilarityService
- Optimized Levenshtein distance algorithm from O(m*n) to O(n) space
- Added cache invalidation with version tracking to prevent memory leaks

### 📚 Documentation
- Comprehensive CHANGELOG entry with detailed feature descriptions
- Updated README with new autofixer tool documentation
- Added tool usage examples in validation workflow

All 16 test cases passing with 100% success rate.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 13:03:10 +02:00
czlonkowski
c1fb3db568 chore: update n8n dependencies to v1.112.3
- Updated n8n from 1.111.0 to 1.112.3
- Updated n8n-core from 1.110.0 to 1.111.0
- Updated n8n-workflow from 1.108.0 to 1.109.0
- Updated @n8n/n8n-nodes-langchain from 1.110.0 to 1.111.1
- Rebuilt node database with 536 nodes (438 from n8n-nodes-base, 98 from langchain)
- Bumped version to 2.12.2
- Updated README.md badges to reflect new n8n version

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-22 23:38:26 +02:00
czlonkowski
1a926630b8 fix: enhance error output validation to detect incorrect configurations
- Add validateErrorOutputConfiguration method to detect when multiple nodes are incorrectly placed in main[0]
- Fix checkWorkflowPatterns to check main[1] for error outputs instead of outputs.error
- Cross-validate onError property matches actual connection structure
- Provide clear error messages with JSON examples showing correct configuration
- Use heuristic detection for error handler nodes (names containing error, fail, catch, etc.)
- Add comprehensive test coverage with 16+ test cases
- Bump version to 2.12.1

Fixes issues where AI agents would incorrectly configure error outputs by placing multiple nodes in the same array instead of separating them into success (main[0]) and error (main[1]) paths.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-22 21:05:27 +02:00
czlonkowski
b366d40d67 chore: release v2.12.0 - flexible instance configuration
- Bump version from 2.11.3 to 2.12.0
- Add comprehensive documentation for flexible instance configuration
- Update CHANGELOG with new features, security enhancements, and performance improvements
- Document architecture, usage examples, and security considerations
- Include migration guide for existing deployments

This release introduces flexible instance configuration, enabling n8n-mcp to serve
multiple users with different n8n instances dynamically, with full backward compatibility.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-19 21:03:38 +02:00
czlonkowski
34fbdc30fe feat: add flexible instance configuration support with security improvements
- Add InstanceContext interface for runtime configuration
- Implement dual-mode API client (singleton + instance-specific)
- Add secure SHA-256 hashing for cache keys
- Implement LRU cache with TTL (100 instances, 30min expiry)
- Add comprehensive input validation for URLs and API keys
- Sanitize all logging to prevent API key exposure
- Fix session context cleanup and memory management
- Add comprehensive security and integration tests
- Maintain full backward compatibility for single-player usage

Security improvements based on code review:
- Cache keys are now cryptographically hashed
- API credentials never appear in logs
- Memory-bounded cache prevents resource exhaustion
- Input validation rejects invalid/placeholder values
- Proper cleanup of orphaned session contexts

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-19 16:23:30 +02:00
czlonkowski
e6f1d6bcf0 chore: bump version to 2.11.3 and update documentation
- Bump version from 2.11.2 to 2.11.3
- Update README.md version badge
- Add CHANGELOG.md entry documenting the fix for n8n_update_partial_workflow tool
- Fix resolves GitHub issues #159 and #168
2025-09-17 23:46:24 +02:00
czlonkowski
f39c9a5389 fix: resolve pyodide version conflict for Docker builds
- Added override for pyodide@0.26.4 to resolve version conflict
- @langchain/community requires pyodide <0.27.0 but npm was installing 0.28.0
- This was causing Railway Docker build failures with npm ci

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-16 11:59:45 +02:00
czlonkowski
19caa7bbb4 2.11.2 2025-09-16 11:14:56 +02:00
czlonkowski
dff0387ae2 chore: update n8n dependencies to v1.111.0
- Updated n8n from 1.110.1 to 1.111.0
- Updated n8n-core from 1.109.0 to 1.110.0
- Updated n8n-workflow from 1.107.0 to 1.108.0
- Updated @n8n/n8n-nodes-langchain from 1.109.1 to 1.110.0
- Rebuilt node database with 535 nodes
- Templates preserved: 2598 templates with 2534 having metadata
- All critical nodes validated successfully
- Test results: 1911 passed, 5 failed (performance tests), 53 skipped

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-16 11:14:24 +02:00
czlonkowski
abc226f111 feat: add optional fields parameter to search_templates tool
- Added fields parameter to filter response fields in search_templates
- Reduces response size by 70-98% when using selective fields
- Maintains backward compatibility with optional parameter
- Supports all template fields: id, name, description, author, nodes, views, created, url, metadata
- Updated tool documentation with examples

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-15 23:46:33 +02:00
czlonkowski
6e24da722b feat: Add structured template metadata generation with OpenAI
- Implement OpenAI batch API integration for metadata generation
- Add metadata columns to database schema (metadata_json, metadata_generated_at)
- Create MetadataGenerator service with structured output schemas
- Create BatchProcessor for handling OpenAI batch jobs
- Add --generate-metadata flag to fetch-templates script
- Update template repository with metadata management methods
- Add OpenAI configuration to environment variables
- Include comprehensive tests for metadata generation
- Use gpt-4o-mini model with 50% cost savings via batch API

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-14 20:00:39 +02:00
czlonkowski
61b54266b3 chore: bump version to 2.11.0
### Added
- Comprehensive template pagination with PaginatedResponse format
- New list_templates tool for efficient template browsing
- Flexible get_template modes (nodes_only, structure, full)

### Enhanced
- Gzip compression for workflow JSONs (84% size reduction)
- Template quality filtering (>10 views required)
- Database statistics now include template metrics

### Performance
- Database: 48MB for 2,596 templates (was 40MB for 499)
- Token usage: 80-90% reduction with new retrieval modes
- All 1,700+ tests passing
2025-09-14 18:11:59 +02:00
czlonkowski
6b4bb7ff66 chore: update n8n dependencies to 1.110.1
- Update n8n: 1.109.2 → 1.110.1
- Update n8n-core: 1.108.0 → 1.109.0
- Update n8n-workflow: 1.106.0 → 1.107.0
- Update @n8n/n8n-nodes-langchain: 1.108.1 → 1.109.1
- Rebuild node database with 536 nodes
- Update templates database with 499 latest workflows
- Bump version to 2.10.9
2025-09-10 00:06:42 +02:00
czlonkowski
15e6e97fd9 chore: bump version to 2.10.8
- Updated n8n dependencies to latest versions (n8n 1.109.2, @n8n/n8n-nodes-langchain 1.109.1)
- Fixed CI/CD pipeline issues with Node.js v22 LTS compatibility
- Resolved Rollup native module compatibility for GitHub Actions
- Enhanced cross-platform deployment with better-sqlite3 and SQL.js fallback
- All 1,728+ tests passing
2025-09-04 11:24:13 +02:00
czlonkowski
984af0a72f fix: resolve rollup native module CI failures
- Added explicit @rollup/rollup-linux-x64-gnu dependency for CI compatibility
- Fixed npm ci failures in GitHub Actions Linux environment
- Regenerated package-lock.json with all platform-specific rollup binaries
- Tests now pass on both macOS ARM64 and Linux x64 platforms
2025-09-04 11:10:47 +02:00
czlonkowski
b65a2f8f3d chore: update n8n dependencies to latest versions
- Updated n8n-nodes-base to 1.106.3
- Updated @n8n/n8n-nodes-langchain to 1.106.3
- Enhanced SQL.js compatibility in database adapter
- Fixed parameter binding and state management in SQLJSStatement
- Rebuilt node database with 535 nodes
- All tests passing with Node.js v22.17.0 LTS
2025-09-04 10:24:33 +02:00