$git clone https://github.com/nickclyde/duckduckgo-mcp-serverA Model Context Protocol (MCP) server that provides web search capabilities through DuckDuckGo, with additional features for content fetching and parsing.
| 1 | # DuckDuckGo Search MCP Server |
| 2 | |
| 3 | [](https://pypi.org/project/duckduckgo-mcp-server/) |
| 4 | [](https://pypi.org/project/duckduckgo-mcp-server/) |
| 5 | [](https://pypi.org/project/duckduckgo-mcp-server/) |
| 6 | |
| 7 | A Model Context Protocol (MCP) server that provides web search capabilities through DuckDuckGo, with additional features for content fetching and parsing. |
| 8 | |
| 9 | ## Quick Start |
| 10 | |
| 11 | ```bash |
| 12 | uvx duckduckgo-mcp-server |
| 13 | ``` |
| 14 | |
| 15 | ## Features |
| 16 | |
| 17 | - **Web Search**: Search DuckDuckGo with advanced rate limiting and result formatting |
| 18 | - **Content Fetching**: Retrieve and parse webpage content with intelligent text extraction |
| 19 | - **Rate Limiting**: Built-in protection against rate limits for both search and content fetching |
| 20 | - **Error Handling**: Comprehensive error handling and logging |
| 21 | - **LLM-Friendly Output**: Results formatted specifically for large language model consumption |
| 22 | |
| 23 | ## Installation |
| 24 | |
| 25 | Install from PyPI using `uv`: |
| 26 | |
| 27 | ```bash |
| 28 | uv pip install duckduckgo-mcp-server |
| 29 | ``` |
| 30 | |
| 31 | ## Usage |
| 32 | |
| 33 | ### Running with Claude Desktop |
| 34 | |
| 35 | 1. Download [Claude Desktop](https://claude.ai/download) |
| 36 | 2. Create or edit your Claude Desktop configuration: |
| 37 | - On macOS: `~/Library/Application Support/Claude/claude_desktop_config.json` |
| 38 | - On Windows: `%APPDATA%\Claude\claude_desktop_config.json` |
| 39 | |
| 40 | Add the following configuration: |
| 41 | |
| 42 | **Basic Configuration (No SafeSearch, No Default Region):** |
| 43 | ```json |
| 44 | { |
| 45 | "mcpServers": { |
| 46 | "ddg-search": { |
| 47 | "command": "uvx", |
| 48 | "args": ["duckduckgo-mcp-server"] |
| 49 | } |
| 50 | } |
| 51 | } |
| 52 | ``` |
| 53 | |
| 54 | **With SafeSearch and Region Configuration:** |
| 55 | ```json |
| 56 | { |
| 57 | "mcpServers": { |
| 58 | "ddg-search": { |
| 59 | "command": "uvx", |
| 60 | "args": ["duckduckgo-mcp-server"], |
| 61 | "env": { |
| 62 | "DDG_SAFE_SEARCH": "STRICT", |
| 63 | "DDG_REGION": "cn-zh" |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | ``` |
| 69 | |
| 70 | **Configuration Options:** |
| 71 | - `DDG_SAFE_SEARCH`: SafeSearch filtering level (optional) |
| 72 | - `STRICT`: Maximum content filtering (kp=1) |
| 73 | - `MODERATE`: Balanced filtering (kp=-1, default if not specified) |
| 74 | - `OFF`: No content filtering (kp=-2) |
| 75 | - `DDG_REGION`: Default region/language code (optional, examples below) |
| 76 | - `us-en`: United States (English) |
| 77 | - `cn-zh`: China (Chinese) |
| 78 | - `jp-ja`: Japan (Japanese) |
| 79 | - `wt-wt`: No specific region |
| 80 | - Leave empty for DuckDuckGo's default behavior |
| 81 | |
| 82 | 3. Restart Claude Desktop |
| 83 | |
| 84 | ### Running with Claude Code |
| 85 | |
| 86 | 1. Download [Claude Code](https://github.com/anthropics/claude-code) |
| 87 | 2. Ensure [`uvenv`](https://github.com/robinvandernoord/uvenv) is installed and the `uvx` command is available |
| 88 | 3. Add the MCP server: `claude mcp add ddg-search uvx duckduckgo-mcp-server` |
| 89 | |
| 90 | ### Running with SSE or Streamable HTTP |
| 91 | |
| 92 | The server supports alternative transports for use with other MCP clients: |
| 93 | |
| 94 | ```bash |
| 95 | # SSE transport |
| 96 | uvx duckduckgo-mcp-server --transport sse |
| 97 | |
| 98 | # Streamable HTTP transport |
| 99 | uvx duckduckgo-mcp-server --transport streamable-http |
| 100 | ``` |
| 101 | |
| 102 | The default transport is `stdio`, which is used by Claude Desktop and Claude Code. |
| 103 | |
| 104 | When running with `sse` or `streamable-http`, override the default bind address (`127.0.0.1:8000`) with the `--host` and `--port` flags: |
| 105 | |
| 106 | ```bash |
| 107 | uvx duckduckgo-mcp-server --transport streamable-http --host 0.0.0.0 --port 7070 |
| 108 | ``` |
| 109 | |
| 110 | ### Backends (bypassing bot detection) |
| 111 | |
| 112 | Some sites — and, as of recently, DuckDuckGo's own search endpoint (`html.duckduckgo.com`) — block the default `httpx` client because of its distinctive TLS fingerprint, regardless of User-Agent. Cloudflare Bot Management and similar filters key on the JA3/TLS handshake, not on headers, so `html.duckduckgo.com` may answer `httpx` with an empty **HTTP 202** page (silently yielding "no results"). An opt-in backend, `curl` (implemented via `curl_cffi`), impersonates a real Chrome browser's TLS handshake and passes through those checks |