@hitl-sh/core
v0.3.1
Published
HITL (Human In The Loop) shared core: typed client for the public API, MCP tool definitions, and the Workflow Live protocol
Maintainers
Readme
The building blocks of the HITL CLI and MCP servers, for your own code. A typed client
for the HITL public API, and the same MCP tools that @hitl-sh/mcp and mcp.hitl.sh serve.
Want a command or a ready-made server instead? Use @hitl-sh/cli
or @hitl-sh/mcp.
Run a workflow from TypeScript
import { HitlClient, WORKFLOW_ROUTES } from "@hitl-sh/core";
const hitl = new HitlClient(process.env.HITL_API_KEY!); // key from https://my.hitl.sh/settings
const route = (tool: string) => WORKFLOW_ROUTES.find((r) => r.tool === tool)!;
const { data: run } = await hitl.call<{ id: string }>(route("run_workflow"), {
path: { id: "<workflow-id>" },
body: { input: { amount: 1200 } },
});
// Waits up to 60 s per call; repeat until finished
const { data: done } = await hitl.call(route("get_execution"), { path: { id: run.id }, query: { wait: 60 } });Every route of the API is declared once in WORKFLOW_ROUTES, with its method, path, parameters and a summary.
Add the HITL tools to your MCP server
import { registerHitlTools, HitlClient } from "@hitl-sh/core";
registerHitlTools(server, { getClient: () => new HitlClient(process.env.HITL_API_KEY!) });getClient runs for every call, so a hosted server can use each user's own key. Or start the stdio server:
startStdioMcpServer({ apiKey }).
Modules
| Import | What |
|---|---|
| @hitl-sh/core/client | HitlClient. The key is only ever sent to hitl.sh hosts |
| @hitl-sh/core/api-catalog | WORKFLOW_ROUTES, every route of the public API |
| @hitl-sh/core/mcp-tools | registerHitlTools, the 28 workflow tools |
| @hitl-sh/core/mcp-stdio | startStdioMcpServer, the server behind hitl mcp |
| @hitl-sh/core/request-source | Turns an MCP client name into the "From Claude Code" reviewers see |
| @hitl-sh/core/protocol, /token, /graph | Workflow Live, used by the editor's Connect Claude |
Node 20 or newer · Docs · MIT
