DuckDuckGo Search MCP server

Integrates DuckDuckGo search capabilities with customizable parameters for web-based information retrieval.
Back to servers
Setup instructions
Provider
Scott Spence
Release date
Jan 23, 2025
Language
TypeScript
Package
Stats
557 downloads
2 stars

This MCP server provides DuckDuckGo search integration for Large Language Models through the Model Context Protocol. It allows your LLM to search the web, returning comprehensive results including organic search results, news, videos, images, and more.

Installation

To use mcp-duckduckgo-search, you'll need to set up the server with your MCP client. This requires a SerpAPI key to function.

Requirements

  • Node.js installed on your system
  • A SerpAPI key (from SerpAPI)
  • An MCP-compatible client (like Cline or Claude Desktop)

Cline Configuration

Add the following to your Cline MCP settings:

{
	"mcpServers": {
		"mcp-duckduckgo-search": {
			"command": "npx",
			"args": ["-y", "mcp-duckduckgo-search"],
			"env": {
				"SERPAPI_KEY": "your-serpapi-api-key"
			}
		}
	}
}

Claude Desktop with WSL Configuration

For Windows users with WSL, add this to your Claude Desktop configuration:

{
	"mcpServers": {
		"mcp-duckduckgo-search": {
			"command": "wsl.exe",
			"args": [
				"bash",
				"-c",
				"source ~/.nvm/nvm.sh && SERPAPI_KEY=your-serpapi-api-key /home/username/.nvm/versions/node/v20.12.1/bin/npx mcp-duckduckgo-search"
			]
		}
	}
}

Make sure to replace your-serpapi-api-key with your actual SerpAPI key and adjust the path to your Node.js installation if needed.

Usage

Search Tool

The server provides a single tool called ddg_search that you can use in your MCP-compatible client.

Parameters

  • query (string, required): The search term you want to look up
  • region (string, optional): Region code for localized results (e.g., us-en, uk-en)
    • Default: us-en
  • safe_search (string, optional): Safe search filtering level
    • Options: off, moderate, strict
    • Default: moderate
  • date_filter (string, optional): Filter results by date
    • d: past day
    • w: past week
    • m: past month
    • y: past year
    • Custom range: 2023-01-01..2023-12-31
  • start (number, optional): Result offset for pagination
  • no_cache (boolean, optional): Force fresh results by bypassing cache
    • Default: false

Example Usage

When using an MCP-compatible client, you can call the search function with parameters like:

ddg_search(query: "climate change solutions", region: "us-en", safe_search: "moderate", date_filter: "y")

This will search for "climate change solutions" in the US region with moderate safe search filtering, limited to results from the past year.

Features

The DuckDuckGo search tool provides:

  • Comprehensive results including knowledge graphs, organic search results, news, videos, and images
  • Regional search for location-specific content
  • Safe search options to filter content appropriately
  • Date filtering to get recent or time-specific information
  • Pagination support for exploring more results
  • Result caching for better performance

Troubleshooting

If you encounter issues:

  • Verify your SerpAPI key is correct and has sufficient credits
  • Check your network connection
  • Ensure you've configured the MCP server correctly in your client
  • Try disabling caching with no_cache: true if results seem outdated

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "mcp-duckduckgo-search" '{"command":"npx","args":["-y","mcp-duckduckgo-search"],"env":{"SERPAPI_KEY":"your-serpapi-api-key"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "mcp-duckduckgo-search": {
            "command": "npx",
            "args": [
                "-y",
                "mcp-duckduckgo-search"
            ],
            "env": {
                "SERPAPI_KEY": "your-serpapi-api-key"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "mcp-duckduckgo-search": {
            "command": "npx",
            "args": [
                "-y",
                "mcp-duckduckgo-search"
            ],
            "env": {
                "SERPAPI_KEY": "your-serpapi-api-key"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later