Skip to main content

hex-mcp

An MIT-licensed MCP server generated from the official Hex public API specification.

The server loads Hex's current OpenAPI document at startup and exposes its operations as deterministic, snake_case MCP tools through FastMCP.

The PyPI distribution and installed command are named hex-openapi-mcp. The shorter hex-mcp command remains available, and the Python import is hex_mcp.

Capability modes

  • read-only exposes only operations classified as non-mutating, regardless of the configured Hex token's permissions.
  • full exposes the complete official API surface.

read-only is the default. It registers GET operations and the non-mutating export_project POST operation. Mutating tools do not exist in the MCP catalog in this mode, even when HEX_API_TOKEN has write permissions.

Install

Requirements: Python 3.12 or newer and uv.

Run the server directly from PyPI:

HEX_API_TOKEN=your_hex_token uvx hex-openapi-mcp

Enable the complete API surface explicitly:

HEX_API_TOKEN=your_hex_token HEX_MCP_MODE=full uvx hex-openapi-mcp

The default transport is stdio. To run Streamable HTTP:

HEX_API_TOKEN=your_hex_token HEX_TRANSPORT=http uvx hex-openapi-mcp

It listens on http://127.0.0.1:8000/mcp by default.

Run from source

Requirements: Python 3.12 or newer and uv.

uv sync --locked --dev
HEX_API_TOKEN=your_hex_token uv run hex-openapi-mcp

MCP client configuration

From PyPI:

{
  "mcpServers": {
    "hex": {
      "command": "uvx",
      "args": ["hex-openapi-mcp"],
      "env": {
        "HEX_API_TOKEN": "your_hex_token",
        "HEX_MCP_MODE": "read-only"
      }
    }
  }
}

For a local checkout, use "command": "uv" with "args": ["--directory", "/absolute/path/to/hex-mcp", "run", "hex-openapi-mcp"].

For stdio, the MCP client passes HEX_API_TOKEN only to the child process. Do not put the token in command-line arguments.

Configuration

Variable Default Purpose
HEX_API_TOKEN Required Hex personal or workspace bearer token
HEX_MCP_MODE read-only read-only or full tool catalog
HEX_API_BASE_URL https://app.hex.tech/api Hex API base URL
HEX_OPENAPI_SPEC https://static.hex.site/openapi.json Official spec URL or a local JSON file
HEX_TRANSPORT stdio stdio or http
HEX_HTTP_HOST 127.0.0.1 Streamable HTTP bind host
HEX_HTTP_PORT 8000 Streamable HTTP bind port
HEX_HTTP_PATH /mcp Streamable HTTP endpoint path
HEX_REQUEST_TIMEOUT_SECONDS 30 Spec download and Hex API timeout

Development

uv run ruff format --check .
uv run ruff check .
uv run mypy
uv run pytest

The repository does not vendor Hex's specification. Contract behavior can be tested offline by setting HEX_OPENAPI_SPEC to an independently supplied local copy.

Safety and reliability

  • Every tool has MCP read-only, destructive, idempotent, and open-world annotations derived from its official operation and HTTP method.
  • Tool results and Hex error bodies recursively redact known credential fields and Hex bearer tokens before they reach MCP output or error logging.
  • Hex HTTP errors preserve the status, reason, and trace ID in a structured MCP error without exposing internal stack traces.
  • GET requests retry transient 429, 502, 503, and 504 responses up to twice, respect Retry-After, and use bounded exponential backoff. Write requests are never retried automatically.

Hex's specification currently publishes two semantic paths with backend regex syntax as literal OpenAPI paths. Those literals return 404, while both expanded routes exist. The loader normalizes them to the current /v1/semantic-projects/... naming before generating tools while retaining the original specification digest for observability.

Streamable HTTP currently uses the single server-wide HEX_API_TOKEN and has no inbound client authentication. Keep the default loopback bind unless access is protected by a trusted authentication proxy.

Design documents

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hex_openapi_mcp-0.1.1.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hex_openapi_mcp-0.1.1-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file hex_openapi_mcp-0.1.1.tar.gz.

File metadata

  • Download URL: hex_openapi_mcp-0.1.1.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for hex_openapi_mcp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7a6df7c93c628cb532d9941fa0d34639e86194249d6737f316637684f2d61a41
MD5 ead5bef4b55a90c19853220b52dac6ff
BLAKE2b-256 3dbc9a9d2f78a8e846ba94ad4fc0dbd2d45d428174f12f046d46f7bb20726f7c

See more details on using hashes here.

File details

Details for the file hex_openapi_mcp-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: hex_openapi_mcp-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for hex_openapi_mcp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 92db9d4c35814a6c49c075a4e6ab4233ce72fb79624977d4a83b2b0c664be29c
MD5 63da4a775f3387393c7326393570b69a
BLAKE2b-256 7fcce424d9493f53ce20b05c750db0b7245fa6067e4f485695ada0575fa41c23

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.0

2 files

This release

0.1.1 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page