mcpField
D
DuckDuckGo Search with MCP Agent

DuckDuckGo Search with MCP Agent

Local
github.com/alihassanmlSearch1Updated 79w ago

About DuckDuckGo Search with MCP Agent

DuckDuckGo Search with MCP Agent is a Python example for combining DuckDuckGo search with a LangChain Groq LLM agent. It uses asynchronous execution to connect through MCP and return search results.

Key features

  1. 01DuckDuckGo MCP server integration
  2. 02Groq LLM reasoning
  3. 03Asynchronous Python execution
  4. 04Modular example structure

Use cases

  1. 01Run agent-assisted DuckDuckGo searches
  2. 02Explore MCP client and server integration

MCP support

The example starts an MCP client and connects it to duckduckgo-mcp-server, which provides DuckDuckGo search.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"Duckduckgo-with-MCP": {
"command": "uvx",
"args": [
"duckduckgo-mcp-server"
]
}
}
}
Run commanduvx duckduckgo-mcp-server

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
pypiduckduckgo-mcp-server

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

DuckDuckGo Search with MCP Agent

This project demonstrates how to use DuckDuckGo MCP Server with a LangChain Groq LLM agent to perform intelligent search tasks via MCP (Micro Component Protocol).


Features

  • MCP Server Integration (DuckDuckGo search)
  • Groq LLM (deepseek-r1-distill-llama-70b) for reasoning
  • Async Python execution
  • Simple and modular

Installation

  1. Clone the repository:
git clone https://github.com/alihassanml/Duckduckgo-with-MCP.git
cd Duckduckgo-with-MCP
  1. Install dependencies:
pip install -r requirements.txt

(Include libraries like langchain_groq, python-dotenv, etc. in your requirements.txt.)

  1. Set up your .env file:
GROQ_API_KEY=your_groq_api_key_here
  1. Install the MCP Server:
uvx -y duckduckgo-mcp-server

(Make sure uvx is installed. If not, install it.)


Usage

Run the main script:

python main.py

This will:

  • Start the MCP client
  • Connect to the duckduckgo-mcp-server
  • Use the Groq LLM to perform a smart search
  • Print the result

Example Code

import asyncio
import os
from dotenv import load_dotenv
from langchain_groq import ChatGroq  
from mcp_use import MCPAgent, MCPClient

async def main():
    load_dotenv()
    config = {
        "mcpServers": {
            "ddg-search": {
                "command": "uvx",
                "args": ["-y", "duckduckgo-mcp-server"]
            }
        }
    }
    client = MCPClient.from_dict(config)
    llm = ChatGroq(model="deepseek-r1-distill-llama-70b")
    agent = MCPAgent(llm=llm, client=client, max_steps=30)
    result = await agent.run("Find the best restaurant in San Francisco")
    print(f"\nResult: {result}")

if __name__ == "__main__":
    asyncio.run(main())

Resources


License

This project is licensed under the MIT License.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.