web-search-mcp
Provides web search capabilities using Brave Search API as the search backend, returning titles, URLs, and snippets.
Provides web search capabilities using DuckDuckGo as the search backend, returning titles, URLs, and snippets.
Provides web search capabilities using SearXNG as the search backend, returning titles, URLs, and snippets.
Click on "Install 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-mcpsearch for current MCP server examples"
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.
Why this exists
Claude Code routed through LiteLLM or AWS Bedrock has WebFetch (client-executed — reads a known URL) but not WebSearch (server-executed — discovers URLs). The distinction:
WebFetch works on any provider because Claude Code itself makes the HTTP request.
WebSearch is an Anthropic-run server-side tool that Bedrock doesn't support.
The only missing primitive is discovery — turning a question into a list of relevant URLs. This MCP server fills that gap with a single web_search tool backed by ddgs (DuckDuckGo metasearch). Claude Code's native WebFetch handles reading whatever pages it finds interesting.
Related MCP server: openai-agents-mcp
How it works
You ask Claude Code a question that needs live web info
│
▼
Claude calls web_search("your query")
│
▼
This MCP server queries DuckDuckGo via ddgs
│
▼
Returns: titles + URLs + snippets
│
▼
Claude uses WebFetch on the URLs it wants to readSetup
Prerequisites
Python 3.13+
uv package manager
Claude Code CLI
# Install uv (if you don't have it)
curl -LsSf https://astral.sh/uv/install.sh | shInstall
git clone https://github.com/victormacaubas/web-search-mcp.gitRegister with Claude Code
Replace /absolute/path/to/web-search-mcp with the actual path to your clone (run pwd inside the repo to get it):
# Get the path first
cd web-search-mcp && pwd
# Example output: /Users/yourname/projects/web-search-mcp
# Then register (substitute your actual path)
claude mcp add --scope user web-search -- uv run --directory /Users/yourname/projects/web-search-mcp python -m web_search_mcp(Optional) Then allow-list the tool in ~/.claude/settings.json so claude doesn't always prompt for permission:
{
"permissions": {
"allow": [
"mcp__web-search__web_search"
]
}
}Restart Claude Code and the web_search tool is available in all sessions.
Usage
Once registered, Claude Code will automatically use it when it needs to search the web. You can also prompt it directly:
"Search for the latest Anthropic MCP documentation"
The tool returns JSON with results:
{
"results": [
{
"title": "Model Context Protocol Documentation",
"url": "https://modelcontextprotocol.io/docs",
"snippet": "The Model Context Protocol (MCP) is an open protocol..."
}
]
}Parameters
Parameter | Type | Default | Description |
| string | required | Search query (1-500 chars) |
| int | 5 | Number of results (1-20) |
| string | null | Locale code (e.g. |
Architecture
src/web_search_mcp/
├── __main__.py # Entry point (python -m web_search_mcp)
├── server.py # FastMCP instance + web_search tool
├── search.py # SearchBackend protocol + DdgsSearchBackend
└── models.py # SearchResult dataclass + WebSearchInput validationKey design decisions:
Swappable backend —
SearchBackendis a Python Protocol. The ddgs implementation can be replaced with SearXNG or a licensed SERP API without touching the MCP layer.stdio transport — Runs as a subprocess of Claude Code. stdout is the MCP wire, stderr for logs.
No
fetch_urltool — Redundant with Claude Code's native WebFetch.
Development
# Run tests
uv run pytest
# Lint + format check
uv run ruff check . && uv run ruff format --check .
# Type check (strict)
uv run mypy src/
# Run the server directly
uv run python -m web_search_mcpSwapping the search backend
The SearchBackend protocol has a single method:
class SearchBackend(Protocol):
async def search(self, query: str, max_results: int, region: str | None) -> list[SearchResult]: ...To use a different backend (e.g., SearXNG, Brave API), implement this protocol and swap the backend variable in server.py.
Disclaimer
This tool is designed for ad-hoc, conversational web searches — a developer occasionally checking docs, verifying a fact, or looking something up mid-session. It is not intended for:
High-volume agentic workflows that issue dozens of searches per minute
Production systems with uptime requirements
Commercial applications at scale
The ddgs library scrapes DuckDuckGo's frontend. At conversational volume (a few searches per hour) this works reliably. At high volume, you will hit rate limits or CAPTCHAs. If your use case requires production-grade search at scale, swap in a licensed Search API via the SearchBackend protocol.
Limitations
ddgs relies on scraping — If DuckDuckGo changes their frontend, searches break until the package is updated.
Rate limits — DuckDuckGo can rate-limit or CAPTCHA under heavy load. At conversational volume this is unlikely.
No guaranteed uptime — This is a personal tool, not a service.
License
MIT
Available Tools
1 toolweb_searchARead-only
Search the web and return titles, URLs, and text snippets for matching pages.
Uses DuckDuckGo as the search backend — no API key required. Results are suitable for driving follow-up fetches with WebFetch.
Args: params (WebSearchInput): Validated search parameters containing: - query (str): Search query, 1–500 characters, must not be whitespace-only. - max_results (int): Maximum results to return, 1–20 (default: 5). - region (str | None): Locale code such as "us-en" or "br-pt". When omitted the backend's worldwide default ("wt-wt") is used.
Returns: str: JSON-formatted string on success:
{
"results": [
{
"title": str, # Page title
"url": str, # Full URL of the result
"snippet": str # Short excerpt from the page
},
...
]
}
Or an error string on failure:
"Error: <human-readable reason>"Examples: - "Python asyncio tutorial" -> returns up to 5 results about asyncio - query="news", region="br-pt" -> returns Brazilian Portuguese news results - query=" " -> rejected by input validation before any search is performed
Error cases: - Whitespace-only or empty query: rejected by Pydantic validation - max_results outside 1–20: rejected by Pydantic validation - Backend failure (network error, rate limit, DuckDuckGo unavailable): returns "Error: Search failed: "
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true and destructiveHint=false; the description adds valuable behavioral details: DuckDuckGo backend, no API key required, parameter validation rules, and error string return format. No contradiction with annotations.
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 thorough yet well-structured with sections for args, returns, examples, and errors. Every sentence adds value, covering validation, defaults, and error handling without redundancy.
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?
The description explains the return format (JSON string or error), provides usage examples, and lists error cases. Given the tool's simplicity, this is complete—no output schema needed beyond what is described.
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?
The schema has zero property descriptions, but the description fully documents each parameter: query length/whitespace constraints, max_results range, and region locale codes with examples. This goes far beyond the structured schema.
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 states 'Search the web and return titles, URLs, and text snippets for matching pages' – a specific verb and resource with clear output. Even without sibling tools, it unambiguously defines the tool's function.
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?
Provides clear usage context: 'Results are suitable for driving follow-up fetches with WebFetch' and includes examples for different queries and regions. No alternatives exist among sibling tools, so explicit when-not-to-use is unnecessary.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
Only one tool exists, so there is no possibility of confusion. The tool's purpose is clearly defined and distinct from any other potential tool.
The single tool name 'web_search' follows a clear verb_noun pattern, which is consistent and predictable. Even with only one tool, the naming is appropriate and self-explanatory.
The server is a focused web search utility with a single tool that fully encapsulates its intended functionality. Despite having fewer tools than typical MCP servers, the scope is appropriately narrow and well-defined.
The web_search tool covers the entire search workflow, including query validation, result limiting, and region specification. No additional search-related operations are needed for the stated purpose.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
Augments MCP Server - A comprehensive framework documentation provider for Claude Code
An MCP server that gives your AI access to the source code and docs of all public github repos
Related MCP Servers
- AlicenseAqualityDmaintenanceAn MCP server that enables Claude to perform web searches using Perplexity's API with intelligent model selection based on query intent and support for domain and recency filtering.64MIT
- AlicenseAqualityDmaintenanceMCP server that bridges OpenAI's Agents SDK with Claude Code, enabling web search, file search, and computer use capabilities directly in your development environment.291MIT
- FlicenseNot gradedqualityCmaintenanceCustom MCP server exposing an internet_search tool that fetches DuckDuckGo results, enabling AI agents to perform web searches and retrieve structured information.1
- AlicenseNot gradedqualityDmaintenanceA local MCP server that indexes and searches your Claude Code conversation history with both keyword and semantic search, fully private and running locally.MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/victormacaubas/web-search-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server