Compare commits

..

1 Commits

Author SHA1 Message Date
Romuald Członkowski
6814880410 chore: update n8n to 2.6.3 and bump version to 2.33.6 (#571) 2026-02-06 09:09:37 +01:00
19 changed files with 6345 additions and 1256 deletions

View File

@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
## [2.33.6] - 2026-02-06
### Changed
- Updated n8n from 2.4.4 to 2.6.3
- Updated n8n-core from 2.4.2 to 2.6.1
- Updated n8n-workflow from 2.4.2 to 2.6.0
- Updated @n8n/n8n-nodes-langchain from 2.4.3 to 2.6.2
- Rebuilt node database with 806 nodes (544 from n8n-nodes-base, 262 from @n8n/n8n-nodes-langchain)
- Updated README badge with new n8n version
## [2.33.5] - 2026-01-23 ## [2.33.5] - 2026-01-23
### Fixed ### Fixed

View File

@@ -5,7 +5,7 @@
[![npm version](https://img.shields.io/npm/v/n8n-mcp.svg)](https://www.npmjs.com/package/n8n-mcp) [![npm version](https://img.shields.io/npm/v/n8n-mcp.svg)](https://www.npmjs.com/package/n8n-mcp)
[![codecov](https://codecov.io/gh/czlonkowski/n8n-mcp/graph/badge.svg?token=YOUR_TOKEN)](https://codecov.io/gh/czlonkowski/n8n-mcp) [![codecov](https://codecov.io/gh/czlonkowski/n8n-mcp/graph/badge.svg?token=YOUR_TOKEN)](https://codecov.io/gh/czlonkowski/n8n-mcp)
[![Tests](https://img.shields.io/badge/tests-3336%20passing-brightgreen.svg)](https://github.com/czlonkowski/n8n-mcp/actions) [![Tests](https://img.shields.io/badge/tests-3336%20passing-brightgreen.svg)](https://github.com/czlonkowski/n8n-mcp/actions)
[![n8n version](https://img.shields.io/badge/n8n-2.4.4-orange.svg)](https://github.com/n8n-io/n8n) [![n8n version](https://img.shields.io/badge/n8n-2.6.3-orange.svg)](https://github.com/n8n-io/n8n)
[![Docker](https://img.shields.io/badge/docker-ghcr.io%2Fczlonkowski%2Fn8n--mcp-green.svg)](https://github.com/czlonkowski/n8n-mcp/pkgs/container/n8n-mcp) [![Docker](https://img.shields.io/badge/docker-ghcr.io%2Fczlonkowski%2Fn8n--mcp-green.svg)](https://github.com/czlonkowski/n8n-mcp/pkgs/container/n8n-mcp)
[![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/deploy/n8n-mcp?referralCode=n8n-mcp) [![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/deploy/n8n-mcp?referralCode=n8n-mcp)

Binary file not shown.

View File

@@ -311,6 +311,17 @@ class SQLJSStatement {
this.stmt = stmt; this.stmt = stmt;
this.onModify = onModify; this.onModify = onModify;
this.boundParams = null; this.boundParams = null;
this.freed = false;
}
freeStatement() {
if (!this.freed && this.stmt) {
try {
this.stmt.free();
this.freed = true;
}
catch (e) {
}
}
} }
run(...params) { run(...params) {
try { try {
@@ -331,6 +342,9 @@ class SQLJSStatement {
this.stmt.reset(); this.stmt.reset();
throw error; throw error;
} }
finally {
this.freeStatement();
}
} }
get(...params) { get(...params) {
try { try {
@@ -352,6 +366,9 @@ class SQLJSStatement {
this.stmt.reset(); this.stmt.reset();
throw error; throw error;
} }
finally {
this.freeStatement();
}
} }
all(...params) { all(...params) {
try { try {
@@ -372,6 +389,9 @@ class SQLJSStatement {
this.stmt.reset(); this.stmt.reset();
throw error; throw error;
} }
finally {
this.freeStatement();
}
} }
iterate(...params) { iterate(...params) {
return this.all(...params)[Symbol.iterator](); return this.all(...params)[Symbol.iterator]();

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
{"version":3,"file":"http-server-single-session.d.ts","sourceRoot":"","sources":["../src/http-server-single-session.ts"],"names":[],"mappings":";AAMA,OAAO,OAAO,MAAM,SAAS,CAAC;AAoB9B,OAAO,EAAE,eAAe,EAA2B,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAuErD,qBAAa,uBAAuB;IAElC,OAAO,CAAC,UAAU,CAA8D;IAChF,OAAO,CAAC,OAAO,CAA0D;IACzE,OAAO,C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I,OAAO,CAAC,IAAI,CAAC;IAgnBtB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IA2D/B,cAAc,IAAI;QAChB,MAAM,EAAE,OAAO,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE;YACT,KAAK,EAAE,MAAM,CAAC;YACd,MAAM,EAAE,MAAM,CAAC;YACf,OAAO,EAAE,MAAM,CAAC;YAChB,GAAG,EAAE,MAAM,CAAC;YACZ,UAAU,EAAE,MAAM,EAAE,CAAC;SACtB,CAAC;KACH;IAmDM,kBAAkB,IAAI,YAAY,EAAE;IAoEpC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,MAAM;CAsG7D"}

View File

@@ -22,6 +22,7 @@ const crypto_1 = require("crypto");
const types_js_1 = require("@modelcontextprotocol/sdk/types.js"); const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
const protocol_version_1 = require("./utils/protocol-version"); const protocol_version_1 = require("./utils/protocol-version");
const instance_context_1 = require("./types/instance-context"); const instance_context_1 = require("./types/instance-context");
const shared_database_1 = require("./database/shared-database");
dotenv_1.default.config(); dotenv_1.default.config();
const DEFAULT_PROTOCOL_VERSION = protocol_version_1.STANDARD_PROTOCOL_VERSION; const DEFAULT_PROTOCOL_VERSION = protocol_version_1.STANDARD_PROTOCOL_VERSION;
const MAX_SESSIONS = Math.max(1, parseInt(process.env.N8N_MCP_MAX_SESSIONS || '100', 10)); const MAX_SESSIONS = Math.max(1, parseInt(process.env.N8N_MCP_MAX_SESSIONS || '100', 10));
@@ -52,7 +53,7 @@ class SingleSessionHTTPServer {
this.contextSwitchLocks = new Map(); this.contextSwitchLocks = new Map();
this.session = null; this.session = null;
this.consoleManager = new console_manager_1.ConsoleManager(); this.consoleManager = new console_manager_1.ConsoleManager();
this.sessionTimeout = 30 * 60 * 1000; this.sessionTimeout = parseInt(process.env.SESSION_TIMEOUT_MINUTES || '5', 10) * 60 * 1000;
this.authToken = null; this.authToken = null;
this.cleanupTimer = null; this.cleanupTimer = null;
this.validateEnvironment(); this.validateEnvironment();
@@ -290,6 +291,25 @@ class SingleSessionHTTPServer {
return; return;
} }
logger_1.logger.info('handleRequest: Creating new transport for initialize request'); logger_1.logger.info('handleRequest: Creating new transport for initialize request');
if (instanceContext?.instanceId) {
const sessionsToRemove = [];
for (const [existingSessionId, context] of Object.entries(this.sessionContexts)) {
if (context?.instanceId === instanceContext.instanceId) {
sessionsToRemove.push(existingSessionId);
}
}
for (const oldSessionId of sessionsToRemove) {
if (!this.transports[oldSessionId]) {
continue;
}
logger_1.logger.info('Cleaning up previous session for instance', {
instanceId: instanceContext.instanceId,
oldSession: oldSessionId,
reason: 'instance_reconnect'
});
await this.removeSession(oldSessionId, 'instance_reconnect');
}
}
let sessionIdToUse; let sessionIdToUse;
const isMultiTenantEnabled = process.env.ENABLE_MULTI_TENANT === 'true'; const isMultiTenantEnabled = process.env.ENABLE_MULTI_TENANT === 'true';
const sessionStrategy = process.env.MULTI_TENANT_SESSION_STRATEGY || 'instance'; const sessionStrategy = process.env.MULTI_TENANT_SESSION_STRATEGY || 'instance';
@@ -434,12 +454,21 @@ class SingleSessionHTTPServer {
} }
async resetSessionSSE(res) { async resetSessionSSE(res) {
if (this.session) { if (this.session) {
const sessionId = this.session.sessionId;
logger_1.logger.info('Closing previous session for SSE', { sessionId });
if (this.session.server && typeof this.session.server.close === 'function') {
try {
await this.session.server.close();
}
catch (serverError) {
logger_1.logger.warn('Error closing server for SSE session', { sessionId, error: serverError });
}
}
try { try {
logger_1.logger.info('Closing previous session for SSE', { sessionId: this.session.sessionId });
await this.session.transport.close(); await this.session.transport.close();
} }
catch (error) { catch (transportError) {
logger_1.logger.warn('Error closing previous session:', error); logger_1.logger.warn('Error closing transport for SSE session', { sessionId, error: transportError });
} }
} }
try { try {
@@ -1014,6 +1043,13 @@ class SingleSessionHTTPServer {
}); });
}); });
} }
try {
await (0, shared_database_1.closeSharedDatabase)();
logger_1.logger.info('Shared database closed');
}
catch (error) {
logger_1.logger.warn('Error closing shared database:', error);
}
logger_1.logger.info('Single-Session HTTP server shutdown completed'); logger_1.logger.info('Single-Session HTTP server shutdown completed');
} }
getSessionInfo() { getSessionInfo() {

File diff suppressed because one or more lines are too long

View File

@@ -13,6 +13,9 @@ export declare class N8NDocumentationMCPServer {
private previousToolTimestamp; private previousToolTimestamp;
private earlyLogger; private earlyLogger;
private disabledToolsCache; private disabledToolsCache;
private useSharedDatabase;
private sharedDbState;
private isShutdown;
constructor(instanceContext?: InstanceContext, earlyLogger?: EarlyErrorLogger); constructor(instanceContext?: InstanceContext, earlyLogger?: EarlyErrorLogger);
close(): Promise<void>; close(): Promise<void>;
private initializeDatabase; private initializeDatabase;

View File

@@ -1 +1 @@
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAsCA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAmGnE,qBAAa,yBAAyB;IACpC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,EAAE,CAAgC;IAC1C,OAAO,CAAC,UAAU,CAA+B;IACjD,OAAO,CAAC,eAAe,CAAgC;IACvD,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,KAAK,CAAqB;IAClC,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,eAAe,CAAC,CAAkB;IAC1C,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,qBAAqB,CAAsB;IACnD,OAAO,CAAC,WAAW,CAAiC;IACpD,OAAO,CAAC,kBAAkB,CAA4B;gBAE1C,eAAe,CAAC,EAAE,eAAe,EAAE,WAAW,CAAC,EAAE,gBAAgB;IAiGvE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YA6Bd,kBAAkB;YAwClB,wBAAw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ples");
const logger_1 = require("../utils/logger"); const logger_1 = require("../utils/logger");
const node_repository_1 = require("../database/node-repository"); const node_repository_1 = require("../database/node-repository");
const database_adapter_1 = require("../database/database-adapter"); const database_adapter_1 = require("../database/database-adapter");
const shared_database_1 = require("../database/shared-database");
const property_filter_1 = require("../services/property-filter"); const property_filter_1 = require("../services/property-filter");
const task_templates_1 = require("../services/task-templates"); const task_templates_1 = require("../services/task-templates");
const config_validator_1 = require("../services/config-validator"); const config_validator_1 = require("../services/config-validator");
@@ -80,6 +81,9 @@ class N8NDocumentationMCPServer {
this.previousToolTimestamp = Date.now(); this.previousToolTimestamp = Date.now();
this.earlyLogger = null; this.earlyLogger = null;
this.disabledToolsCache = null; this.disabledToolsCache = null;
this.useSharedDatabase = false;
this.sharedDbState = null;
this.isShutdown = false;
this.dbHealthChecked = false; this.dbHealthChecked = false;
this.instanceContext = instanceContext; this.instanceContext = instanceContext;
this.earlyLogger = earlyLogger || null; this.earlyLogger = earlyLogger || null;
@@ -149,10 +153,22 @@ class N8NDocumentationMCPServer {
this.setupHandlers(); this.setupHandlers();
} }
async close() { async close() {
try {
await this.initialized;
}
catch (error) {
logger_1.logger.debug('Initialization had failed, proceeding with cleanup', {
error: error instanceof Error ? error.message : String(error)
});
}
try { try {
await this.server.close(); await this.server.close();
this.cache.destroy(); this.cache.destroy();
if (this.db) { if (this.useSharedDatabase && this.sharedDbState) {
(0, shared_database_1.releaseSharedDatabase)(this.sharedDbState);
logger_1.logger.debug('Released shared database reference');
}
else if (this.db) {
try { try {
this.db.close(); this.db.close();
} }
@@ -166,6 +182,7 @@ class N8NDocumentationMCPServer {
this.repository = null; this.repository = null;
this.templateService = null; this.templateService = null;
this.earlyLogger = null; this.earlyLogger = null;
this.sharedDbState = null;
} }
catch (error) { catch (error) {
logger_1.logger.warn('Error closing MCP server', { error: error instanceof Error ? error.message : String(error) }); logger_1.logger.warn('Error closing MCP server', { error: error instanceof Error ? error.message : String(error) });
@@ -177,17 +194,27 @@ class N8NDocumentationMCPServer {
this.earlyLogger.logCheckpoint(startup_checkpoints_1.STARTUP_CHECKPOINTS.DATABASE_CONNECTING); this.earlyLogger.logCheckpoint(startup_checkpoints_1.STARTUP_CHECKPOINTS.DATABASE_CONNECTING);
} }
logger_1.logger.debug('Database initialization starting...', { dbPath }); logger_1.logger.debug('Database initialization starting...', { dbPath });
this.db = await (0, database_adapter_1.createDatabaseAdapter)(dbPath);
logger_1.logger.debug('Database adapter created');
if (dbPath === ':memory:') { if (dbPath === ':memory:') {
this.db = await (0, database_adapter_1.createDatabaseAdapter)(dbPath);
logger_1.logger.debug('Database adapter created (in-memory mode)');
await this.initializeInMemorySchema(); await this.initializeInMemorySchema();
logger_1.logger.debug('In-memory schema initialized'); logger_1.logger.debug('In-memory schema initialized');
this.repository = new node_repository_1.NodeRepository(this.db);
this.templateService = new template_service_1.TemplateService(this.db);
enhanced_config_validator_1.EnhancedConfigValidator.initializeSimilarityServices(this.repository);
this.useSharedDatabase = false;
}
else {
const sharedState = await (0, shared_database_1.getSharedDatabase)(dbPath);
this.db = sharedState.db;
this.repository = sharedState.repository;
this.templateService = sharedState.templateService;
this.sharedDbState = sharedState;
this.useSharedDatabase = true;
logger_1.logger.debug('Using shared database connection');
} }
this.repository = new node_repository_1.NodeRepository(this.db);
logger_1.logger.debug('Node repository initialized'); logger_1.logger.debug('Node repository initialized');
this.templateService = new template_service_1.TemplateService(this.db);
logger_1.logger.debug('Template service initialized'); logger_1.logger.debug('Template service initialized');
enhanced_config_validator_1.EnhancedConfigValidator.initializeSimilarityServices(this.repository);
logger_1.logger.debug('Similarity services initialized'); logger_1.logger.debug('Similarity services initialized');
if (this.earlyLogger) { if (this.earlyLogger) {
this.earlyLogger.logCheckpoint(startup_checkpoints_1.STARTUP_CHECKPOINTS.DATABASE_CONNECTED); this.earlyLogger.logCheckpoint(startup_checkpoints_1.STARTUP_CHECKPOINTS.DATABASE_CONNECTED);
@@ -2889,7 +2916,26 @@ Full documentation is being prepared. For now, use get_node_essentials for confi
process.stdin.resume(); process.stdin.resume();
} }
async shutdown() { async shutdown() {
if (this.isShutdown) {
logger_1.logger.debug('Shutdown already called, skipping');
return;
}
this.isShutdown = true;
logger_1.logger.info('Shutting down MCP server...'); logger_1.logger.info('Shutting down MCP server...');
try {
await this.initialized;
}
catch (error) {
logger_1.logger.debug('Initialization had failed, proceeding with cleanup', {
error: error instanceof Error ? error.message : String(error)
});
}
try {
await this.server.close();
}
catch (error) {
logger_1.logger.error('Error closing MCP server:', error);
}
if (this.cache) { if (this.cache) {
try { try {
this.cache.destroy(); this.cache.destroy();
@@ -2899,15 +2945,29 @@ Full documentation is being prepared. For now, use get_node_essentials for confi
logger_1.logger.error('Error cleaning up cache:', error); logger_1.logger.error('Error cleaning up cache:', error);
} }
} }
if (this.db) { if (this.useSharedDatabase && this.sharedDbState) {
try { try {
await this.db.close(); (0, shared_database_1.releaseSharedDatabase)(this.sharedDbState);
logger_1.logger.info('Released shared database reference');
}
catch (error) {
logger_1.logger.error('Error releasing shared database:', error);
}
}
else if (this.db) {
try {
this.db.close();
logger_1.logger.info('Database connection closed'); logger_1.logger.info('Database connection closed');
} }
catch (error) { catch (error) {
logger_1.logger.error('Error closing database:', error); logger_1.logger.error('Error closing database:', error);
} }
} }
this.db = null;
this.repository = null;
this.templateService = null;
this.earlyLogger = null;
this.sharedDbState = null;
} }
} }
exports.N8NDocumentationMCPServer = N8NDocumentationMCPServer; exports.N8NDocumentationMCPServer = N8NDocumentationMCPServer;

File diff suppressed because one or more lines are too long

View File

@@ -26,10 +26,10 @@ export declare const workflowNodeSchema: z.ZodObject<{
parameters: Record<string, unknown>; parameters: Record<string, unknown>;
credentials?: Record<string, unknown> | undefined; credentials?: Record<string, unknown> | undefined;
retryOnFail?: boolean | undefined; retryOnFail?: boolean | undefined;
continueOnFail?: boolean | undefined;
maxTries?: number | undefined; maxTries?: number | undefined;
waitBetweenTries?: number | undefined; waitBetweenTries?: number | undefined;
alwaysOutputData?: boolean | undefined; alwaysOutputData?: boolean | undefined;
continueOnFail?: boolean | undefined;
executeOnce?: boolean | undefined; executeOnce?: boolean | undefined;
disabled?: boolean | undefined; disabled?: boolean | undefined;
notes?: string | undefined; notes?: string | undefined;
@@ -43,10 +43,10 @@ export declare const workflowNodeSchema: z.ZodObject<{
parameters: Record<string, unknown>; parameters: Record<string, unknown>;
credentials?: Record<string, unknown> | undefined; credentials?: Record<string, unknown> | undefined;
retryOnFail?: boolean | undefined; retryOnFail?: boolean | undefined;
continueOnFail?: boolean | undefined;
maxTries?: number | undefined; maxTries?: number | undefined;
waitBetweenTries?: number | undefined; waitBetweenTries?: number | undefined;
alwaysOutputData?: boolean | undefined; alwaysOutputData?: boolean | undefined;
continueOnFail?: boolean | undefined;
executeOnce?: boolean | undefined; executeOnce?: boolean | undefined;
disabled?: boolean | undefined; disabled?: boolean | undefined;
notes?: string | undefined; notes?: string | undefined;

View File

@@ -12,6 +12,8 @@ export declare class TelemetryBatchProcessor {
private flushTimes; private flushTimes;
private deadLetterQueue; private deadLetterQueue;
private readonly maxDeadLetterSize; private readonly maxDeadLetterSize;
private eventListeners;
private started;
constructor(supabase: SupabaseClient | null, isEnabled: () => boolean); constructor(supabase: SupabaseClient | null, isEnabled: () => boolean);
start(): void; start(): void;
stop(): void; stop(): void;

View File

@@ -1 +1 @@
{"version":3,"file":"batch-processor.d.ts","sourceRoot":"","sources":["../../src/telemetry/batch-processor.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,sBAAsB,EAAoB,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAoClI,qBAAa,uBAAuB;IAoBhC,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,SAAS;IApBnB,OAAO,CAAC,UAAU,CAAC,CAAiB;IACpC,OAAO,CAAC,gBAAgB,CAAkB;IAC1C,OAAO,CAAC,mBAAmB,CAAkB;IAC7C,OAAO,CAA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,OAAO,CAAC,cAAc,CAA0B;IAChD,OAAO,CAAC,OAAO,CAQb;IACF,OAAO,CAAC,UAAU,CAAgB;IAClC,OAAO,CAAC,eAAe,CAAuE;IAC9F,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAO;IAEzC,OAAO,CAAC,cAAc,CAIf;IACP,OAAO,CAAC,OAAO,CAAkB;gBAGvB,QAAQ,EAAE,cAAc,GAAG,IAAI,EAC/B,SAAS,EAAE,MAAM,OAAO;IAQlC,KAAK,IAAI,IAAI;IA0Cb,IAAI,IAAI,IAAI;IAyBN,KAAK,CAAC,MAAM,CAAC,EAAE,cAAc,EAAE,EAAE,SAAS,CAAC,EAAE,iBAAiB,EAAE,EAAE,SAAS,CAAC,EAAE,sBAAsB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;YAgD9G,WAAW;YAmDX,cAAc;YAuDd,cAAc;YAiEd,gBAAgB;IAgD9B,OAAO,CAAC,aAAa;IAarB,OAAO,CAAC,oBAAoB;IAiB5B,OAAO,CAAC,oBAAoB;YAmBd,sBAAsB;IAgCpC,OAAO,CAAC,eAAe;IAiBvB,UAAU,IAAI,gBAAgB,GAAG;QAAE,mBAAmB,EAAE,GAAG,CAAC;QAAC,mBAAmB,EAAE,MAAM,CAAA;KAAE;IAW1F,YAAY,IAAI,IAAI;CAarB"}

View File

@@ -33,26 +33,36 @@ class TelemetryBatchProcessor {
this.flushTimes = []; this.flushTimes = [];
this.deadLetterQueue = []; this.deadLetterQueue = [];
this.maxDeadLetterSize = 100; this.maxDeadLetterSize = 100;
this.eventListeners = {};
this.started = false;
this.circuitBreaker = new telemetry_error_1.TelemetryCircuitBreaker(); this.circuitBreaker = new telemetry_error_1.TelemetryCircuitBreaker();
} }
start() { start() {
if (!this.isEnabled() || !this.supabase) if (!this.isEnabled() || !this.supabase)
return; return;
if (this.started) {
logger_1.logger.debug('Telemetry batch processor already started, skipping');
return;
}
this.flushTimer = setInterval(() => { this.flushTimer = setInterval(() => {
this.flush(); this.flush();
}, telemetry_types_1.TELEMETRY_CONFIG.BATCH_FLUSH_INTERVAL); }, telemetry_types_1.TELEMETRY_CONFIG.BATCH_FLUSH_INTERVAL);
if (typeof this.flushTimer === 'object' && 'unref' in this.flushTimer) { if (typeof this.flushTimer === 'object' && 'unref' in this.flushTimer) {
this.flushTimer.unref(); this.flushTimer.unref();
} }
process.on('beforeExit', () => this.flush()); this.eventListeners.beforeExit = () => this.flush();
process.on('SIGINT', () => { this.eventListeners.sigint = () => {
this.flush(); this.flush();
process.exit(0); process.exit(0);
}); };
process.on('SIGTERM', () => { this.eventListeners.sigterm = () => {
this.flush(); this.flush();
process.exit(0); process.exit(0);
}); };
process.on('beforeExit', this.eventListeners.beforeExit);
process.on('SIGINT', this.eventListeners.sigint);
process.on('SIGTERM', this.eventListeners.sigterm);
this.started = true;
logger_1.logger.debug('Telemetry batch processor started'); logger_1.logger.debug('Telemetry batch processor started');
} }
stop() { stop() {
@@ -60,6 +70,17 @@ class TelemetryBatchProcessor {
clearInterval(this.flushTimer); clearInterval(this.flushTimer);
this.flushTimer = undefined; this.flushTimer = undefined;
} }
if (this.eventListeners.beforeExit) {
process.removeListener('beforeExit', this.eventListeners.beforeExit);
}
if (this.eventListeners.sigint) {
process.removeListener('SIGINT', this.eventListeners.sigint);
}
if (this.eventListeners.sigterm) {
process.removeListener('SIGTERM', this.eventListeners.sigterm);
}
this.eventListeners = {};
this.started = false;
logger_1.logger.debug('Telemetry batch processor stopped'); logger_1.logger.debug('Telemetry batch processor stopped');
} }
async flush(events, workflows, mutations) { async flush(events, workflows, mutations) {

File diff suppressed because one or more lines are too long

7384
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "n8n-mcp", "name": "n8n-mcp",
"version": "2.33.5", "version": "2.33.6",
"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",
@@ -150,16 +150,16 @@
}, },
"dependencies": { "dependencies": {
"@modelcontextprotocol/sdk": "1.20.1", "@modelcontextprotocol/sdk": "1.20.1",
"@n8n/n8n-nodes-langchain": "^2.4.3", "@n8n/n8n-nodes-langchain": "^2.6.2",
"@supabase/supabase-js": "^2.57.4", "@supabase/supabase-js": "^2.57.4",
"dotenv": "^16.5.0", "dotenv": "^16.5.0",
"express": "^5.1.0", "express": "^5.1.0",
"express-rate-limit": "^7.1.5", "express-rate-limit": "^7.1.5",
"form-data": "^4.0.5", "form-data": "^4.0.5",
"lru-cache": "^11.2.1", "lru-cache": "^11.2.1",
"n8n": "^2.4.4", "n8n": "^2.6.3",
"n8n-core": "^2.4.2", "n8n-core": "^2.6.1",
"n8n-workflow": "^2.4.2", "n8n-workflow": "^2.6.0",
"openai": "^4.77.0", "openai": "^4.77.0",
"sql.js": "^1.13.0", "sql.js": "^1.13.0",
"tslib": "^2.6.2", "tslib": "^2.6.2",