Used for configuration management, storing database credentials and API keys securely for the MCP SQL Visualization system.
Supports version control for project collaboration, allowing users to fork, branch, and contribute to the MCP SQL Visualization codebase.
Enables project distribution and collaboration through repository hosting, supporting contribution workflows through pull requests.
Enables transformation of MySQL databases into interactive dashboards through natural language queries, supporting read-only access with schema validation and security features.
Utilizes OpenAI's language models to convert natural language questions into SQL queries and interpret results for data visualization.
Enables transformation of PostgreSQL databases into interactive dashboards through natural language queries, supporting read-only access with schema validation and security features.
Provides the frontend interface for chat and dashboard interactions, allowing users to visualize SQL data through natural language queries.
MCP SQL Visualization
An AI-powered system that transforms SQL databases into interactive dashboards using natural language queries.
📌 Project Overview
MCP SQL Visualization removes the need for SQL expertise when analyzing data. Users can ask questions in plain English, and the system will generate SQL queries, execute them, and visualize the results automatically. The tool is designed for secure, read-only access to your database and leverages large language models (LLMs) for intelligent data interpretation.
✨ Features
Natural Language Interface:
Ask questions in plain English; the system generates and runs SQL queries for you.Automated Dashboards:
Instantly create visualizations and dashboards from your data.Secure Database Access:
All operations are read-only, with schema-level permissions and SQL injection protection.Multi-Database Support:
Compatible with MySQL and PostgreSQL.Export Options:
Download dashboards as HTML or PDF.
Components:
Streamlit Frontend: User interface for chat and dashboard interaction.
LLM Agent: Converts natural language to SQL and interprets results.
MCP Server: Manages query validation, database connection, and security.
Database: Your SQL data source (MySQL/PostgreSQL).
🚀 Installation
Prerequisites
Python 3.9+
MySQL or PostgreSQL database
LLM API Key (Anthropic/OpenAI/Groq)
Steps
Clone the repository:
git clone https://github.com/sathwikabbaraju/MCP-SQL-Visualization.git cd mcp-sql-visualizationSet up a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activateInstall dependencies:
pip install -r requirements.txtConfigure environment variables: Create a
.env
file in the project root with the following content:DB_HOST=your_database_host DB_USER=readonly_user DB_PASSWORD=secure_password DB_NAME=your_database LLM_API_KEY=your_api_key MODEL_ID=claude-3-opus-20240229Start the backend server:
uvicorn mcp_server:app --reload --port 8000Launch the Streamlit UI:
streamlit run app.py
🖥️ Usage
Ask a Question:
Type a question in plain English in the chat interface.
Example:
What were our top 5 selling products last quarter?Generate a Dashboard:
Request a visualization or report.
Example:
Show monthly sales trends by region with key metrics.Export Results:
Download the generated dashboard as HTML or PDF for sharing.
Security
Read-Only Database Access: Only SELECT queries are permitted.
Schema Validation: Queries are checked against allowed tables and columns.
SQL Injection Protection: All inputs are sanitized and parameterized.
Example Query Validation: def validate_query(query: str): if not query.strip().upper().startswith("SELECT"): raise Exception("Only SELECT queries are allowed.")
Contributing
Fork the repository.
Create a new branch:
git checkout -b feature/your-feature
Commit your changes:
git commit -m 'Add your feature'
Push to the branch:
git push origin feature/your-feature
Open a Pull Request.
Acknowledgements
Agno AI Agent Framework
Streamlit
Happy Visualizing! 🚀
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Manages query validation, database connection, and security for a system that transforms SQL databases into interactive dashboards using natural language queries.
Related MCP Servers
- AsecurityAlicenseAqualityAllows AI assistants to list tables, read data, and execute SQL queries through a controlled interface, making database exploration and analysis safer and more structured.Last updated -880MIT License
- -securityAlicense-qualityHandles SQL query execution for a natural language interface to SQLite databases, enabling users to interact with databases using plain English rather than writing SQL manually.Last updated -1MIT License
- AsecurityAlicenseAqualityA tool service that enables AI agents to interact with MySQL databases through natural language, supporting SQL queries, table structure retrieval, and connection testing.Last updated -74920Apache 2.0
- AsecurityAlicenseAqualityAn AI-powered SQLite assistant that converts natural language to SQL queries with full schema awareness, enabling users to interact with databases using conversational language.Last updated -51MIT License