web-search-mcp

command module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 27 Imported by: 0

README ยถ

web-search-mcp ๐Ÿ•ธ๏ธ

web-search-mcp

Go MCP License Ollama DuckDuckGo

MCP server for intelligent web search โ€” no API keys required, with local AI-powered semantic analysis running on your machine.


๐Ÿ’ก Why This Exists & The Magic

When an AI assistant needs to find information on the web, the typical approach is wasteful:

web-search-mcp-d1

โŒ BAD APPROACH (without web-search-mcp):
   AI: "find me Go trends 2025"
   โ†’ AI invokes a search engine
   โ†’ AI reads ALL pages in full
   โ†’ AI loads MEGABYTES of text into context
   โ†’ Wastes tons of tokens analyzing everything
   โ†’ Expensive, slow, inefficient

With web-search-mcp the analysis happens locally:

โœ… GOOD APPROACH (with web-search-mcp):
   AI: "find me Go trends 2025"
   โ†’ web_search_analyze:
      โ”œโ”€ DuckDuckGo โ†’ 8 URLs (0 tokens)
      โ”œโ”€ chromedp + readability โ†’ clean text (0 tokens)
      โ””โ”€ Ollama embedding โ†’ semantic ranking (0 tokens!)
   โ†’ AI gets: [{url, title, relevance: 66%, snippet}, ...]
   โ†’ AI PICKS only 1-2 best pages
   โ†’ AI reads ONLY their full text (few tokens)
   โ†’ Fast, cheap, intelligent

The killer feature: semantic analysis (comparing query meaning with page meaning) is done locally via Ollama โ€” it consumes zero AI API tokens! The AI receives a pre-ranked list and can decide which page to read without burning through kilobytes of garbage.


๐Ÿš€ Quick Start

1. Install dependencies
# Ollama + embedding model (required for semantic analysis)
ollama pull embeddinggemma:latest
ollama serve

# Chromium (for JavaScript-rendered pages, optional)
# Arch:  sudo pacman -S chromium
# Ubuntu: sudo apt install chromium-browser
# macOS:  brew install chromium
2. Build and run
git clone https://github.com/kirill-scherba/web-search-mcp
cd web-search-mcp
go build -o web-search-mcp .

# Start โ€” server listens on stdin/stdout for MCP
./web-search-mcp
3. Connect to an AI agent

Any MCP-capable agent can use this server: it speaks the standard stdio transport, so the only thing a client needs is a command to start and the name it should call it by. The settings file differs per client, the entry does not.

The entry itself (same everywhere, only the path changes):

{
  "mcpServers": {
    "web-search-mcp": {
      "command": "/path/to/web-search-mcp",
      "args": [],
      "env": {},
      "disabled": false
    }
  }
}
Cline

Paste the entry into the Cline MCP settings file, then press "Restart MCP Servers" in the Cline panel (or reload the page). Optionally add the tool names to autoApprove so searches run without a confirmation prompt:

"autoApprove": ["web_search", "web_search_analyze", "web_fetch", "web_semantic_search"]
Codex

Codex reads MCP servers from its own configuration and starts them the same way:

# ~/.codex/config.toml
[mcp_servers.web-search-mcp]
command = "/path/to/web-search-mcp"
args = []

Restart the session; the tools appear as web_search, web_search_analyze, web_fetch and web_semantic_search.

Claude

Claude Desktop takes the same JSON entry in claude_desktop_config.json (Settings โ†’ Developer โ†’ Edit Config), after which the application is restarted:

{
  "mcpServers": {
    "web-search-mcp": {
      "command": "/path/to/web-search-mcp",
      "args": []
    }
  }
}

On Linux and macOS the file lives at ~/Library/Application Support/Claude/ (macOS) or ~/.config/Claude/ (Linux), on Windows under %APPDATA%\Claude\.

Windows users: the command is the path to web-search-mcp.exe, and forward slashes or doubled backslashes both work in JSON.


๐ŸŽฎ How to Use โ€” Examples

Just tell the AI what you need. The tools are invoked automatically:

User: "find information about Go in 2025"
AI calls: web_search("Go 2025 trends", limit=8)
โ†’ Gets: URL list + snippets
โ†’ Shows: top 3 links with descriptions
๐Ÿ† Smart Search with Semantic Ranking (saves tokens!)
User: "analyze what people are writing about Go trends"
AI calls: web_search_analyze("Go programming trends 2025", limit=8)
โ†’ 1. DuckDuckGo โ†’ fetches 8 URLs
โ†’ 2. Downloads each page (in parallel!)
โ†’ 3. Ollama embeds each page's text
โ†’ 4. Ollama embeds the query
โ†’ 5. Cosine similarity โ†’ ranks by meaning
โ†’ 6. Saves everything to DB for future searches
โ†’ Returns: [{url, title, relevance: 66%, snippet}, ...]

AI: "Most relevant results:
     1. Go Developer Survey 2025 โ€” 66% match
     2. JetBrains Go Ecosystem โ€” 57%
     3. GeeksForGeeks Future of Go โ€” 51%
     Want me to read the first article in full?"

The magic: AI doesn't waste tokens analyzing all pages โ€” that work is done by local Ollama.

๐Ÿ“„ Read Full Page Content
User: "open the developer survey article"
AI calls: web_fetch("https://go.dev/blog/survey2025")
โ†’ Checks cache (if already fetched โ€” returns from DB)
โ†’ If not: chromedp + readability โ†’ clean text
โ†’ Returns: full article text (18K chars)
โ†’ AI reads it and answers your question
๐Ÿ”Ž Semantic Search Over Previously Indexed Content
User: "what was there about Go popularity?"
AI calls: web_semantic_search("Go popularity among developers")
โ†’ Ollama embeds the query
โ†’ Searches all stored chunks in DB
โ†’ Returns: relevant text fragments with match %

AI: "From the Go Developer Survey 2025:
     Go ranks in the top 5 languages by developer
     satisfaction (relevance: 48%)"

๐Ÿ› ๏ธ Tool Reference

Tool What it does When to use
web_search Searches DuckDuckGo, returns URL + snippet Need a quick list of links
web_search_analyze ๐Ÿ† Search + fetch + semantic analysis Primary tool! Saves tokens
web_fetch Fetches page, renders JS, extracts text Need full content of a specific page
web_semantic_search Semantic search over indexed content "What was there about X?" โ€” no need to re-google

๐Ÿ’ฐ Why This Saves Tokens

Without web-search-mcp:

  1. AI โ†’ search โ†’ gets HTML result list
  2. AI โ†’ reads first result (full HTML)
  3. AI โ†’ if wrong, reads second... and so on
  4. Each page = thousands of tokens
  5. Total: 10-50K tokens per search

With web-search-mcp:

  1. AI โ†’ web_search_analyze โ†’ gets ranked list
  2. AI picks 1-2 best pages based on relevance
  3. AI โ†’ web_fetch โ†’ reads only the best one
  4. Total: 3-5K tokens per search (10x savings!)

โš™๏ธ Configuration

./web-search-mcp \
  --db ~/.config/web-search-mcp/web_search.db \
  --ollama-url http://localhost:11434 \
  --embedding-model embeddinggemma:latest \
  --chromium-path /usr/bin/chromium

# Or via environment variables
export OLLAMA_BASE_URL=http://localhost:11434
export CHROME_PATH=/usr/bin/chromium
./web-search-mcp
CLI flags
Flag Default Description
--db ~/.config/web-search-mcp/web_search.db Database path (cache)
--ollama-url http://localhost:11434 Ollama endpoint
--embedding-model embeddinggemma:latest Embedding model
--chromium-path auto-detect Chromium binary path
-h โ€” Help

๐Ÿ—๏ธ Architecture

                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚    MCP Client (AI)   โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                               โ”‚ JSON-RPC / stdin-stdout
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚   web-search-mcp    โ”‚
                    โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
                    โ”‚  โ”‚  web_search    โ”‚โ”€โ”ผโ”€โ”€โ†’ DuckDuckGo
                    โ”‚  โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚
                    โ”‚  โ”‚  web_fetch     โ”‚โ”€โ”ผโ”€โ”€โ†’ chromedp + readability
                    โ”‚  โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚
                    โ”‚  โ”‚  search_analyzeโ”‚โ”€โ”ผโ”€โ”€โ†’ search + fetch + embed
                    โ”‚  โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚
                    โ”‚  โ”‚ semantic_searchโ”‚โ”€โ”ผโ”€โ”€โ†’ vector search (libSQL)
                    โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜
                           โ”‚        โ”‚
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”  โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚Ollama โ”‚  โ”‚  libSQL   โ”‚
                    โ”‚embed  โ”‚  โ”‚  (cache)  โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Stack: Go + chromedp + go-readability + Ollama + go-libsql + mcp-go Transport: stdin/stdout (JSON-RPC 2.0) License: MIT


๐ŸŽจ Logo Prompt

Send this prompt to Gemini or any image generation AI to create a logo for the project:

Minimalist logo for "web-search-mcp" โ€” an MCP server for intelligent web search.

A stylized spider web (representing "web" and "MCP") with a magnifying glass in the center. The web is drawn with thin, clean cyan/blue lines on a dark background. In the center, the magnifying glass overlaps the web intersection โ€” the glass lens contains a subtle glow effect symbolizing "intelligence" and "AI." The style is flat vector, modern, cyberpunk-lite. No text needed. Simple icon, suitable for a 128x128 app icon.

Style: flat vector, dark theme, cyan/blue accent palette (#00ADD8 for Go, #3B82F6). Minimal lines, tech aesthetics.


๐Ÿงช Quick Test

# Direct test (without MCP)
printf '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}\n{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}\n' | timeout 3 ./web-search-mcp 2>/dev/null

# If you see 4 tools โ€” everything works!

License

MIT ยฉ Kirill Scherba


Built with Go + chromedp + go-readability + Ollama + go-libsql + mcp-go.

Documentation ยถ

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL