hex-mcp

hex-mcp

An MCP server that exposes Hex's public API as deterministic, snake_case MCP tools, supporting read-only and full operation modes.

Category
访问服务器

README

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. It also provides a read-only helper that resolves Hex project URLs to the UUIDs required by the API.

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.

Both modes expose resolve_project_url. Agents should call it before tools requiring projectId when the user provides a Hex URL. Direct /hex/<uuid>/ URLs are parsed locally. For /app/ URLs, the compact suffix is not the API project ID, so the helper paginates through accessible projects and matches the normalized title. Duplicate titles are returned as candidates instead of being guessed.

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

  • Generated API tools have MCP read-only, destructive, idempotent, and open-world annotations derived from their official operation and HTTP method. The project URL resolver is explicitly marked read-only and idempotent.
  • 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.

The specification also applies its UUID-based ProjectId schema inconsistently. The loader normalizes all projectId inputs to the UUID contract so compact IDs from /app/ URLs are rejected before a Hex API request.

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

推荐服务器

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

官方
精选