KirokuForms

KirokuForms MCP Server

A Model Context Protocol (MCP) server providing Human-in-the-Loop (HITL) capabilities, dynamic form generation, and intelligent data collection for AI systems. Integrate human oversight into your AI workflows with standardized MCP tools.

What is Model Context Protocol?

MCP is an open protocol that enables AI models to securely interact with local and remote resources through standardized server implementations. KirokuForms implements MCP to provide:

  • Structured human-in-the-loop capabilities for AI workflows
  • Dynamic form generation based on context and data analysis
  • Real-time event streaming for task completion notifications
  • Standardized APIs that work with all MCP-compatible clients

Quick Start

1. Prerequisites

  • A KirokuForms account and API key with hitl:create, hitl:read, and forms:write scopes.
  • A compatible MCP client (e.g., Cursor) or an API tool like curl.

2. Server Information

Server Name:
KirokuForms MCP Server v1.0.0
Base URL:
https://www.kirokuforms.com/api/mcp
Authentication:
Authorization: Bearer YOUR_API_KEY

3. Test Your Connection

A GET returns the server's capabilities, which is a quick way to confirm your API key works:

Check Server Capabilities
curl -H "Authorization: Bearer YOUR_API_KEY" https://www.kirokuforms.com/api/mcp

To drive the MCP protocol itself, POST a JSON-RPC initialize request. This is the same handshake an MCP client runs on connect; the reply carries the protocolVersion and serverInfo. The Accept header must list both application/json and text/event-stream.

Run the MCP initialize handshake
curl -X POST https://www.kirokuforms.com/api/mcp \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl","version":"1.0.0"}}}'

4. Plans and limits

Every plan can call the MCP server, including the free one, and an API key needs no subscription. What changes with the plan is how many requests a minute we accept before answering 429.

Plan Requests a minute
Free 10
Pro 60
Business 300

Moving up a plan raises that number. The pricing page shows what each plan costs.

A refusal carries Retry-After, X-RateLimit-Limit and X-RateLimit-Remaining headers, so a client knows how long to wait before it tries again. The count is kept per API key against a fixed clock minute, so it resets on the minute rather than sixty seconds after your first call.

Every plan can also set how long a review stays open: pass settings.expiration when you create the task. A task nobody sets a deadline for expires after 72 hours, and whoever opened it is told it went unanswered, so a paused workflow hears back either way.

Client Configuration

The server is remote and speaks the Streamable HTTP transport at https://www.kirokuforms.com/api/mcp. Cursor and VS Code connect to that URL directly. Claude Desktop speaks stdio only, so it reaches the endpoint through the mcp-remote bridge, which forwards your Bearer key on every request.

In Claude Desktop settings, go to the "Developer" tab and add the following to your configuration. It runs the mcp-remote bridge, which connects to the KirokuForms endpoint and attaches your Bearer key. Restart Claude Desktop after saving.

Claude Desktop Configuration
{
  "mcpServers": {
    "kirokuforms": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://www.kirokuforms.com/api/mcp",
        "--header",
        "Authorization:${AUTH_HEADER}"
      ],
      "env": {
        "AUTH_HEADER": "Bearer YOUR_API_KEY"
      }
    }
  }
}

In your project, create a file at .cursor/mcp.json with the following content. Cursor connects to the URL directly and sends the Authorization header on each request.

.cursor/mcp.json
{
  "mcpServers": {
    "kirokuforms": {
      "url": "https://www.kirokuforms.com/api/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}

In your project, create a file at .vscode/mcp.json with the following content. The http type points VS Code at the remote endpoint with your Bearer key.

.vscode/mcp.json
{
  "servers": {
    "kirokuforms": {
      "type": "http",
      "url": "https://www.kirokuforms.com/api/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}

Available Tools

A tools/list call advertises three HITL tools that tools/call can invoke: request-human-review (create a task), list-hitl-tasks (list the tasks this key created), and cancel-hitl-task (cancel a pending task and revoke its links). Each tool is also reachable as a REST endpoint for clients that do not speak MCP.

request-human-review

Creates a Human-in-the-Loop (HITL) task that pauses an AI workflow, generates a web form, and waits for human input.

Endpoint: POST /api/mcp/tools/request-human-review

Key Features:

  • Dynamic Form Generation: If you only provide initialData, the server analyzes it and generates appropriate form fields (e.g., text, number, radio buttons for booleans).
  • Template-Based Forms: Use a pre-configured KirokuForms template by providing a templateId.
  • Custom Field Definitions: Define the exact form fields, validation rules, and layout using a fields array.

Core Parameters:

title: (Required) The task title the reviewer sees.
description: (Required) What you are asking the reviewer to do.
initialData: (Optional) A JSON object with initial data to pre-fill the form or for dynamic generation.
fields: (Optional) An array defining the form's fields and structure. Provide either this or templateId.
templateId: (Optional) The ID of an existing KirokuForms template to use.
settings.callbackUrl: (Optional) A webhook URL to be called upon task completion.
settings.expiration: (Optional) How long the task stays open, as a number of hours or days: "24h", "3d". Defaults to 72h.
settings.priority: (Optional) "low", "medium" or "high". Defaults to "medium".

Returns:

  • taskId: The unique identifier for the created task.
  • reviewUrl: The direct URL for the human reviewer to complete the task.
  • status: The initial status of the task (e.g., "pending").

Available Resources

Resources are entities you can retrieve information about via GET requests.

hitl/tasks/{taskId}

Retrieve a HITL task's status, progress, and final results. This is essential for polling for task completion if you are not using webhooks.

forms

Access form definitions, templates, and aggregated submission data. (Full API documentation forthcoming).

submissions

Access aggregated submission data. (Full API documentation forthcoming).

Python SDK Example

The easiest way to integrate is with our Python SDK, which handles API requests, dynamic form generation, and polling.

Full Workflow with Python SDK
# Install the Python SDK. Full reference: https://chelseaaiventures.github.io/langgraph-kirokuforms/
pip install git+https://github.com/ChelseaAIVentures/langgraph-kirokuforms.git

# Basic usage
from kirokuforms import KirokuFormsHITL
import time

client = KirokuFormsHITL(api_key="your_api_key_here")

# 1. Create a verification task using dynamic form generation
print("Creating HITL task...")
task_response = client.create_verification_task(
    title="Verify New Customer Data",
    description="Please review the information for Acme Corp and confirm its accuracy.",
    data={"company_name": "Acme Corp", "revenue": 1500000, "is_active": True}
)

task_id = task_response.get('taskId')
review_url = task_response.get('reviewUrl')

print(f"Task created with ID: {task_id}")
print(f"Please complete the review at: {review_url}")
print("\nWaiting for task completion (polling every 5s)...")

# 2. Poll for the result
try:
    # The get_task_result method handles the polling logic
    final_result = client.get_task_result(task_id, timeout=300) # 5 minute timeout
    
    print("\n✅ Task Completed!")
    print("Human Response:")
    print(final_result)

except TimeoutError as e:
    print(f"\n❌ {e}")

Webhook & Event Integration

For real-time updates, you can use webhooks or subscribe to Server-Sent Events (SSE).

Webhook Callbacks

If you provide a callbackUrl when creating a task, KirokuForms will send a POST request to that URL upon completion.

Example Webhook Payload
POST /your-callback-url

{
  "eventType": "hitl.task.completed",
  "taskId": "task-abc123",
  "timestamp": "2025-01-15T15:30:00Z",
  "data": {
    "status": "completed",
    "formData": {
      "customer_name": "Acme Corporation",
      "is_verified": "yes",
      "comments": "Updated company name based on latest filing."
    }
  }
}

Event Streaming (SSE)

For clients that can maintain a connection, you can subscribe to real-time events.

Subscribe to Task Completion Events
GET /api/mcp/events/hitl.task.completed
Authorization: Bearer YOUR_API_KEY

Explore More