Skip to main content
Glama
manohar135

Local Database Analytics MCP Server

by manohar135

Local Database Analytics MCP Server

A Python-based Model Context Protocol (MCP) server that connects local databases to AI assistants like Claude. This project demonstrates how to build analytical abstractions on top of raw SQL data using FastMCP, SQLAlchemy, and Pandas.

Overview

Instead of just giving an LLM raw SQL access, this server provides a structured suite of analytical tools. It allows an AI assistant to natively inspect schemas, run safe queries, aggregate data, detect nulls, compute correlations, and generate time-series summaries—all through natural language.

The repository includes a seed script that generates a realistic local SQLite e-commerce database, allowing you to test the server immediately without needing external database credentials.

Related MCP server: agente-mcp-streamlit-ecommerce

Core Capabilities

  • Read-Only SQL Execution: Safely execute SELECT queries without risking data modification.

  • Statistical Analysis: Calculate min/max, standard deviation, and Pearson correlations between columns.

  • Time-Series Aggregation: Group data by day, week, or month to spot trends.

  • Automated Data Quality Checks: Tools to scan for nulls and anomalies.

  • MCP Prompts: Pre-built templates for common tasks like generating business summaries and analyzing tables.

Project Structure

  • server.py & mcp_instance.py: The FastMCP server initialization and entry points.

  • database/: Contains the SQLAlchemy connection logic and the data seeding script.

  • tools/: The core of the server.

    • query.py: Basic SQL and schema inspection tools.

    • analytics.py: Higher-level Pandas-based statistical tools.

  • resources/: Exposes database schemas as static MCP resources.

  • prompts/: Standardized MCP prompts for the AI assistant.

  • tests/: Pytest suite verifying the functionality of all tools.

Setup Instructions

  1. Clone the repository

    git clone https://github.com/manohar135/Local-Database-Analytics-MCP-Server.git
    cd Local-Database-Analytics-MCP-Server
  2. Set up a virtual environment

    python -m venv .venv
    source .venv/bin/activate
    pip install -r requirements.txt
  3. Generate the sample database This script creates a local SQLite database (data/analytics.db) and populates it with sample e-commerce data (customers, products, orders).

    python database/seed_data.py
  4. Run the MCP Inspector FastMCP comes with a built-in UI for testing tools locally without needing Claude Desktop.

    fastmcp dev inspector server.py

Testing

The project includes a test suite that uses a temporary SQLite setup to verify the MCP tools.

pytest tests/ -v

Integration with Claude Desktop

To use this server directly within Claude Desktop, add the following to your claude_desktop_config.json:

{
  "mcpServers": {
    "local-db-analytics": {
      "command": "/path/to/your/repo/.venv/bin/python",
      "args": ["-m", "fastmcp", "run", "/path/to/your/repo/server.py"]
    }
  }
}

(Replace the paths with the absolute paths to your virtual environment and repository).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

No tool schema history has been recorded yet.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables LLMs to interact with a SQLite e-commerce database via safe, typed MCP tools with read-only guards and auth-gated mutations, plus a Claude agent for answering business questions.
    1
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables natural-language querying of an e-commerce dataset by providing a LangChain agent that uses tools to execute parameterized SQL queries on a SQLite database, with short-term memory and Streamlit or Claude Desktop interfaces.
    -
  • A
    license
    A
    quality
    B
    maintenance
    Enables AI agents to safely interact with a SQLite shop database through schema discovery, read-only SQL queries, and pre-built analytics reports like top customers, top products, and revenue summaries.
    6
    83
    MIT
  • F
    license
    A
    quality
    B
    maintenance
    Gives AI agents read-only analytical access to an e-commerce SQLite database (customers, orders, order_items, products) via SQL queries, table listing, and schema inspection.
    3
    -

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/manohar135/Local-Database-Analytics-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server