Agentic AI Query Brain
БесплатноНе проверенAn MCP server that transforms natural language questions into SQL, executes queries on PostgreSQL, and returns human-friendly responses, with Redis memory for c
Описание
An MCP server that transforms natural language questions into SQL, executes queries on PostgreSQL, and returns human-friendly responses, with Redis memory for context.
README
An intelligent, agentic system built with Model Context Protocol (MCP) that transforms natural language queries into SQL, executes them against a database, and returns human-friendly results. Powered by modular microservices, Redis memory, and PostgreSQL for robust, context-aware querying.
📌 Overview
This project enables you to ask questions in plain English and receive structured data answers. It does so using:
- A modular MCP architecture for agent-to-tool communication
- FastAPI microservices hosting API endpoints
- Redis memory for storing conversational context
- OpenAI / LLM integration for generating SQL
- PostgreSQL backend for executing queries
- Docker + NGINX setup for production scalability
🧠 Tech Stack
| Component | Technology |
|---|---|
| Language | Python 3.12 |
| Web Framework | FastAPI |
| AI / LLM Integration | OpenAI (via LLM) |
| Memory Store | Redis |
| Database | PostgreSQL |
| Containerization | Docker & Docker Compose |
| Reverse Proxy / Load Balancer | NGINX |
| Communication | JSON over standard I/O / HTTP |
📁 Project Structure
Agentic-AI-MCP-Query-Brain/
├── agent/ # Core MCP agent logic
├── api_client/ # Client side communication logic
├── api_service/ # FastAPI based endpoints
├── docker/ # Dockerfiles & container setup
├── memory/ # Redis memory and context logic
├── models/ # Data models & schema definitions
├── sdk/ # MCP SDK & router utilities
├── services/ # Tool registry and helper services
├── sql_tool/ # SQL execution, explanation & validation
│
├── main.py # FastAPI entry point
├── main_stdio.py # MCP host via stdio runner
├── requirements.txt # Python dependencies
├── docker-compose.yml # Multi-container orchestration
├── nginx.conf # NGINX configuration
└── README.md # This documentation
🧩 Key Tools & Modules
- OpenAITool — Converts natural language queries to SQL
- SQLTool — Executes SQL on PostgreSQL securely
- ExplainSQLTool — Converts SQL into readable descriptions
- QueryCacheTool — Caches commonly run queries
- FeedbackLoggingTool — Logs user feedback for model tuning
- NaturalLanguageResponseTool — Turns SQL results into textual responses
- RateLimiterTool — Controls request throughput
- TableSchemaTool — Retrieves schema metadata for better query accuracy
🧠 How It Works
- User input (natural language) is sent via the frontend or CLI.
- The MCP Host routes the input to the appropriate tool.
- OpenAITool generates SQL from the input using LLM reasoning.
- SQLTool executes the query on PostgreSQL, returning raw results.
- NaturalLanguageResponseTool translates results into readable form.
- Redis memory retains conversation context for follow-up queries.
⚙️ Example Configuration Snippet (VS Code / MCP)
Use this example in your MCP setup (sensitive keys masked for security):
{
"mcpServers": {
"vartopia-sql-agent": {
"command": "D:/vartopia/.venv/Scripts/python.exe",
"args": [
"-u",
"D:/vartopia/main_stdio.py"
],
"env": {
"OPENAI_API_KEY": "sk-proj-********-REDACTED",
"DB_URL": "postgresql://mcp_postgres_user:********@render.com/mcp_postgres",
"REDIS_URL": "redis://localhost:6379"
},
"transport": "stdio",
"workingDirectory": "D:/vartopia"
}
}
}
▶️ Getting Started
✅ Prerequisites
- Python 3.12+
- PostgreSQL database
- Redis server
- Docker & Docker Compose (optional, but recommended)
🛠 Setup Steps
Clone the repository
git clone https://github.com/Ramneek82810/Agentic-AI-MCP-Query-Brain.git cd Agentic-AI-MCP-Query-BrainInstall dependencies
pip install -r requirements.txtRun the FastAPI service
uvicorn main:app --reloadOr start with Docker (multi-container setup)
docker-compose up --build
🧠 Architecture Flow
User Input
↓
MCP Client → MCP Host (FastAPI)
↓
Tool Router → [OpenAITool ⇄ SQLTool ⇄ MemoryTool]
↓
Redis Memory ↔ PostgreSQL
↓
Formatted JSON or Natural Language Response
🧩 Example Use Case
Input:
“Show the top 5 sales by department for the last quarter.”
Pipeline:
- OpenAITool → Generates SQL
- SQLTool → Executes query
- NaturalLanguageResponseTool → Formats the results
Output:
“Here are the top 5 departments by sales last quarter: Electronics, Home, Fashion, Sports, and Toys.”
📈 Future Enhancements
- 🗄 Multi-database support (MySQL, MongoDB)
- 🧠 Custom fine-tuned LLMs for SQL generation
- 🛡 Role-based authentication & access control
- 🤖 Multi-agent orchestration for complex workflows
📄 License
This project is licensed under the MIT License — free to use, modify, and distribute with attribution.
Установка Agentic AI Query Brain
У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.
▸ github.com/Ramneek82810/Agentic-AI-MCP-Query-BrainFAQ
Agentic AI Query Brain MCP бесплатный?
Да, Agentic AI Query Brain MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Agentic AI Query Brain?
Нет, Agentic AI Query Brain работает без API-ключей и переменных окружения.
Agentic AI Query Brain — hosted или self-hosted?
Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.
Как установить Agentic AI Query Brain в Claude Desktop, Claude Code или Cursor?
Открой Agentic AI Query Brain на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
wenb1n-dev/SmartDB_MCP
A universal database MCP server supporting simultaneous connections to multiple databases. It provides tools for database operations, health analysis, SQL optim
автор: wenb1n-devPostgres Server
This server enables interaction with PostgreSQL databases through the Model Context Protocol, optimized for the AWS Bedrock AgentCore Runtime. It provides tools
автор: madhurprashPostgres
Query your database in natural language
автор: AnthropicPostgreSQL
Read-only database access with schema inspection.
автор: modelcontextprotocolCompare Agentic AI Query Brain with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории data
