database-analytics-mcp
Provides tools for connecting to SQLite databases, executing queries, listing tables, and exporting results to CSV, along with read-only access to table schemas, sample data, and statistics.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@database-analytics-mcp Connect to my SQLite database at ./sample.db"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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 filesexecute_query- Execute SQL queries with safety checkslist_tables- List all tables in the database
๐ Resources (Read-only Data Access)
schema://tables/{table_name}- Get table column information and structuredata://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
Related MCP server: MCP SQLite Server
Setup and Installation
Clone the repository:
git clone https://github.com/khuyentran1401/database-analytics-mcp.git cd database-analytics-mcpInstall UV (recommended):
# Install UV if you haven't already curl -LsSf https://astral.sh/uv/install.sh | shInstall dependencies:
# UV automatically manages dependencies from pyproject.toml uv syncTest the server:
uv run example_usage.pyAdd to Claude Code
# Quick setup claude mcp add database-analytics -- uv run database_mcp_server.pyVerify 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
Connect to Database
Connect to my SQLite database at ./sample_database.dbExplore Schema
What tables are available in this database?Examine Table Structure
Show me the schema for the users tablePreview Data
Show me some sample data from the users tableRun Analytics Queries
Calculate total sales by product categoryExport Results
Export the query "SELECT product_name, SUM(quantity) as total_sold FROM orders GROUP BY product_name" to CSV file called sales_report.csvGet 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 to SQLite database file |
|
| Execute SQL query with safety checks and timing |
| None | List all tables in connected database |
|
| Export query results to CSV file |
Resources (Read-only Access)
Resource URI | Description |
| Get column info, types, constraints, foreign keys |
| Get sample rows with pagination, statistics (limit, offset) |
| Get comprehensive table statistics and column analysis |
Available Tools
4 toolsconnect_dbB
Connect to an SQLite database file.
Inputs: database_path (required). Returns: object
execute_queryC
Execute a SQL query on the connected database.
Inputs: sql (required). Returns: object
export_to_csvB
Execute a SQL query and export results to CSV file
Inputs: sql (required), filename (required). Returns: object
list_tablesA
List all tables in the connected database.
Inputs: no named parameters. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 4 tools
Each tool has a clearly distinct role: connecting, executing queries, listing tables, and exporting results. Even though export_to_csv involves executing a query, its output destination (file) differentiates it from execute_query.
All tool names follow a consistent verb_noun pattern (connect_db, execute_query, list_tables, export_to_csv), making the set predictable and easy to understand.
Four tools is well-scoped for a focused SQLite analytics server, covering the essential operations without unnecessary bloat.
The set covers connection, querying, table listing, and export, which are core for analytics. A minor gap is lack of explicit schema inspection, but agents can work around this via SQL queries (e.g., PRAGMA table_info).
Maintenance
Related MCP Connectors
Query, join, profile, clean and convert CSV/JSON/Parquet with server-side DuckDB over MCP.
Query your warehouse or a CSV with Claude/ChatGPT over MCP, governed by table-level ACL + audit.
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides comprehensive SQLite database interaction through MCP, enabling CRUD operations, custom SQL queries, and database exploration.711 npm130MIT
- FlicenseNot gradedqualityDmaintenanceQuery, explore, and manage SQLite databases through the Model Context Protocol. Connect any MCP-compatible AI client to your databases.-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage and query SQLite databases through MCP tools, supporting CRUD operations, schema management, and saved views.4 npmMIT
- FlicenseNot gradedqualityDmaintenanceMCP server that provides SQLite database operations. Allows AI assistants to query, modify and manage SQLite databases through the Model Context Protocol.-