firecrawl-mcp 3.20.5 → 3.20.6

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 (3) hide show
  1. package/README.md +37 -0
  2. package/dist/index.js +123 -4
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -623,6 +623,43 @@ Sends structured feedback on a previous `firecrawl_search` result. The first fee
623
623
 
624
624
  - `{ success, feedbackId, creditsRefunded, alreadySubmitted? }` JSON.
625
625
 
626
+ ### 5c. Generic Feedback Tool (`firecrawl_feedback`)
627
+
628
+ Sends structured feedback for a completed v2 endpoint job through `/v2/feedback`.
629
+ Use this for endpoint-level feedback on `scrape`, `parse`, `map`, or `search`
630
+ jobs. For search-result quality specifically, prefer
631
+ `firecrawl_search_feedback` because it includes search-specific guidance.
632
+
633
+ Keep feedback concise: use issue codes, tags, short notes, URLs, page numbers,
634
+ and small metadata objects. Do not include raw scrape/parse outputs.
635
+
636
+ **Opt out:** set `FIRECRAWL_NO_ENDPOINT_FEEDBACK=1` (or `FIRECRAWL_DISABLE_ENDPOINT_FEEDBACK=1`) in the environment when starting the MCP server. The `firecrawl_feedback` tool will not be registered, so agents cannot call it.
637
+
638
+ **Usage Example:**
639
+
640
+ ```json
641
+ {
642
+ "name": "firecrawl_feedback",
643
+ "arguments": {
644
+ "endpoint": "scrape",
645
+ "jobId": "0193f6c5-1234-7890-abcd-1234567890ab",
646
+ "rating": "partial",
647
+ "issues": ["missing_markdown"],
648
+ "tags": ["docs"],
649
+ "note": "The pricing table was missing from the markdown output.",
650
+ "url": "https://example.com/pricing",
651
+ "pageNumbers": [1],
652
+ "metadata": {
653
+ "format": "markdown"
654
+ }
655
+ }
656
+ }
657
+ ```
658
+
659
+ **Returns:**
660
+
661
+ - `{ success, feedbackId, creditsRefunded, creditsRefundedToday?, dailyRefundCap?, dailyCapReached?, alreadySubmitted?, warning? }` JSON.
662
+
626
663
  ### 6. Crawl Tool (`firecrawl_crawl`)
627
664
 
628
665
  Starts an asynchronous crawl job on a website and extract content from all pages.
package/dist/index.js CHANGED
@@ -852,11 +852,29 @@ async function keylessPost(path, body, session) {
852
852
  }
853
853
  return json;
854
854
  }
855
- const SEARCH_FEEDBACK_DISABLED = ['1', 'true', 'yes', 'on'].includes((process.env.FIRECRAWL_NO_SEARCH_FEEDBACK ||
856
- process.env.FIRECRAWL_DISABLE_SEARCH_FEEDBACK ||
857
- '')
855
+ const feedbackIssueSchema = z
856
+ .string()
858
857
  .trim()
859
- .toLowerCase());
858
+ .min(1)
859
+ .max(80)
860
+ .regex(/^[a-z0-9][a-z0-9_-]*$/, 'Issue codes must use lowercase letters, numbers, underscores, or hyphens');
861
+ const valuableSourceSchema = z.object({
862
+ url: z.string().url(),
863
+ reason: z.string().max(1000).optional(),
864
+ });
865
+ const missingContentSchema = z.object({
866
+ topic: z
867
+ .string()
868
+ .min(1, 'topic must not be empty')
869
+ .max(200, 'topic must be 200 characters or fewer'),
870
+ description: z.string().max(2000).optional(),
871
+ });
872
+ const FEEDBACK_DISABLED_VALUES = new Set(['1', 'true', 'yes', 'on']);
873
+ function feedbackEnvEnabled(...keys) {
874
+ return keys.some((key) => FEEDBACK_DISABLED_VALUES.has((process.env[key] || '').trim().toLowerCase()));
875
+ }
876
+ const SEARCH_FEEDBACK_DISABLED = feedbackEnvEnabled('FIRECRAWL_NO_SEARCH_FEEDBACK', 'FIRECRAWL_DISABLE_SEARCH_FEEDBACK');
877
+ const ENDPOINT_FEEDBACK_DISABLED = feedbackEnvEnabled('FIRECRAWL_NO_ENDPOINT_FEEDBACK', 'FIRECRAWL_DISABLE_ENDPOINT_FEEDBACK');
860
878
  if (SEARCH_FEEDBACK_DISABLED) {
861
879
  console.error('[firecrawl-mcp] Search feedback tool disabled by FIRECRAWL_NO_SEARCH_FEEDBACK; firecrawl_search_feedback will not be registered.');
862
880
  }
@@ -1016,6 +1034,107 @@ Pass the \`searchId\` returned by \`firecrawl_search\` (the \`id\` field on the
1016
1034
  },
1017
1035
  });
1018
1036
  }
1037
+ if (ENDPOINT_FEEDBACK_DISABLED) {
1038
+ console.error('[firecrawl-mcp] Endpoint feedback tool disabled by FIRECRAWL_NO_ENDPOINT_FEEDBACK; firecrawl_feedback will not be registered.');
1039
+ }
1040
+ if (!ENDPOINT_FEEDBACK_DISABLED) {
1041
+ server.addTool({
1042
+ name: 'firecrawl_feedback',
1043
+ annotations: {
1044
+ title: 'Send feedback on a Firecrawl job',
1045
+ readOnlyHint: false,
1046
+ openWorldHint: true,
1047
+ },
1048
+ description: `
1049
+ Send structured feedback for a completed Firecrawl v2 job. Use this for endpoint-level feedback on \`scrape\`, \`parse\`, \`map\`, or \`search\` jobs when the job result was useful, partially useful, or failed to meet expectations.
1050
+
1051
+ For search-result quality specifically, prefer \`firecrawl_search_feedback\` when available because it has search-focused guidance. This generic tool posts to \`/v2/feedback\` and accepts endpoint-wide signals:
1052
+
1053
+ - **endpoint** — one of \`search\`, \`scrape\`, \`parse\`, or \`map\`.
1054
+ - **jobId** — the id returned by that endpoint.
1055
+ - **rating** — overall result quality: \`good\`, \`partial\`, or \`bad\`.
1056
+ - **issues** — stable lowercase issue codes such as \`missing_markdown\`, \`bad_pdf_parse\`, or \`wrong_links\`.
1057
+ - **tags** — optional lowercase tags for grouping feedback.
1058
+ - **note** — short human-readable context. Do not include huge page contents or raw scrape results.
1059
+ - **url**, **pageNumbers**, and **metadata** — small contextual fields that identify what the feedback refers to.
1060
+
1061
+ Do not store multi-MB outputs in feedback. Use concise notes, issue codes, URLs, and page numbers.
1062
+
1063
+ **Returns:** \`{ success, feedbackId, creditsRefunded, creditsRefundedToday?, dailyRefundCap?, dailyCapReached?, alreadySubmitted?, warning? }\` JSON.
1064
+ `,
1065
+ parameters: z.object({
1066
+ endpoint: z.enum(['search', 'scrape', 'parse', 'map']),
1067
+ jobId: z.string().uuid('jobId must be the UUID returned by Firecrawl'),
1068
+ rating: z.enum(['good', 'bad', 'partial']),
1069
+ issues: z.array(feedbackIssueSchema).max(20).optional(),
1070
+ tags: z.array(feedbackIssueSchema).max(20).optional(),
1071
+ note: z.string().max(4000).optional(),
1072
+ valuableSources: z.array(valuableSourceSchema).max(50).optional(),
1073
+ missingContent: z.array(missingContentSchema).max(50).optional(),
1074
+ querySuggestions: z.string().max(2000).optional(),
1075
+ url: z.string().url().optional(),
1076
+ pageNumbers: z.array(z.number().int().positive()).max(100).optional(),
1077
+ metadata: z.record(z.string(), z.unknown()).optional(),
1078
+ }),
1079
+ execute: async (args, { session, log }) => {
1080
+ const { endpoint, jobId, rating, issues, tags, note, valuableSources, missingContent, querySuggestions, url, pageNumbers, metadata, } = args;
1081
+ const apiBase = resolveApiBaseUrl();
1082
+ const headers = {
1083
+ 'Content-Type': 'application/json',
1084
+ };
1085
+ const apiKey = session?.firecrawlApiKey;
1086
+ if (apiKey) {
1087
+ headers['Authorization'] = `Bearer ${apiKey}`;
1088
+ }
1089
+ else if (process.env.CLOUD_SERVICE === 'true') {
1090
+ throw new Error('Unauthorized: missing API key for feedback.');
1091
+ }
1092
+ const body = removeEmptyTopLevel({
1093
+ endpoint,
1094
+ jobId,
1095
+ rating,
1096
+ issues,
1097
+ tags,
1098
+ note,
1099
+ valuableSources,
1100
+ missingContent,
1101
+ querySuggestions,
1102
+ url,
1103
+ pageNumbers,
1104
+ metadata,
1105
+ origin: ORIGIN,
1106
+ });
1107
+ log.info('Submitting endpoint feedback', { endpoint, jobId, rating });
1108
+ const response = await fetch(`${apiBase}/v2/feedback`, {
1109
+ method: 'POST',
1110
+ headers,
1111
+ body: JSON.stringify(body),
1112
+ });
1113
+ const responseText = await response.text();
1114
+ let parsed;
1115
+ try {
1116
+ parsed = JSON.parse(responseText);
1117
+ }
1118
+ catch {
1119
+ parsed = { raw: responseText };
1120
+ }
1121
+ if (!response.ok) {
1122
+ log.warn('Endpoint feedback rejected', {
1123
+ status: response.status,
1124
+ feedbackErrorCode: parsed?.feedbackErrorCode,
1125
+ });
1126
+ return asText({
1127
+ success: false,
1128
+ status: response.status,
1129
+ feedbackErrorCode: parsed?.feedbackErrorCode,
1130
+ error: parsed?.error ?? `HTTP ${response.status}`,
1131
+ retryable: response.status >= 500,
1132
+ });
1133
+ }
1134
+ return asText(parsed);
1135
+ },
1136
+ });
1137
+ }
1019
1138
  server.addTool({
1020
1139
  name: 'firecrawl_crawl',
1021
1140
  annotations: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firecrawl-mcp",
3
- "version": "3.20.5",
3
+ "version": "3.20.6",
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",