Skip to main content
Glama
manohar135

Local Database Analytics MCP Server

by manohar135

本地数据库分析 MCP 服务器

一个基于 Python 的 模型上下文协议(MCP)服务器,将本地 SQLite 电子商务数据库暴露给 Claude 等 AI 助手。使用 FastMCPSQLAlchemyPandas 构建。

什么是 MCP? 模型上下文协议(由 Anthropic 提出)让 AI 模型能够安全地与本地工具和数据交互。该服务器让 Claude 了解你的数据库,使其能够使用自然语言查询、分析和解释数据。


功能特性

工具(共 11 个)

工具

描述

list_tables

列出数据库中的所有表

describe_table

显示指定表的模式/列结构

get_sample_rows

从表中返回 N 条样本行

get_row_count

统计行数,支持可选的 WHERE 过滤条件

run_sql_query

执行任何安全的 SELECT 查询

summarize_column

统计信息:任意列的最小值/最大值/均值/空值/唯一值

find_top_n

按某列排序的前 N 行

group_and_aggregate

GROUP BY + SUM/AVG/COUNT/MIN/MAX

detect_nulls

查找包含缺失数据的列

compute_correlation

两列之间的皮尔逊相关系数

time_series_summary

按日/周/月聚合数据

资源

URI

描述

db://schema

完整数据库模式

db://tables/{name}

指定表的模式

提示词

  • analyze_table — 对任意表进行完整统计分析

  • business_summary — 高管级别的电子商务报告

  • find_anomalies — 数据质量与异常值检测


Related MCP server: SQLite MCP Server

数据库模式

customers ──< orders ──< order_items >── products
  • customers:15 条记录,包含姓名、邮箱、城市、注册日期

  • products:15 个产品,涵盖电子产品、图书、运动、家居、文具

  • orders:60 条订单,包含状态(已完成/待处理/已取消)和金额

  • order_items:将订单与产品关联的订单明细行


项目结构

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)

快速开始

1. 克隆仓库

git clone https://github.com/manohar135/Local-Database-Analytics-MCP-Server.git
cd Local-Database-Analytics-MCP-Server

2. 创建虚拟环境并安装依赖

python -m venv .venv
source .venv/bin/activate       # On Windows: .venv\Scripts\activate
pip install -r requirements.txt

3. 初始化数据库

python database/seed_data.py

4. 启动 MCP Inspector(开发模式)

fastmcp dev server.py

5. 运行测试

pytest tests/ -v

技术栈

技术

角色

FastMCP

MCP 服务器框架

SQLite

零配置本地数据库

SQLAlchemy

数据库引擎与 ORM

Pandas

数据分析与聚合

Pydantic

输入验证

Pytest

单元测试


Claude 对话示例

连接到 Claude Desktop 后,可以尝试:

  • "你可以访问哪些表?"

  • "给我一份销售数据的业务摘要"

  • "哪些产品卖得最好?"

  • "orders 表中是否存在数据质量问题?"

  • "展示过去一年的月度收入趋势"

F
license - not found
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

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

Related MCP Servers

  • A
    license
    -
    quality
    D
    maintenance
    Enables Claude to connect to and interact with SQLite, SQL Server, PostgreSQL, and MySQL databases through natural language. Supports executing queries, managing tables, exporting data, and storing business insights with authentication options including AWS IAM.
    853
    MIT
  • A
    license
    -
    quality
    D
    maintenance
    Enables natural language interaction with local SQLite databases through Claude Desktop, translating plain English queries into SQL for data analysis and exploration.
    3
    MIT
  • A
    license
    -
    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
    -
    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.

View all related MCP servers

Related MCP Connectors

  • Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…

  • Manage your Savanto store from your AI: catalog, content, prompts, and analytics, by chat.

  • Amazon brand, seller, niche & buy-box intelligence inside your own Claude or ChatGPT.

View all MCP Connectors

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