DuckDuckGo Search MCP Server with anti-bot protection
Project description
ddg-search-mcp
DuckDuckGo Search MCP Server. Scrapes DuckDuckGo Lite directly — no API key required, no rate limits, robust anti-bot protection.
Quick Start
pip install ddg-search-mcp-Albertous007
# or
uvx ddg-search-mcp-Albertous007
From source (before PyPI release)
git clone https://github.com/Albertous007/ddg-search-mcp.git
cd ddg-search-mcp
pip install -e .
Add to your MCP client:
{
"mcpServers": {
"ddg-search": {
"command": "uvx",
"args": ["ddg-search-mcp-Albertous007"]
}
}
}
Features
- Advanced Anti-bot Protection: Uses
curl_cffito mimic a real Chrome 131 TLS fingerprint (JA3), seamlessly bypassing most bot detection and CAPTCHA systems. - Dual Parser Engine: Primary parser for DuckDuckGo Lite HTML, with automatic legacy fallback if the structure changes.
- Parser Health Warning: If the primary parser fails and no results are found, a warning is included in the output with a link to report the issue.
- Full Content Extraction: Deep extraction of page content via
trafilatura(with automatic snippet fallback on fetch failure). - Concurrent Processing: Page content is fetched in parallel to minimize latency.
- Full Region Support: Regional searches (e.g.,
es-esfor Spain,mx-esfor Mexico) using the native DuckDuckGoklparameter. - Zero Configuration: No API keys, accounts, or complex setup required.
- Structured Logging: All server activity logs to stderr with configurable verbosity.
- Environment Configuration: All constants tunable via environment variables (see
.env.example).
No SafeSearch filter
This server does not implement SafeSearch filtering. All search results are returned as-is from DuckDuckGo. If you need content filtering, consider nickclyde/duckduckgo-mcp-server which supports
DDG_SAFE_SEARCH=STRICT | MODERATE | OFF.This is a deliberate design choice — keeping the server simple, fast, and without feature creep.
Installation
From PyPI (recommended)
pip install ddg-search-mcp-Albertous007
From source
git clone https://github.com/Albertous007/ddg-search-mcp.git
cd ddg-search-mcp
pip install -e .
Usage with opencode
After pip install, the installed console script is the simplest option:
{
"mcp": {
"ddg-search": {
"type": "local",
"command": ["ddg-search-mcp"],
"enabled": true
}
}
}
With python -m
{
"mcp": {
"ddg-search": {
"type": "local",
"command": ["python", "-m", "ddg_search_mcp"],
"enabled": true
}
}
}
With uvx
{
"mcp": {
"ddg-search": {
"type": "local",
"command": ["uvx", "ddg-search-mcp-Albertous007"],
"enabled": true
}
}
}
Tool: search
| Parameter | Required | Default | Description |
|---|---|---|---|
query |
Yes | — | Search terms |
count |
No | 10 | Max results (1–10, configurable via DDG_MAX_RESULTS) |
region |
No | wt-wt | Region: wt-wt (global), us-en (USA), es-es (Spain), etc. |
Environment Variables
All settings are optional — defaults are shown below.
| Variable | Default | Description |
|---|---|---|
DDG_LOG_LEVEL |
INFO |
Log level: DEBUG, INFO, WARNING, ERROR |
DDG_SEARCH_DELAY |
3.0 |
Min seconds between search requests |
DDG_MAX_CONTENT_CHARS |
6000 |
Max chars of page content per result |
DDG_MAX_SNIPPET_CHARS |
400 |
Max chars of snippet fallback |
DDG_PAGE_FETCH_TIMEOUT |
8.0 |
Timeout (s) for fetching result pages |
DDG_SEARCH_TIMEOUT |
12.0 |
Timeout (s) for the search request itself |
DDG_MAX_RESULTS |
10 |
Max results returned per search (1–10) |
Copy .env.example to .env and customize, or set them directly in your environment.
Cross-platform
Works on Windows, Linux, and macOS. Requires Python 3.10+.
Known Issues
Rate limiting (CAPTCHA)
DuckDuckGo aggressively rate-limits requests from a single IP. This MCP uses DuckDuckGo Lite, browser impersonation, and an integrated 3.0s delay with auto-retries to be as robust as possible.
Symptoms: The tool returns No results found for all queries.
Fix: If blocked, wait a few minutes. The rate limit expires automatically.
HTML structure changes
This MCP scrapes DuckDuckGo's HTML directly. If DDG changes their HTML structure, the parsing logic may need to be updated.
When a search returns no results and the parser structure is suspected to have changed, the output includes a warning:
⚠️ DuckDuckGo may have changed their HTML structure.
If searches fail consistently, report at:
https://github.com/Albertous007/ddg-search-mcp/issues
This warning only appears when both the primary and fallback parsers fail to extract results.
Development
git clone https://github.com/Albertous007/ddg-search-mcp.git
cd ddg-search-mcp
pip install -e .
cp .env.example .env # optional: tweak settings
python -m ddg_search_mcp
Test with MCP Inspector:
pip install mcp[cli]
mcp dev src/ddg_search_mcp/server.py
Run unit tests:
pip install pytest
pytest
Requirements
- Python 3.10+
curl_cffi(HTTP client with TLS fingerprinting)beautifulsoup4(HTML parsing)trafilatura(content extraction)mcp(MCP Python SDK)
Contributing
See CONTRIBUTING.md.
This is a personal project maintained by @Albertous007. If the repository becomes unmaintained, anyone is welcome to fork it.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ddg_search_mcp_albertous007-1.0.1.tar.gz.
File metadata
- Download URL: ddg_search_mcp_albertous007-1.0.1.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dac30789faaddfbd36f58d38e3eee698b68601ca5d5e1c89d93a3c9242d4164b
|
|
| MD5 |
cd28714284659fa6035dc2cbef34f5d4
|
|
| BLAKE2b-256 |
391e84e3ff6d0208e7e148dc6746a676602ca82de8d477b5fb2deb8188f582a8
|
Provenance
The following attestation bundles were made for ddg_search_mcp_albertous007-1.0.1.tar.gz:
Publisher:
publish.yml on Albertous007/ddg-search-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ddg_search_mcp_albertous007-1.0.1.tar.gz -
Subject digest:
dac30789faaddfbd36f58d38e3eee698b68601ca5d5e1c89d93a3c9242d4164b - Sigstore transparency entry: 1606071880
- Sigstore integration time:
-
Permalink:
Albertous007/ddg-search-mcp@980c8d98ca48bc505d169ceb9aba8a562f7c71fd -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/Albertous007
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@980c8d98ca48bc505d169ceb9aba8a562f7c71fd -
Trigger Event:
push
-
Statement type:
File details
Details for the file ddg_search_mcp_albertous007-1.0.1-py3-none-any.whl.
File metadata
- Download URL: ddg_search_mcp_albertous007-1.0.1-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
802223f330b5fac59bbcb3e1edcf76fbb040379dcf08e09e1dca53145f8cb36b
|
|
| MD5 |
b555b8a74c41c167fec69c59e2f27795
|
|
| BLAKE2b-256 |
6acae006c331308da7bb3f5f9e24608d74869935f672ed98d45727b2eb1f8c98
|
Provenance
The following attestation bundles were made for ddg_search_mcp_albertous007-1.0.1-py3-none-any.whl:
Publisher:
publish.yml on Albertous007/ddg-search-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ddg_search_mcp_albertous007-1.0.1-py3-none-any.whl -
Subject digest:
802223f330b5fac59bbcb3e1edcf76fbb040379dcf08e09e1dca53145f8cb36b - Sigstore transparency entry: 1606071992
- Sigstore integration time:
-
Permalink:
Albertous007/ddg-search-mcp@980c8d98ca48bc505d169ceb9aba8a562f7c71fd -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/Albertous007
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@980c8d98ca48bc505d169ceb9aba8a562f7c71fd -
Trigger Event:
push
-
Statement type: