Firecrawl MCP server in LangChain scraping tools, loaded as code.
LangChain has no config file for MCP — you wire servers up in code with langchain-mcp-adapters. Here's the exact Python to load Firecrawl's tools into an agent, and the async gotchas that follow.
Editors configure MCP servers in JSON files; LangChain configures them in code. The langchain-mcp-adapters package speaks the MCP protocol, converts each server tool into a LangChain-native tool object, and hands the list to your agent — so Firecrawl MCP Server (github.com/firecrawl/firecrawl-mcp-server, 6.5k stars) becomes a set of scraping tools your graph can call like any other.
This is the setup that matters for production agents: a LangGraph research agent that searches, scrapes, and extracts from the live web on every run, not just inside an editor session.
Install the pieces
You need three things: `pip install langchain-mcp-adapters langgraph` in your Python environment, Node.js 18+ on the same machine (the adapter spawns firecrawl-mcp via npx as a subprocess), and a Firecrawl API key from firecrawl.dev — the fc- prefixed kind. The Node dependency surprises people: your Python agent is launching a Node process under the hood.
Wire up MultiServerMCPClient
MultiServerMCPClient takes a dict of server definitions — the same command/args/env shape editors use, plus a transport field. With stdio transport the client manages the subprocess lifecycle for you:
from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent
client = MultiServerMCPClient({
"firecrawl": {
"command": "npx",
"args": ["-y", "firecrawl-mcp"],
"env": {"FIRECRAWL_API_KEY": "fc-YOUR-API-KEY"},
"transport": "stdio",
}
})
tools = await client.get_tools()
agent = create_react_agent("anthropic:claude-sonnet-4-5", tools)
result = await agent.ainvoke(
{"messages": "Scrape https://example.com and summarize it."}
)What the agent gets
get_tools() returns Firecrawl's full tool surface — search, scrape, crawl, and extract — as LangChain tools with their MCP schemas intact, so the model sees proper argument descriptions. You can filter the list before passing it to the agent if you only want scraping and not full crawls; fewer tools generally means better tool selection.
The canonical tool list for this server is published on its live Loomal listing at https://loomal.ai/marketplace/firecrawl-mcp-server — useful as a reference for what get_tools() should return.
If you're deploying multiple agent workers, consider running the server once in its SSE mode (`SSE_LOCAL=true npx -y firecrawl-mcp`) and switching the client definition to transport "sse" with the endpoint URL. One shared server process beats spawning a Node subprocess per worker, and it moves the API key out of your application code entirely.
Troubleshooting in LangChain
Everything here is async — get_tools() and ainvoke() must run inside an event loop, and calling them from sync code raises immediately. Wrap your entry point in asyncio.run() if you're scripting.
FileNotFoundError on startup means Python couldn't spawn npx: it's not on the PATH of the environment running your script (common in Docker images and systemd services that have Python but not Node). Install Node in the same image, or point command at an absolute npx path. Hangs at get_tools() usually mean npx is downloading the package on first run — slow, not broken. And 401s from the tools mean the fc- key in the env dict is wrong; note the subprocess only sees what you pass in env, not your shell's exports, unless you merge them in.
FAQ
How do I install Firecrawl in LangChain?
Install langchain-mcp-adapters, then instantiate MultiServerMCPClient with a firecrawl entry (command npx, args ["-y", "firecrawl-mcp"], your fc- key in env, transport stdio) and call await client.get_tools(). Pass the returned tools to your agent or LangGraph node.
Is there a config file like other MCP clients use?
No. LangChain configures MCP servers entirely in Python or JS code through langchain-mcp-adapters. The server definition dict mirrors the JSON shape editors use, which makes it easy to port a working editor config into code.
Why does my Python agent need Node.js installed?
Because firecrawl-mcp is an npm package: the adapter launches it as a subprocess via npx and talks MCP over stdio. In containerized deployments you need both runtimes in the image — a Python-only base image will fail with FileNotFoundError at client startup.
Can I use only some of Firecrawl's tools in my agent?
Yes. get_tools() returns a plain list, so filter it by tool name before handing it to create_react_agent. Trimming to just search and scrape is a common move — it tightens tool selection and keeps an autonomous agent from launching expensive full-site crawls.
More MCP servers for LangChain.
Browse scraping, search, and data servers with live tool lists.