mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-02-06 05:23:08 +00:00
- Add close() method to N8NDocumentationMCPServer that: - Calls server.close() (MCP SDK cleanup) - Clears internal cache - Nullifies service references to help GC - Update removeSession() to call server.close() before releasing references Root cause: removeSession() deleted server from map but didn't call cleanup Evidence: Production server memory grew ~1GB in 43 minutes (10% to 35%) Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Romuald Członkowski <romualdczlonkowski@MacBook-Pro-Romuald.local> Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
60479e0eb4
commit
cdaa29e7a2
13
dist/mcp/server.js
vendored
13
dist/mcp/server.js
vendored
@@ -147,6 +147,19 @@ class N8NDocumentationMCPServer {
|
||||
});
|
||||
this.setupHandlers();
|
||||
}
|
||||
async close() {
|
||||
try {
|
||||
await this.server.close();
|
||||
this.cache.clear();
|
||||
this.db = null;
|
||||
this.repository = null;
|
||||
this.templateService = null;
|
||||
this.earlyLogger = null;
|
||||
}
|
||||
catch (error) {
|
||||
logger_1.logger.warn('Error closing MCP server', { error: error instanceof Error ? error.message : String(error) });
|
||||
}
|
||||
}
|
||||
async initializeDatabase(dbPath) {
|
||||
try {
|
||||
if (this.earlyLogger) {
|
||||
|
||||
Reference in New Issue
Block a user