
mcp sql query
A chat-based interface for querying your database using natural language. Built with MCP (Model Context Protocol).
Repository Info
About This Server
A chat-based interface for querying your database using natural language. Built with MCP (Model Context Protocol).
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
DataQuest - Database Query Assistant
A chat-based interface for querying your database using natural language. Built with MCP (Model Context Protocol).
!Preview
Read the full article on Medium here: https://medium.com/@jonortega20/building-a-database-querier-with-mcp-17df0f49a2de
Features
- Clean, modern UI with responsive design
- Chat-style interface for natural language database queries
- Real-time interaction with your PostgreSQL database
- Supports code block formatting in responses
- Status indicators and loading animations
Requirements
- Python 3.11+
- Flask
- LangChain OpenAI
- Postgre MCP
Installation
-
Clone this repository
-
Install the required Python packages:
pip install flask flask-cors langchain_openai python-dotenv
- Make sure you have MCP installed:
pip install mcp_use
- Make sure you have an OpenAI API key and your database connection string in your .env file:
OPENAI_API_KEY=your_api_key_here
DB_LINK=your_database_connection_string_here
Usage
- Start the Flask server:
python app.py
- Open your browser and navigate to:
http://localhost:5000
- Start asking questions about your database!
Example Queries
- "How many users are in the database?"
- "Show me a random user's information"
- "What is the average age of the users?"
- "What is the percentage of active users?"
- "How many users are there per country?"
Created By
Jon Ortega
Quick Start
Clone the repository
git clone https://github.com/jonortega20/mcp-sql-queryInstall dependencies
cd mcp-sql-query
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.