webfetch — Claude Code MCP server: what it does, how to install
Self-hosted web search pipeline for AI agents featuring local scraping, answer compression, and SQLite semantic caching.
claude mcp add --env BRAVE_API_KEY=<BRAVE_API_KEY> --env SERPER_API_KEY=<SERPER_API_KEY> --env TAVILY_API_KEY=<TAVILY_API_KEY> --env WEBFETCH_PROVIDER=<WEBFETCH_PROVIDER> --transport stdio webfetch -- uvx webfetch-llmWhat webfetch does
The server handles web queries locally instead of offloading retrieval to hosted search endpoints. It blends results from DuckDuckGo, Brave, Serper, and Tavily using reciprocal rank fusion. DuckDuckGo operates out of the box without external credentials. Retrieved pages are parsed with trafilatura and readability, while Playwright manages JavaScript execution and blocks.
Results pass through a BM25 and neural reranking pipeline before shrinking to sentences answering the query. Everything saves to a two-tier SQLite cache. Reworded prompts resolve against previous lookups at zero token cost. Installing the complete semantic stack requires pip 24 or newer inside your environment.
What it helps with
- Run agent web searches using DuckDuckGo without paying search API subscriptions
- Compress raw HTML pages down to query-relevant sentences before feeding context
- Retrieve cached search findings for paraphrased queries via SQLite
- Render JavaScript-heavy pages and bypass access blocks using Playwright
Example prompts for the agent
- Search the web for recent library releases using webfetch
- Pull the full page content from the documentation link with fetch_url
- Display the search token usage summary using savings_report
How to install webfetch
Platform CLI
claude mcp add --env BRAVE_API_KEY=<BRAVE_API_KEY> --env SERPER_API_KEY=<SERPER_API_KEY> --env TAVILY_API_KEY=<TAVILY_API_KEY> --env WEBFETCH_PROVIDER=<WEBFETCH_PROVIDER> --transport stdio webfetch -- uvx webfetch-llmReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from webfetch-llm <command>
Platform CLI
codex mcp add webfetch --env BRAVE_API_KEY=<BRAVE_API_KEY> --env SERPER_API_KEY=<SERPER_API_KEY> --env TAVILY_API_KEY=<TAVILY_API_KEY> --env WEBFETCH_PROVIDER=<WEBFETCH_PROVIDER> -- uvx webfetch-llmReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from webfetch-llm <command>
Config file
{
"mcpServers": {
"webfetch": {
"command": "uvx",
"args": [
"webfetch-llm"
],
"env": {
"BRAVE_API_KEY": "<BRAVE_API_KEY>",
"SERPER_API_KEY": "<SERPER_API_KEY>",
"TAVILY_API_KEY": "<TAVILY_API_KEY>",
"WEBFETCH_PROVIDER": "<WEBFETCH_PROVIDER>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from webfetch-llm <command>
Config file
{
"servers": {
"webfetch": {
"type": "stdio",
"command": "uvx",
"args": [
"webfetch-llm"
],
"env": {
"BRAVE_API_KEY": "<BRAVE_API_KEY>",
"SERPER_API_KEY": "<SERPER_API_KEY>",
"TAVILY_API_KEY": "<TAVILY_API_KEY>",
"WEBFETCH_PROVIDER": "<WEBFETCH_PROVIDER>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from webfetch-llm <command>
Platform CLI
gemini mcp add -e BRAVE_API_KEY=<BRAVE_API_KEY> -e SERPER_API_KEY=<SERPER_API_KEY> -e TAVILY_API_KEY=<TAVILY_API_KEY> -e WEBFETCH_PROVIDER=<WEBFETCH_PROVIDER> webfetch uvx webfetch-llmReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from webfetch-llm <command>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about webfetch
How to install webfetch in Claude Code?
Run `claude mcp add webfetch -e BRAVE_API_KEY=<BRAVE_API_KEY> -e SERPER_API_KEY=<SERPER_API_KEY> -e TAVILY_API_KEY=<TAVILY_API_KEY> -- uvx webfetch-llm`. You can omit the API key flags if you plan to rely solely on the free engine.
What does webfetch do?
It equips your agent with local web retrieval, downloading pages, reranking excerpts, and returning concise answer sentences. It also maintains a semantic cache to prevent duplicate web lookups.
Are paid search engine keys required?
No, DuckDuckGo functions immediately without any authentication tokens. Optional keys for Brave, Serper, or Tavily merely feed extra links into the fusion ranker.