Skip to main content
Glama
LMilazzo

web-search-mcp

by LMilazzo

web-search-mcp

A Python MCP server that exposes a WebSearch tool backed by a self-hosted SearXNG instance — a free, private web search engine.

Replace Claude's default web search with your own private instance. No API keys, no rate limits, no third-party tracking.

Quick Start

1. Clone and start SearXNG

git clone https://github.com/LMilazzo/web-search-mcp.git
cd web-search-mcp

2. I recommend using the SearXNG docker container method as this is a quick easy set up if you already have docker installed.

#Pull the image
docker pull searxng/searxng

# Start SearXNG in the background
docker compose -f infra/docker-compose.yml up -d

SearXNG will be available at http://localhost:8080. This can be configured in /infra/docker-compose.yml.

3. Add the MCP server to Claude Code

  • You need to replace the --directory flag value with the path to this repo locally.

uv sync

claude mcp add xngSearch -s user -- uv --directory "path/to/directory/" run --with "mcp[cli]" mcp run "src/web_search_mcp/mcp_server.py"

That's it. Restart Claude Code and you'll have a WebSearch tool available in your conversations.

4. Use it

Ask Claude to perform WebSearch and return formatted results:

"What are the latest developments in quantum computing?"

Related MCP server: SearXNG MCP Server

Configuration

SearXNG URL

By default the tool connects to http://localhost:8080. If your SearXNG instance runs on a different port or host configured in docker-compose.yml:

  • You need to replace the --directory flag value with the path to this repo locally.

claude mcp add xngSearch -s user \
  --env SEARXNG_BASE_URL="http://localhost:8080" \
  -- uv --directory "path/to/directory/" \
  run --with "mcp[cli]" mcp run "src/web_search_mcp/mcp_server.py"
  • You can remove the -s user flag if you want this to only apply to a specific project folder.

Search Engines

Edit infra/data/searxng/settings.yml to add or disable search engines:

engines:
  - name: google
    engine: google
  - name: wikipedia
    engine: wikipedia
  - name: duckduckgo
    engine: duckduckgo
  - name: bing
    engine: bing

Restart SearXNG after changes:

  • Note that occasional you may be timed out from certain search engines if you make very frequent requests, typically restarting your container resets these timers.

docker compose -f infra/docker-compose.yml restart

Stopping

docker compose -f infra/docker-compose.yml down

Claude Code (via MCP protocol) └── web-search-mcp (Python MCP server) └── SearXNG (self-hosted search frontend)


The MCP server registers a single `WebSearch` tool that calls SearXNG's JSON API and returns results as a markdown-formatted string. Claude Code reads the markdown and presents it to you as a normal response.

## Requirements

- [Docker](https://www.docker.com/) (for SearXNG)
- Python 3.14+ (for the MCP server)
- [uv](https://github.com/astral-sh/uv) (for dependency management)

## License

SearXNG is licensed under the GNU Affero General Public License v3. See [searxng/searxng](https://github.com/searxng/searxng) for details.

Available Tools

1 tool
WebSearchA

Search the web via a self-hosted SearXNG instance.

Args: query: The search query.

Returns: Search results formatted as a markdown string.

Raises: RuntimeError: If the SearXNG instance is unreachable.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full behavioral burden. It discloses the return format ('Search results formatted as a markdown string') and a specific error condition ('RuntimeError: If the SearXNG instance is unreachable'), which are meaningful operational details. It does not mention potential delays, result count limits, or network timeouts, but for a simple search tool the disclosed traits are sufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is compact and well-structured with clear Args, Returns, and Raises sections. Every line earns its place, the purpose is front-loaded, and there is no redundant filler or repetition of schema data.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter tool with no siblings, the description is largely complete: it states what the tool does, what the parameter is, what it returns, and a key failure mode. The existence of an output schema further reduces the need to explain return structure. Minor omissions like authentication, rate limits, or search scope details are not critical given the tool's simplicity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It adds only 'The search query' for the query parameter, which is minimally more informative than the schema's bare 'Query' title. This is helpful but not detailed—no format, length limits, or usage examples are provided, leaving the parameter semantics only slightly enriched.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description starts with 'Search the web via a self-hosted SearXNG instance', which uses a specific verb and resource, clearly identifying the tool's function. It distinguishes the tool from generic web search by specifying the SearXNG backend, and there are no siblings to confuse it with.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage: whenever web search results are needed through this SearXNG instance. However, it provides no explicit guidance on when to prefer this tool over alternatives, no exclusions, and no context on typical use cases. Since there are no sibling tools, this lack of comparison is less critical, but the description does not go beyond the basic action.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool updatev0.1.0
    • First observedWebSearch

TDQS

A4.2/5.0

Scored across 1 tool

Disambiguation5/5

Only one tool exists, so there is no possibility of confusion between tools. The tool's name and description clearly communicate its single purpose.

Naming Consistency5/5

With only one tool, naming consistency is trivially satisfied. The camelCase name 'WebSearch' is clear and predictable, though there is no broader set to compare against.

Tool Count4/5

A single tool is slightly lean but appropriate for a focused web-search server. The tool directly fulfills the server's purpose without unnecessary additions, though most servers have more operations.

Completeness5/5

The server's entire domain is web search, and the single tool covers that capability fully by accepting a query and returning results. No obvious operations like pagination or configuration seem essential to the stated purpose.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI agents to perform privacy-respecting web searches through SearXNG, with support for multiple search engines, categories, and advanced filtering options.
    26
    -
  • A
    license
    A
    quality
    D
    maintenance
    Enables web search, image search, and news search through a self-hosted SearXNG instance. Provides privacy-focused meta-search capabilities aggregating results from multiple search engines.
    3
    1
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables web search and content scraping from multiple engines via a local SearXNG instance, allowing AI assistants to retrieve and extract web content.
    1
    -