feat: implement cancel crawl functionality in MCP server #80
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
feat: implement cancel crawl functionality in MCP server
Summary
Adds a new
firecrawl_cancel_crawltool to the Firecrawl MCP server that allows users to cancel running crawl jobs. This implementation leverages the existingcancelCrawlmethod from the Firecrawl JS SDK and follows the same patterns as other tools in the server.Key Changes:
CANCEL_CRAWL_TOOLdefinition with proper input schema and documentationThe tool accepts a crawl job ID and returns a confirmation message when the cancellation is successful.
Review & Testing Checklist for Human
cancelCrawlmethod behavior with a real Firecrawl instance to ensure the response format matches our assumptions (success/error fields)Recommended Test Plan:
firecrawl_crawltoolfirecrawl_cancel_crawlwith the job IDfirecrawl_check_crawl_statusDiagram
%%{ init : { "theme" : "default" }}%% graph TD subgraph "MCP Server Components" A["src/index.ts<br/>Main Server File"]:::major-edit B["src/index.test.ts<br/>Test File"]:::major-edit C["CANCEL_CRAWL_TOOL<br/>Tool Definition"]:::major-edit D["isCancelCrawlOptions<br/>Type Guard"]:::major-edit E["CallToolRequestSchema<br/>Handler"]:::major-edit end subgraph "External Dependencies" F["@mendable/firecrawl-js<br/>SDK"]:::context G["cancelCrawl()<br/>SDK Method"]:::context end subgraph "MCP Framework" H["ListToolsRequestSchema<br/>Tool Registry"]:::minor-edit I["Tool Interface<br/>Type System"]:::context end A --> C A --> D A --> E A --> H C --> I E --> G E --> F B --> A subgraph Legend L1["Major Edit"]:::major-edit L2["Minor Edit"]:::minor-edit L3["Context/No Edit"]:::context end classDef major-edit fill:#90EE90 classDef minor-edit fill:#87CEEB classDef context fill:#FFFFFFNotes
StatusCheckOptionsinterface for type validation since both cancel and status check operations only require anidfieldwithRetrywrapper, consistent with other toolsLink to Devin run: https://app.devin.ai/sessions/6da4eeb600f44cad9e9ec98342e50b36
Requested by: @nickscamara