duckduckgo-mcp-server
by: zhsama
duckduckgo mcp server
📌Overview
Purpose: To provide an efficient Model Context Protocol (MCP) server that integrates DuckDuckGo search functionality.
Overview: This TypeScript-based MCP server allows users to perform web searches through DuckDuckGo’s API. It incorporates essential MCP principles, offering a straightforward search tool interface along with support for rate limiting and error handling.
Key Features:
-
Search Tool: The
duckduckgo_search
function enables users to execute web searches via the DuckDuckGo API by specifying a search query. Optional parameters allow customization of the number of results and safe search levels, returning results in a formatted Markdown style. -
Rate Limits: To ensure fair use, the server implements a rate limit of one request per second and allows a maximum of 15,000 requests per month.
duckduckgo-search MCP Server
A Model Context Protocol server for DuckDuckGo Search.
This TypeScript-based MCP server provides DuckDuckGo search functionality and demonstrates core MCP concepts through:
- Integration with DuckDuckGo Search
- Easy-to-use search tool interface
- Rate limiting and error handling support
Features
Search Tool
duckduckgo_search
- Perform web searches using DuckDuckGo API- Required parameter:
query
(search query, max 400 characters) - Optional parameter:
count
(number of results, 1-20, default 10) - Optional parameter:
safeSearch
(safety level: strict/moderate/off, default moderate) - Returns formatted Markdown search results
- Required parameter:
Rate Limits
- Maximum 1 request per second
- Maximum 15000 requests per month
Development
Prerequisites
- Node.js >= 18
- pnpm >= 8.0.0
Installation
# Install pnpm if not already installed
npm install -g pnpm
# Install project dependencies
pnpm install
Build and Run
Build the server:
pnpm run build
For development with auto-rebuild:
pnpm run watch
Setup in Claude Desktop
To use with Claude Desktop, add the server config:
- On MacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- On Windows:
%APPDATA%/Claude/claude_desktop_config.json
Example configuration:
# online
{
"mcpServers": {
"duckduckgo-search": {
"command": "npx",
"args": [
"-y",
"duckduckgo-mcp-server"
]
}
}
}
# local
{
"mcpServers": {
"duckduckgo-search": {
"command": "node",
"args": [
"/path/to/duckduckgo-search/build/index.js"
]
}
}
}
Debugging
Since MCP servers communicate over stdio, debugging can be challenging. It is recommended to use the MCP Inspector, available as a package script:
pnpm run inspector
The Inspector will provide a URL to access debugging tools in your browser.