AP

Apache Gravitino MCP Server for LLM Data Governance

Enable LLMs to explore metadata and perform tagging and classification with the Apache Gravitino MCP server for data governance.

Quick Install
npx -y @datastrato/mcp-server-gravitino

Overview

The Apache Gravitino MCP Server implements the Model Context Protocol (MCP) for Apache Gravitino metadata stores so large language models (LLMs) can discover, tag, and classify data objects as part of data governance workflows. It wraps a curated subset of Gravitino APIs behind a FastMCP-compatible endpoint, returning compact, LLM-friendly metadata payloads that are optimized for token budgets and semantic clarity.

This server is useful when you want LLM agents or applications to explore catalogs, schemas, tables, models, tags, and user-role information without exposing the full Gravitino API surface. It supports token- and basic-auth methods, configurable tool activation, and simple integration using the uv runtime toolchain.

Features

  • FastMCP-compatible MCP server that exposes Gravitino metadata to LLMs
  • Compact, semantic responses designed to fit LLM token constraints
  • Toolset covering catalogs, schemas, tables, models, tags, and user/role management
  • Support for token (JWT) and basic (username/password) authentication
  • Selective tool activation via environment variable
  • Easy runtime using uv with optional injection of runtime dependencies

Installation / Configuration

Prerequisites: Python 3.10+, and the uv CLI tool for dependency/venv management.

Clone and prepare the project:

git clone [email protected]:datastrato/mcp-server-gravitino.git
cd mcp-server-gravitino
uv venv
source .venv/bin/activate
uv install

Minimum environment variables (required):

export GRAVITINO_URI="http://<gravitino-host>:<port>"
export GRAVITINO_METALAKE="metalake_demo"

Authentication options

  • Token (JWT):
export GRAVITINO_JWT_TOKEN="<your_jwt_token>"
  • Basic auth:
export GRAVITINO_USERNAME="admin"
export GRAVITINO_PASSWORD="secret"

Selectively enable tools (default: all):

# Activate only get_list_of_roles
export GRAVITINO_ACTIVE_TOOLS="get_list_of_roles"

Start the MCP server via uv (example):

uv \
  --directory /path/to/mcp-server-gravitino \
  run \
  --with fastmcp \
  --with httpx \
  --with mcp-server-gravitino \
  python -m mcp_server_gravitino.server

Arguments explained:

Example Goose client snippet (JSON):

{
  "mcpServers": {
    "Gravitino": {
      "command": "uv",
      "args": ["--directory","/path/to/mcp-server-gravitino","run","--with","fastmcp","--with","httpx","--with","mcp-server-gravitino","python","-m","mcp_server_gravitino.server"],
      "env": {
        "GRAVITINO_URI": "http://localhost:8090",
        "GRAVITINO_USERNAME": "admin",
        "GRAVITINO_PASSWORD": "admin",
        "GRAVITINO_METALAKE": "metalake_demo"
      }
    }
  }
}

Available Tools

The server intentionally exposes a curated set of tools focused on metadata discovery, tagging, and user/role operations. Responses are constrained to be concise and LLM-friendly.

Table / catalog tools:

  • get_list_of_catalogs
  • get_list_of_schemas
  • get_list_of_tables (paginated)
  • get_table_by_fqn
  • get_table_columns_by_fqn

Tagging tools:

  • get_list_of_tags
  • associate_tag_to_entity (attach tag to table or column)
  • list_objects_by_tag

User & role tools:

  • get_list_of_roles
  • get_list_of_users
  • grant_role_to_user
  • revoke_role_from_user

Model tools:

  • get_list_of_models
  • get_list_of_model_versions_by_fqn

Each tool returns a minimal JSON payload intended to preserve the most relevant metadata for LLM reasoning (identifiers, brief descriptions, owner/role relations, column summaries, and tag associations).

Use Cases

  • LLM-assisted catalog exploration: An assistant can call get_list_of_catalogs and get_list_of_tables to surface candidate tables for analytics or prompt engineering, without loading entire schemas into context.
  • Auto-tagging and data classification: Use get_table_columns_by_fqn to obtain column names/types; let an LLM propose tags and then persist them via associate_tag_to_entity.
  • Role auditing and governance workflows: Retrieve users and roles; automatically detect role discrepancies and remediate by calling grant_role_to_user or revoke_role_from_user through a controlled automation flow.
  • Model inventory for MLops: Query get_list_of_models and model versions to map deployed models to dataset provenance tracked in Gravitino.
  • Agent safety and token control: Because tool responses are compact, you can safely include metadata snippets in LLM prompts while staying within token limits.

Best practices

  • Restrict GRAVITINO_ACTIVE_TOOLS to only the methods your LLM agent needs.
  • Use JWT tokens for non-interactive automated agents; use short-lived credentials where possible.
  • Validate payloads in your agent workflow and limit any downstream actions (e.g., revoking roles) behind manual approvals when necessary.

Licensing and Contributing

This implementation is distributed under the Apache License 2.0. Contributions, bug reports, and pull requests are welcome via the GitHub repository.

ArgumentPurpose
–directory /path/to/projectProject folder containing pyproject.toml
runExecute a command inside the uv-managed environment
–with Inject runtime-only dependency (fastmcp, httpx, local package)
python -m mcp_server_gravitino.serverStart the MCP server module