freesearch-mcp Server

Um servidor MCP que roteia consultas de busca através de instâncias públicas do

Documentação

freesearch-mcp

Free web search for AI agents — no API key required.

An MCP server that routes search queries through public SearXNG instances. Instead of paying per query to SerpAPI, Exa, or Brave Search, this server fans out to multiple public SearXNG instances simultaneously, merges the results, and returns the best ones.

Claude Code / any MCP client
         ↓
  freesearch-mcp
         ↓
  Best SearXNG instances (auto-discovered)
         ↓
  Merged, deduplicated search results


Tools

ToolDescription
web_searchGeneral web search with multi-instance fan-out and Reciprocal Rank Fusion ranking
news_searchRecent news articles with publication dates
image_searchImage search returning image URL, thumbnail URL, title, and source page
extract_pageFetch any URL and return its main content as clean markdown
best_instanceReturns the top-ranked SearXNG instance with its score, latency, uptime, engine count, and JSON support status

Quick start

Claude Code

claude mcp add freesearch -s user -- npx -y freesearch-mcp

Or add manually to ~/.claude/claude.json:

{ "mcpServers": { "freesearch": { "command": "npx", "args": ["-y", "freesearch-mcp"] } } }

Then ask Claude: "search for 'typescript generics' and summarize the top results"

Other MCP clients

Test interactively

npx -y @modelcontextprotocol/inspector npx -y freesearch-mcp

Opens a browser UI at http://localhost:6274 where you can call each tool manually.


How it works

Multi-instance fan-out

Every search fans out to all available SearXNG instances simultaneously. Failures (rate limits, blocks) resolve in milliseconds and don't slow things down. web_search resolves as soon as MIN_SUCCESS (default 2) instances return results; news_search and image_search resolve as soon as 1 instance responds.

Self-learning instance selection

The first search discovers which public instances accept requests from your IP and saves them to ~/.freesearch-mcp-cache.json. All subsequent searches go straight to the proven instances — no re-discovery needed.

Instance ranking uses data from searx.space: latency (50%) + uptime (30%) + engine count (20%).

Reciprocal Rank Fusion

web_search merges results from multiple instances: each result earns 1 / (position + 1) points per instance, scores are summed, and URLs are normalized and deduplicated before returning. Results that appear across multiple instances and rank near the top of each naturally score highest.

Content extraction

extract_page uses Mozilla's Readability to strip navigation, ads, and boilerplate from any page, then converts the article content to clean markdown via Turndown. Extracted pages are cached in-process for 30 minutes.


Configuration

All settings are optional environment variables:

VariableDefaultDescription
SEARXNG_URLPin a specific SearXNG instance. Bypasses all auto-discovery. Ideal for self-hosted setups.
MAX_INSTANCES999Maximum number of instances tried per search
MIN_SUCCESS2Instances that must return results before web_search resolves
MAX_WAIT_MS5000Maximum time (ms) to wait for instances per search
SEARCH_TIMEOUT_MS4000Per-instance HTTP timeout
CACHE_TTL_MS300000How long to cache search results in memory (5 min). Does not affect extract_page, which uses a fixed 30-minute cache.
INSTANCE_CACHE_TTL_MS3600000How long to cache the ranked instance list in memory (1 h)

Self-hosted SearXNG

For reliable use from servers or CI environments (where public instances may rate-limit), run your own SearXNG:

docker run -d -p 8080:8080 searxng/searxng

Then pin it:

{ "mcpServers": { "freesearch": { "command": "npx", "args": ["-y", "freesearch-mcp"], "env": { "SEARXNG_URL": "http://localhost:8080" } } } }


Performance

ScenarioSpeed
First search (cold)2–5 s (discovers working instances)
Subsequent searches1–3 s
Cached result (repeat query)< 50 ms
After restartFast (instance list persisted to disk for 24 h)

License

MIT