MCP server

Let a bot ask a human through HITLy over Model Context Protocol.

The HITLy MCP server lets a bot pause and ask a person (on the HITLy inbox) for an approval or an answer, then carry on once the human has decided. It speaks Streamable HTTP MCP - async-first: every create returns immediately with state: "pending"; there is no wait or long-poll. A bot can request, read and cancel; it can never decide - decisions come only from a signed-in human in the HITLy inbox.

Endpoint and transport

https://mcp.hitly.net/mcp

The server speaks JSON-RPC 2.0 over Streamable HTTP at /mcp. If you self-host HITLy, run the @hitly/mcp app behind your own reverse proxy and substitute your host (all runtime settings are environment variables: HITLY_MCP_HOST/HITLY_MCP_PORT to listen on, HITLY_API_URL for the HITLy host API, HITLY_MCP_PUBLIC_URL for the public origin of this MCP server).

The server is stateless: it issues no Mcp-Session-Id and keeps no session between calls. Every POST carries the full JSON-RPC body and the Authorization header - there is no per-session handshake to reattach, and a server restart loses nothing. Responses are application/json. Only POST /mcp is accepted: a GET asking for text/event-stream gets 405 (there is no server-initiated SSE stream), which is why MCP clients take a callback or poll get_decision. A plain browser visit (a GET with an HTML Accept and no credentials) is redirected here, to this page. The request body is capped at 1 MiB.

Auth

Every request authenticates with a HITLy project API key in the header:

Authorization: Bearer <your-project-api-key>
  • Where to create it: open your project in the HITLy web app and copy (or create) an API key under Config in the project's settings - the same key the HTTP plugin uses for ingest. Keys start with hitly_.
  • Keep it secret. Anyone with the key can create, read and cancel your project's MCP requests. Do not commit it to a repository or embed it in client-side code; rotate it from the project settings if it leaks.
  • Scope. The key is a requester credential: it can call request_approval, ask_user, get_decision, list_pending and cancel, and only for requests that same key created - requests created with a key are readable and cancellable only with that key. It cannot decide: there is deliberately no decide tool.
  • A missing or malformed key gets 401 with a WWW-Authenticate: Bearer realm="hitly-mcp" challenge. (Resume tokens, hitly_resume_..., are a different credential and are refused here.)
  • Each key has a request-rate budget (default 120 requests per minute); exceeding it answers 429 with a Retry-After header. The budget is per process by default; set HITLY_MCP_DATABASE_URL to the app's Postgres so every MCP replica counts against one shared budget through the same rate_limit_buckets table the web app uses (keys are stored only as hashes). Tune with HITLY_MCP_RATE_LIMIT / HITLY_MCP_RATE_LIMIT_WINDOW_MS; HITLY_MCP_RATE_LIMIT=0 disables limiting.

Set up a client

Replace <mcp-host> with the host your HITLy MCP server is served on and <your-project-api-key> with your project API key. The endpoint is a Streamable HTTP MCP server; every example authenticates with Authorization: Bearer <your-project-api-key>.

Grok Bot (custom MCP connector)

A Grok Bot agent connects over Streamable HTTP by adding a custom MCP connector that points at the URL and passes the key in the header:

{
  "mcpServers": {
    "hitly": {
      "url": "https://<mcp-host>/mcp",
      "headers": { "Authorization": "Bearer <your-project-api-key>" }
    }
  }
}

When the agent calls request_approval it passes callback_url (its own agent webhook, e.g. https://example.com/hooks/hitly) and a cb_auth_token secret (see Callbacks), so it is woken when the human decides.

If the connector plugin exposes a webhook routine for waking the bot, register that URL once instead of handing the bot a secret to pass on every request:

  1. Create the webhook routine in the Grok connector plugin and copy its URL and the signing secret the platform shows you.
  2. In HITLy, open Project settings → Callbacks, paste the URL, pick the auth mode the platform shows you (Bearer token, Standard Webhooks, or GitHub X-Hub-Signature-256), paste the secret, and save. The secret is write-only: it is never displayed again, so keep the value the platform showed you. It is stored with the project's credentials — encrypted at rest on HITLy Cloud, and in the credentials column as written on the open-source edition.
  3. Tell the bot to pass that same URL as callback_url. Because the URL is registered on the project, HITLy authenticates the delivery from the registration — no cb_auth_token needed.

A callback_url that is not registered still needs cb_auth_token to arrive authenticated, and get_decision still confirms the outcome either way.

Claude Desktop / Claude Code

Claude Desktop config (claude_desktop_config.json), via the mcp-remote stdio bridge:

{
  "mcpServers": {
    "hitly": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://<mcp-host>/mcp", "--header", "Authorization: Bearer <your-project-api-key>"]
    }
  }
}

Claude Code can register the remote server directly:

claude mcp add --transport http hitly https://<mcp-host>/mcp --header "Authorization: Bearer <your-project-api-key>"

Claude Desktop builds that accept remote Streamable HTTP servers natively can use the plain url + headers form shown for Cursor instead.

Cursor

Project-level .cursor/mcp.json (or the global MCP settings):

{
  "mcpServers": {
    "hitly": {
      "url": "https://<mcp-host>/mcp",
      "headers": { "Authorization": "Bearer <your-project-api-key>" }
    }
  }
}

Protocol flow

The server speaks JSON-RPC over Streamable HTTP at /mcp. In order:

  1. initialize - POST your protocolVersion, capabilities and clientInfo; the server answers with its capabilities and instructions (the rules: pending is never approval, confirm with get_decision).
  2. tools/list - returns the tools and their input schemas.
  3. tools/call - one POST per call, e.g. {"method":"tools/call","params":{"name":"request_approval","arguments":{…}}}.

Async-first pattern

Creating never blocks:

  1. Call request_approval or ask_user - you get requestId and state: "pending" back immediately.
  2. Carry on with other work; do not busy-wait.
  3. React to the callback if you passed callback_url, or poll get_decision politely (every 30-60 s, backing off) until the deadline.
  4. Act only on what get_decision confirms. pending, expired and cancelled are never approval.

When you omit deadline, the expiry the host stores follows a fixed precedence: the matched rule's SLA first, then the project's default timeout, then the published 24 h default. An explicit deadline beats all of them and is never clamped down to the project's timeout; it must be in the future and at most 30 days out. Expiry is never approval.

Retrying a create with the same idempotencyKey returns the same request (replayed: true) instead of asking the human twice.

Tools

The server exposes exactly five tools: request_approval, ask_user, get_decision, list_pending, cancel. All tools return their result as JSON in structuredContent (mirrored in a text content block); errors come back as { "error": { "code", "message" } } with isError: true.

request_approval and ask_user share these common optional arguments:

ArgumentTypeDescription
contextstring (≤ 64 000 chars)Markdown detail shown to the reviewer.
deadlinestring (ISO 8601 date-time)When the ask expires. An explicit deadline always wins; omitted, the host falls back to the matched rule's SLA, then the project's default timeout, then 24 h. Max 30 days out.
callback_urlstring (https URL)URL HITLy POSTs the outcome to. If omitted, no callback is sent at all - poll get_decision (see Callbacks).
cb_auth_tokenstring (16-512 chars)Secret HITLy sends back on every callback so only your endpoint accepts it. Never echoed back to you.

request_approval

Ask a human to Approve, Reject or Ignore an action.

ArgumentRequiredTypeDescription
idempotencyKeyyesstring (8-200 chars, printable ASCII, no spaces)Stable key for this ask (e.g. hash of bot id, task id, action name and args). Retries return the same request.
questionyesstringOne sentence on one line, at most 160 characters, ending with ?.
actionyesobject { name, args }name: string (1-200 chars). args: object (defaults to {}) - the arguments of the action to be approved.
riskno"low" | "medium" | "high"Recorded on the request for the reviewer.
reasonRequirednoarray of "approve" | "reject" | "ignore"The reviewer must give a reason when acting with these outcomes.
linksnoarray (≤ 20) of { url, label?, mustOpen? }https links for the reviewer (label ≤ 200 chars); mustOpen gates Approve/Reject until opened. HITLy never fetches them.
common optional argumentsnosee abovecontext, deadline, callback_url, cb_auth_token.
{ "name": "request_approval", "arguments": {
    "idempotencyKey": "refund-1842-40gbp",
    "question": "Send the refund of £40 to order 1842?",
    "action": { "name": "send-refund", "args": { "orderId": "1842", "amount": 40 } },
    "risk": "high",
    "context": "Customer reported a delivery failure; policy allows refunds under £50.",
    "callback_url": "https://example.com/hooks/hitly",
    "cb_auth_token": "<your-callback-token>"
} }

Response (immediate):

{ "requestId": "<request-id>", "state": "pending", "replayed": false,
  "argsHash": "b64url-sha256-of-args", "deadline": "2026-11-11T09:00:00.000Z",
  "callback": true, "reviewUrl": "https://<hitly-host>/inbox/<request-id>" }

argsHash is b64url(SHA-256(JCS(action.args))) (RFC 8785 canonicalisation) - the hash of the arguments as originally sent. deadline is the expiry the host stored; callback is true only when you passed callback_url.

ask_user

Ask a question and get a typed answer later.

ArgumentRequiredTypeDescription
idempotencyKeyyesstring (8-200 chars, printable ASCII, no spaces)As for request_approval.
promptyesstringThe headline the reviewer sees: one sentence on one line, at most 160 characters, ending with ?.
detailnostring (≤ 8 000 chars)Markdown rendered under the headline (must not be blank if sent).
answerSchemayesobject { type, options?, bounds? }The typed answer, described below.
common optional argumentsnosee abovecontext, deadline, callback_url, cb_auth_token.

answerSchema.type is the spec name text, single, multi or number (the legacy aliases free_text, single_choice, multi_choice are accepted on input and stored as the spec name). single and multi require options (1-20 items, values distinct); the other types take none. Options are plain strings (value = label) or { value, label?, description? }. bounds constrains the answer: min/max/step/unit for number, minLength/maxLength/pattern for text, minItems/maxItems for multi.

Ask one question per ask_user request. In hitl/v0 the reviewer answers exactly one ask, so a form with several fields gets you one answer, not per-field answers - issue one ask_user per field instead. simple_form is refused with an error: ask_user accepts only text, single, multi and number answer schemas, so send a separate ask_user for each field.

{ "name": "ask_user", "arguments": {
    "idempotencyKey": "refund-1842-colour",
    "prompt": "Which colour should we ship as the replacement?",
    "detail": "The customer returned a **blue** mug; we have blue, green and red left.",
    "answerSchema": { "type": "single", "options": ["blue", "green", "red"] }
} }

Response: the same pending shape minus argsHash (ask_user sends no action arguments): { "requestId": "<request-id>", "state": "pending", "replayed": false, "deadline": "…", "callback": false, "reviewUrl": "https://<hitly-host>/inbox/<request-id>" }.

get_decision

Non-blocking read of a request, as a hitl/response/v0 object.

ArgumentRequiredTypeDescription
requestIdyesstring (1-64 chars, [A-Za-z0-9_-])The requestId returned at create.
{ "name": "get_decision", "arguments": { "requestId": "<request-id>" } }

Answered example (an ask_user reply):

{ "spec": "hitl/response/v0", "requestId": "<request-id>", "status": "answered",
  "answer": { "kind": "single", "value": "blue" },
  "reason": "fine to ship", "decidedBy": { "kind": "human", "id": "usr_…", "display": "A. Reviewer" },
  "decidedAt": "2026-11-10T10:02:00.000Z", "argsHash": "b64url-sha256-of-args",
  "activity": { "presentedAt": "2026-11-10T09:58:00.000Z", "items": [] } }

Fields:

  • status is one of pending, answered, declined, cancelled, expired.
  • The typed answer is an object { kind, value }. kind is the stored answer type - one of text, single, multi, number (the aliases you may have sent in answerSchema.type are normalised on input, so single_choice comes back as single). value is the reviewer's reply for that type: a string for text and single, an array of strings for multi, a finite number for number. HITLy stores and returns it unmodified - use it verbatim.
  • The top-level value carries the decision value for approve/reject/respond ("approve", "reject", or the reply text). A decided response carries either answer (an ask_user reply) or the decision fields (value etc.) - never both.
  • reason, decidedBy ({ kind, id, display? }), decidedAt, argsHash and activity are present when the host has them.
  • callbackDelivery reports callback delivery: "none" for requests created without callback_url (no callback was attempted), "failed" when the callback could not be delivered. A successful delivery adds nothing.

editedArgs

If the reviewer amended the action's arguments, get_decision includes editedArgs with the full merged arguments. The stored request and its argsHash stay original - act on editedArgs when present, not your original args. An edit decision that arrives without editedArgs is reported as declined, never as approval (fail closed).

list_pending

List requests created with your key that still await a human.

ArgumentRequiredTypeDescription
projectIdnostring (≤ 64 chars)Restrict to one project.
cursornostring (≤ 512 chars)The opaque nextCursor from a previous page.
{ "name": "list_pending", "arguments": { "projectId": "prj_…" } }

Response: { "items": [ { "id": "…", "kind": "question", "question": "…", "createdAt": "…", "deadline": "…" } ], "nextCursor": null } - items carry id, kind, and whichever of question/prompt, createdAt, deadline/expiresAt, status the host stores. Pass nextCursor back as cursor to page through results. A request a human already decided whose resume then failed (failed_resume) is not listed - its outcome and the failed delivery (callbackDelivery: "failed") come back from get_decision. On a host without a key-scoped pending list yet, the tool answers the error not_supported_by_host.

cancel

Withdraw an open request your key created.

ArgumentRequiredTypeDescription
requestIdyesstring (1-64 chars, [A-Za-z0-9_-])The requestId returned at create.
reasonnostring (≤ 500 chars)Why the request is withdrawn (recorded for the reviewer).
{ "name": "cancel", "arguments": { "requestId": "<request-id>", "reason": "order refunded by hand" } }

Response: { "requestId": "<request-id>", "state": "cancelled" }. Cancelled is never approval. Cancelling a request another key created fails; some hosts do not yet enable requester cancel with an API key and answer unauthorized.

Project status errors

A project can be live, paused or archived (set by an owner in the project settings). Creates and mutations against a non-live project are refused by the host with HTTP 409; MCP tools report them in the standard error envelope { "error": { "code", "message" } } with isError: true:

Toolpaused projectarchived project
request_approval, ask_userfails - project pausedfails - project archived
get_decision, list_pendingreadablereadable
cancelworksfails - project archived

Over REST the host's exact bodies are { "error": "project paused", "code": "project_paused" } and { "error": "project archived", "code": "project_archived" } (HTTP 409). The MCP layer forwards the host's message verbatim - the tool message is exactly project paused or project archived - and reports the generic client-facing code for the status (invalid_request for 409). Pausing a project stops new asks; reviewers can still decide, and cancel still works on open requests. Archiving additionally refuses cancel and resume retries; stored requests stay readable.

Callbacks

request_approval and ask_user accept two optional fields:

  • callback_url - an https URL that HITLy POSTs to when the request is decided (or answered). If you do not pass it, HITLy sends no callback at all and you poll get_decision instead.
  • cb_auth_token - a secret of 16-512 characters. HITLy sends it back on every callback as authorization: Bearer <your-callback-token>, so you can verify the delivery is yours and only your endpoint accepts it. It is never echoed back to you. (If the tool reports your host does not support cb_auth_token yet, omit it and use get_decision.)

Registered callbacks (no per-request secret needed). If the URL is registered under Project settings → Callbacks for the project, an operator stores the URL and its shared secret once and picks an auth mode - Bearer token, Standard Webhooks (webhook-id, webhook-timestamp, webhook-signature: v1,<base64 HMAC>), or GitHub X-Hub-Signature-256 (sha256=<hex HMAC of the body>). When callback_url matches a registered URL exactly, HITLy authenticates the delivery from that registration and the request needs no cb_auth_token. The match is exact (scheme, host, port, path and query all significant) and per project; an unregistered URL behaves exactly as before and still needs cb_auth_token to be authenticated. The stored secret is never returned by the API or shown in the UI after saving. See HTTP → Registered callbacks for the receiver-side verification of each scheme.

The callback is only a hint. A callback tells you an outcome may exist. Always confirm with get_decision before acting - it is the source of truth, and callback delivery can fail (the read then reports callbackDelivery: "failed").

What the POST looks like

Headers: content-type: application/json, plus authorization: Bearer <your-callback-token> when you passed one (or when the URL is registered with the Bearer token mode). When webhook signing is enabled for your project, four more headers arrive: x-hitly-timestamp (unix seconds), x-hitly-signature (hex HMAC-SHA256 over "<timestamp>.<raw body>"), x-hitly-event-id (dedupe on this - retries reuse it), and x-hitly-key-id (which signing key signed). Without a signing secret, only x-hitly-event-id is sent. Receivers should reject timestamps more than 5 minutes off. A Standard Webhooks or X-Hub-Signature-256 registration adds its own scheme headers alongside the x-hitly-* set, never instead of it.

The JSON body for a decided approval:

{
  "event_id": "evt_…",
  "type": "decided",
  "request_id": "<request-id>",
  "id": "<request-id>",
  "occurred_at": "2026-11-10T12:00:00.000Z",
  "state": "decided",
  "decision": "accept",
  "reason": "ok to send",
  "argsHash": "…",
  "metadata": {},
  "decisionDetail": { "outcome": "accept", "reason": "ok to send", "decidedBy": "…" }
}
  • type and state are "decided", or "answered" for an ask_user reply.
  • decision is the host decision name: accept, reject, ignore, respond, or edit (a reviewer amendment).
  • For an answered ask_user, answer is the reviewer's typed reply as an object { kind, value } with the stored spec type (e.g. {"kind": "single", "value": "blue"}), exactly as the host stored it. When there is no typed answer the answer key is omitted entirely - never sent as answer: null.
  • Reviewer amendments arrive as editedArgs (act on those); a plain text reply arrives as response.
  • id, request_id, idempotency_key, metadata, reason, argsHash and decisionDetail are present when the host has the values.

Delivery semantics: any 2xx counts as acceptance. 5xx, 429, 408 and 425 are retried (a short in-process schedule, then host-side retries over about 24 hours, always reusing the same x-hitly-event-id); other non-2xx answers fail the delivery immediately. Redirects are not followed: a 3xx from your URL fails the delivery. Callback targets must be public https endpoints - private and loopback destinations are refused. A request whose callback ultimately fails shows callbackDelivery: "failed" on get_decision; the decision itself stands.

Example: a Grok Bot agent passes its own agent webhook URL as callback_url (e.g. https://example.com/hooks/hitly) and a secret only it knows as cb_auth_token, then calls get_decision on waking to confirm the outcome. If an operator has registered that same URL under Project settings → Callbacks, the agent omits cb_auth_token and HITLy authenticates the POST from the registration instead - the bot still calls get_decision to confirm.

There is no decide tool

Bots can request, read, and cancel - they cannot decide. Decisions come from a signed-in human in the HITLy web or mobile inbox. pending, expired and cancelled are never approval: confirm with get_decision before acting.

Open the endpoint URL in a browser and you will be redirected here.

On this page