firecrawl-mcp 3.1.13 → 3.2.0

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.
Files changed (2) hide show
  1. package/dist/index.js +21 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -79,8 +79,9 @@ const server = new FastMCP({
79
79
  return { firecrawlApiKey: apiKey };
80
80
  }
81
81
  else {
82
- if (!process.env.FIRECRAWL_API_KEY) {
83
- console.error('Firecrawl API key is required');
82
+ // For self-hosted instances, API key is optional if FIRECRAWL_API_URL is provided
83
+ if (!process.env.FIRECRAWL_API_KEY && !process.env.FIRECRAWL_API_URL) {
84
+ console.error('Either FIRECRAWL_API_KEY or FIRECRAWL_API_URL must be provided');
84
85
  process.exit(1);
85
86
  }
86
87
  return { firecrawlApiKey: process.env.FIRECRAWL_API_KEY };
@@ -95,19 +96,31 @@ const server = new FastMCP({
95
96
  },
96
97
  });
97
98
  function createClient(apiKey) {
98
- return new FirecrawlApp({
99
- apiKey,
99
+ const config = {
100
100
  ...(process.env.FIRECRAWL_API_URL && {
101
101
  apiUrl: process.env.FIRECRAWL_API_URL,
102
102
  }),
103
- });
103
+ };
104
+ // Only add apiKey if it's provided (required for cloud, optional for self-hosted)
105
+ if (apiKey) {
106
+ config.apiKey = apiKey;
107
+ }
108
+ return new FirecrawlApp(config);
104
109
  }
105
110
  const ORIGIN = 'mcp-fastmcp';
106
111
  function getClient(session) {
107
- if (!session || !session.firecrawlApiKey) {
108
- throw new Error('Unauthorized');
112
+ // For cloud service, API key is required
113
+ if (process.env.CLOUD_SERVICE === 'true') {
114
+ if (!session || !session.firecrawlApiKey) {
115
+ throw new Error('Unauthorized');
116
+ }
117
+ return createClient(session.firecrawlApiKey);
118
+ }
119
+ // For self-hosted instances, API key is optional if FIRECRAWL_API_URL is provided
120
+ if (!process.env.FIRECRAWL_API_URL && (!session || !session.firecrawlApiKey)) {
121
+ throw new Error('Unauthorized: API key is required when not using a self-hosted instance');
109
122
  }
110
- return createClient(session.firecrawlApiKey);
123
+ return createClient(session?.firecrawlApiKey);
111
124
  }
112
125
  function asText(data) {
113
126
  return JSON.stringify(data, null, 2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firecrawl-mcp",
3
- "version": "3.1.13",
3
+ "version": "3.2.0",
4
4
  "description": "MCP server for Firecrawl web scraping integration. Supports both cloud and self-hosted instances. Features include web scraping, search, batch processing, structured data extraction, and LLM-powered content analysis.",
5
5
  "type": "module",
6
6
  "bin": {