Skip to main content
Glama
avelloal

Apache Hive MCP Server

by avelloal

Apache Hive MCP Server

MCP-сервер для Apache Hive (HiveServer2), созданный на базе FastMCP. Подключается к любой совместимой с HiveServer2 конечной точке — Apache Hive с откryтым исходным кодом, Cloudera CDP Base вл Cloudera CDP Public Cloud (CDW) — и предоставляет два инструмента, доступных только для чтения, которые может вызывать агент LLM.


Краткое описание проекта

  • Что это — сервер Model Context Protocol, который позволяет агенту LLM запрашивать Apache Hive: получает список таблиц and выполнять SQL-запросы только для чтения, результаты возвращаются в видим JSON.

  • Паритет функционала — повторяет функционал MCP-сервера Cloudera Impala/Iceberg MCP server: те же инструменты execute_query + get_schema, та же структура; слой подключения заменён на HiveServer2 через impyla.

  • Работает везде, где рабетает HiveServer2 — Apache Hive с открытым исходнным кодом, CDP Base (Kerberos/LDAP) и CDP Public Cloud / CDW Regist (Knox, LDAP через HTTPS). Аутентификация, транспорт и TLS полность настраиваются через перемененные окружения HIVE_*.

  • Безопасность по умолчанию — execute_query проверяет префикс запроса: разрешает только чтение (SELECT/SHOW/DESCRIBLE/WITH); запросы на запis/DDL отклоняются до открития соединения.

  • Транспорт — stdio (по умолчанию), http или sse; выбيرается из MCP_TRANSPORT.

  • Технологический стек — Python ≥3.10, FastMP, fastmcp), impyla, uv. 11 unit-тестов (соединение мокнуто — живой Hive не трбуется).



Related MCP server: impala-mcp-server

Инструменты

Инструмент

Сигнатура

Описание

execute_query

execute_query(query: str) -> str

Выполняет SQL-запрос только для чтения (SELECT, SHOW, DESCRIBLE, WITH) and возвращает результаты в видим JSON-массива объект, ключи которых соответствут колонкам. Операции записи отклоняются с возвтротом строки ошибки.

get_schema

get_schema() -> str

Выполняет SHOW TABLES в настроенной базе данных, и возвращает список таблиц в видим JSON-массива строк.


Конфигурация

Все настройки конфигурации задаются переменными окружения (или файлом .env в корне проекта).

Переменная

По умолчанию

Описание

HIVE_HOST

localhost

Имя хоста или IP-press HiveServer2

HIVE_PORT

10000

Торthrift HiveServer2

HIVE_DASABASE

default

База данных, For, подключения

HIVE_USER

(пустое)

Имя пользователя (оставте пустым для NOSASL/keros)

HIVE_PASSASPORD

* (пустое)*

Пароль (используется с PLAIN/LDC)

HIVE_AUTH_MECHANISM

PLAIN

Метод аутentification: NOSASL, PLAIN, LDAP,GSSAPI`

HIVE_USE_HTTP_TRANS_PORT

false

Использовать HTTP-транспорт вместо бинарного thrift

HIVE_HTTP_PATH

cliservice

HTTP-путь for gateway when HIVE_USE_HTTP_TRANSPORT=true

HIVE_USE_SSL

(empty)x

Включить TLS для thrift-соединения

HIVE_KERBEROS_SERVICE_NAME

hю

Имя основного сервиспринципала Kerberos (only GSSAPI)

MCP_TRANSPORT

стдо

MCP-транспорт: stdio, http или sse

Скопируйте .env.example в .env в и заполните себя значения.


Пресеты развёртывания

Локальный окруж / разработки (Docker HiveServer2)

HIVE_HOST=localhost
HIVE_PORT=10000
HIVE_DATABASE=default
HIVE_AUTH_MECHANISM=NOSASL
MCP_TRANSPORT=stdio

Cloudera CDP Public Cloud (CDW Virtual Warehouse)

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=stdio

CDP Base / on-premises with Kerberos (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

Получите билет Kerberos (kinit) до того, как запустите сервер.


Запуск

# 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-server

Hасстрой MCP-клиент

MCP-хосты (Claude Desktop, Cloudera AI Agent Studio и т.д.) регистрируют серверы в JSON-блоке mcpServers. uvx запускает ceотр вер прямо из 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 фиксирует конкретную версию — удалите этот тег, чтобы отслеживать последнюю версию, либо поднимите его для новой.

Для Claude AI Agent Studio — отдельно (шаги регистрации, работa с переменные окружения, ограничения stdio/uvx) см. examples/agent-studio/.


Дымовой тест

  1. Запустите локальный HiveServer2 (например, Docker-образ Apache Hive):

    docker run -d -p 10000:10000 apache/hive:3.1.3
  2. Настройите .env по локальному пресету выше.

  3. Запустите сервер:

    uv run hive-mcp-server
  4. Во втором термине используйте dev-инспектор fastmcp или любой MCP-клиент, чтобы вызвать оба инструмента:

    • get_schema() — должен вернуть [] или список имён таблиц.

    • execute_query("SHOW DATABASES") — должен вернуть JSON-массив баз данных.


Лицензия

Apache License 2.0 — см. LICENSE.

Available Tools

2 tools
execute_queryA

Execute a read-only SQL query on Hive and return results as JSON.

NameRequiredDescriptionDefault
queryYes

Output Schema

NameRequiredDescription
resultYes

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full behavioral burden. It usefully discloses that the tool is read-only and returns JSON, which are meaningful safety and output traits. However, it doesn't explain error behavior, query size limits, permission expectations, or how results are shaped.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single sentence that front-loads the action, target, and output format. There is no wasted or redundant phrasing; every clause adds information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter tool with an output schema present, the description covers the essential usage context: the action, the data source, the read-only safety property, and the return format. It could add routing to get_schema, but the core invocation context is adequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must carry parameter semantics. 'SQL query on Hive' clarifies that the query parameter should be a Hive SQL string, which adds meaning beyond the schema's bare 'query' field. But the description never mentions the parameter by name or provides syntax, limits, or examples.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb ('Execute') and resource ('SQL query on Hive'), and also names the output format ('results as JSON'). It clearly distinguishes this tool from the sibling get_schema, which is about schema retrieval rather than running queries.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no explicit guidance about when to use this tool versus get_schema, or when not to use it. The 'read-only' qualifier is a constraint, but it doesn't describe alternatives or usage scenarios beyond what the description literally states.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_schemaA

List the table names in the current Hive database.

NameRequiredDescriptionDefault

No parameters

Output Schema

NameRequiredDescription
resultYes

TDQS

A4.1/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the disclosure burden. It communicates a read-only, list-style behavior and the scope to the current Hive database, but it does not mention return format, potential limitations, or side effects. For such a simple zero-parameter read operation, this is adequate but not richly transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single-front-loaded sentence communicates the core action and target resource with no superfluous words. Every part of the description adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has no parameters and an output schema is provided, so the description only needs to specify what is listed and in what context. The single sentence fully covers that for a minimal introspection operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The parameter count is 0, so there is no semantic burden on the description. The description accurately describes what the tool will produce, and no parameter-related information is required beyond the schema's empty object.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('List'), identifies the exact resource ('table names'), and scopes it to the 'current Hive database.' This clearly distinguishes it from the sibling tool execute_query, which focuses on running queries rather than returning schema metadata.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description makes the tool's purpose obvious: use it when you need the list of table names in the current Hive database. However, it does not explicitly contrast this with execute_query or state when to prefer one over the other, leaving the routing decision somewhat implied.

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.

  1. 2 tool updatesv0.1.0
    • First observedexecute_query
    • First observedget_schema

TDQS

A3.9/5.0

Scored across 2 tools

Disambiguation5/5

The two tools have clearly distinct purposes: one executes SQL queries, the other lists table names. There is no overlap or ambiguity between them.

Naming Consistency5/5

Both tool names follow a consistent snake_case verb_noun pattern: execute_query and get_schema. The naming is predictable and easy to extend.

Tool Count3/5

Two tools is on the thin side for a full Apache Hive server, though the set is minimal and comprehensible. It feels borderline but not absurdly incomplete.

Completeness3/5

The set covers basic querying and table listing, but lacks explicit schema/column detail, database selection, and non-query operations. An agent can partially work around this via execute_query, but there are notable gaps.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    A
    quality
    D
    maintenance
    Enables LLM agents to query and explore Cloudera Hive virtual warehouses through tools like list_databases, list_tables, describe_table, get_table_sample, and execute_query with read-only safety.
    5
    -
  • A
    license
    A
    quality
    C
    maintenance
    Enables AI agents to safely query and explore Apache Impala clusters with read-only SQL, metadata, statistics, cluster overview, and analysis prompt templates.
    17
    Apache 2.0