dq-mcp

dq-mcp

Enables language models to run data-quality checks and profiling on local files, using dbt-style assertions like not_null, unique, relationships, and accepted_values.

Category
访问服务器

README

dq-mcp

An MCP server that gives a language model real data-quality tools instead of guesses.

Ask an LLM about a dataset it cannot inspect and it will describe the table it expects to see. This server closes that gap: it exposes profiling and assertion tools over the Model Context Protocol, so an agent has to go and look before it says anything about your data.

The checks deliberately mirror the dbt test vocabulary — not_null, unique, relationships, accepted_values — so the assertions you already enforce in a pipeline are available to an agent at query time, under the same names.


Tools

Tool What it does
infer_schema Column names, dtypes, row count. Cheap; run it first.
profile_table Per-column null rate, distinct count, examples, numeric range
check_not_null Asserts columns are fully populated
check_unique Asserts a single or composite key is unique
check_relationship Asserts every foreign key exists in the parent
check_accepted_values Asserts a column stays inside an allowed set
run_suite Runs several checks in one call, returns a combined report

There is also a dq://conventions resource holding the rules for reading a report — most usefully, that a passing test means the assertion held, not that the data is correct.

Reads CSV, TSV, JSON, JSONL and Parquet. Files above 512 MB are refused rather than silently loaded into memory.


Quickstart

git clone https://github.com/jyoshnagoshika-spec/dq-mcp.git
cd dq-mcp

python3 -m venv .venv
source .venv/bin/activate          # Windows: .venv\Scripts\activate

pip install -r requirements.txt
python dq_server.py                # starts on stdio; Ctrl+C to stop

The server speaks MCP over stdio, so running it directly just waits for a client. Nothing will print. That is correct behaviour — connect a client to use it.

Connect it to Claude Desktop

Add this to claude_desktop_config.json:

  • macOS — ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows — %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "dq": {
      "command": "/absolute/path/to/dq-mcp/.venv/bin/python",
      "args": ["/absolute/path/to/dq-mcp/dq_server.py"]
    }
  }
}

Use the absolute path to the virtual environment's Python, not plain python. Claude Desktop does not inherit your shell's PATH, so a bare python will find a system interpreter without mcp or pandas installed. This is the single most common reason the server fails to appear.

Restart Claude Desktop fully — quit it, don't just close the window.


Try it on the included fixtures

fixtures/ contains 900 orders and 200 customers with four deliberate quality problems planted in them. Ask Claude:

Profile fixtures/orders.csv, then check that order_id is unique, that customer_id is never null, and that every customer_id exists in fixtures/customers.csv.

It should find all four:

Problem Tool that catches it Result
5 duplicated order_id values check_unique ORD-00013 appears 3 times
5 null customer_id values check_not_null 0.56% null rate
3 orphaned foreign keys check_relationship CUST-9991, CUST-9992, CUST-9993
2 rows with status pending_review check_accepted_values outside the allowed set

Example output

> check_unique(path="fixtures/orders.csv", columns=["order_id"])

{
  "status": "fail",
  "test": "unique",
  "key": ["order_id"],
  "duplicate_rows": 5,
  "worst_offenders": { "ORD-00013": 3, "ORD-00301": 2 }
}

Failures name the worst offenders, because "this column is not unique" is not actionable and "ORD-00013 appears three times" is.


Compatibility

The MCP Python SDK renamed its high-level server class in 2.0 (FastMCP became MCPServer). dq_server.py imports whichever is present, so it runs on both 1.x and 2.x without changes.

Roadmap

  • Warehouse-backed checks (Redshift, Snowflake) rather than files only
  • Freshness assertions against a timestamp column
  • Emit results in the dbt run_results.json shape for CI

Licence

MIT — see LICENSE.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选