MCP ExplorerExplorer

Duckduckgo With Mcp

@alihassanmlon 9 months ago
1 MIT
FreeCommunity
AI Systems
#duckduckgo#mcp-server
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).

Overview

What is Duckduckgo With Mcp

Duckduckgo-with-MCP is a project that demonstrates the integration of DuckDuckGo MCP Server with a LangChain Groq LLM agent to perform intelligent search tasks using the Micro Component Protocol (MCP).

Use cases

Use cases include finding specific information, conducting research, and enhancing search functionalities in applications or services that require intelligent query handling.

How to use

To use Duckduckgo-with-MCP, clone the repository, install the required dependencies, set up your environment variables, and run the main script to initiate the MCP client and perform smart searches.

Key features

Key features include MCP Server integration for DuckDuckGo search, the use of Groq LLM for reasoning, asynchronous Python execution, and a simple, modular design.

Where to use

Duckduckgo-with-MCP can be used in various fields such as web development, data analysis, and AI-driven applications where intelligent search capabilities are needed.

Content

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.

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers