Skip to main content
Glama
mcp-data-service

mcp-data-service

by lengzhanbao

MCP Data Service · MCP 数据服务

Expose data query + insights + SQL as an MCP Server — plug into Claude Desktop, Cursor, or any MCP client in 30 seconds. 把「数据查询 + 自动洞察 + SQL」包装成 MCP 标准工具,Claude Desktop / Cursor 即插即用——给任意 AI Agent 装上数据能力,30 秒接入。

License: MIT Python 3.10+ CI


English · 中文

English

What is this?

An MCP (Model Context Protocol) server that turns a data table into callable tools for any AI agent. No LLM API — pandas + SQLite locally.

  • v0.2.0: 11 tools + 2 resources + 2 prompts · CSV/SQLite · pagination · read-only SQL · health check · Docker

Tools (11)

Tool

What it does

query_video_stats(metric, rule, condition, source, page, page_size, columns)

Query: TOP/BOTTOM/AVG/SUM/by-date + filter + pagination + column select

data_insights(source)

Auto insights: overview + anomaly (1.5σ) + recommendations

list_columns(source)

List columns & dtypes

list_sources()

List configured sources

refresh_sources()

Clear cache

get_schema(source)

Detailed schema: dtype/nulls/mean/min/max/samples

preview_data(source, page, page_size, condition)

Paginated preview with filter

aggregate_stats(source, group_by, metric, agg, condition)

Group-by agg (mean/sum/count/min/max/median)

correlation_analysis(source, columns)

Pearson correlation matrix

sql_query(sql, source)

Read-only SELECT/WITH over DataFrame or SQLite file

health_check()

Health: sources/rows/cols/tools

Resources (2)

URI

What

data://{source}/preview

First 5 rows

data://{source}/schema

Schema JSON (rows + dtypes)

Prompts (2)

Prompt

What

analyze_video_data(source)

6-step full analysis guide

anomaly_drilldown(source, metric)

Anomaly drill-down guide

Quick Start

pip install -r requirements.txt
pip install -e .[dotenv]           # or pipx install -e .[dotenv]
LOG_LEVEL=DEBUG python server.py --verbose --health  # 详细日志
python tests/test_server.py        # direct + MCP handshake (tools/resources/prompts)
python server.py --health          # health check
python server.py                   # stdio (clients launch it)

Connect from Claude Desktop / Cursor

{ "mcpServers": { "data-service": { "command": "python", "args": ["/absolute/path/to/mcp-data-service/server.py"] } } }

Multiple sources (CSV + SQLite)

DATA_SOURCES="default=./data/video_stats.csv,archive=./data/archive.db" python server.py
# SQLite auto-detected by .db/.sqlite; table video_stats or first table is used

Docker

docker build -t mcp-data-service .
docker run -i --rm -v ./data:/app/data:ro mcp-data-service --health
docker compose up

Related MCP server: Pandas-MCP Server

中文

这是什么?

一个 MCP Server:把一张数据表变成任何 AI Agent 可调用的工具。不依赖 LLM API——pandas + SQLite 本地计算。

  • v0.2.0:11 工具 + 2 资源 + 2 提示 · 支持 CSV/SQLite · 分页 · 只读 SQL · 健康自检 · Docker

工具清单(11)

工具

作用

query_video_stats(metric, rule, condition, source, page, page_size, columns)

按指标查询:TOP/BOTTOM/平均值/总和/按日期 + 过滤 + 分页 + 选列

data_insights(source)

自动洞察:总览 + 异常(1.5σ)+ 建议

list_columns(source)

列出列名与类型

list_sources() / refresh_sources()

多源列表 / 清缓存

get_schema(source)

详细 Schema + 统计摘要

preview_data(source, page, page_size, condition)

分页预览 + 条件过滤

aggregate_stats(source, group_by, metric, agg, condition)

分组聚合 mean/sum/count/min/max/median

correlation_analysis(source, columns)

相关性矩阵

sql_query(sql, source)

只读 SELECT/WITH(内存 DataFrame 或 SQLite 文件)

health_check()

健康自检

资源与提示

  • 资源:data://{source}/preview 预览、data://{source}/schema JSON

  • 提示:analyze_video_data 全流程引导、anomaly_drilldown 异常下探

快速开始

pip install -r requirements.txt
pip install -e .[dotenv]       # 或 pipx install -e .[dotenv]
LOG_LEVEL=DEBUG python server.py --verbose --health  # 详细日志
python tests/test_server.py    # 直调 + MCP 握手
python server.py --health      # 自检
python server.py               # stdio(客户端自动拉起)

多数据源(CSV + SQLite)

DATA_SOURCES="default=./data/video_stats.csv,archive=./data/archive.db" python server.py
# .db/.sqlite 自动走 SQLite,表名为 video_stats 或首表

Docker

docker build -t mcp-data-service .
docker compose up

License

MIT © lengzhanbao

Available Tools

11 tools
aggregate_statsC

按字段分组聚合。

Inputs: agg, format, metric, source, +2 more. Returns: result

correlation_analysisB

数值列相关性矩阵(Pearson),可选指定列。

Inputs: format, source, columns. Returns: result

data_insightsC

自动洞察:数据总览 + 异常下探(1.5σ 偏离)+ 建议。列名以实际 CSV 为准。

Inputs: metric, source. Returns: result

get_schemaB

获取数据集详细 Schema:列名、类型、非空数、均值/分位数、取值示例。

Inputs: source. Returns: result

health_checkA

健康自检:返回数据源、行列数、必要列、MCP 工具数。

Inputs: no named parameters. Returns: result

list_columnsB

列出数据集的全部列名与类型。

Inputs: source. Returns: result

list_sourcesA

列出当前可用的数据源(通过 DATA_FILE / DATA_SOURCES 配置)。

Inputs: no named parameters. Returns: result

preview_dataC

分页预览数据,支持条件过滤。

Inputs: page, format, source, condition, +1 more. Returns: result

query_video_statsC

查询统计数据。列名以实际 CSV 为准,metric 必须是存在的列。

Inputs: page, rule, format, metric, +4 more. Returns: result

refresh_sourcesA

清除数据源缓存;下次查询重新读取 CSV/SQLite。只读操作,不修改文件。

Inputs: no named parameters. Returns: result

sql_queryA

只读 SQL 查询(仅 SELECT/WITH),在 SQLite 或 DataFrame 上执行。

Inputs: sql (required), format, source. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 11 tools

    Disambiguation3/5

    Most tools are distinct, but list_columns and get_schema clearly overlap, and query_video_stats, aggregate_stats, and data_insights have fuzzy boundaries around statistics and insights. Descriptions help somewhat, but an agent could easily select the wrong tool for a given analytical request.

    Naming Consistency3/5

    All names are snake_case, but conventions are mixed: verb-noun names like list_columns and preview_data coexist with noun-phrase names like data_insights and correlation_analysis. query_video_stats also stands out as a domain-specific exception to the otherwise general-purpose naming pattern.

    Tool Count5/5

    Eleven tools is an appropriate size for a data service covering source management, schema inspection, preview, aggregation, correlation, SQL querying, and health checks. The count is neither bloated nor too thin for the stated purpose.

    Completeness4/5

    The tool surface covers the core read-only data workflow well: discovering sources, inspecting schema, previewing, aggregating, running SQL, checking correlations, and getting automated insights. Minor gaps exist—such as no explicit dataset-comparison or export tool—but they are workable through sql_query and preview_data.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      A
      maintenance
      Production Model Context Protocol (MCP) server for business — replaces stale generic descriptions with concrete 2026 technical intelligence and data agents. Exposes dynamic KPI analytics, forecasting, anomaly detection, and schema resources across 10 enterprise domains via FastMCP over stdio and SSE transports.
      9
      AGPL 3.0
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables querying CSV or Excel data using natural language through MCP tools, running pandas operations on an uploaded dataset.
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides MCP-compatible tools for data analysis, including file reading, Python/SQL execution, and hypothesis testing. Enables autonomous data analysis agents to interact with a sandboxed environment.
      1
      -