MCP Hub
Back to servers

Websearch MCP Server

Enables web searching via DuckDuckGo and page fetching with automatic HTML-to-Markdown conversion to reduce LLM token usage by approximately 60%. It provides tools for search, content extraction, and combined operations without requiring any external API keys.

glama
Stars
3
Updated
Mar 27, 2026
Validated
Mar 29, 2026

Websearch MCP Server

An MCP server for web search and page fetching. Converts HTML to clean markdown using html-to-markdown (Rust-based, ~200 MB/s), cutting token usage by ~60% when LLMs consume web content.

No API keys required — search is powered by DuckDuckGo.

Token Savings

Run uv run python benchmark.py to reproduce. Results from fetching real pages:

PageHTML tokensMD tokensSaved
GitHub Blog90,82950,73344%
Hacker News11,8844,38163%
MDN — JavaScript51,86223,32655%
BBC News123,99728,91877%
Go pkg — net/http119,99460,34450%
Python docs — asyncio6,6862,40564%
Rust Lang5,1071,51570%
Total410,359171,62258%

At Sonnet pricing ($3/M input tokens), that's $0.72 saved per batch of 7 pages.

Tools

ToolDescription
websearch_searchSearch the web via DuckDuckGo
websearch_fetch_pageFetch a URL and return content as markdown
websearch_search_and_fetchSearch + fetch top results in one call

websearch_search

ParameterTypeDefaultDescription
querystrrequiredSearch query
max_resultsint10Number of results (1–20)
regionstr"wt-wt"Region code ("us-en", "wt-wt" for global)

websearch_fetch_page

ParameterTypeDefaultDescription
urlstrrequiredURL to fetch
max_charsint20000Truncate output (1,000–100,000)
extract_metadataboolFalseInclude YAML frontmatter (title, meta tags)
heading_stylestr"atx""atx" (#) or "underlined"

websearch_search_and_fetch

ParameterTypeDefaultDescription
querystrrequiredSearch query
max_resultsint3Pages to fetch (1–5)
max_chars_per_pageint5000Max characters per page (1,000–50,000)

Setup

Requires uv.

uv sync

Usage

MCP Inspector (dev)

uv run mcp dev server.py

Claude Code

claude mcp add websearch -- uv run --directory /path/to/mcp-websearch-server python server.py

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "websearch": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/mcp-websearch-server", "python", "server.py"]
    }
  }
}

Benchmark

uv run python benchmark.py

Fetches a set of real pages, counts tokens with tiktoken (cl100k_base), and reports HTML vs markdown savings with cost estimates for Sonnet and Opus pricing.

Dependencies

  • mcp — FastMCP framework
  • httpx — async HTTP client
  • html-to-markdown — Rust-based HTML-to-Markdown converter
  • ddgs — DuckDuckGo search (no API key)
  • truststore — system certificate store for SSL
  • tiktoken — token counting (dev dependency, for benchmark)

Reviews

No reviews yet

Sign in to write a review