# webfetch MCP server

> Provides a self-hosted web search and extraction pipeline for LLM agents featuring multi-engine fusion, semantic caching, and sentence-level compression.

- Repository: https://github.com/firish/webfetch
- Page: https://hostedmcp.org/servers/firish/webfetch
- Transport: stdio
- Stars: 60
- License: MIT
- Latest version: 0.1.3

## Install

### Claude Code

```sh
claude mcp add --env 'BRAVE_API_KEY=<YOUR_BRAVE_API_KEY>' --env 'SERPER_API_KEY=<YOUR_SERPER_API_KEY>' --env 'TAVILY_API_KEY=<YOUR_TAVILY_API_KEY>' webfetch -- uvx webfetch-llm
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "webfetch": {
      "command": "uvx",
      "args": [
        "webfetch-llm"
      ],
      "env": {
        "BRAVE_API_KEY": "<YOUR_BRAVE_API_KEY>",
        "SERPER_API_KEY": "<YOUR_SERPER_API_KEY>",
        "TAVILY_API_KEY": "<YOUR_TAVILY_API_KEY>"
      }
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "webfetch": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "webfetch-llm"
      ],
      "env": {
        "BRAVE_API_KEY": "<YOUR_BRAVE_API_KEY>",
        "SERPER_API_KEY": "<YOUR_SERPER_API_KEY>",
        "TAVILY_API_KEY": "<YOUR_TAVILY_API_KEY>"
      }
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"webfetch","type":"stdio","command":"uvx","args":["webfetch-llm"],"env":{"BRAVE_API_KEY":"<YOUR_BRAVE_API_KEY>","SERPER_API_KEY":"<YOUR_SERPER_API_KEY>","TAVILY_API_KEY":"<YOUR_TAVILY_API_KEY>"}}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "webfetch": {
      "command": "uvx",
      "args": [
        "webfetch-llm"
      ],
      "env": {
        "BRAVE_API_KEY": "<YOUR_BRAVE_API_KEY>",
        "SERPER_API_KEY": "<YOUR_SERPER_API_KEY>",
        "TAVILY_API_KEY": "<YOUR_TAVILY_API_KEY>"
      }
    }
  }
}
```

### Codex

```sh
codex mcp add webfetch --env 'BRAVE_API_KEY=<YOUR_BRAVE_API_KEY>' --env 'SERPER_API_KEY=<YOUR_SERPER_API_KEY>' --env 'TAVILY_API_KEY=<YOUR_TAVILY_API_KEY>' -- uvx webfetch-llm
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.webfetch]
command = "uvx"
args = ["webfetch-llm"]

[mcp_servers.webfetch.env]
BRAVE_API_KEY = "<YOUR_BRAVE_API_KEY>"
SERPER_API_KEY = "<YOUR_SERPER_API_KEY>"
TAVILY_API_KEY = "<YOUR_TAVILY_API_KEY>"
```

### Gemini CLI

```sh
gemini mcp add -s user -e 'BRAVE_API_KEY=<YOUR_BRAVE_API_KEY>' -e 'SERPER_API_KEY=<YOUR_SERPER_API_KEY>' -e 'TAVILY_API_KEY=<YOUR_TAVILY_API_KEY>' webfetch uvx -- webfetch-llm
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "webfetch": {
      "command": "uvx",
      "args": [
        "webfetch-llm"
      ],
      "env": {
        "BRAVE_API_KEY": "<YOUR_BRAVE_API_KEY>",
        "SERPER_API_KEY": "<YOUR_SERPER_API_KEY>",
        "TAVILY_API_KEY": "<YOUR_TAVILY_API_KEY>"
      }
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `BRAVE_API_KEY` | no | yes | Optional - adds Brave to the multi-engine fusion. DDG works with no keys at all. |
| `SERPER_API_KEY` | no | yes | Optional - adds Serper (Google results) to the multi-engine fusion. |
| `TAVILY_API_KEY` | no | yes | Optional - adds Tavily to the multi-engine fusion. |
| `WEBFETCH_PROVIDER` | no | no | Optional - search strategy: multi (RRF fusion of available engines, default), fallback (priority failover), or a single engine name like ddg. |

## FAQ

### Does webfetch require API keys to work?

No, DuckDuckGo works with no key, so the tool works at zero cost out of the box. Adding keys for Brave, Serper, or Tavily improves recall through engine fusion.

### How does the semantic cache work?

It uses two layers in a SQLite file: page text by URL and ranked results by query. It supports exact matching for identical queries and semantic matching for paraphrased queries.

### How does webfetch reduce token usage?

It uses sentence-level compression to extract only the sentences that answer the query, which can result in 50% fewer tokens without losing recall.
