BUNNY SCOPE

2 Squirrels AI

Technology Stack

MCP FrameworkFastMCP
Query EngineNLP-to-SQL
AI ModelClaude LLM
DatabaseSQL (Any)
ProtocolMCP Tools

Architecture Note: BUNNY SCOPE enables natural language database queries through FastMCP server integration. Users ask questions in plain English, and the LLM translates them into optimized SQL queries with schema-aware context.

Core Components

🔧
FastMCP Server
Protocol Handler
🗄️
NLP-to-SQL Engine
Query Translator
🧠
Claude LLM
Language Understanding
📊
Schema Analyzer
Context Provider
🔍
Query Optimizer
SQL Enhancement
📈
Report Generator
Results Formatter

FastMCP Server Integration

%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#C17852', 'primaryTextColor': '#F0F6FC', 'primaryBorderColor': '#4A5E32', 'lineColor': '#E6C98F', 'secondaryColor': '#161B22', 'tertiaryColor': '#0D1117', 'background': '#0D1117', 'mainBkg': '#161B22', 'nodeBorder': '#4A5E32', 'clusterBkg': '#161B22', 'clusterBorder': '#4A5E32', 'titleColor': '#E6C98F', 'edgeLabelBackground': '#161B22'}}}%%
flowchart TB
    subgraph Client["🖥️ Claude Desktop/CLI"]
        USR["👤 User Query"]
        CLD["🧠 Claude LLM"]
    end
    subgraph MCP["🔧 FastMCP Server"]
        REG["📋 Tool Registration"]
        HND["⚙️ Request Handler"]
        VAL["✅ Input Validation"]
    end
    subgraph Tools["🔌 MCP Tools"]
        QRY["🔍 query_database"]
        SCH["📊 get_schema"]
        RPT["📈 generate_report"]
    end
    subgraph Exec["⚡ Tool Execution"]
        PRS["🔧 Parse Arguments"]
        RUN["▶️ Execute Logic"]
        RES["📤 Return Results"]
    end
    USR --> CLD
    CLD -->|"MCP Protocol"| REG
    REG --> HND
    HND --> VAL
    VAL --> QRY
    VAL --> SCH
    VAL --> RPT
    QRY --> PRS
    SCH --> PRS
    RPT --> PRS
    PRS --> RUN
    RUN --> RES
    RES -->|"Response"| CLD
                

NLP-to-SQL Translation

%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#C17852', 'primaryTextColor': '#F0F6FC', 'primaryBorderColor': '#4A5E32', 'lineColor': '#E6C98F', 'secondaryColor': '#161B22', 'tertiaryColor': '#0D1117', 'background': '#0D1117', 'mainBkg': '#161B22', 'nodeBorder': '#4A5E32', 'clusterBkg': '#161B22', 'clusterBorder': '#4A5E32', 'titleColor': '#E6C98F', 'edgeLabelBackground': '#161B22'}}}%%
flowchart LR
    subgraph Input["📥 Natural Language"]
        NL["💬 User Question"]
        EX["📝 'Show me sales from last month'"]
    end
    subgraph LLM["🧠 Claude Processing"]
        INT["🎯 Intent Detection"]
        ENT["📊 Entity Extraction"]
        MAP["🔗 Schema Mapping"]
    end
    subgraph Build["🔧 SQL Construction"]
        SEL["SELECT columns"]
        FRM["FROM tables"]
        WHR["WHERE conditions"]
        ORD["ORDER BY / LIMIT"]
    end
    subgraph Output["📤 Generated SQL"]
        SQL["🗄️ Valid SQL Query"]
        VAL["✅ Syntax Check"]
    end
    NL --> INT
    EX --> INT
    INT --> ENT
    ENT --> MAP
    MAP --> SEL
    SEL --> FRM
    FRM --> WHR
    WHR --> ORD
    ORD --> SQL
    SQL --> VAL
                

Database Query Pipeline

%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#C17852', 'primaryTextColor': '#F0F6FC', 'primaryBorderColor': '#4A5E32', 'lineColor': '#E6C98F', 'secondaryColor': '#161B22', 'tertiaryColor': '#0D1117', 'background': '#0D1117', 'mainBkg': '#161B22', 'nodeBorder': '#4A5E32', 'clusterBkg': '#161B22', 'clusterBorder': '#4A5E32', 'titleColor': '#E6C98F', 'edgeLabelBackground': '#161B22'}}}%%
flowchart TB
    subgraph Query["📝 SQL Query"]
        SQL["🗄️ Generated SQL"]
        SAF["🛡️ Safety Check"]
    end
    subgraph Connect["🔌 Connection"]
        POOL["📊 Connection Pool"]
        AUTH["🔐 Credentials"]
    end
    subgraph Execute["⚡ Execution"]
        PREP["📋 Prepare Statement"]
        RUN["▶️ Execute Query"]
        TMO["⏱️ Timeout Handler"]
    end
    subgraph Results["📊 Results"]
        RAW["📦 Raw Data"]
        TRN["🔄 Transform"]
        FMT["📊 Format Output"]
    end
    subgraph Response["📤 Response"]
        JSON["📋 JSON Response"]
        TBL["📊 Table Format"]
        SUM["📈 Summary Stats"]
    end
    SQL --> SAF
    SAF --> POOL
    POOL --> AUTH
    AUTH --> PREP
    PREP --> RUN
    RUN --> TMO
    TMO --> RAW
    RAW --> TRN
    TRN --> FMT
    FMT --> JSON
    FMT --> TBL
    FMT --> SUM
                

Context-Aware Queries

%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#C17852', 'primaryTextColor': '#F0F6FC', 'primaryBorderColor': '#4A5E32', 'lineColor': '#E6C98F', 'secondaryColor': '#161B22', 'tertiaryColor': '#0D1117', 'background': '#0D1117', 'mainBkg': '#161B22', 'nodeBorder': '#4A5E32', 'clusterBkg': '#161B22', 'clusterBorder': '#4A5E32', 'titleColor': '#E6C98F', 'edgeLabelBackground': '#161B22'}}}%%
flowchart TB
    subgraph Schema["📊 Schema Context"]
        TBL["📋 Tables"]
        COL["📊 Columns"]
        REL["🔗 Relationships"]
        IDX["📈 Indexes"]
    end
    subgraph Context["🧠 Context Building"]
        DSC["📝 Column Descriptions"]
        SAM["📊 Sample Data"]
        CNS["⚙️ Constraints"]
    end
    subgraph LLM["🧠 LLM Processing"]
        PRM["📋 Build Prompt"]
        INF["🔍 Inference"]
        OPT["⚡ Optimize Query"]
    end
    subgraph Output["📤 Optimized Query"]
        JON["🔗 Efficient JOINs"]
        IDU["📈 Index Usage"]
        LMT["📊 Smart LIMIT"]
    end
    TBL --> DSC
    COL --> DSC
    REL --> DSC
    IDX --> CNS
    DSC --> PRM
    SAM --> PRM
    CNS --> PRM
    PRM --> INF
    INF --> OPT
    OPT --> JON
    OPT --> IDU
    OPT --> LMT
                

Usage Report Generation

%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#C17852', 'primaryTextColor': '#F0F6FC', 'primaryBorderColor': '#4A5E32', 'lineColor': '#E6C98F', 'secondaryColor': '#161B22', 'tertiaryColor': '#0D1117', 'background': '#0D1117', 'mainBkg': '#161B22', 'nodeBorder': '#4A5E32', 'clusterBkg': '#161B22', 'clusterBorder': '#4A5E32', 'titleColor': '#E6C98F', 'edgeLabelBackground': '#161B22'}}}%%
flowchart LR
    subgraph Data["📊 Query Results"]
        RAW["📦 Raw Data"]
        CNT["🔢 Row Count"]
        TYP["📋 Data Types"]
    end
    subgraph Analysis["🧠 LLM Analysis"]
        PAT["📈 Pattern Detection"]
        TRD["📉 Trend Analysis"]
        ANO["⚠️ Anomaly Detection"]
    end
    subgraph Format["📝 Report Building"]
        HDR["📋 Header Summary"]
        INS["💡 Key Insights"]
        VIS["📊 Visualization Hints"]
    end
    subgraph Output["📤 Formatted Report"]
        MKD["📝 Markdown"]
        TBL["📊 Tables"]
        CHT["📈 Chart Suggestions"]
    end
    RAW --> PAT
    CNT --> PAT
    TYP --> PAT
    PAT --> TRD
    TRD --> ANO
    ANO --> HDR
    HDR --> INS
    INS --> VIS
    VIS --> MKD
    VIS --> TBL
    VIS --> CHT
                

Full BUNNY SCOPE Architecture

%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#C17852', 'primaryTextColor': '#F0F6FC', 'primaryBorderColor': '#4A5E32', 'lineColor': '#E6C98F', 'secondaryColor': '#161B22', 'tertiaryColor': '#0D1117', 'background': '#0D1117', 'mainBkg': '#161B22', 'nodeBorder': '#4A5E32', 'clusterBkg': '#161B22', 'clusterBorder': '#4A5E32', 'titleColor': '#E6C98F', 'edgeLabelBackground': '#161B22'}}}%%
flowchart TB
    subgraph User["👤 User Interface"]
        QRY["💬 Natural Language Query"]
        RPT["📊 View Results"]
    end
    subgraph Claude["🧠 Claude LLM"]
        NLP["🔍 NLP Processing"]
        SQL["🗄️ SQL Generation"]
        FMT["📝 Report Formatting"]
    end
    subgraph FastMCP["🔧 FastMCP Server"]
        REG["📋 Tool Registry"]
        HND["⚙️ Request Handler"]
        VAL["✅ Validation"]
    end
    subgraph Tools["🔌 MCP Tools"]
        T1["🔍 query_database"]
        T2["📊 get_schema"]
        T3["📈 generate_report"]
    end
    subgraph Database["🗄️ Database Layer"]
        CONN["🔌 Connection Pool"]
        EXEC["▶️ Query Executor"]
        RES["📦 Result Set"]
    end
    subgraph Output["📤 Insights"]
        DATA["📊 Structured Data"]
        INS["💡 AI Insights"]
        VIS["📈 Visualizations"]
    end
    QRY --> NLP
    NLP --> SQL
    SQL --> REG
    REG --> HND
    HND --> VAL
    VAL --> T1
    VAL --> T2
    VAL --> T3
    T1 --> CONN
    T2 --> CONN
    CONN --> EXEC
    EXEC --> RES
    RES --> FMT
    FMT --> DATA
    FMT --> INS
    T3 --> VIS
    DATA --> RPT
    INS --> RPT
    VIS --> RPT