database-analytics-mcp

database-analytics-mcp

Provides SQLite database analytics operations through MCP, enabling AI assistants to connect, query, explore schema, and export data from SQLite databases.

Category
Visit Server

README

Database Analytics MCP Server

A practical database analytics MCP server built with FastMCP, providing SQLite database operations through the Model Context Protocol (MCP). Perfect for data analysis workflows with AI assistants like Claude.

What This Server Provides

🛠️ Tools (Interactive Operations)

  • connect_db - Connect to SQLite database files
  • execute_query - Execute SQL queries with safety checks
  • list_tables - List all tables in the database

📊 Resources (Read-only Data Access)

  • schema://tables/{table_name} - Get table column information and structure
  • data://tables/{table_name} - Get sample table data for preview

🔐 Safety Features

  • SQL injection prevention with dangerous operation blocking
  • Read-only resource access for safe schema exploration
  • Comprehensive error handling with descriptive messages

Setup and Installation

  1. Clone the repository:

    git clone https://github.com/khuyentran1401/database-analytics-mcp.git
    cd database-analytics-mcp
    
  2. Install UV (recommended):

    # Install UV if you haven't already
    curl -LsSf https://astral.sh/uv/install.sh | sh
    
  3. Install dependencies:

    # UV automatically manages dependencies from pyproject.toml
    uv sync
    
  4. Test the server:

    uv run example_usage.py
    
  5. Add to Claude Code

    # Quick setup
    claude mcp add database-analytics -- uv run database_mcp_server.py
    

    Verify installation:

    # Check if the server is registered
    claude mcp list
    

Other MCP Clients

For any MCP client that supports the standard protocol:

servers:
  - name: database-analytics
    transport:
      type: stdio
      command: uv
      args: ["run", "database_mcp_server.py"]

Example Workflows

Data Exploration with Claude Code

  1. Connect to Database

    Connect to my SQLite database at ./sample_database.db
    
  2. Explore Schema

    What tables are available in this database?
    
  3. Examine Table Structure

    Show me the schema for the users table
    
  4. Preview Data

    Show me some sample data from the users table
    
  5. Run Analytics Queries

    Calculate total sales by product category
    
  6. Export Results

    Export the query "SELECT product_name, SUM(quantity) as total_sold FROM orders GROUP BY product_name" to CSV file called sales_report.csv
    
  7. Get Table Statistics

    Show me statistics for the users table
    

Common Use Cases

  • Database Schema Discovery: Quickly understand database structure
  • Data Quality Checks: Sample data to verify data integrity
  • Ad-hoc Analysis: Run custom SQL queries safely
  • Report Generation: Execute complex analytical queries
  • Data Exploration: Browse tables and relationships with pagination
  • Data Export: Export query results to CSV for external analysis
  • Performance Monitoring: Track query execution times

Available Tools & Resources

Tools (Interactive Operations)

Tool Parameters Description
connect_db database_path: str Connect to SQLite database file
execute_query sql: str Execute SQL query with safety checks and timing
list_tables None List all tables in connected database
export_to_csv sql: str, filename: str Export query results to CSV file

Resources (Read-only Access)

Resource URI Description
schema://tables/{table_name} Get column info, types, constraints, foreign keys
data://tables/{table_name} Get sample rows with pagination, statistics (limit, offset)
stats://tables/{table_name} Get comprehensive table statistics and column analysis

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