crawlforge-mcp-server 3.0.2 → 3.0.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crawlforge-mcp-server",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "description": "CrawlForge MCP Server - Professional Model Context Protocol server with 19 comprehensive web scraping, crawling, and content processing tools.",
5
5
  "main": "server.js",
6
6
  "bin": {
package/server.js CHANGED
@@ -1,5 +1,30 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ // Secure Creator Mode Authentication - MUST run before any imports
4
+ // Only the creator can enable unlimited access with their secret
5
+ import crypto from 'crypto';
6
+ import dotenv from 'dotenv';
7
+
8
+ // Load .env file early to check for creator secret
9
+ dotenv.config({ path: '.env', quiet: true });
10
+
11
+ const CREATOR_SECRET_HASH = 'cfef62e5068d48e7dd6a39c9e16f0be2615510c6b68274fc8abe3156feb5050b';
12
+
13
+ if (process.env.CRAWLFORGE_CREATOR_SECRET) {
14
+ const providedHash = crypto
15
+ .createHash('sha256')
16
+ .update(process.env.CRAWLFORGE_CREATOR_SECRET)
17
+ .digest('hex');
18
+
19
+ if (providedHash === CREATOR_SECRET_HASH) {
20
+ process.env.CRAWLFORGE_CREATOR_MODE = 'true';
21
+ console.log('🔓 Creator Mode Enabled - Unlimited Access');
22
+ } else {
23
+ console.warn('⚠️ Invalid creator secret provided');
24
+ }
25
+ }
26
+
27
+ // Now import everything else
3
28
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
29
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
30
  import { z } from "zod";
@@ -28,11 +53,6 @@ import { config, validateConfig, isSearchConfigured, getToolConfig, getActiveSea
28
53
  // Authentication Manager
29
54
  import AuthManager from "./src/core/AuthManager.js";
30
55
 
31
- // Enable creator mode if BYPASS_API_KEY is set
32
- if (process.env.BYPASS_API_KEY === 'true') {
33
- process.env.CRAWLFORGE_CREATOR_MODE = 'true';
34
- }
35
-
36
56
  // Initialize Authentication Manager
37
57
  await AuthManager.initialize();
38
58
 
@@ -16,14 +16,15 @@ class AuthManager {
16
16
  this.lastCreditCheck = null;
17
17
  this.CREDIT_CHECK_INTERVAL = 60000; // Check credits every minute max
18
18
  this.initialized = false;
19
- this.creatorMode = process.env.CRAWLFORGE_CREATOR_MODE === 'true';
19
+ // NOTE: Don't read creator mode in constructor - it's set dynamically in server.js
20
20
  }
21
21
 
22
22
  /**
23
23
  * Check if running in creator mode (unlimited access, no API required)
24
+ * Reads from environment variable dynamically to ensure proper initialization order
24
25
  */
25
26
  isCreatorMode() {
26
- return this.creatorMode;
27
+ return process.env.CRAWLFORGE_CREATOR_MODE === 'true';
27
28
  }
28
29
 
29
30
  /**