Skip to main content

DuckDuckGo search and content retrieval tool for MCP (Model Context Protocol)

Project description

DuckDuckGo MCP Server

PyPI Python Version License: MIT Downloads

A Model Context Protocol (MCP) server that allows searching the web using DuckDuckGo. This package provides an easy way to integrate DuckDuckGo search functionality into your Python applications and LLM workflows.

Features

  • Search the web using DuckDuckGo
  • Return structured results with titles, URLs, and snippets
  • Configurable number of results
  • Implemented using FastMCP library with STDIO transport

Installation

Prerequisites

  • Python 3.10 or higher
  • uv (recommended) or pip

Install from PyPI (recommended)

# Using uv (recommended)
uv pip install duckduckgo-mcp

# Or using pip
pip install duckduckgo-mcp

Install with UVX (for Claude Desktop)

# Install UVX if you haven't already
pip install uvx

# Install the DuckDuckGo MCP package
uvx install duckduckgo-mcp

Install from source

For development or to get the latest changes:

# Clone the repository
git clone https://github.com/CyranoB/duckduckgo-mcp.git
cd duckduckgo-mcp

# Install with uv (recommended)
uv pip install -e .

# Or with pip
pip install -e .

Usage

Starting the Server (STDIO Mode)

# Start the server in STDIO mode (for use with MCP clients like Claude)
duckduckgo-mcp serve

# Enable debug logging
duckduckgo-mcp serve --debug

Testing the Search Tool

You can test the search functionality directly from the command line:

# Search DuckDuckGo
duckduckgo-mcp search "your search query" --max-results 5

Integration with LLM Tools

This MCP server is designed to work with any LLM tool that supports the Model Context Protocol (MCP).

Using with Claude CLI

  1. Install the package using one of the methods above

  2. Use it with Claude CLI:

    claude code --mcp duckduckgo-mcp
    

    Or with the full path:

    claude code --mcp $(which duckduckgo-mcp)
    

Using with Claude Desktop

  1. Install the package with UVX as described above

  2. Add it to Claude Desktop (recommended method):

    claude mcp add duckduckgo -- uvx --python=3.10 duckduckgo-mcp serve
    
  3. Alternatively, manually edit the Claude Desktop configuration file:

    The configuration file is located at:

    • macOS: ~/.claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
    • Linux: ~/.config/Claude/claude_desktop_config.json

    Add the following to your configuration file:

    {
      "mcpServers": {
        "duckduckgo": {
          "command": "uvx",
          "args": ["--python=3.10", "duckduckgo-mcp", "serve"]
        }
      }
    }
    
  4. Start a new session in Claude Desktop and select the DuckDuckGo tool from available MCPs

MCP Integration

When using with an MCP client (like Claude), the server exposes a single tool:

@mcp.tool()
def search(query: str, max_results: int = 5) -> list:
    """Search DuckDuckGo for the given query.
    
    Args:
        query: The search query string
        max_results: Maximum number of results to return (default: 5)
        
    Returns:
        List of search results with title, url, and snippet for each result
    """

Example usage in an MCP client:

# This is handled automatically by the MCP client
results = search("Python programming", max_results=3)

Contributing

Contributions are welcome! Here's how you can contribute:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

API

The MCP server exposes a single tool:

  • Tool Name: duckduckgo_search
  • Description: Search the web using DuckDuckGo

Parameters

  • query (string, required): The search query
  • max_results (integer, optional, default: 5): Maximum number of search results to return

Response

{
  "results": [
    {
      "title": "Result title",
      "url": "https://example.com",
      "snippet": "Text snippet from the search result"
    },
    ...
  ]
}

Contributing

Contributions are welcome! Here's how you can contribute:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

duckduckgo_mcp-2.0.0.tar.gz (67.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

duckduckgo_mcp-2.0.0-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file duckduckgo_mcp-2.0.0.tar.gz.

File metadata

  • Download URL: duckduckgo_mcp-2.0.0.tar.gz
  • Upload date:
  • Size: 67.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for duckduckgo_mcp-2.0.0.tar.gz
Algorithm Hash digest
SHA256 9410c6257a3c81ab5c9a29d644601e061e4f61656c84bd3741ac9e5708e8da99
MD5 7d5ec263bf0c930c58181fa5dad7bed6
BLAKE2b-256 229d130cddd8dabd89d4e3ec97f77e63460b604eefd0ef76c6b91dc1ff8dc67c

See more details on using hashes here.

File details

Details for the file duckduckgo_mcp-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: duckduckgo_mcp-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for duckduckgo_mcp-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c5c9fb09c4b83353078800d37a1aa907b32922ea8d11879e24840466a7a2dc45
MD5 d457907259fd2758df8773579cc194ce
BLAKE2b-256 aa9d7de93f34028b2416ef5cb1470c718a732dfc1176223bd537f2f392c3a8d0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page