How myusegtr/mcp-chatbot-using-groq-project-one works
Project Type & Purpose
• Type: CLI-based conversational AI agent
• Purpose: Provide an interactive chat interface that retains memory and can invoke real-time tools (DuckDuckGo Search, Airbnb listing fetch, Playwright automation) via an MCP (Model Context Protocol) bridge to a Groq-backed LLM.
File Structure
• Top-level files:
– app.py & main.py: application entry points (CLI runner, asyncio event loop via Uvicorn)
– browser_mcp.json: JSON config defining available MCP tools and endpoints
– pyproject.toml & uv.lock: dependency declarations and lock file
– .env: environment variables (e.g., GROQ_API_KEY)
• No separate “frontend” or “backend” folders—monolith of CLI + core libraries + config.
• Key libraries implied: langchain_groq, mcp_use, asyncio, dotenv.
Extract Architectural Insights from README
• Core Components called out: MCPAgent, MCPClient, conversation memory, external tools.
• Tool integrations abstracted via JSON configuration and MCP protocol.
• LLM interactions handled asynchronously through langchain_groq.
Main Components & Their Interactions
a. User Interface (CLI)
– Runs in terminal via Uvicorn/uv.run (app.py)
– Captures user input and displays agent responses
b. Application Layer
– main.py: bootstraps event loop, loads .env, loads browser_mcp.json
– Initializes MCPClient & MCPAgent instances
c. MCPAgent Core Logic
– Maintains conversation memory (in-process store)
– Orchestrates calls to LLM and dispatches tool requests via MCPClient
d. LLM Backend
– langchain_groq connector forwards prompts to Groq-hosted model
– Receives streaming or batched replies
e. Tool Integration Layer
– Configured by browser_mcp.json
– mcp_use client invokes:
• DuckDuckGo Search API
• Airbnb listings API
• Playwright automation scripts (headless browser)
f. External Services
– Third-party APIs and browser automation endpoints
g. Configuration & Environment
– .env for secure keys
– JSON configuration driving tool endpoints and credentials
Architectural Patterns & Principles
• Separation of Concerns: CLI vs core logic vs tool adapters vs LLM connector
• Adapter/Plugin Pattern: JSON-driven registration of tools
• Async Event-Driven Flow: asyncio for non-blocking I/O and streaming responses
• Lightweight In-Memory State: short-term conversation memory