Skip to main content

DuckDuckGo search 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.8 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

  1. Install the package using one of the methods above

  2. Use it with Claude:

    claude code --mcp duckduckgo-mcp
    

    Or with the full path:

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

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-0.5.0.tar.gz (11.6 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-0.5.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for duckduckgo_mcp-0.5.0.tar.gz
Algorithm Hash digest
SHA256 39c54ab264a91a91afdaecff5cfc0e08e570cabbfc9ae2b2d95917e7bea322dc
MD5 ff9a4abeea0bb40f7083d757a5c45e44
BLAKE2b-256 ad35b8c55d766760eb5f778b607547f40e9a5b2e97e8c521fa33161d99416439

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for duckduckgo_mcp-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 84b1c8bb421e17ae1326c07e12941e172a723cffe580266cb6564e4c0f804dc9
MD5 a8ff05f5d8fa61167581932a36b33e21
BLAKE2b-256 31ea4b03121db7dcd05cf8e7a9893312b2c5c364a5469e68b37ff347cef47bb6

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