Skip to main content
Glama
DDGS MCP Server
by AlirezaF80

DDGS MCP Server

A Model Context Protocol (MCP) server that wraps the DDGS (Dux Distributed Global Search) library, providing AI agents with powerful web search capabilities across multiple search engines.

Note: This entire codebase was generated by Claude Sonnet 4.5. The repository owner does not take any responsibility for any issues, bugs, or problems that may arise from using this software. Use at your own risk.

Features

Search Types

  • Text Search: Web search across Bing, Brave, DuckDuckGo, Google, Mojeek, Yahoo, Wikipedia, and more

  • Image Search: Search images with filters for size, color, type, layout, and license

  • Video Search: Find videos with resolution, duration, and license filters

  • News Search: Search news articles from multiple sources

  • Book Search: Search books across Anna's Archive

Advanced Capabilities

  • Multiple Search Engines: Automatic fallback between backends for reliability

  • Search Operators: Support for filetype:, site:, intitle:, inurl:, and boolean operators

  • Regional Search: Support for country-language combinations (us-en, uk-en, cn-zh, etc.)

  • Proxy Support: HTTP/HTTPS/SOCKS5 proxies, including Tor browser integration

  • Flexible Filtering: Safesearch, time limits, and content-specific filters

Related MCP server: SerpApi MCP Server

Installation

Prerequisites

  • Python 3.9 or higher

  • pip

Setup

  1. Clone or navigate to the repository:

    cd "d:\MCP Servers\ddgs-mcp-wrapper"
  2. Create a virtual environment (recommended):

    python -m venv venv
    .\venv\Scripts\Activate.ps1
  3. Install dependencies:

    pip install -r requirements.txt

    Or install directly:

    pip install mcp ddgs pydantic

Usage

Running the Server

Standalone

python server.py

With MCP Client Configuration

Add to your MCP client configuration (e.g., Claude Desktop, Cline, etc.):

For Claude Desktop (%APPDATA%\Claude\claude_desktop_config.json):

{
  "mcpServers": {
    "ddgs-search": {
      "command": "python",
      "args": ["d:\\MCP Servers\\ddgs-mcp-wrapper\\server.py"],
      "env": {
        "DDGS_PROXY": ""
      }
    }
  }
}

For Cline (.vscode/settings.json):

{
  "mcp.servers": {
    "ddgs-search": {
      "command": "python",
      "args": ["d:\\MCP Servers\\ddgs-mcp-wrapper\\server.py"]
    }
  }
}

Using with UV (Alternative)

If you prefer using uv:

uvx --from mcp ddgs-mcp-server

Available Tools

Search the web for text content.

Parameters:

  • query (required): Search query with optional operators

  • region: Region code (default: "us-en")

  • safesearch: "on", "moderate", or "off" (default: "moderate")

  • timelimit: "d" (day), "w" (week), "m" (month), "y" (year)

  • max_results: Maximum results (1-100, default: 10)

  • backend: "auto" or comma-separated backends (default: "auto")

  • proxy: Proxy URL or "tb" for Tor browser

Example:

{
  "query": "python machine learning filetype:pdf",
  "region": "us-en",
  "max_results": 20,
  "timelimit": "y"
}

Search for images with filters.

Parameters:

  • query (required): Image search query

  • region, safesearch, timelimit, max_results: Same as text search

  • size: "Small", "Medium", "Large", "Wallpaper"

  • color: "color", "Monochrome", "Red", "Orange", "Yellow", "Green", "Blue", etc.

  • type_image: "photo", "clipart", "gif", "transparent", "line"

  • layout: "Square", "Tall", "Wide"

  • license_image: "any", "Public", "Share", "ShareCommercially", "Modify", "ModifyCommercially"

Search for videos.

Parameters:

  • query (required): Video search query

  • region, safesearch, timelimit, max_results: Same as text search

  • resolution: "high" or "standard"

  • duration: "short", "medium", "long"

  • license_videos: "creativeCommon", "youtube"

Search news articles.

Parameters:

  • query (required): News search query

  • region, safesearch, timelimit, max_results: Same as text search

  • backend: "auto", "bing", "duckduckgo", "yahoo"

Search for books.

Parameters:

  • query (required): Book search query (title, author, ISBN)

  • max_results: Maximum results (1-100, default: 10)

Search Operators

The text search supports advanced operators:

Operator

Description

cats dogs

Results about cats OR dogs

"exact phrase"

Exact match for phrase

cats -dogs

Fewer dogs in results

cats +dogs

More dogs in results

filetype:pdf

Specific file type (pdf, doc, xls, ppt, html)

site:example.com

Results from specific domain

-site:example.com

Exclude specific domain

intitle:keyword

Keyword in page title

inurl:keyword

Keyword in URL

Proxy Configuration

Using Tor Browser

{
  "proxy": "tb"
}

Or set the environment variable:

$env:DDGS_PROXY = "socks5h://127.0.0.1:9150"

Using Custom Proxy

{
  "proxy": "http://user:pass@proxy.example.com:8080"
}

Supported protocols: http://, https://, socks5://, socks5h://

Development

Project Structure

ddgs-mcp-wrapper/
├── server.py           # Main MCP server implementation
├── pyproject.toml      # Project configuration
├── requirements.txt    # Python dependencies
├── README.md          # This file
└── .gitignore         # Git ignore rules

Testing the Server

Test with an MCP client or using the MCP Inspector:

npm install -g @modelcontextprotocol/inspector
mcp-inspector python server.py

Debugging

Enable debug logging by modifying server.py:

logging.basicConfig(level=logging.DEBUG)

Tips for AI Agents

  1. Use backend='auto': Automatically handles temporary backend unavailability

  2. Specify regions: Better search quality with region codes like ar-es, pl-pl, cn-zh

  3. Iterate through pages: Single queries return results from page 1; iterate for more

  4. Use search operators: Combine operators for precise results (e.g., "machine learning" filetype:pdf site:.edu)

  5. Proxy for blocked regions: Use proxy if backends are rate-limited or blocked in your country

Troubleshooting

Common Issues

"Module not found" errors:

pip install --upgrade mcp ddgs pydantic

Rate limiting:

  • Use backend='auto' to cycle through engines

  • Add delays between requests

  • Use a proxy or Tor browser

Import errors:

# Verify installation
pip list | Select-String -Pattern "mcp|ddgs|pydantic"

Connection timeout:

  • Increase timeout in get_ddgs_instance() call

  • Check proxy configuration

  • Try different backends

License

MIT License - feel free to use in your projects.

Contributing

Contributions welcome! Please:

  1. Fork the repository

  2. Create a feature branch

  3. Submit a pull request

Resources

Disclaimer

Code Generation: This entire project was generated by Claude Sonnet 4.5 AI. The repository owner takes no responsibility for any issues, errors, or consequences arising from the use of this software.

Usage: This server is for educational and research purposes only. Respect search engine terms of service and rate limits. Use at your own risk.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables AI agents to perform comprehensive search across 27 search engines including web, academic, code, community, package managers, video, images, podcasts, and maps, with multi-modal support, caching, and security features.
      14
      MIT
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables agents to query Google, Bing, Yahoo, DuckDuckGo, YouTube, eBay, and other search engines for real-time results such as weather, stock data, news, images, and shopping listings. Supports flexible JSON or Markdown responses with complete or compact modes.
      -
    • F
      license
      Not graded
      quality
      Not graded
      maintenance
      Enables AI assistants to run real-time searches across Google, Bing, Yahoo, DuckDuckGo, YouTube, eBay and other engines, returning results such as answer boxes, news, images, shopping, weather and stock data. Responses are automatically detected and formatted as structured JSON or token-saving Markdown, with optional interactive UI tools for tabular and dashboard views.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables agents to run multi-engine web searches across Google, Bing, Yahoo, DuckDuckGo, YouTube, eBay and more, along with related live data such as weather, stocks, and news. Results are automatically detected and formatted, and can be returned as structured JSON (complete or compact) or token-efficient Markdown, optionally rendered through interactive UI tools.
      -