Skip to main content
Glama
Replicant-Partners

Firecrawl Agent MCP Server

scrape

Extract content from a single webpage in formats like markdown, HTML, links, or screenshots. Configure extraction to focus on main content by including or excluding specific HTML tags.

Instructions

Scrape a single URL and extract content in various formats (markdown, html, links, screenshot). Use this for simple single-page scraping without AI agent capabilities.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe URL to scrape
formatsNoOutput formats to return. Default: ["markdown"]. Can request multiple formats.
onlyMainContentNoExtract only main content, removing headers, footers, nav, etc. Default: true
includeTagsNoHTML tags to include (e.g., ["article", "main"])
excludeTagsNoHTML tags to exclude (e.g., ["nav", "footer"])
waitForNoMilliseconds to wait before scraping (for JS rendering)
timeoutNoRequest timeout in milliseconds

Implementation Reference

  • MCP tool handler for 'scrape': extracts parameters from args, calls firecrawl.scrape(), handles success/error and formats response as MCP content.
    case 'scrape': {
      const {
        url,
        formats,
        onlyMainContent,
        includeTags,
        excludeTags,
        waitFor,
        timeout,
      } = args as {
        url: string;
        formats?: ('markdown' | 'html' | 'rawHtml' | 'links' | 'screenshot')[];
        onlyMainContent?: boolean;
        includeTags?: string[];
        excludeTags?: string[];
        waitFor?: number;
        timeout?: number;
      };
    
      const result = await firecrawl.scrape({
        url,
        formats,
        onlyMainContent,
        includeTags,
        excludeTags,
        waitFor,
        timeout,
      });
    
      if (!result.success) {
        return {
          content: [
            {
              type: 'text',
              text: `Error: ${result.error}`,
            },
          ],
          isError: true,
        };
      }
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(
              {
                success: true,
                data: result.data,
              },
              null,
              2
            ),
          },
        ],
      };
    }
  • src/server.ts:136-182 (registration)
    Registration of the 'scrape' tool in the TOOLS array provided to ListToolsRequestHandler, defining name, description, and inputSchema.
    {
      name: 'scrape',
      description:
        'Scrape a single URL and extract content in various formats (markdown, html, links, screenshot). Use this for simple single-page scraping without AI agent capabilities.',
      inputSchema: {
        type: 'object',
        properties: {
          url: {
            type: 'string',
            description: 'The URL to scrape',
          },
          formats: {
            type: 'array',
            items: {
              type: 'string',
              enum: ['markdown', 'html', 'rawHtml', 'links', 'screenshot'],
            },
            description:
              'Output formats to return. Default: ["markdown"]. Can request multiple formats.',
          },
          onlyMainContent: {
            type: 'boolean',
            description:
              'Extract only main content, removing headers, footers, nav, etc. Default: true',
          },
          includeTags: {
            type: 'array',
            items: { type: 'string' },
            description: 'HTML tags to include (e.g., ["article", "main"])',
          },
          excludeTags: {
            type: 'array',
            items: { type: 'string' },
            description: 'HTML tags to exclude (e.g., ["nav", "footer"])',
          },
          waitFor: {
            type: 'number',
            description: 'Milliseconds to wait before scraping (for JS rendering)',
          },
          timeout: {
            type: 'number',
            description: 'Request timeout in milliseconds',
          },
        },
        required: ['url'],
      },
    },
  • TypeScript interfaces defining the input (FirecrawlScrapeRequest) and output (FirecrawlScrapeResponse) for the scrape operation, matching the tool inputSchema.
    export interface FirecrawlScrapeRequest {
      url: string;
      formats?: ('markdown' | 'html' | 'rawHtml' | 'links' | 'screenshot')[];
      onlyMainContent?: boolean;
      includeTags?: string[];
      excludeTags?: string[];
      headers?: Record<string, string>;
      waitFor?: number;
      timeout?: number;
    }
  • Core implementation of scrape: HTTP POST to Firecrawl API /v1/scrape endpoint with request params, handles response and errors.
    async scrape(request: FirecrawlScrapeRequest): Promise<FirecrawlScrapeResponse> {
      try {
        const response = await fetch(`${this.apiBase}/v1/scrape`, {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
            'Authorization': `Bearer ${this.apiKey}`,
          },
          body: JSON.stringify(request),
        });
    
        const data = await response.json() as any;
    
        if (!response.ok) {
          return {
            success: false,
            error: data.error || `HTTP ${response.status}: ${response.statusText}`,
          };
        }
    
        return {
          success: true,
          data: data.data,
        };
      } catch (error) {
        return {
          success: false,
          error: error instanceof Error ? error.message : 'Unknown error',
        };
      }
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the tool's limitation ('without AI agent capabilities') and scope ('simple single-page scraping'), which adds useful context. However, it doesn't disclose important behavioral traits like rate limits, authentication requirements, error handling, or what happens with invalid URLs, leaving gaps for a mutation-like operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly concise with two sentences that each earn their place. The first sentence states the core functionality, and the second provides crucial usage guidance. There's zero waste or redundancy, making it highly efficient and front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 7 parameters, no annotations, and no output schema, the description provides good purpose and usage guidance but lacks behavioral details about what the tool returns, error conditions, or operational constraints. Given the complexity and absence of structured metadata, it should do more to explain the tool's behavior and output expectations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, providing detailed documentation for all 7 parameters. The description adds no additional parameter semantics beyond what's already in the schema, so it meets the baseline of 3. It doesn't compensate for any gaps since there are none in the schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('scrape a single URL') and resource ('extract content in various formats'), distinguishing it from sibling tools like agent_execute or search. It explicitly mentions the scope ('simple single-page scraping without AI agent capabilities'), which helps differentiate it from more complex alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool ('for simple single-page scraping') and when not to use it ('without AI agent capabilities'), clearly positioning it against more advanced alternatives. This helps the agent choose between this tool and sibling tools like agent_execute for different scraping needs.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Replicant-Partners/Firecrawler-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server