Apache Hive MCP Server
Apache Hive MCP Server
一个针对 Apache Hive(HiveServer2)编写的 MCP 服务器,基于 FastMCP 构建。可以连接任何与 HiveServer2 兼容的端点 — 开源 Apache Hive、Cloudera CDP Base 或 Cloudera CDP Public Cloud(CDW)— 并暴露两个 LLM 智能体可调用的只读工具。
项目摘要
是什么 — 一个 Model Context Protocol 服务器,允许 LLM 智能体查询 Apache Hive:列出表并运行只读 SQL,结果以 JSON 形式返回。
功能对齐 — 与 Cloudera 的 Impala/Iceberg MCP server 一致:相同的
execute_query+get_schema工具与结构,连接层通过impyla切换到 HiveServer2。在 HiveServer2 支持的所有环境中可用 — 开源 Apache Hive、CDP Base(Kerberos/LDAP)、CDP Public Cloud / CDW(Knox、LDAP over HTTPS)。认证、传输和 TLS 均由
HIVE_*环境变量驱动。默认安全 —
execute_query强制执行只读前缀检查(SELECT/SHOW/DESCRIBE/WTH);写入/DDL 语句将在建立连接前被拒绝。传输方式 —
transstdio(默认)、http或sse,通过MCP_TRANSPORT选择。技术栈 — Python ≥3.11、FastMCP、
impyla、uv。11 个单元测试(连接层为 mock — 无需真实 Hive)。
Related MCP server: Cloudera Iceberg MCP Server
工具
工具 | 签名 | 描述 |
|
| 执行只读 SQL 查询(SELECT、SHOW、DESCRIBE、WITH),并将结果以按列名索引的对象组成的 JSON 数组返回。写入操作会被拒绝并返回错误字符串。 |
|
| 对已配置的数据库运行 |
配置
所有配置均通过环境变量(或项目根目录下的 .env 文件)完成。
变量 | 默认值 | 描述 |
|
| HiveServer2 主机名或 IP |
|
| HiveServer2 thrift 端口 |
|
| 要连接的数据库 |
| (空) | 用户名(使用 NOSASL/Kerberos 用例时留空) |
| (空) | 密码(与 PLAIN/LDAP 一起使用) |
|
| 认证方式: |
|
| 使用 HTTP 传输而非二进制 thrift |
|
| 当 |
|
| 为 thrift 连接启用 TLS |
|
| Kerberos 服务主体名称(仅限 |
|
| MCP 传输方式: |
将 .env.example 复制为 .env,然后填入你自己的值。
部署预设
分本地/开发环境(Docker HiveServer2)
HIVE_HOST=localhost
HIVE_PORT=10000
HIVE_DATABASE=default
HIVE_AUTH_MECHANISM=NOSASL
MCP_TRANSPORT=stdioCDP Public Cloud(CDW 虚拟仓库)
HIVE_HOST=<coordinator-hostname>.dw.cloudera.site
HIVE_PORT=443
HIVE_DATABASE=default
HIVE_USER=<workload-username>
HIVE_PASSWORD=<workload-password>
HIVE_AUTH_MECHANISM=LDAP
HIVE_USE_HTTP_TRANSPORT=true
HIVE_HTTP_PATH=cliservice
HIVE_USE_SSL=true
MCP_TRANSPORT=stdioCDP Base / 部署环境(Kerberos)
HIVE_HOST=<hiveserver2-host.example.com>
HIVE_PORT=10000
HIVE_DATABASE=default
HIVE_AUTH_MECHANISM=GSSAPI
HIVE_KERBEROS_SERVICE_NAME=hive
MCP_TRANSPORT=stdio启动服务器前,请先通过
kinit获取 Kerberos 票据。
运行
# Install
pip install -e .
# or with uv:
uv sync
# Copy and edit config
cp .env.example .env
# Start (stdio transport, for use with an MCP host)
uv run hive-mcp-serverMCP 客户端配置
MCP 客户端(如 Claude Desktop、Cloudera AI Agent Studio 等)使用 mcpServers JSON 块注册服务器。uvx 直接从 GitHub 运行本服务器 — 无需本地安装,也无需发布到 PyPI。请填入你的环境中所需的 HIVE_* 值(参见配置和上方预设)。
{
"mcpServers": {
"Hive": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/avelloal/hive-mcp-server@v0.1.0",
"hive-mcp-server"
],
"env": {
"HIVE_HOST": "<coordinator-hostname>.dw.cloudera.site",
"HIVE_PORT": "443",
"HIVE_DATABASE": "default",
"HIVE_USER": "<workload-username>",
"HIVE_PASSWORD": "<workload-password>",
"HIVE_AUTH_MECHANISM": "LDAP",
"HIVE_USE_HTTP_TRANSPORT": "true",
"HIVE_HTTP_PATH": "cliservice",
"HIVE_USE_SSL": "true"
}
}
}
}上面的示例面向 CDP Public Cloud / CDW。对于本地或 Kerberos 部署,请将 env 值替换为上方预设中的值。@v0.1.0 固定了版本 — 去除可跟踪最新版本,或更换更新版本。
针对 Cloudera AI Agent Studio 的特殊说明(注册步骤、环境变量处理、stdio/uvx 的局限),请参见 examples/agent-studio/。
冒烟测试
启动本地 HiveServer2(例如,使用 Apache Hive Docker 镜像):
docker run -d -p 10000:10000 apache/hive:3.1.3使用上方本地配置
.env。启动服务器:
uv run hive-mcp-server在第二个终端中,使用
fastmcp开发检查器或任何 MCP 客户端调用两个工具:get_schema()— 应返回[]或表名列表。execute_query("SHOW DATABASES")— 应返回一个数据库名组成的 JSON 数组。
许可证
Apache License 2.0 — 参见 LICENSE。
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Tools
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables read-only access to Apache Iceberg tables via Impala, allowing LLMs to inspect database schemas and execute SQL queries to retrieve data from Iceberg tables.213Apache 2.0
- AlicenseNot gradedqualityDmaintenanceProvides read-only access to Iceberg tables via Apache Impala, enabling LLMs to inspect database schemas and execute SQL queries on Iceberg data.Apache 2.0
- AlicenseAqualityDmaintenanceEnables AI assistants to interact with Hadoop Hue for executing SQL queries using Hive, SparkSQL, or Impala and managing HDFS files. It supports directory browsing, file transfers, and exporting query results to CSV through the Model Context Protocol.81MIT
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to query and explore schemas in Microsoft Fabric lakehouses, warehouses, and SQL databases using natural language, with tools for executing read-only SQL queries and searching tables, columns, and query patterns.3MIT
Related MCP Connectors
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
Gateway between LLM agents and world data through eight tools and a bundled endpoint catalog.
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
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/avelloal/hive-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server