crawlforge-mcp-server 4.2.6 → 4.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server.js +8 -2
- package/src/utils/Logger.js +8 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "crawlforge-mcp-server",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.8",
|
|
4
4
|
"description": "CrawlForge MCP Server - Professional Model Context Protocol server with 23 web scraping, crawling, and content processing tools. Defaults to local Ollama for LLM extraction (no API key needed); OpenAI/Anthropic available as opt-in. v4.0 adds Markdown-first output, pre-built site templates, Camoufox stealth engine, and cost transparency.",
|
|
5
5
|
"main": "server.js",
|
|
6
6
|
"bin": {
|
package/server.js
CHANGED
|
@@ -1163,12 +1163,18 @@ async function gracefulShutdown(signal) {
|
|
|
1163
1163
|
process.on('SIGINT', () => gracefulShutdown('SIGINT'));
|
|
1164
1164
|
process.on('SIGTERM', () => gracefulShutdown('SIGTERM'));
|
|
1165
1165
|
process.on('uncaughtException', (error) => {
|
|
1166
|
+
// Keep the long-running stdio server alive: a single uncaught error in one
|
|
1167
|
+
// request path should not tear down the session for every other tool. We log
|
|
1168
|
+
// and continue rather than exiting. (Node considers the process state
|
|
1169
|
+
// technically undefined after this; acceptable trade-off for a resilient MCP
|
|
1170
|
+
// server, vs. disconnecting the client on any stray throw.)
|
|
1166
1171
|
console.error('Uncaught Exception:', error);
|
|
1167
|
-
gracefulShutdown('uncaughtException');
|
|
1168
1172
|
});
|
|
1169
1173
|
process.on('unhandledRejection', (reason, promise) => {
|
|
1174
|
+
// A stray rejection — typically background async work inside a single tool —
|
|
1175
|
+
// must NOT terminate the whole stdio MCP server, which would disconnect every
|
|
1176
|
+
// other tool mid-session. Log it and keep serving.
|
|
1170
1177
|
console.error('Unhandled Rejection at:', promise, 'reason:', reason);
|
|
1171
|
-
gracefulShutdown('unhandledRejection');
|
|
1172
1178
|
});
|
|
1173
1179
|
|
|
1174
1180
|
// Memory monitoring (development only)
|
package/src/utils/Logger.js
CHANGED
|
@@ -391,8 +391,9 @@ export class Logger {
|
|
|
391
391
|
|
|
392
392
|
this.winston.error(message, errorContext);
|
|
393
393
|
|
|
394
|
-
// Track error for analysis
|
|
395
|
-
|
|
394
|
+
// Track error for analysis (only when an Error object was actually passed —
|
|
395
|
+
// logger.error(message) with no error must not reach trackError's error.name).
|
|
396
|
+
if (this.enableErrorTracking && error) {
|
|
396
397
|
this.trackError(error, context, requestId);
|
|
397
398
|
}
|
|
398
399
|
}
|
|
@@ -425,11 +426,13 @@ export class Logger {
|
|
|
425
426
|
trackError(error, context, requestId) {
|
|
426
427
|
// Could be extended to send to error tracking service
|
|
427
428
|
// For now, just log structured error data
|
|
429
|
+
// Null-safe: a shared logger must never throw, even if called with a
|
|
430
|
+
// non-Error (or null) value.
|
|
428
431
|
this.winston.error('Error tracking', {
|
|
429
432
|
errorTracking: {
|
|
430
|
-
type: error
|
|
431
|
-
message: error
|
|
432
|
-
stack: error
|
|
433
|
+
type: error?.name ?? 'UnknownError',
|
|
434
|
+
message: error?.message ?? String(error ?? ''),
|
|
435
|
+
stack: error?.stack,
|
|
433
436
|
context,
|
|
434
437
|
requestId,
|
|
435
438
|
timestamp: new Date().toISOString()
|