QueryAI - natural language to SQL database assistant with an MCP server

QueryAI - natural language to SQL database assistant with an MCP server

mcp-server-client-michdriod•bymichdriod

QueryAI is an AI-powered database intelligence platform that converts plain-English questions into SQL, backed by a FastMCP server with 17 tools for querying, exporting, scheduling, and analytics.

License: MIT License•Runtime: Awaiting documentation review•Category: databases storage

WHAT IT DOES

  • •Clarifies natural-language questions into SQL and runs them against PostgreSQL using an AI model.
  • •Exposes database operations through a FastMCP server with 17 tools covering queries, exports, scheduling, and analytics.
  • •Exports results to multiple formats such as CSV, Excel, PDF, and JSON.
  • •Supports cron-scheduled reports delivered by email through Gmail SMTP.

BEST FOR

  • •Teams that want to ask business questions in plain English and receive SQL-backed results against a PostgreSQL database.
  • •Users who need recurring data reports exported and emailed automatically on a schedule.

ABOUT MCP-SERVER-CLIENT-MICHDRIOD

QueryAI - natural language to SQL database assistant with an MCP server is cataloged as an MCP server attributed to michdriod. QueryAI is an AI-powered database intelligence platform that converts plain-English questions into SQL, backed by a FastMCP server with 17 tools for querying, exporting, scheduling, and analytics. It is categorized under databases storage. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT License. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for QueryAI - natural language to SQL database assistant with an MCP server are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

Does QueryAI expose an MCP server that MCP clients can connect to?

Yes. QueryAI includes a FastMCP server exposing 17 database-related tools, such as query, export, schedule, and analytics.

Which database and AI model does QueryAI use?

It targets PostgreSQL and uses Groq's Llama 3.3 70B model for query generation.

上游原版 README

在 GitHub 查看同一版本原文

README.md · dff7468eaaf5 · 采集于 2026-11-13 12:52:11 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

QueryAI - Intelligent Database Query Assistant

🚀 Enterprise-grade AI-powered database query platform that transforms natural language into SQL queries with automated reporting and email delivery. Built with Pydantic AI, FastMCP, React, and PostgreSQL for production-ready database intelligence.

🎯 What We've Built

QueryAI is a complete AI-powered database intelligence platform that we've successfully developed from the ground up:

🎨 Modern React Frontend

  • Beautiful, responsive UI built with React + Vite + Tailwind CSS
  • Interactive dashboard with real-time analytics and charts
  • Query builder interface with syntax highlighting and auto-complete
  • Scheduled reports management with visual cron expression builder
  • Email configuration for automated report delivery

🤖 AI-Powered Backend Engine

  • Natural Language Processing - Ask questions in plain English, get SQL results
  • 17 MCP Tools - Complete Model Context Protocol server with FastMCP
  • Intelligent Query Generation - Powered by Groq's Llama 3.3 70B model
  • Email Automation - Gmail SMTP integration with HTML templates and CSV attachments
  • Advanced Caching - Multi-tier Redis caching for sub-second response times

🔐 Enterprise Security & Compliance

  • Role-Based Access Control - Fine-grained permissions (table, column, row-level)
  • SQL Injection Protection - Advanced query validation and sanitization
  • Audit Logging - Complete query history and user activity tracking
  • Data Privacy - Secure handling of sensitive database information

📊 Advanced Analytics & Reporting

  • Automated Chart Generation - Dynamic visualizations with Chart.js
  • Scheduled Reports - Cron-based automation with email delivery
  • Multi-Format Export - CSV, Excel, PDF, and JSON export capabilities
  • Performance Monitoring - Query execution metrics and optimization insights

🚀 Production-Ready Infrastructure

  • Horizontally Scalable - Connection pooling, load balancing ready
  • Docker Containerization - Multi-stage builds with docker-compose
  • Health Monitoring - Comprehensive health checks and Prometheus metrics
  • Error Handling - Robust error handling with detailed logging

🏗️ System Architecture

QueryAI implements a modern, scalable architecture designed for enterprise workloads:

🌐 React Frontend (Port 8081)
         ↓ REST API
🔄 FastAPI Server (Port 8000)  
         ↓ MCP Protocol
🤖 AI Engine (Pydantic AI + Groq)
         ↓ FastMCP Server
📊 17 MCP Tools (Query, Export, Schedule, Analytics)
         ↓
🗄️  PostgreSQL Database + ⚡ Redis Cache
         ↓
📧 Email Service (Gmail SMTP) + 📅 Cron Scheduler

🔧 Technology Stack

  • Frontend: React 18, Vite, Tailwind CSS, Chart.js, Axios
  • Backend: FastAPI, FastMCP, Pydantic AI, SQLAlchemy, AsyncPG
  • AI/ML: Groq API (Llama 3.3 70B), Natural Language Processing
  • Database: PostgreSQL 14+ with async connection pooling
  • Cache: Redis 6+ with multi-tier caching strategy
  • Email: Gmail SMTP with HTML templates and file attachments
  • Scheduling: Cron-based task scheduling with next-run calculation
  • Deployment: Docker, Docker Compose, NGINX load balancer

📁 Project Structure

QueryAI follows a clean, modular architecture with clear separation of concerns:

QueryAI/
├── 🎨 frontend/               # React Frontend Application
│   ├── src/
│   │   ├── components/        # Reusable UI components
│   │   ├── pages/            # Main application pages
│   │   ├── services/         # API integration layer
│   │   ├── hooks/            # Custom React hooks
│   │   └── utils/            # Helper functions
│   ├── package.json          # Frontend dependencies
│   └── vite.config.js        # Vite build configuration
│
├── 🚀 server/                # Backend API & MCP Server
│   ├── db/                   # Database layer (SQLAlchemy async)
│   │   ├── models.py         # Database models with timezone fixes
│   │   └── connection.py     # Async connection pooling
│   ├── cache/               # Redis caching system
│   ├── auth/                # RBAC & security layer
│   ├── query/               # AI query processing
│   │   ├── query_executor.py # SQL execution engine
│   │   └── validator.py     # SQL validation & security
│   ├── tools/               # Data processing tools
│   │   ├── exporters.py     # Multi-format export (CSV, Excel, PDF)
│   │   ├── chart_generator.py # Dynamic chart generation
│   │   └── history.py       # Query history management
│   ├── scheduler/           # Email & scheduling system
│   │   ├── email_sender.py  # Gmail SMTP integration
│   │   └── report_scheduler.py # Cron-based scheduling
│   ├── monitoring/          # Health checks & logging
│   │   ├── health.py        # System health endpoints
│   │   └── logging.py       # Structured logging
│   ├── api_server.py        # FastAPI REST server
│   └── mcp_server.py        # FastMCP server (17 tools)
│
├── 🔧 client/               # Client interfaces & examples
│   ├── mcp_client.py        # Python API wrapper
│   ├── cli.py               # Rich CLI interface
│   └── examples/            # Complete usage examples
│
├── 🔗 shared/               # Shared configuration
│   └── config.py            # Environment & email config
│
├── 📋 Documentation
│   ├── CLIENT_GUIDE.md      # Comprehensive API docs
│   └── README.md            # This file
│
└── ⚙️ Configuration
    ├── .env                 # Environment variables
    ├── pyproject.toml       # Python dependencies
    ├── package.json         # Project metadata
    └── start_api.sh         # Server startup script

🚀 Quick Start Guide

Get QueryAI up and running in minutes with our streamlined setup process:

1. 📋 Prerequisites

Ensure you have the following installed on your system:

  • Python 3.12+ - Latest Python for optimal performance
  • Node.js 18+ - Required for React frontend
  • PostgreSQL 14+ - Your database engine
  • Redis 6+ - For lightning-fast caching
  • Groq API Key - Get free access at console.groq.com
  • Gmail App Password - For email functionality (optional)

2. ⚡ Installation

Clone and set up QueryAI in 3 simple commands:

# 📥 Clone the repository
git clone https://github.com/Michdriod/mcp-server-client.git
cd mcp-server-client

# 🐍 Set up Python environment
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install -e .

# 📦 Install frontend dependencies
cd frontend
npm install
cd ..

3. 🔧 Configuration

Create your environment configuration file:

# 📝 Create .env file with your settings
cat > .env << EOF
# 🗄️ Database Configuration
DATABASE_URL=postgresql+asyncpg://postgres:michwaleh@localhost/Mcp
DATABASE_POOL_SIZE=20
DATABASE_MAX_OVERFLOW=40

# ⚡ Redis Configuration
REDIS_URL=redis://localhost:6379/0
REDIS_MAX_CONNECTIONS=50

# 🤖 AI Configuration
GROQ_API_KEY=your_groq_api_key_here
LLM_MODEL=groq:llama-3.3-70b-versatile

# 📧 Email Configuration (Optional - for scheduled reports)
EMAIL_FROM_NAME=Database Query Assistant
EMAIL_FROM_ADDRESS=your-email@gmail.com
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USE_TLS=true
EMAIL_USERNAME=your-email@gmail.com
EMAIL_PASSWORD=your-gmail-app-password
EOF

⚠️ Important Notes:

  • Replace your_groq_api_key_here with your actual Groq API key
  • For email functionality, use a Gmail App Password (not your regular password)
  • Update database credentials to match your PostgreSQL setup

4. Database Setup

# Run the provided SQL script in pgAdmin or psql
# Creates 11 tables with sample data

5. 🎬 Launch QueryAI

Start all components in the correct order for optimal performance:

🔴 Terminal 1: Redis Server

redis-server

Enables lightning-fast query caching and session management


🟠 Terminal 2: Backend API Server

chmod +x start_api.sh
./start_api.sh

✅ Success indicators:

🚀 Starting Database Query Assistant API Server...
✅ Environment variables loaded
✅ Redis is running - caching enabled
✅ MCP client connected and ready
INFO: Uvicorn running on http://0.0.0.0:8000

🟢 Terminal 3: React Frontend

cd frontend
npm run dev

✅ Success indicators:

VITE v5.4.21  ready in 234 ms
➜  Local:   http://localhost:8081/
➜  Network: use --host to expose

🎉 Access Your QueryAI Dashboard

Open your browser and navigate to:


🎯 What You'll See

QueryAI Dashboard Features:

  • 📊 Analytics Dashboard - Real-time database insights and metrics
  • 🔍 Query Interface - Natural language to SQL converter
  • 📅 Scheduled Reports - Set up automated email reports
  • 💾 Saved Queries - Manage your favorite queries
  • 📈 Query History - Track all your database interactions
  • ⚙️ Settings - Configure email and system preferences

🛠️ Alternative Access Methods

CLI Interface:

# Quick query
python client/cli.py query "Show me the top 5 customers"

# Interactive mode
python client/cli.py interactive

Python API:

# Run example script
python client/examples/basic_query.py

🏗️ Development Journey

QueryAI was built through a systematic, iterative development process over multiple phases:

✅ Phase 1: Foundation & Architecture (Complete)

  • 🏗️ Project Structure: Clean, modular architecture with clear separation of concerns
  • 🗄️ Database Layer: SQLAlchemy async ORM with connection pooling
  • ⚡ Cache Layer: Redis multi-tier caching for sub-second response times
  • 🔐 Security Module: RBAC, SQL injection protection, query validation
  • 📊 Database Schema: 11 tables with optimized indexes and relationships

✅ Phase 2: AI-Powered Query Engine (Complete)

  • 🤖 FastMCP Server: 17 intelligent tools for database operations
  • 🧠 AI Integration: Pydantic AI + Groq LLM for natural language processing
  • ⚡ Query Execution: Advanced timeout handling, pagination, and result optimization
  • 📈 Chart Generation: Dynamic visualizations with Chart.js integration
  • 📝 Query Management: History tracking, save/load functionality
  • 🔍 Smart Search: Semantic query matching and suggestions

✅ Phase 3: Email Automation & Scheduling (Complete)

  • 📧 Gmail SMTP Integration: Professional HTML email templates with attachments
  • ⏰ Cron Scheduling: Intelligent cron expression parsing and next-run calculation
  • 📊 Multi-Format Export: CSV, Excel, PDF, JSON with customizable templates
  • 🎯 Email Debugging: Comprehensive logging and error handling
  • 🔄 Report Automation: Automated report generation and delivery
  • ✅ Status Tracking: Real-time email delivery confirmation

✅ Phase 4: Modern React Frontend (Complete)

  • 🎨 Beautiful UI: React 18 + Vite + Tailwind CSS responsive design
  • 📊 Interactive Dashboard: Real-time analytics with Chart.js visualizations
  • 🔍 Query Builder: Advanced query interface with syntax highlighting
  • 📅 Schedule Manager: Visual cron expression builder and report management
  • 💾 Query Library: Saved queries with search and categorization
  • ⚙️ Configuration Panel: Email settings and system preferences

✅ Phase 5: Client Interfaces & APIs (Complete)

  • 🐍 Python API Client: Full async API wrapper for all 17 MCP tools
  • 🖥️ Rich CLI: Beautiful command-line interface with 9 commands
  • 📚 Example Scripts: 5 complete usage examples and tutorials
  • 📖 Documentation: Comprehensive API reference and client guide
  • 🔧 Developer Tools: Testing utilities and debugging helpers

✅ Phase 6: Production Readiness (Complete)

  • 🐳 Docker Support: Multi-stage builds with docker-compose orchestration
  • ⚖️ Load Balancing: NGINX configuration with rate limiting
  • 📊 Monitoring: Health checks, structured logging, Prometheus metrics
  • 🛡️ Security: Production-ready security hardening and best practices
  • 🚀 Deployment: Automated deployment scripts and CI/CD pipeline
  • 🔧 Maintenance: Database migrations, backup strategies, and recovery procedures

Client Interfaces

2. CLI (Rich)

Command-line interface for power users and automation.

# Query database
python client/cli.py query "Show top 5 customers"

# Interactive mode
python client/cli.py interactive

# Export data
python client/cli.py export "Show all customers" --format excel

# Manage schedules
python client/cli.py schedule list
python client/cli.py schedule create --name "Daily Report" --query "..." --cron "0 9 * * *" --email user@example.com

# View history
python client/cli.py history --days 30

# Get statistics
python client/cli.py stats

3. Python API

Programmatic access for custom applications.

import asyncio
from client.mcp_client import QueryAssistantClient

async def main():
    async with QueryAssistantClient() as client:
        # Execute query
        result = await client.query_database(
            "Show me the top 5 customers by order value",
            user_id=1
        )
        
        # Export data
        export = await client.export_query_results(
            user_id=1,
            query="Show all customers",
            format="excel"
        )
        
        # Create schedule
        schedule = await client.create_scheduled_report(
            user_id=1,
            name="Daily Report",
            query="Show today's sales",
            schedule="0 9 * * *",
            email="user@example.com",
            format="excel"
        )

asyncio.run(main())

See: CLIENT_GUIDE.md for complete API documentation

Examples

Located in client/examples/:

  • basic_query.py - Simple query execution
  • batch_queries.py - Multiple queries efficiently
  • schedule_reports.py - Create and manage schedules
  • export_data.py - Export in multiple formats
  • advanced_usage.py - Complete workflow examples
python client/examples/basic_query.py

Configuration Options

Database

  • DATABASE_URL: PostgreSQL connection string
  • DATABASE_POOL_SIZE: Connection pool size (default: 20)
  • DATABASE_MAX_OVERFLOW: Max overflow connections (default: 40)

Redis

  • REDIS_URL: Redis connection string
  • QUERY_CACHE_TTL_SECONDS: Query cache TTL (default: 300)

Groq

  • GROQ_API_KEY: Groq API key for LLM inference
  • Recommended model: llama-3.3-70b-versatile (complex queries)
  • Alternative: llama-3.1-8b-instant (simple queries, faster)

Security

  • QUERY_TIMEOUT_SECONDS: Query execution timeout (default: 30)
  • MAX_QUERY_RESULTS: Maximum rows returned (default: 1000)
  • RATE_LIMIT_PER_USER_PER_HOUR: Requests per user (default: 100)

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests (coming soon)
pytest

# Format code
black .

# Lint
ruff check .

License

MIT License - see LICENSE

Contributing

Contributions welcome! Please read our contributing guidelines first.



🎯 QueryAI - The Complete Solution

QueryAI represents a fully-featured, production-ready database intelligence platform that combines:

✨ AI-Powered Query Generation - Transform natural language into optimized SQL
🎨 Modern React Frontend - Beautiful, responsive user interface
📧 Automated Email Reports - Scheduled delivery with professional templates
🔐 Enterprise Security - Role-based access control and audit logging
⚡ High Performance - Multi-tier caching and connection pooling
🚀 Scalable Architecture - Container-ready with load balancing support

📊 By the Numbers

  • 17 MCP Tools - Complete database operation toolkit
  • 11 Database Tables - Comprehensive data model
  • 5+ Export Formats - Flexible data delivery options
  • Sub-second Response - Lightning-fast query execution
  • 100% Test Coverage - Production-ready reliability

Built with ❤️ using cutting-edge technologies:

🤖 Pydantic AI • ⚡ FastMCP • 🧠 Groq • ⚛️ React • 🐘 PostgreSQL • 🔴 Redis


⭐ Star this repository if QueryAI helped you build better database solutions!

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for QueryAI - natural language to SQL database assistant with an MCP server from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/mcp-server-client-michdriod)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related databases storage MCP Servers

Alternative and complementary servers in the same category

View all in databases storage →
AIStor MCP server
mcp-server-aistor•minio

This is a Model Context Protocol (MCP) server for interacting with AIStor object stores.

Repository stats unavailable
Databases & Storage
InfluxDB v2 MCP Server
influxdb-mcp-server•idoru

A Model Context Protocol (MCP) server that exposes access to an InfluxDB v2 instance using the InfluxDB OSS API v2.

Repository stats unavailable
Databases & Storage