Provides web search capabilities using DuckDuckGo's search engine with configurable safe search controls and result formatting options.
DuckDuckGo MCP Server
A Model Context Protocol (MCP) server that provides two capabilities:
Search the web using DuckDuckGo
Fetch and convert web content using Jina Reader
Features
DuckDuckGo web search with safe search controls
Fetch and convert URLs to markdown or JSON using Jina Reader
LLM-friendly output format option for search results
CLI for search, fetch, serve, and version commands
MCP tools for LLM integration
Docker support for containerized deployment
Installation
Prerequisites
Python 3.10 or higher
uv (recommended) or pip
Install from PyPI (recommended)
Install with UVX (for Claude Desktop)
Install via Smithery
To install DuckDuckGo MCP Server for Claude Desktop automatically via Smithery:
Install from source
For development or to get the latest changes:
Docker
Build and run with Docker:
Usage
Starting the Server (STDIO Mode)
Testing the Search Tool
Testing the Fetch Tool
Version Information
MCP Client Setup
This MCP server works with any MCP-compatible client. Use one of the setups below.
Python 3.10-3.13 is supported (3.14 not yet). Use --python ">=3.10,<3.14" with uvx to enforce. Verified with Python 3.12 and 3.13.
Claude Desktop
Open Claude Desktop > Settings > Developer > Edit Config.
Edit the config file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
Add the server config under
mcpServers:{ "mcpServers": { "duckduckgo": { "command": "uvx", "args": ["--python", ">=3.10,<3.14", "duckduckgo-mcp", "serve"] } } }Restart Claude Desktop.
Claude Code
Add a local stdio server:
Optional: claude mcp list to verify, or claude mcp add-from-claude-desktop to import.
Codex (CLI + IDE)
Add via CLI:
Or configure ~/.codex/config.toml:
OpenCode
Add to your OpenCode config (~/.config/opencode/opencode.json or project opencode.json):
Or run opencode mcp add and follow the prompts.
Cursor
Add to ~/.cursor/mcp.json (global) or .cursor/mcp.json (project):
Verify with:
MCP Tools
The server exposes these tools to MCP clients:
Example usage in an MCP client:
API
Tool 1: Search
Tool Name:
duckduckgo_searchDescription: Search the web using DuckDuckGo (powered by the
ddgslibrary)
Parameters
query(string, required): The search querymax_results(integer, optional, default: 5): Maximum number of search results to returnsafesearch(string, optional, default: "moderate"): Safe search setting ("on", "moderate", or "off")output_format(string, optional, default: "json"): Output format - "json" for structured data, "text" for LLM-friendly formatted string
Response
JSON format (default): A list of dictionaries:
Text format: An LLM-friendly formatted string:
Tool 2: Fetch
Tool Name:
jina_fetchDescription: Fetch a URL and convert it to markdown or JSON using Jina Reader
Parameters
url(string, required): The URL to fetch and convertformat(string, optional, default: "markdown"): Output format ("markdown" or "json")max_length(integer, optional): Maximum content length to return (None for no limit)with_images(boolean, optional, default: false): Whether to include image alt text generation
Response
For markdown format: a string containing markdown content
For JSON format: a dictionary with the structure:
Notes
Search uses the
ddgspackage (renamed fromduckduckgo-search).Fetch uses the Jina Reader API at
https://r.jina.ai/.
Contributing
Contributions are welcome! Here's how you can contribute:
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add some amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
Support
If you encounter any issues or have questions, please open an issue.
License
This project is licensed under the MIT License - see the LICENSE file for details.