web-search-mcp
Provides a WebSearch tool that queries a self-hosted SearXNG instance's JSON API and returns formatted markdown search results.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@web-search-mcpWhat's the latest news on AI regulation?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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-mcp2. 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 -dSearXNG 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: bingRestart 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 restartStopping
docker compose -f infra/docker-compose.yml downClaude 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 toolWebSearchA
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.
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
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.
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.
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.
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.
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.
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 tool update
v0.1.0- First observed
WebSearch
TDQS
Scored across 1 tool
Only one tool exists, so there is no possibility of confusion between tools. The tool's name and description clearly communicate its single purpose.
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.
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.
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
Related MCP Connectors
Google, Bing, DuckDuckGo and Google Maps search results, free without an API key.
Provides AI assistants with access to Seltz's powerful Web Search capabilities.
Serper MCP — wraps the Serper Google Search API (serper.dev)
Web search and page-reading for AI agents. One-click OAuth connect, or a Caesar API key.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to perform privacy-respecting web searches through SearXNG, with support for multiple search engines, categories, and advanced filtering options.26-
- AlicenseAqualityDmaintenanceEnables 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.31MIT
- AlicenseAqualityDmaintenanceEnables private web search and webpage content extraction using a local SearxNG instance, prioritizing user privacy and autonomy.22MIT
- FlicenseNot gradedqualityDmaintenanceEnables web search and content scraping from multiple engines via a local SearXNG instance, allowing AI assistants to retrieve and extract web content.1-