MCP Server

MCP Server

Manages query validation, database connection, and security for a system that transforms SQL databases into interactive dashboards using natural language queries.

Category
Visit Server

README

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

  1. Clone the repository:

    git clone https://github.com/sathwikabbaraju/MCP-SQL-Visualization.git
    cd mcp-sql-visualization
    
  2. Set up a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    
  3. Install dependencies:

    pip install -r requirements.txt
    
  4. Configure 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-20240229
    
  5. Start the backend server:

    uvicorn mcp_server:app --reload --port 8000
    
  6. Launch the Streamlit UI:

    streamlit run app.py
    

🖥️ Usage

  1. Ask a Question:
    Type a question in plain English in the chat interface.
    Example:
    What were our top 5 selling products last quarter?

  2. Generate a Dashboard:
    Request a visualization or report.
    Example:
    Show monthly sales trends by region with key metrics.

  3. 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

  1. Fork the repository.
  2. Create a new branch:
    git checkout -b feature/your-feature
  3. Commit your changes:
    git commit -m 'Add your feature'
  4. Push to the branch:
    git push origin feature/your-feature
  5. Open a Pull Request.

Acknowledgements

  • Agno AI Agent Framework
  • Streamlit

Happy Visualizing! 🚀

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured