DataPilot AI MCP Server

DataPilot AI MCP Server

Enables natural language data analysis on uploaded CSV files by converting them to SQLite and exposing read-only database tools via MCP. Integrates with Ollama LLM to translate user questions into safe SQL queries.

Category
Visit Server

README

šŸ›« DataPilot AI

DataPilot AI is a production-quality, AI-powered database assistant that allows users to upload CSV files, automatically converts them into an isolated SQLite database, and enables natural language data analysis using an Ollama LLM Agent (qwen3:8b) communicating strictly through Model Context Protocol (MCP) tools.


šŸ›ļø Architecture & Clean Isolation

 +-----------------------------------------------------------------------+
 |                            Streamlit UI                               |
 |     - CSV Upload & Table Data Preview                                 |
 |     - Natural Language Query Interface                                |
 |     - Render SQL Queries, Results & Dynamic Plotly Charts             |
 +-----------------------------------+-----------------------------------+
                                     |
                                     v
 +-----------------------------------+-----------------------------------+
 |                             AI Agent                                  |
 |     - Ollama (`qwen3:8b`) Agent Loop                                  |
 |     - Translates user questions into MCP tool calls                   |
 |     - STRICTLY NO direct database access                              |
 +-----------------------------------+-----------------------------------+
                                     |
                                     | (MCP JSON-RPC Protocol)
                                     v
 +-----------------------------------+-----------------------------------+
 |                            MCP Server                                 |
 |     - Built with FastMCP / MCP Python SDK                             |
 |     - Exposes isolated tools:                                         |
 |         * list_tables()                                               |
 |         * describe_table(table_name)                                  |
 |         * run_sql(query)                                              |
 +-----------------------------------+-----------------------------------+
                                     |
                                     v
 +-----------------------------------+-----------------------------------+
 |                      Database & Storage Layer                         |
 |     - SQLite Database (`database/datapilot.db`)                       |
 |     - SQLAlchemy ORM & Engine abstraction                             |
 |     - Ingestion Layer (`database/csv_loader.py`)                      |
 +-----------------------------------------------------------------------+

Key Architectural Principles

  • Strict MCP Tool Isolation: The AI Model never opens SQLite files or executes SQL directly. It interacts with data solely through registered MCP server tools.
  • Security Guard: run_sql blocks write operations (DROP, DELETE, INSERT, UPDATE, ALTER).
  • Type Hints & Clean Code: Type annotations (typing), modern Python practices (pathlib), modular functions under 30 lines, proper logging, and exception handling.

šŸ› ļø Tech Stack

  • Frontend: Streamlit
  • Backend: Python 3.10+
  • Database: SQLite, SQLAlchemy
  • AI / LLM: Ollama (qwen3:8b)
  • Protocol: Official MCP Python SDK / FastMCP
  • Data Visualization: Plotly
  • Data Processing: Pandas
  • Configuration: python-dotenv, Pydantic

šŸ“‚ Project Structure

DataPilot-AI/
ā”œā”€ā”€ app/
│   ā”œā”€ā”€ __init__.py
│   └── main.py              # Streamlit Web UI application
ā”œā”€ā”€ database/
│   ā”œā”€ā”€ __init__.py
│   ā”œā”€ā”€ database.py          # SQLAlchemy database engine management
│   └── csv_loader.py        # CSV parsing & SQL table ingestion
ā”œā”€ā”€ agent/
│   ā”œā”€ā”€ __init__.py
│   └── agent.py             # Ollama AI agent & MCP tool dispatcher
ā”œā”€ā”€ mcp_server/
│   ā”œā”€ā”€ __init__.py
│   ā”œā”€ā”€ server.py            # FastMCP server transport
│   └── tools.py             # MCP database tool implementations
ā”œā”€ā”€ charts/
│   ā”œā”€ā”€ __init__.py
│   └── chart_generator.py   # Automated Plotly chart generator
ā”œā”€ā”€ uploads/                 # Storage for raw CSV uploads
ā”œā”€ā”€ database/                # SQLite database directory (`datapilot.db`)
ā”œā”€ā”€ scratch/                 # Verification test scripts
ā”œā”€ā”€ .env.example             # Environment variables template
ā”œā”€ā”€ requirements.txt         # Pinned project dependencies
└── README.md                # Project documentation

āš™ļø Quickstart Guide

1. Clone & Setup Virtual Environment

git clone https://github.com/taneeshk12/hcai_project.git DataPilotAI
cd DataPilotAI

# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate

# Install dependencies
pip install --upgrade pip
pip install -r requirements.txt

2. Configure Environment Variables

Copy .env.example to .env:

cp .env.example .env

3. Setup & Start Ollama

Make sure Ollama is installed and running locally with the target model:

# Start Ollama server
ollama serve

# Pull target model in a separate terminal
ollama pull qwen3:8b

4. Run the Application

Launch the Streamlit interface:

streamlit run app/main.py

Open http://localhost:8501 in your browser.


šŸ”Œ MCP Tools Specification

The MCP server exposes three database tools:

Tool Name Parameters Description
list_tables() None Returns a JSON list of all active tables in the SQLite database.
describe_table(table_name) table_name: str Returns schema, column types, total row count, and 3 sample records.
run_sql(query) query: str Executes a read-only SQL query and returns matching records.

šŸ’” Usage Example

  1. Upload CSV: Drag and drop amazon.csv (or any CSV dataset) into the uploader.
  2. Automatic SQL Ingestion: DataPilot AI sanitizes the filename into a table name (e.g. amazon) and creates a SQLite table with full row insertion.
  3. Ask Natural Language Questions:
    • "How many rows are in the database?"
    • "Show all columns for table amazon"
    • "What are the top 5 highest rated items?"
    • "Show average price by category"
  4. Inspect Output:
    • Generated SQL Query displayed first in a code block.
    • AI Answer in clean natural language text.
    • MCP Execution Trace showing tool calls.
    • Automated Plotly Chart generated automatically for numerical data.

šŸ“œ License

MIT License. Created for AI Product Engineering portfolio.

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