hatchet-ops-mcp

hatchet-ops-mcp

A read-only MCP server that exposes Hatchet client / REST observability APIs to coding agents across multiple environments from one process.

Category
访问服务器

README

hatchet-ops-mcp

A small, read-only MCP server that exposes Hatchet client / REST observability APIs to coding agents — across multiple environments from one process.

Hatchet itself does not ship an official ops MCP. This project is a thin wrapper around the official Python hatchet-sdk: each tool call picks an env, resolves that environment's Hatchet JWT from envs.yaml, uses a cached Hatchet client, and returns the SDK response as structured MCP output.

The default transport is local stdio (no host / API key). For a shared process on a trusted network, streamable HTTP (and legacy SSE) are also available.

Why this exists

Hatchet's official agent integrations today are mainly docs MCP, CLI skills, and SDK helpers that turn your workflows/tasks into agent tools. None of those is a multi-tenant ops console for listing runs, workers, and queue metrics.

This server fills that gap by mapping read-only hatchet-sdk feature clients (workflows, runs, workers, metrics, logs, …) to MCP tools, with one extra capability: explicit env routing so one MCP process can talk to several Hatchet tenants/instances.

Requirements

  • Python 3.12 or newer
  • uv
  • A Hatchet API token (JWT) for each environment you want to query
  • Docker and Docker Compose (optional, for HTTP deployment)

Setup

git clone <repository-url>
cd hatchet-ops-mcp
cp envs.example.yaml envs.yaml
uv sync

Edit envs.yaml. Each environment has its own Hatchet JWT (token). Entries left as TODO remain visible in list_envs, but cannot be queried until a token is provided.

envs:
  development:
    description: "Development"
    token: "eyJ..."   # Hatchet API JWT for this env
    server_url: "http://localhost:8080"
    tls_strategy: "none"

  production:
    description: "Production"
    token: "TODO"
    server_url: "https://hatchet.example.com"

server_url and tls_strategy are optional. When server_url is omitted, Hatchet resolves it from the JWT.

Note: envs.yaml token is the Hatchet credential. The MCP HTTP Bearer key is separate: set HATCHET_OPS_MCP_API_KEY (only needed for streamable-http / sse).

Local use (stdio)

This is the usual path for Cursor / Claude Code on your laptop — no bind address, no API key:

uv run hatchet-ops-mcp

Set HATCHET_OPS_MCP_ENVS when the config is outside the current checkout:

HATCHET_OPS_MCP_ENVS=/absolute/path/to/envs.yaml uv run hatchet-ops-mcp

MCP client configuration:

{
  "mcpServers": {
    "hatchet-ops": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/hatchet-ops-mcp",
        "run",
        "hatchet-ops-mcp"
      ],
      "env": {
        "HATCHET_OPS_MCP_ENVS": "/absolute/path/to/hatchet-ops-mcp/envs.yaml"
      }
    }
  }
}

Shared HTTP (trusted network)

For one process that several clients hit on a LAN / VPN. Auth is a single shared Bearer API key checked by middleware — not OAuth.

HTTP refuses to start without an API key unless you pass --allow-insecure (trusted network only). Default bind is 127.0.0.1; only override --host when something other than this machine must connect (Docker Compose already sets 0.0.0.0).

export HATCHET_OPS_MCP_API_KEY='replace-with-a-strong-random-value'

uv run hatchet-ops-mcp --transport streamable-http
# optional: --port 8765
# Docker / LAN only: --host 0.0.0.0

Endpoints: /mcp (MCP), /health (no auth).

Docker Compose mounts local envs.yaml and binds 0.0.0.0 for you:

export HATCHET_OPS_MCP_API_KEY='replace-with-a-strong-random-value'
docker compose up --build

Remote MCP client example:

{
  "mcpServers": {
    "hatchet-ops": {
      "url": "http://hatchet-ops.internal:8765/mcp",
      "headers": {
        "Authorization": "Bearer replace-with-the-shared-api-key"
      }
    }
  }
}
Environment variable Purpose
HATCHET_OPS_MCP_ENVS Path to envs.yaml
HATCHET_OPS_MCP_TRANSPORT stdio (default), streamable-http, or sse
HATCHET_OPS_MCP_PORT HTTP port (default 8765)
HATCHET_OPS_MCP_HOST HTTP bind address (default 127.0.0.1; Docker uses 0.0.0.0)
HATCHET_OPS_MCP_API_KEY Shared Bearer key for MCP HTTP (not a Hatchet JWT)
HATCHET_OPS_MCP_ALLOW_INSECURE Allow HTTP with no API key

Tools

Tool Purpose
list_envs List environment names and configuration status without secrets
list_workflows List workflow definitions (optional workflow_name filter)
get_workflow Get one workflow definition by ID
list_runs List recent workflow or task runs (status / name / metadata / worker filters)
get_run Get one workflow run (status, tasks; payloads opt-in)
get_run_events Get lifecycle events for one workflow run
get_run_logs Get logs for one task or merged logs for a whole workflow run
list_workers List workers and their status
get_worker Get one worker by ID
get_queue_metrics Inspect current queue backlog depth
get_task_metrics Task counts by status over a time window
get_task_stats Per-task-name statistics for the tenant

All tools except list_envs require env.

Debug playbook

Typical failed / stuck run investigation:

  1. list_runs with statuses, workflow_name (exact name), and/or additional_metadata
  2. get_run for status and per-task summaries (include_payloads=true for I/O)
  3. get_run_events for QUEUED / STARTED / FAILED / CANCELLED timeline
  4. get_run_logs with workflow_run_id for merged application logs (newest lines kept)
  5. If stuck QUEUED: list_workers / get_worker
  6. For environment health: get_queue_metrics, get_task_metrics, get_task_stats

list_runs / get_run omit payloads by default. include_payloads=true on list_runs also disables minimal_output.

Security

  • envs.yaml is ignored by Git. Never commit real Hatchet tokens.
  • Prefer stdio on developer machines; treat shared HTTP as an internal service.
  • HTTP refuses to start without a Bearer API key unless --allow-insecure is set.
  • Prefer read-only Hatchet tokens when the deployment supports scoped tokens.
  • Tool results may contain workflow inputs, outputs, errors, or logs. Treat MCP output according to the sensitivity of the underlying environment.
  • The server intentionally exposes no mutating Hatchet operations.

Development

uv sync
uv run pytest
uv build

License

MIT

推荐服务器

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

官方
精选