quantdb-mcp
Click on "Install 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., "@quantdb-mcpWhat are the latest stock prices and company names?"
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.
quantdb-mcp
量化金融数据库 + 只读 SQL MCP 服务。
数据源:easy-tdx(通达信 TCP 行情)+ pywestockdata(腾讯/东财基本面 HTTP)
存储:DuckDB 双文件 ——
quantdb_ods.duckdb(ODS 原始层)/quantdb.duckdb(DWD 层,清洗后)接口:FastMCP streamable-http 只读
query(sql)工具(可跨库 JOIN)
分层架构
层 | 库文件 | 表 |
ODS | quantdb_ods.duckdb | stock_basic / daily_kline / realtime_quote / finance_income / finance_balance / finance_cashflow |
DWD | quantdb.duckdb | dim_stock(去重标准化)/ fact_daily(列名统一) |
APP | - | 后续因子层(可复用 factor-pipeline 表达式引擎) |
ODS 可整体重灌,DWD 由 sync_dwd 全量重建(幂等)。
Related MCP server: ashare-mcp
安装
cd projects/quantdb-mcp
uv sync # 或 pip install -e .依赖:duckdb、fastmcp、pywestockdata、easy-tdx、click。
CLI
quantdb init # 建库建表(双文件)
quantdb full-load # 全量同步:代码表 → 日K → 财务 → DWD 重建
quantdb full-load --codes 50 --kline-count 120 # 限前 50 只、每只 120 根K线(试跑用)
quantdb update --once # 增量同步 + 一次实时快照
quantdb update # 盘中 30s 快照循环(Ctrl+C 退出)
quantdb summary # 各表行数与最新日期数据目录通过环境变量 QUANTDB_DATA_DIR 指定(默认 ./data)。
MCP 接入
启动服务(streamable-http):
uv run python -m quantdb.server.mcp # 等价 pip 安装后的 quantdb-mcp注册到 MCP 客户端(如 nanobot / Claude Desktop):
{
"mcpServers": {
"quantdb": {
"command": "quantdb-mcp",
"type": "stdio"
}
}
}查询示例(query 工具,只读):
SELECT * FROM dim_stock WHERE market = 'sh' LIMIT 5
SELECT d.code, s.name, d.close FROM fact_daily d JOIN ods.stock_basic s ON d.code = s.code
WHERE d.date = (SELECT max(date) FROM fact_daily)安全限制
仅允许单条
SELECT/WITH;写语句、多语句被拒绝表白名单:仅业务表(ODS 用
ods.前缀),内部表不可见最多返回 10_000 行;查询超时 30s;DuckDB 以只读模式打开
测试
uv run pytest # 97 tests,100% 覆盖率(mock 数据源,不依赖网络)
uv run ruff check src tests # 0 error详见 design.md 与 task_list.md。
Available Tools
1 toolqueryA
对量化数据库执行只读 SQL 查询。
支持表:dim_stock、fact_daily、finance_income/balance/cashflow、 realtime_quote、stock_basic、daily_kline(ODS 表用 ods. 前缀)。 仅允许单条 SELECT/WITH;写语句与多语句会被拒绝;最多返回 10000 行。
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, but the description fully compensates by disclosing read-only behavior, statement restrictions, and the row limit. It also clarifies supported tables and the ODS prefix, which are important operational context. This exceeds typical descriptions.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three terse sentences carry all key information: read-only, supported tables, and constraints. No filler or redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a single-parameter SQL tool with an output schema, the description covers the essential operational aspects: target database, allowed query forms, table names, and result limits. There are no obvious gaps that would prevent correct invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema only defines sql as a string with no description (0% coverage). The description adds crucial semantics: it defines the acceptable SQL dialect (single SELECT/WITH), enumerates permissible tables, and states the 10,000-row cap. This substantially compensates for the sparse schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('执行只读 SQL 查询' – execute read-only SQL queries) and identifies the resource ('量化数据库' – quantitative database), clearly distinguishing it as a query tool. It goes beyond a tautology by specifying supported tables and constraints.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It provides explicit usage boundaries: only single SELECT/WITH statements are allowed, write and multi-statement queries are rejected, and result size is limited to 10,000 rows. It also enumerates supported tables, giving the agent clear criteria for when this tool applies. No sibling tools exist, so alternative tool guidance is not applicable.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
1 tool update
v0.1.0- First observed
query
TDQS
With only a single tool, there is no possibility of ambiguity or overlap between tools. The tool's purpose is clearly defined as executing read-only SQL queries against a specified set of tables, so agents can directly know what it does.
The sole tool is named 'query', which is a simple, predictable, and consistent name. Since there is only one tool, there are no mixed conventions or inconsistent patterns to confuse an agent.
A single tool might seem thin, but it serves a comprehensive purpose as a generic SQL query interface covering many tables. While additional metadata tools could be useful, the count is slightly under but acceptable for a focused read-only database server.
The tool provides complete read-only access to all listed tables, supporting SELECT/WITH queries with a row limit. A minor gap is the lack of schema/metadata exploration tools, but the description partially fills this by listing the available tables, making it workable for most use cases.
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 Connectors
The stock market, in SQL — scan, replay, or subscribe across ~12k US tickers and top 100 cryptos.
China A-share market data for research, backtesting and AI agents via MCP.
MCP server giving AI agents one-connection access to China A-share market intelligence: financials,
Query, join, profile, clean and convert CSV/JSON/Parquet with server-side DuckDB over MCP.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenance基于Model Context Protocol (MCP) 的A股实时行情查询服务器,支持查询A股实时价格、历史K线数据、财务信息及市场概况。8MIT
- AlicenseAqualityAmaintenanceA-share market data MCP server via baostock. Full-stack coverage: K-line, financials, DCF/DDM/PEG valuation, 11 technical indicators with proper split-day volume handling (OBV/MFI on raw bars), CN-style KDJ (J=3K-2D), risk metrics (Beta/Sharpe/MaxDD with stock-suspension-aware aligned returns), and PBoC macro data.2511MIT
- AlicenseAqualityBmaintenanceRead-only MCP server for large-scale cross-sectional quant analysis of US stock market data (1.49 billion rows) using ClickHouse.7MIT
- AlicenseBqualityBmaintenanceMCP server that syncs and queries comprehensive stock data (quotes, financials, dividends, analyst forecasts, options, news) from Yahoo Finance and Investing.com into an external MySQL database.27200MIT
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/openbot-coder/quantdb-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server