Enables web searches using DuckDuckGo's privacy-focused search engine, with tools for performing searches, fetching page content, and generating related search suggestions.
DuckDuckGo MCP Server
A Model Context Protocol (MCP) server that enables AI assistants and language models to perform real-time web searches using DuckDuckGo's privacy-focused search engine.
Tools
1. web_search
Search the web using DuckDuckGo.
Parameters:
query(string, required): The search querymax_results(integer, optional): Maximum number of results (default: 10, max: 50)region(string, optional): Region code (e.g., 'us-en', 'uk-en', 'wt-wt' for worldwide)safe_search(boolean, optional): Enable safe search filtering
Example:
2. fetch_page_content
Fetch and extract clean content from a web page.
Parameters:
url(string, required): The URL to fetch
Example:
3. suggest_related_searches
Get related search suggestions.
Parameters:
query(string, required): The search querymax_suggestions(integer, optional): Maximum suggestions (default: 5, max: 10)
Example:
Installation
Prerequisites
Python 3.10 or higher
pip or uv package manager
Local Development
Clone the repository:
Create a virtual environment:
Install dependencies:
Run the server:
Using with Claude Desktop
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Deploy to Apify
Create an account at Apify
Install Apify CLI:
Login to Apify:
Deploy the Actor:
Configuration
Configure the Actor through the input schema:
Configuration Options
Option | Type | Default | Description |
| string | "stdio" | Server mode: "stdio" or "http" |
| integer | 30 | Max search requests per minute |
| integer | 20 | Max fetch requests per minute |
| integer | 10 | Default number of search results |
| boolean | true | Enable safe search by default |
| boolean | true | Enable detailed logging |
| boolean | false | Cache search results |
| integer | 60 | Cache expiry time |
Architecture
Development
Running Tests
Code Formatting
Type Checking
Rate Limits
The server implements rate limiting to prevent abuse:
Search: 30 requests per minute (configurable)
Fetch: 20 requests per minute (configurable)
Rate limiting uses a token bucket algorithm that refills over time.
Error Handling
The server provides comprehensive error handling:
Network failures are caught and reported
Rate limit violations are queued
Invalid inputs are validated
All errors return structured messages
Use Cases
For AI Developers
Build chatbots with web search capabilities
Create research assistants
Develop fact-checking tools
For Software Engineers
Integrate search into applications
Build custom search interfaces
Create data collection pipelines
For Researchers
Combine AI reasoning with real-time data
Perform automated research
Analyze search trends
Privacy & Terms
This Actor:
Uses DuckDuckGo's privacy-focused search engine
Does not track user queries
Is for educational and research purposes
Should respect DuckDuckGo's Terms of Service
Is not affiliated with DuckDuckGo
Important: This tool is not intended for commercial use that violates DuckDuckGo's Terms of Service.
Contributing
Contributions are welcome! Please:
Fork the repository
Create a feature branch
Make your changes
Add tests
Submit a pull request
License
MIT License - see LICENSE file for details
Support
For issues, questions, or contributions:
Open an issue on GitHub
Check existing documentation
Review the code examples
Changelog
Version 1.0.0
Initial release
Web search functionality
Content fetching and parsing
Search suggestions
Rate limiting
MCP protocol support
Apify Actor integration
Roadmap
Future enhancements:
HTTP server mode
News search
Image search
Video search
Advanced caching
Search history
Analytics and metrics
Multi-language support
Credits
Built with:
Model Context Protocol by Anthropic
duckduckgo-search library
Apify platform
BeautifulSoup for HTML parsing
readability-lxml for content extraction
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Enables AI assistants to perform real-time web searches, fetch webpage content, and get search suggestions using DuckDuckGo's privacy-focused search engine.