← Code Exchange

Temporal Invoice Processor (MCP + Claude + Human-In-The-Loop)

The temporal-invoice-mcp repository contains a demo that integrates Temporal workflows with Anthropic’s MCP tools. The README explains how to install the demo, run Temporal locally, start the worker, and use trigger, approve, reject, and status tools to drive the process. It notes that you can view workflow progress in Temporal Web and restart workers to demonstrate deterministic replay. The README also highlights that the demo lets agents interact with workflows by sending approvals or other updates, all while explaining what’s happening in human-friendly terms.

Under the hood, signals drive approval, queries expose current state, and child workflows handle each line item, showing how to build durable, interactive processes that combine automation with human oversight.

The workflow code defines signals for approval and rejection, queries for invoice status, and starts child workflows for paying each line item. The InvoiceWorkflow waits for a human decision before proceeding, illustrating a human-in-the-loop process:

@workflow.signal
async def ApproveInvoice(self) -> None:
    self.approved = True

@workflow.signal
async def RejectInvoice(self) -> None:
    self.approved = False

@workflow.query
async def GetInvoiceStatus(self) -> str:
    return self.status
...
for line in invoice.get("lines", []):
    handle = await workflow.start_child_workflow(PayLineItem.run, line)

Overall, the demo’s purpose is to showcase how customers can use Temporal with MCP to run long‑lived invoice workflows that allow human approvals via signals, expose queries for current status, and spawn child workflows to handle each invoice line item. The example demonstrates features like deterministic replay, parallel line‑item processing, and interactive agentic control over the workflow. This illustrates a complete pattern for building human-in-the-loop, durable applications with Temporal.

💖 Community aimcpclaudehuman-in-the-loop

About the Author

Kevin Martin photo

Kevin Martin

Sr. Strategic Account Executive

headshot-josh-smith

Joshua Smith

Staff Solutions Architect