drill-mcp

drill-mcp

Official MCP server for Apache Drill, enabling read-only SQL queries and inspection of schemas, storage plugins, and cluster/query state.

Category
访问服务器

README

Drill-MCP Server

The official MCP server for Apache Drill. It lets an MCP client run read-only (and narrowly, explicitly allow-listed write) SQL against a Drill cluster, and inspect schemas, storage plugins, and cluster/query state. It does not implement Drill administration (ALTER SYSTEM, storage-plugin management) — see "Safety model" below.

Install

pip install drill-mcp             # REST backend
pip install drill-mcp[jdbc]       # adds the JDBC backend (needs a JVM)
pip install drill-mcp[kerberos]   # adds SPNEGO auth for the REST backend

The base install has no JVM dependency: the default REST backend talks to Drill over plain HTTP via httpx. The jdbc extra pulls in jaydebeapi/JPype1 and is only needed if you select backend: jdbc (see "Backends" below).

Quickstart

drill-mcp --url http://localhost:8047
# or
drill-mcp --config /etc/drill-mcp/drill.yaml

drill-mcp --help lists every CLI flag.

Register it with an MCP client:

{
  "mcpServers": {
    "drill": {
      "command": "drill-mcp",
      "args": ["--config", "/etc/drill-mcp/drill.yaml"]
    }
  }
}

Configuration

Configuration is merged from three sources, each overriding the last: config file → DRILL_* environment variables → CLI flags. Because the environment wins over the file, a stale exported DRILL_PASSWORD silently overrides a password: set in the config file — unset it if the file is meant to be authoritative.

There is no --user/--password CLI flag and no tool accepts a credential as an argument; user/password can only be set via the config file or DRILL_USER/DRILL_PASSWORD.

Every config key, its default, its environment variable, and its CLI flag are documented in docs/configuration.md. drill.example.yaml is a complete example file with every key present.

Tools

Tool Description
run_query Run one SQL statement
list_schemas List visible schemas
list_tables List tables in a schema
describe_table Column names, types, and nullability where the plugin reports it
list_storage_plugins Plugin configs, secrets redacted
cluster_status Drillbit membership and status
list_profiles Recent and running queries
get_profile Full profile for one query id
cancel_query Cancel a running query

list_storage_plugins, cluster_status, list_profiles, get_profile, and cancel_query are management tools: they require the REST backend and raise a clear ToolError on the JDBC backend rather than failing silently or returning empty data.

Full parameters, return shapes, errors, and per-tool surprises are in docs/tools.md.

Safety model

  • Writes are denied by default. CREATE TABLE AS, CREATE VIEW, DROP TABLE, and DROP VIEW are permitted only into plugins listed in writable_plugins. INSERT, UPDATE, DELETE, MERGE, ALTER, USE, and REFRESH are always rejected, no matter what writable_plugins contains.
  • ALTER SYSTEM and storage-plugin create/update/delete are not implemented at all. There is no flag, config key, or code path that turns them on — there is nothing for such a tool to call.
  • Exactly one statement per call, checked with a real SQL parser (sqlglot's Drill dialect), not a regex, so a write hidden in a comment, a string literal, or a stacked statement does not slip through. Anything that fails to parse — including a tokenizer failure — is rejected.
  • EXPLAIN recurses. The guard strips a leading EXPLAIN or EXPLAIN PLAN FOR and re-checks the remaining statement against the same allowlist and hidden-schema rules, with bounded recursion depth.
  • hidden_schemas filters more than schema listings. Beyond refusing queries against a hidden schema, it filters the result rows of every SHOW command (not only SHOW SCHEMAS), because Drill's SHOW grammar gives sqlglot no reliable way to identify which spelling lists schemas. This is a deliberate fail-closed trade: a table or file whose name happens to match a hidden-schema prefix is incidentally hidden too. See docs/tools.md for the full explanation. Hiding INFORMATION_SCHEMA does not break the metadata tools, which query it internally regardless and simply omit hidden entries from their output.
  • Secrets are always redacted from list_storage_plugins output. This is not configurable off.
  • Results are capped by max_rows; a caller may lower the cap for a single call but never raise it above the configured limit. A truncated result is marked "truncated": true.

Backends

  • REST (default, backend: rest): talks to a Drillbit's HTTP endpoints over httpx. Works out of the box, no JVM required.
  • JDBC (backend: jdbc, needs the jdbc extra): uses jaydebeapi/JPype1 against Drill's JDBC driver. It exists mainly because Kerberos is materially less painful through the Drill JDBC driver than through Python SPNEGO. It needs a JVM and jdbc_driver_path pointing at drill-jdbc-all.jar. Management tools are unavailable on this backend, since Drill's management API is REST-only, and run_query never returns a query_id on this backend.

Wire-level behavior — identifier quoting, INFORMATION_SCHEMA queries, and the per-plugin-type column-discovery strategy in describe_table — follows sqlalchemy-drill, the most complete and maintained reference for talking to Drill from Python. PyDrill was evaluated and not adopted: it has no form-based login, no Kerberos support, and its last release was in 2018.

Development

pip install -e ".[dev]"
pytest

The test suite needs no live Drill cluster and no JVM: Drill's wire protocol is mocked at the transport boundary, so pytest runs anywhere Python does.

Credits and license

Wire-level behavior follows sqlalchemy-drill.

Licensed under the Apache License, Version 2.0. See NOTICE.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选