Skip to main content
Glama
doris-mcp

doris-mcp

by fhm0520

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
MCP_HOSTNoHTTP 模式监听地址。127.0.0.1
MCP_PATHNoHTTP 模式端点路径。/mcp
MCP_PORTNoHTTP 模式监听端口。3000
LOG_LEVELNo日志级别;日志只写 stderr。INFO
DORIS_HOSTNoFE 的 MySQL 协议地址。127.0.0.1
DORIS_PORTNoFE 的 MySQL 协议端口。9030
DORIS_USERNoDoris 用户名;建议使用只有 SELECT_PRIV 的账号。root
DORIS_RETRIESNo传输层重试次数(2013/10054),0 表示不重试。2
MCP_TRANSPORTNo传输方式:stdio 或 streamable-http。stdio
DORIS_DATABASENo默认库。
DORIS_MAX_ROWSNo单次返回行数上限(硬上限)。200
DORIS_PASSWORDNoDoris 密码。
DORIS_POOL_SIZENo连接池大小。4
DORIS_QUERY_TIMEOUTNo查询超时(秒)。60
DORIS_CONNECT_TIMEOUTNo建连超时(秒)。10
DORIS_MAX_RESULT_BYTESNo单次返回字节上限。1000000

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

Apache Doris 1.2.x(doris-1.2.4-1-Unknown)专用的只读 MCP Server。 17 个工具全部以 doris_ 前缀命名,避免与其他数据库类 MCP 混用。

推荐流程:

  1. 不确定库表时,先 doris_list_databases / doris_list_catalogs / doris_list_tables(都支持 limit+offset 翻页)。

  2. 写 SQL 前先 doris_describe_table 确认字段名、类型和注释(include_basic / include_ddl 可看引擎与建表语句)。

  3. 任意只读 SQL 用 doris_execute_query。

  4. 慢 SQL 用 doris_explain_query(format=graph 看执行图),需要 profile 时用 doris_get_query_profile。

  5. 体量问题看 doris_get_table_size / doris_get_table_partitions(含数据新鲜度)。

  6. 集群与导入:doris_get_cluster_overview / doris_get_compaction_status / doris_get_ingestion_status。

  7. 不确定某个语法在 1.2 上是否可用,先调 doris_get_runtime_capabilities,不要靠猜。

本服务是只读的:只能执行 SELECT / SHOW / DESC / EXPLAIN / WITH,没有任何写工具。 需要改注释、建表等写操作,请在 Doris 侧用别的客户端执行。

Doris 1.2 限制(写成 2.0+ 语法会报错):

  • SHOW FRONTENDS 取 FE;SHOW PROC '/frontends' 在部分实例上很慢(十几秒),别用它

  • BE 信息用 information_schema.backends(列名是 IP)

  • 没有 information_schema.active_queries、__internal_schema.audit_log、mv_infos()、SHOW WORKLOAD GROUPS

  • 没有 SHOW GLOBAL FUNCTIONS,UDF 用 SHOW FUNCTIONS

  • SHOW DATA 必须先选库;SHOW DATA FROM db 报 unknown table

  • 没有倒排索引 / ANN / Variant / BM25

  • 并行度变量是 parallel_fragment_exec_instance_num,不是 parallel_pipeline_task_num

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}

Tools

Functions exposed to the LLM to take actions

NameDescription
doris_pingA

检查连通性并返回 Doris 版本、默认库、服务器时间与结果限制。连通性排查的第一步。

doris_list_databasesA

列出数据库,分页返回。

    internal:走 information_schema.schemata(1.2 的 SHOW DATABASES 不支持 LIMIT,
    这里在服务端分页);指定其他 catalog 时用 SHOW DATABASES FROM,取回后本地切页。

    返回:{ok, total, count, offset, limit, items[{name}], has_more, next_offset, source}
    
doris_list_catalogsA

列出 catalog(SHOW CATALOGS,1.2 可用,4 列)。

doris_list_tablesA

列出某个库下的表,分页返回,并区分表与视图。

    internal:走 information_schema.tables(1.2 的 SHOW TABLES 不支持 LIMIT),
    WHERE TABLE_SCHEMA + 可选 LIKE 在服务端过滤;其他 catalog 用 SHOW TABLES FROM,
    取回后本地切页。

    返回:{ok, total, count, offset, limit, items[{name, type}], has_more, next_offset, source}
    
doris_describe_tableA

查看表结构:字段名、类型、是否可空、是否 key 列、默认值、Extra(聚合类型等)、注释。 注释取自 SHOW FULL COLUMNS —— 1.2 上最完整的列元数据来源。 include_basic 用 SHOW TABLE STATUS 补引擎/行数/创建时间(官方 get_table_context 的 basic 段)。

doris_get_table_sizeA

看表/库的数据量。不传 table:SHOW DATA(必须先选库,返回每表 Size + ReplicaCount)。 传 table:SHOW PARTITIONS 汇总 DataSize,给出总字节数与分区数。

doris_get_table_partitionsA

看分区清单与数据新鲜度(SHOW PARTITIONS,17 列)。 VisibleVersionTime 是分区最新可见版本时间,用它算滞后(官方 monitor_data_freshness)。

doris_inspect_external_catalogA

浏览 catalog:只传 catalog 时列库(SHOW DATABASES FROM c); 带 database 时列表(SHOW TABLES FROM c.db)。

doris_execute_queryA

执行只读 SQL 并返回列与行。非 SELECT/SHOW/DESC/EXPLAIN/WITH 一律拒绝, 本服务没有任何写通道。结果超出 max_rows 时 truncated=true。

doris_explain_queryA

看执行计划:EXPLAIN / EXPLAIN VERBOSE / EXPLAIN GRAPH。 graph 输出 ASCII 执行图,排查 join/scan 分布最直观(1.2 实测可用)。

doris_get_query_profileA

取某个查询的 profile(SHOW QUERY PROFILE "/id")。只对执行过的 query id 有效, 取不到时 Doris 返回 1105 not found。

doris_get_cluster_overviewA

集群概览:FE 节点(SHOW FRONTENDS)、BE 节点(information_schema.backends)、 库表统计(SHOW PROC '/statistic')、库容量(SHOW PROC '/dbs')。 FE 查询给短超时,取不到就降级为只给 BE,不阻塞整体返回。

doris_get_compaction_statusA

排查 compaction 落后:按 tablet 统计 rowset(版本)数量(information_schema.rowsets)。 单个 tablet 的 rowset 数持续偏高说明 compaction 跟不上写入。

doris_list_active_tasksA

当前正在执行的查询(SHOW PROC '/current_queries',7 列)。空结果表示当前无活跃查询。

doris_get_runtime_capabilitiesA

返回当前实例的能力矩阵(1.2 实测结论):哪些语法可用、哪些会挂死或不存在。 写 SQL 前先查一次,能避免用 2.0+ 语法踩坑。probe=true 时附带实时抽查结果。

doris_get_ingestion_statusB

导入任务状态:SHOW LOAD(17 列,Broker/Routine 一次性导入)与 SHOW ROUTINE LOAD(19 列,常驻例行导入)。默认两类都给。

doris_list_udfsA

列出 UDF,分页返回。

    SHOW FUNCTIONS 在 1.2 不支持 LIMIT,也不支持 SHOW GLOBAL FUNCTIONS(语法错误),
    且要求连接已选库;因此取回后在本地切页(UDF 数量有限,代价可忽略)。

    返回:{ok, total, count, offset, limit, items[{name}], has_more, next_offset}
    

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

A3.8/5.0

Scored across 17 tools

Disambiguation4/5

Most tools target a distinct resource: catalog/db/table metadata, query execution, monitoring, ingestion status. However doris_inspect_external_catalog overlaps with doris_list_databases and doris_list_tables (it lists dbs when given a catalog, tables when given a db), and doris_get_table_size without a table also returns per-table sizes like SHOW DATA, so an agent could reasonably pick the wrong one. Descriptions help but the boundaries are not fully crisp.

Naming Consistency5/5

Every tool uses the doris_ prefix plus a consistent verb_noun pattern (list_databases, get_table_size, describe_table, execute_query, explain_query), with only doris_ping as a conventional noun-only exception. No mixed casing or verb-style drift.

Tool Count4/5

17 tools is on the high side, but each covers a distinct Doris administration surface (metadata, query profiling, ingestion, cluster health, compaction). No obvious filler tools, though a couple of metadata tools could plausibly be merged.

Completeness4/5

Strong coverage for a deliberately read-only server: connectivity/capability probing, catalog-db-table-column metadata, sizes and partitions, query execution/explain/profile, active tasks, ingestion, cluster and compaction health. Notable gaps are operational actions like killing a runaway query, session variable inspection, and user/permission metadata.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues