Firecrawl Agent MCP Server
by markusleucht
README.md
# Firecrawl Agent MCP Server
An MCP (Model Context Protocol) server that exposes Firecrawl's autonomous agent endpoint for web research and data extraction.
## Features
- **Autonomous Web Research**: Just provide a natural language prompt - no URLs required
- **Structured Data Extraction**: Define JSON schemas to get structured output
- **Flexible Scope**: Research the entire web or constrain to specific URLs
- **Async Support**: Run long-running jobs asynchronously with status polling
- **Credit Control**: Set spending limits to control API costs
## Installation
### Prerequisites
- Python 3.10 or higher
- Firecrawl API key (get one at [firecrawl.dev](https://firecrawl.dev))
### Setup
1. Clone this repository:
```bash
git clone https://github.com/markusleucht/firecrawl-agent-mcp.git
cd firecrawl-agent-mcp
```
2. Install dependencies:
```bash
pip install -r requirements.txt
```
3. Set your Firecrawl API key:
```bash
export FIRECRAWL_API_KEY="your-api-key-here"
```
### Configure in Claude Code
Add to your `~/.claude/settings.json`:
```json
{
"mcpServers": {
"firecrawl-agent": {
"type": "stdio",
"command": "python",
"args": ["/path/to/firecrawl-agent-mcp/mcp_server.py"],
"env": {
"FIRECRAWL_API_KEY": "your-api-key-here"
}
}
}
}
```
## Usage
### Tool 1: `firecrawl_agent_run`
Run autonomous web research with a natural language prompt.
**Basic Example:**
```python
firecrawl_agent_run("Find the founders of Firecrawl and their backgrounds")
```
**With Schema for Structured Output:**
```python
firecrawl_agent_run(
prompt="Compare pricing of Snowflake vs Databricks vs BigQuery",
schema={
"type": "array",
"items": {
"type": "object",
"properties": {
"company": {"type": "string"},
"pricing_model": {"type": "string"},
"starting_price": {"type": "string"}
}
}
}
)
```
**Constrained to Specific URLs:**
```python
firecrawl_agent_run(
prompt="Extract all product features",
urls=["https://example.com/products"],
strict_urls=True
)
```
**Async Mode:**
```python
firecrawl_agent_run(
prompt="Research top 50 AI companies",
wait_for_completion=False # Returns job_id immediately
)
```
### Tool 2: `firecrawl_agent_status`
Check the status of an async job or retrieve completed results.
```python
firecrawl_agent_status(job_id="your-job-id")
```
## Parameters
### `firecrawl_agent_run`
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `prompt` | string | Yes | - | Natural language description of what data to extract (max 10,000 chars) |
| `schema` | object | No | - | JSON schema to structure the output |
| `urls` | list[string] | No | - | URLs to constrain the agent's search scope |
| `max_credits` | integer | No | 50 | Maximum credits to spend on this task |
| `strict_urls` | boolean | No | false | Only visit provided URLs (requires `urls`) |
| `wait_for_completion` | boolean | No | true | Wait for job to complete or return job_id immediately |
### `firecrawl_agent_status`
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `job_id` | string | Yes | Job ID returned from `firecrawl_agent_run` |
## Pricing
- **5 free agent runs per day** on Firecrawl
- Credits vary by complexity (simple extractions use fewer credits)
- Use `max_credits` parameter to control spending
- Results are cached for 24 hours
## How It Works
1. You provide a natural language prompt describing what data you need
2. Firecrawl's agent searches the web, navigates pages, and extracts information
3. Results are returned as raw text or structured JSON (if schema provided)
4. The agent autonomously decides which pages to visit and what data to extract
## Examples
### Research Task
```
Prompt: "Find the CEO, founding year, and latest funding round for Anthropic, OpenAI, and Google DeepMind"
```
### Competitive Analysis
```
Prompt: "Compare the pricing plans, key features, and target customers for the top 3 CRM platforms"
Schema: Define a structured format with company, plans[], features[], target_market
```
### Data Collection
```
Prompt: "Extract all job postings for 'Machine Learning Engineer' from YC companies"
URLs: ["https://www.ycombinator.com/companies"]
```
## Troubleshooting
### Error: "FIRECRAWL_API_KEY not configured"
Make sure you've set the environment variable or added it to your MCP server config.
### Error: "Payment required"
Your Firecrawl account needs billing configured or you've exceeded free tier limits.
### Error: "Rate limit exceeded"
Wait a few moments and try again, or upgrade your Firecrawl plan.
### Job times out
Increase the polling timeout in the code, or use `wait_for_completion=False` and check status manually.
## License
MIT
## Credits
Built on [Firecrawl](https://firecrawl.dev) and the [Model Context Protocol](https://modelcontextprotocol.io).
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo recent community issues