firecrawl-mcp 3.23.6 → 3.23.7

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/README.md CHANGED
@@ -35,11 +35,11 @@ Connect to the remote hosted server with no setup:
35
35
  https://mcp.firecrawl.dev/v2/mcp
36
36
  ```
37
37
 
38
- On the keyless free tier, `scrape`, `search`, and `interact` work without an API key (rate-limited). Other tools such as `crawl`, `map`, and `agent` still need a key.
38
+ On the keyless free tier, `scrape`, `search`, and `parse` work without an API key (rate-limited). Other tools such as `crawl`, `map`, and `agent` still need a key.
39
39
 
40
40
  Prefer OAuth or an API key whenever the human can sign up. It unlocks the full tool set and higher limits.
41
41
 
42
- For an interactive account connection, use:
42
+ For an interactive account connection, configure your MCP client to use this server URL. This is an MCP endpoint, **not a browser page**; use the client's account-connection flow and do not add a second Firecrawl server entry when reconnecting:
43
43
 
44
44
  ```
45
45
  https://mcp.firecrawl.dev/v2/mcp-oauth
@@ -57,7 +57,7 @@ Then configure the client's secure header or secret setting with:
57
57
  Authorization: Bearer <FIRECRAWL_API_KEY>
58
58
  ```
59
59
 
60
- Never put an API key in the server URL. See the [hosted MCP setup guide](https://docs.firecrawl.dev/developer-guides/mcp-setup-guides/oauth) and the [agent onboarding guide](https://www.firecrawl.dev/agent-onboarding/SKILL.md) for client-specific instructions.
60
+ Never put an API key in the server URL. Never put an API key in an agent chat. Configure it directly in the client or secret manager. See the [hosted MCP setup guide](https://docs.firecrawl.dev/mcp-server) and the [agent onboarding guide](https://www.firecrawl.dev/agent-onboarding/SKILL.md) for client-specific instructions.
61
61
 
62
62
  #### Search-only endpoint
63
63
 
package/dist/index.js CHANGED
@@ -802,6 +802,11 @@ Search indexed public GitHub issue, pull-request, and README content. Returns ra
802
802
  });
803
803
  }
804
804
 
805
+ // src/www-authenticate.ts
806
+ function escapeWWWAuthenticateValue(value) {
807
+ return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
808
+ }
809
+
805
810
  // src/index.ts
806
811
  dotenv.config({ debug: false, quiet: true });
807
812
  var require2 = createRequire(import.meta.url);
@@ -849,6 +854,9 @@ var DEFAULT_MCP_RESOURCE_URL = "https://mcp.firecrawl.dev/v2/mcp";
849
854
  var DEFAULT_MCP_OAUTH_RESOURCE_URL = "https://mcp.firecrawl.dev/v2/mcp-oauth";
850
855
  var DEFAULT_MCP_SEARCH_RESOURCE_URL = "https://mcp.firecrawl.dev/v2/mcp-search";
851
856
  var DEFAULT_MCP_SEARCH_ENDPOINT = "/v2/mcp-search";
857
+ var MCP_CONNECTION_GUIDE_URL = "https://docs.firecrawl.dev/mcp-server";
858
+ var MCP_OAUTH_SERVER_URL = "https://mcp.firecrawl.dev/v2/mcp-oauth";
859
+ var API_KEY_SIGNUP_URL = "https://www.firecrawl.dev/app/api-keys";
852
860
  function withoutTrailingSlash(value) {
853
861
  return value.replace(/\/+$/, "");
854
862
  }
@@ -884,23 +892,23 @@ function getOAuthProtectedResourceMetadataUrl(profile) {
884
892
  const base = `${resource.origin}/.well-known/oauth-protected-resource`;
885
893
  return profile.id === "full" ? base : `${base}${resource.pathname}`;
886
894
  }
887
- function escapeWWWAuthenticateValue(value) {
888
- return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
889
- }
890
- function createOAuthChallengeResponse(error, profile) {
895
+ function createOAuthChallengeResponse(error, profile, details = {}) {
891
896
  if (!isMcpOAuthEnabled()) {
892
897
  return void 0;
893
898
  }
894
899
  const errorMessage = error instanceof Error ? error.message : String(error || "Unauthorized");
895
900
  const wwwAuthenticate = [
896
- `resource_metadata="${escapeWWWAuthenticateValue(getOAuthProtectedResourceMetadataUrl(profile))}"`,
901
+ ...profile.advertiseOAuth ? [
902
+ `resource_metadata="${escapeWWWAuthenticateValue(getOAuthProtectedResourceMetadataUrl(profile))}"`
903
+ ] : [],
897
904
  'error="invalid_token"',
898
905
  `error_description="${escapeWWWAuthenticateValue(errorMessage)}"`
899
906
  ].join(", ");
900
907
  return new Response(
901
908
  JSON.stringify({
902
909
  error: "invalid_token",
903
- error_description: errorMessage
910
+ error_description: errorMessage,
911
+ ...details
904
912
  }),
905
913
  {
906
914
  headers: {
@@ -911,11 +919,26 @@ function createOAuthChallengeResponse(error, profile) {
911
919
  }
912
920
  );
913
921
  }
914
- function createInvalidCredentialResponse(error) {
922
+ function createInvalidCredentialResponse(_error) {
923
+ const recovery = invalidApiKeyRecoveryPayload();
915
924
  return new Response(
916
925
  JSON.stringify({
917
926
  error: "invalid_api_key",
918
- error_description: error.message
927
+ error_description: recovery.message,
928
+ ...recovery
929
+ }),
930
+ {
931
+ headers: { "Content-Type": "application/json" },
932
+ status: 401
933
+ }
934
+ );
935
+ }
936
+ function createInvalidOAuthRecoveryResponse(recovery) {
937
+ return new Response(
938
+ JSON.stringify({
939
+ error: "invalid_token",
940
+ error_description: recovery.message,
941
+ ...recovery
919
942
  }),
920
943
  {
921
944
  headers: { "Content-Type": "application/json" },
@@ -941,6 +964,12 @@ var InvalidFirecrawlCredentialError = class extends Error {
941
964
  this.name = "InvalidFirecrawlCredentialError";
942
965
  }
943
966
  };
967
+ var InvalidOAuthCredentialError = class extends Error {
968
+ constructor() {
969
+ super("Invalid OAuth access token");
970
+ this.name = "InvalidOAuthCredentialError";
971
+ }
972
+ };
944
973
  var MCP_GLOBAL_SCOPE = "firecrawl:global";
945
974
  function values(value) {
946
975
  if (typeof value === "string") return value.split(/\s+/).filter(Boolean);
@@ -1019,7 +1048,7 @@ async function resolveCredentialFromHeaders(headers, profile) {
1019
1048
  }
1020
1049
  if (!data.active || !data.api_key) {
1021
1050
  if (isFirecrawlOAuthAccessToken(token)) {
1022
- throw new Error("Invalid OAuth access token");
1051
+ throw new InvalidOAuthCredentialError();
1023
1052
  }
1024
1053
  return { invalid: true };
1025
1054
  }
@@ -1171,6 +1200,15 @@ function makeAuthenticate(profile) {
1171
1200
  if (error instanceof InvalidFirecrawlCredentialError) {
1172
1201
  throw createInvalidCredentialResponse(error);
1173
1202
  }
1203
+ if (error instanceof InvalidOAuthCredentialError) {
1204
+ const recovery = invalidOAuthRecoveryPayload(profile);
1205
+ const oauthChallenge2 = createOAuthChallengeResponse(
1206
+ new Error(recovery.message),
1207
+ profile,
1208
+ recovery
1209
+ );
1210
+ throw oauthChallenge2 ?? createInvalidOAuthRecoveryResponse(recovery);
1211
+ }
1174
1212
  if (error instanceof CredentialValidationUnavailableError) {
1175
1213
  throw new Response(
1176
1214
  JSON.stringify({
@@ -1296,6 +1334,7 @@ function makeFullProfile() {
1296
1334
  allowKeyless: !account,
1297
1335
  acceptApiKeys: true,
1298
1336
  acceptLegacyAudience: account && process.env.MCP_OAUTH_ACCEPT_LEGACY_V2_MCP_AUD !== "false",
1337
+ advertiseOAuth: account,
1299
1338
  primary: true
1300
1339
  };
1301
1340
  }
@@ -1323,6 +1362,7 @@ function makeSearchProfile({ primary = false } = {}) {
1323
1362
  // deployment explicitly enables the same profile flag used by primary.
1324
1363
  acceptApiKeys: !oauthOnly,
1325
1364
  requireManagedOAuth: oauthOnly,
1365
+ advertiseOAuth: true,
1326
1366
  primary
1327
1367
  };
1328
1368
  }
@@ -1337,7 +1377,7 @@ function createServer(profile) {
1337
1377
  logger: new ConsoleLogger(),
1338
1378
  roots: { enabled: false },
1339
1379
  oauth: {
1340
- enabled: isMcpOAuthEnabled(),
1380
+ enabled: isMcpOAuthEnabled() && profile.advertiseOAuth,
1341
1381
  protectedResource: {
1342
1382
  authorizationServers: [getOAuthIssuer()],
1343
1383
  bearerMethodsSupported: ["header"],
@@ -1369,27 +1409,82 @@ function isHostedKeylessSession(session) {
1369
1409
  function isLocalKeylessStartup() {
1370
1410
  return process.env.CLOUD_SERVICE !== "true" && !isHttpStreamingTransport() && !resolveCredentialFromEnv() && !normalizeHeader(process.env.FIRECRAWL_API_URL);
1371
1411
  }
1412
+ var NEVER_SHARE_API_KEY_SENTENCE = "Never ask for, accept, or put an API key in chat or in an MCP URL.";
1413
+ var RETRY_AFTER_CONFIRM_SUFFIX = "start a new client session or run and retry the original task.";
1414
+ var HUMAN_CONNECTION_GUIDANCE = `A human or operator must complete the connection because this session cannot reconnect Firecrawl itself. Ask the human to choose before changing anything: (1) in the MCP client's settings, update or replace the existing Firecrawl server entry so its URL is ${MCP_OAUTH_SERVER_URL}, then complete sign-in through the client. That URL is a client configuration value, not a page to open in a browser. Do not add a second Firecrawl server or change configuration without approval; or (2) have an operator create an API key at ${API_KEY_SIGNUP_URL} and configure it in the client or secret manager outside this chat. ${NEVER_SHARE_API_KEY_SENTENCE} After the human confirms setup, ${RETRY_AFTER_CONFIRM_SUFFIX} Connection guide: ${MCP_CONNECTION_GUIDE_URL}`;
1415
+ var ACCOUNT_ONLY_TOOL_GUIDANCE = `This tool needs a connected Firecrawl account. Search, Scrape, and Parse remain available, so continue with those if they can complete the task. Only if this task specifically requires this tool, tell the user that a human must update the existing Firecrawl connection using ${MCP_CONNECTION_GUIDE_URL}. Never ask for or accept an API key in chat. After setup, start a new client session and retry.`;
1416
+ var HUMAN_RECONNECT_ACCOUNT_ACTION = {
1417
+ kind: "human_reconnect_account",
1418
+ actor: "human",
1419
+ requires_user_consent: true,
1420
+ existing_server_only: true,
1421
+ server_url: MCP_OAUTH_SERVER_URL,
1422
+ open_server_url_in_browser: false,
1423
+ docs_url: MCP_CONNECTION_GUIDE_URL
1424
+ };
1425
+ var OPERATOR_CONFIGURE_API_KEY_ACTION = {
1426
+ kind: "operator_configure_api_key",
1427
+ actor: "human_or_operator",
1428
+ requires_user_consent: true,
1429
+ credential_delivery: "outside_agent_chat",
1430
+ signup_url: API_KEY_SIGNUP_URL
1431
+ };
1432
+ var HUMAN_CONNECTION_ACTIONS = [
1433
+ HUMAN_RECONNECT_ACCOUNT_ACTION,
1434
+ OPERATOR_CONFIGURE_API_KEY_ACTION
1435
+ ];
1436
+ function connectionRecoveryPayload(params) {
1437
+ return {
1438
+ code: params.code,
1439
+ auth_mode: params.authMode,
1440
+ message: params.message,
1441
+ docs_url: MCP_CONNECTION_GUIDE_URL,
1442
+ next_actions: params.nextActions
1443
+ };
1444
+ }
1445
+ function invalidApiKeyRecoveryPayload() {
1446
+ return connectionRecoveryPayload({
1447
+ code: "CREDENTIAL_INVALID",
1448
+ authMode: "api_key",
1449
+ message: `The Firecrawl API key configured for this server is invalid or revoked. Ask a human or operator to replace it in this existing server configuration or secret manager outside this chat. ${NEVER_SHARE_API_KEY_SENTENCE} After the human confirms the change, ${RETRY_AFTER_CONFIRM_SUFFIX}`,
1450
+ nextActions: [OPERATOR_CONFIGURE_API_KEY_ACTION]
1451
+ });
1452
+ }
1453
+ function invalidOAuthRecoveryPayload(profile) {
1454
+ if (isMcpOAuthEnabled() && profile.advertiseOAuth) {
1455
+ return connectionRecoveryPayload({
1456
+ code: "OAUTH_CONNECTION_INVALID",
1457
+ authMode: "oauth",
1458
+ message: `This Firecrawl account connection is no longer valid. Ask the human to sign in again through this MCP client's account-connection flow. Do not add a second Firecrawl server or open the MCP server URL directly in a browser. After sign-in, ${RETRY_AFTER_CONFIRM_SUFFIX}`,
1459
+ nextActions: [HUMAN_RECONNECT_ACCOUNT_ACTION, OPERATOR_CONFIGURE_API_KEY_ACTION]
1460
+ });
1461
+ }
1462
+ return connectionRecoveryPayload({
1463
+ code: "OAUTH_CONNECTION_INVALID",
1464
+ authMode: "oauth",
1465
+ message: `This Firecrawl account connection is no longer valid, and this server does not start account sign-in. Ask the human to choose before changing anything: (1) have an operator create a Firecrawl API key at ${API_KEY_SIGNUP_URL} and configure it on this existing server outside this chat; or (2) update this existing server's URL to ${MCP_OAUTH_SERVER_URL} and complete sign-in through the MCP client. That URL is a client configuration value, not a page to open in a browser. ${NEVER_SHARE_API_KEY_SENTENCE} After the human confirms the change, ${RETRY_AFTER_CONFIRM_SUFFIX}`,
1466
+ nextActions: [OPERATOR_CONFIGURE_API_KEY_ACTION, HUMAN_RECONNECT_ACCOUNT_ACTION]
1467
+ });
1468
+ }
1372
1469
  function recoveryPayload(code, requestId = randomUUID(), options = {}) {
1373
1470
  const retryAfterSeconds = options.retryAfterSeconds;
1374
1471
  const isQuotaExhausted = code === "KEYLESS_QUOTA_EXHAUSTED" || code === "KEYLESS_LIMIT_REACHED";
1375
1472
  const isToolUnavailable = code === "KEYLESS_TOOL_NOT_AVAILABLE";
1376
1473
  const isKeylessAccessUnavailable = code === "KEYLESS_ACCESS_NOT_AVAILABLE";
1377
1474
  const isKeylessEligibilityUnavailable = code === "KEYLESS_ELIGIBILITY_UNAVAILABLE";
1378
- const oauthUrl = "https://mcp.firecrawl.dev/v2/mcp-oauth";
1379
1475
  return {
1380
1476
  code,
1381
1477
  request_id: requestId,
1382
1478
  auth_mode: code === "CREDENTIAL_INVALID" ? "credential_error" : "keyless",
1383
- message: code === "CREDENTIAL_INVALID" ? `The supplied Firecrawl credential is invalid or revoked. Reconnect the account via OAuth (https://mcp.firecrawl.dev/v2/mcp-oauth) or create a new API key at https://www.firecrawl.dev/signin and send it as Authorization: Bearer <FIRECRAWL_API_KEY>, then retry.` : isQuotaExhausted ? `The free daily limit for this network has been reached${retryAfterSeconds ? `; try again in about ${retryAfterSeconds} seconds` : ""}. To continue now, connect a Firecrawl account via OAuth (https://mcp.firecrawl.dev/v2/mcp-oauth) or create a free API key at https://www.firecrawl.dev/signin and send it as Authorization: Bearer <FIRECRAWL_API_KEY>.` : isToolUnavailable ? "The free tier includes Search, Scrape, and Parse. This tool needs a connected account; Search, Scrape, and Parse still work, so no action is required." : isKeylessAccessUnavailable ? `Anonymous keyless access is unavailable for this request. To continue, connect a Firecrawl account via OAuth (https://mcp.firecrawl.dev/v2/mcp-oauth) or create a free API key at https://www.firecrawl.dev/signin and send it as Authorization: Bearer <FIRECRAWL_API_KEY>.` : isKeylessEligibilityUnavailable ? "The anonymous keyless eligibility check is temporarily unavailable. Retry shortly." : `This tool requires a Firecrawl account or API key. Connect an account via OAuth (https://mcp.firecrawl.dev/v2/mcp-oauth) or create a free API key at https://www.firecrawl.dev/signin and send it as Authorization: Bearer <FIRECRAWL_API_KEY>, then retry.`,
1479
+ message: code === "CREDENTIAL_INVALID" ? `The supplied Firecrawl credential is invalid or revoked. ${HUMAN_CONNECTION_GUIDANCE}` : isQuotaExhausted ? `The free daily limit for this network has been reached${retryAfterSeconds ? `; try again in about ${retryAfterSeconds} seconds` : ""}. To continue now: ${HUMAN_CONNECTION_GUIDANCE}` : isToolUnavailable ? ACCOUNT_ONLY_TOOL_GUIDANCE : isKeylessAccessUnavailable ? `Anonymous keyless access is unavailable for this request. To continue: ${HUMAN_CONNECTION_GUIDANCE}` : isKeylessEligibilityUnavailable ? "The anonymous keyless eligibility check is temporarily unavailable. Retry shortly." : `This tool requires a Firecrawl account or API key. ${HUMAN_CONNECTION_GUIDANCE}`,
1384
1480
  ...isKeylessAccessUnavailable ? {} : { available_tools: [...KEYLESS_TOOL_NAMES] },
1385
- docs_url: "https://docs.firecrawl.dev/mcp-server",
1481
+ docs_url: MCP_CONNECTION_GUIDE_URL,
1386
1482
  ...retryAfterSeconds ? { retry_after_seconds: retryAfterSeconds } : {},
1387
- next_actions: isKeylessEligibilityUnavailable ? [{ kind: "retry_later", after_seconds: 30 }] : isQuotaExhausted || isKeylessAccessUnavailable ? [
1388
- { kind: "connect_oauth", url: oauthUrl, client_commands: [{ client: "claude-code", command: "claude mcp add --transport http firecrawl https://mcp.firecrawl.dev/v2/mcp-oauth" }] },
1389
- { kind: "configure_api_key", header: "Authorization: Bearer <FIRECRAWL_API_KEY>" }
1390
- ] : isToolUnavailable ? [{ kind: "continue_keyless", tools: [...KEYLESS_TOOL_NAMES] }] : [
1391
- { kind: "connect_oauth", url: oauthUrl },
1392
- { kind: "configure_api_key", header: "Authorization: Bearer <FIRECRAWL_API_KEY>" }
1483
+ next_actions: isKeylessEligibilityUnavailable ? [{ kind: "retry_later", after_seconds: 30 }] : isQuotaExhausted || isKeylessAccessUnavailable ? HUMAN_CONNECTION_ACTIONS : isToolUnavailable ? [
1484
+ { kind: "continue_keyless", tools: [...KEYLESS_TOOL_NAMES] },
1485
+ ...HUMAN_CONNECTION_ACTIONS
1486
+ ] : [
1487
+ ...HUMAN_CONNECTION_ACTIONS
1393
1488
  ]
1394
1489
  };
1395
1490
  }
@@ -0,0 +1,7 @@
1
+ // src/www-authenticate.ts
2
+ function escapeWWWAuthenticateValue(value) {
3
+ return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
4
+ }
5
+ export {
6
+ escapeWWWAuthenticateValue
7
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firecrawl-mcp",
3
- "version": "3.23.6",
3
+ "version": "3.23.7",
4
4
  "description": "MCP server for Firecrawl — search, scrape, and interact with the web. Supports both cloud and self-hosted instances. Features include web search, scraping, page interaction, batch processing, and LLM-powered content analysis.",
5
5
  "type": "module",
6
6
  "mcpName": "io.github.firecrawl/firecrawl-mcp-server",