Local Database Analytics MCP Server
Enables AI assistants like Claude to query, analyze, and summarize local SQLite e-commerce databases using natural language through 11 tools, schema resources, and pre-built analytical prompts.
README
Local Database Analytics MCP Server
A Python-based Model Context Protocol (MCP) server that exposes a local SQLite e-commerce database to AI assistants like Claude. Built with FastMCP, SQLAlchemy, and Pandas.
What is MCP? The Model Context Protocol (by Anthropic) lets AI models securely interact with local tools and data. This server teaches Claude about your database so it can query, analyze, and explain the data — all using natural language.
Features
Tools (11 total)
| Tool | Description |
|---|---|
list_tables |
List all tables in the database |
describe_table |
Show schema/columns of a specific table |
get_sample_rows |
Return N sample rows from a table |
get_row_count |
Count rows with optional WHERE filter |
run_sql_query |
Execute any safe SELECT query |
summarize_column |
Stats: min/max/mean/nulls/unique for any column |
find_top_n |
Top N rows sorted by a column |
group_and_aggregate |
GROUP BY + SUM/AVG/COUNT/MIN/MAX |
detect_nulls |
Find columns with missing data |
compute_correlation |
Pearson correlation between two columns |
time_series_summary |
Aggregate data by day/week/month |
Resources
| URI | Description |
|---|---|
db://schema |
Full database schema |
db://tables/{name} |
Schema for a specific table |
Prompts
analyze_table— Full statistical analysis of any tablebusiness_summary— Executive-level e-commerce reportfind_anomalies— Data quality & outlier detection
Database Schema
customers ──< orders ──< order_items >── products
- customers: 15 records with name, email, city, signup date
- products: 15 products across Electronics, Books, Sports, Home, Stationery
- orders: 60 orders with status (completed/pending/cancelled) and totals
- order_items: Line items linking orders to products
Project Structure
MCP_Server/
├── server.py # FastMCP server entry point
├── requirements.txt # Python dependencies
├── database/
│ ├── engine.py # SQLAlchemy DB connection
│ └── seed_data.py # Seed script (creates + populates DB)
├── tools/
│ ├── query.py # Core SQL tools (Phase 2)
│ └── analytics.py # Analytics tools (Phase 3)
├── resources/
│ └── schema.py # DB schema as MCP resources
├── prompts/
│ └── templates.py # Pre-built analyst prompts
├── tests/
│ └── test_tools.py # Unit tests
└── data/
└── analytics.db # SQLite database (auto-created)
Getting Started
1. Clone the repo
git clone https://github.com/manohar135/Local-Database-Analytics-MCP-Server.git
cd Local-Database-Analytics-MCP-Server
2. Create a virtual environment and install dependencies
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -r requirements.txt
3. Seed the database
python database/seed_data.py
4. Launch the MCP Inspector (dev mode)
fastmcp dev server.py
5. Run tests
pytest tests/ -v
Tech Stack
| Technology | Role |
|---|---|
| FastMCP | MCP server framework |
| SQLite | Zero-config local database |
| SQLAlchemy | DB engine & ORM |
| Pandas | Analytics & aggregation |
| Pydantic | Input validation |
| Pytest | Unit testing |
Example Claude Conversations
Once connected to Claude Desktop, try:
- "What tables do you have access to?"
- "Give me a business summary of the sales data"
- "Which products are selling the most?"
- "Are there any data quality issues in the orders table?"
- "Show me monthly revenue trends for the past year"
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.