Local Database Analytics MCP Server
本地数据库分析 MCP 服务器
一个基于 Python 的 模型上下文协议(MCP)服务器,将本地 SQLite 电子商务数据库暴露给 Claude 等 AI 助手。使用 FastMCP、SQLAlchemy 和 Pandas 构建。
什么是 MCP? 模型上下文协议(由 Anthropic 提出)让 AI 模型能够安全地与本地工具和数据交互。该服务器让 Claude 了解你的数据库,使其能够使用自然语言查询、分析和解释数据。
功能特性
工具(共 11 个)
工具 | 描述 |
| 列出数据库中的所有表 |
| 显示指定表的模式/列结构 |
| 从表中返回 N 条样本行 |
| 统计行数,支持可选的 WHERE 过滤条件 |
| 执行任何安全的 SELECT 查询 |
| 统计信息:任意列的最小值/最大值/均值/空值/唯一值 |
| 按某列排序的前 N 行 |
| GROUP BY + SUM/AVG/COUNT/MIN/MAX |
| 查找包含缺失数据的列 |
| 两列之间的皮尔逊相关系数 |
| 按日/周/月聚合数据 |
资源
URI | 描述 |
| 完整数据库模式 |
| 指定表的模式 |
提示词
analyze_table— 对任意表进行完整统计分析business_summary— 高管级别的电子商务报告find_anomalies— 数据质量与异常值检测
Related MCP server: SQLite MCP Server
数据库模式
customers ──< orders ──< order_items >── productscustomers: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-Server2. 创建虚拟环境并安装依赖
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -r requirements.txt3. 初始化数据库
python database/seed_data.py4. 启动 MCP Inspector(开发模式)
fastmcp dev server.py5. 运行测试
pytest tests/ -v技术栈
技术 | 角色 |
MCP 服务器框架 | |
SQLite | 零配置本地数据库 |
SQLAlchemy | 数据库引擎与 ORM |
Pandas | 数据分析与聚合 |
Pydantic | 输入验证 |
Pytest | 单元测试 |
Claude 对话示例
连接到 Claude Desktop 后,可以尝试:
"你可以访问哪些表?"
"给我一份销售数据的业务摘要"
"哪些产品卖得最好?"
"orders 表中是否存在数据质量问题?"
"展示过去一年的月度收入趋势"
This server cannot be installed
Maintenance
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
- Alicense-qualityDmaintenanceEnables 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.853MIT
- Alicense-qualityDmaintenanceEnables natural language interaction with local SQLite databases through Claude Desktop, translating plain English queries into SQL for data analysis and exploration.3MIT
- Alicense-qualityBmaintenanceEnables 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.1MIT
- Flicense-qualityCmaintenanceEnables 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.
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.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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