DuckDuckGo MCP Agent
Provides web search capabilities using DuckDuckGo, allowing LLMs to perform searches with parameters like query, region, safesearch, and timelimit.
Click on "Deploy 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., "@DuckDuckGo MCP Agentsearch for latest advancements in AI"
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.
DuckDuckGo MCP Agent
A minimal, production-ready Model Context Protocol (MCP) server enabling LLMs to perform web searches via DuckDuckGo. Built with FastAPI and Server-Sent Events (SSE).
Features:
✅ Single-file implementation (~324 lines)
✅ No API keys required
✅ HTTP + SSE streaming (LM Studio compatible)
✅ Docker-ready
✅ Minimal dependencies (FastAPI, Uvicorn, duckduckgo-search)
Quick Start
Prerequisites
Python 3.10+ or Docker
LM Studio (optional)
Option 1: Dev Container (Recommended)
Install VS Code and Docker Desktop
Install Dev Containers extension
Open folder in VS Code → "Reopen in Container"
Option 2: Local Development
make install-dev
make run-dev
# Server: http://localhost:8000Option 3: Docker
make docker-build
make docker-run
# Or: make docker-composeRelated MCP server: web-mcp-server
Usage
HTTP Request
curl -X POST http://localhost:8000/ \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "web_search",
"arguments": {"query": "Python async", "all_results": true, "region": "us-en", "safesearch": "moderate", "timelimit": "w"}
}
}'MCP Protocol
Initialize:
{"method": "initialize", "id": 1}List Tools:
{"method": "tools/list", "id": 2}Call Search:
{
"method": "tools/call",
"id": 3,
"params": {
"name": "web_search",
"arguments": {"query": "your query", "max_results": 5, "all_results": false, "region": "wt-wt", "safesearch": "moderate"}
}
}LM Studio Configuration
Add to mcp-config.json:
{
"mcpServers": {
"duckduckgo-search": {
"type": "http",
"url": "http://localhost:8000",
"disabled": false
}
}
}Architecture
Data Flow:
LM Studio → POST / (JSON-RPC) → FastAPI → SSE Events → Client
↓
MCP Handlers (initialize, tools/list, tools/call)
↓
DuckDuckGo Search APIKey Components:
mcp_http_sse_server.py- Single FastAPI app with async streamingrequirements.txt- Dependencies onlyDockerfile- Production & dev stagesdocker-compose.yml- Orchestrationtest-mcp-sse.py- Integration tests
Development
Make Commands
make help # Show all commands
make install-dev # Install dev dependencies
make run-dev # Run with auto-reload
make test # Run tests
make lint # Ruff + mypy type checking
make format # Black + ruff auto-format
make clean # Remove build artifacts
make docker-build # Build Docker image
make docker-compose # Run with Docker ComposeCode Quality
make format # Auto-format code
make lint # Run lintersConfiguration
Environment Variables
Variable | Default | Purpose |
|
| Verbose logging |
|
| Dev mode |
|
| Log level |
|
| Server port |
Docker
Set in docker-compose.yml:
environment:
- MCP_ENVIRONMENT=development
- MCP_LOG_LEVEL=INFOProduction requires: mcp_http_sse_server.py + requirements.txt
API Reference
Response Format (SSE)
event: message
data: {"jsonrpc": "2.0", "id": 1, "result": {...}}
event: done
data: {}Search Tool
Input:
query(string, required)max_results(int, 1-10, default 5). Ignored whenall_resultsis true.all_results(boolean, default false): fetch maximum results (capped at 10)region(string, defaultwt-wt)safesearch(string enum:off|moderate|strict, defaultmoderate)timelimit(string enum:d|w|m|y, optional)
Output: Formatted markdown with title, URL, snippet
Contributing
Keep this project minimal:
Single-file design (avoid modularization)
MCP protocol compliance
Test with real LM Studio
Run
make format && make lintbefore submission
Support
Examples: test-mcp-sse.py
Debugging: Set
MCP_DEBUG=trueConfig: See mcp-config.json
Changelog
1.2.0: Add
all_resultsflag (internal cap 100) to support larger result sets; bump version and docs.1.1.0: Improved DuckDuckGo search with region/safesearch/timelimit parameters; better markdown formatting; version surfaced in initialize.
License
See LICENSE
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for Firecrawl — web search, scraping, and biomedical/arXiv paper search.
Free web search for AI agents. No API key required. Hosted MCP in active development.
Docs: https://docs.keenable.ai/mcp-server Keenable is a free, remote MCP server that gives agents access to the web index. Search the web with ranked results and date/site filters, then fetch any indexed page as clean markdown. Works out of the box with no account or API key.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA lightweight MCP server that enables LLMs to search the web via DuckDuckGo, search GitHub code repositories, and extract clean content from web pages in LLM-friendly formats.9-
- FlicenseNot gradedqualityDmaintenanceMCP server that exposes web_search and web_fetch tools, allowing LLM applications to search the web via DuckDuckGo and fetch page content as cleaned markdown.-
- AlicenseNot gradedqualityCmaintenanceMCP server for web search and content extraction using DuckDuckGo or SearXNG, with Playwright-based fetching and LLM-powered data extraction.140MIT
- AlicenseNot gradedqualityCmaintenanceA minimal MCP server that exposes a private SearXNG instance as a search tool over streamable-HTTP, enabling web search from the llama.cpp WebUI or any compatible MCP client.4MIT