# myusegtr/mcp-chatbot-using-groq-project-one architecture

> Architecture diagram of the GitHub repository myusegtr/mcp-chatbot-using-groq-project-one, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/myusegtr/mcp-chatbot-using-groq-project-one
- Repository: https://github.com/myusegtr/mcp-chatbot-using-groq-project-one

## Overview

##### 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

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Configuration group
    subgraph "Configuration"
        JSON["browser_mcp.json"]:::config
        ENV[".env"]:::config
        PY["pyproject.toml"]:::config
        LOCK["uv.lock"]:::config
        README["README.md"]:::config
    end

    %% CLI and Application Layer
    CLI["CLI Interface"]:::module
    MAIN["Application Bootstrap\n(main.py)"]:::module

    %% Core Agent Components
    Agent["MCPAgent Core Logic"]:::core
    Memory["Memory Store"]:::storage
    MCPClient["MCPClient (Tool Adapter)"]:::core

    %% LLM Connector
    LLM["langchain_groq LLM Connector"]:::external

    %% Tool Integration Layer
    Tools["Dynamic Tool Adapters\n(via JSON)"]:::module
    Duck["DuckDuckGo Search API"]:::external
    Airbnb["Airbnb Listings API"]:::external
    Playwright["Playwright Automation Service"]:::external

    %% User interaction
    User((User)):::external

    %% Flow arrows
    User -->|"input"| CLI
    CLI -->|"launch"| MAIN
    MAIN -->|"initialize"| Agent
    MAIN -->|"load config"| JSON
    MAIN -->|"load env"| ENV

    Agent -->|"read/write"| Memory
    Agent -->|"prompt→response"| LLM
    LLM -.->|"reply"| Agent

    Agent -->|"invoke tool"| MCPClient
    MCPClient -->|"load adapters"| Tools
    Tools -->|"call"| Duck
    Tools -->|"call"| Airbnb
    Tools -->|"call"| Playwright
    Duck -.->|"result"| MCPClient
    Airbnb -.->|"result"| MCPClient
    Playwright -.->|"result"| MCPClient
    MCPClient -->|"tool output"| Agent

    Agent -->|"response"| CLI
    CLI -->|"display"| User

    %% Click Events
    click CLI "https://github.com/myusegtr/mcp-chatbot-using-groq-project-one/blob/main/app.py"
    click MAIN "https://github.com/myusegtr/mcp-chatbot-using-groq-project-one/blob/main/main.py"
    click JSON "https://github.com/myusegtr/mcp-chatbot-using-groq-project-one/blob/main/browser_mcp.json"
    click ENV "https://github.com/myusegtr/mcp-chatbot-using-groq-project-one/blob/main/.env"
    click PY "https://github.com/myusegtr/mcp-chatbot-using-groq-project-one/blob/main/pyproject.toml"
    click LOCK "https://github.com/myusegtr/mcp-chatbot-using-groq-project-one/blob/main/uv.lock"
    click README "https://github.com/myusegtr/mcp-chatbot-using-groq-project-one/blob/main/README.md"

    %% Styles
    classDef module fill:#AEDFF7,stroke:#333,stroke-width:1px
    classDef core fill:#A7F7AE,stroke:#333,stroke-width:1px
    classDef external fill:#F7AEF7,stroke:#333,stroke-width:1px
    classDef config fill:#F7F7AE,stroke:#333,stroke-width:1px
    classDef storage fill:#AEF7F1,stroke:#333,stroke-width:1px
```
