Expand description
Per-tool audit for external MCP servers served over the HTTP gateway.
A client-mediated tools/call to an external provider has no backend
process to record it, so the gateway taps the forwarded request/response,
writes one mcp_tool_executions row under the calling user, and hands the
result to the artifact ingest. The execution id is minted before the
response leaves, and stamped into its _meta, so the client’s own later
report of the same result carries the exact server key. record composes
the tap over the upstream body; the tap owns an McpAudit and finalizes
it (once) on stream EOF or drop, writing on the process’s
BackgroundTasks so shutdown drains the row.
The execution row is written first, then paired with the model’s intent
through IntentClaimService, mirroring
systemprompt_mcp::McpToolExecutor: a client-supplied tool-call id is
claimed as an exact pairing, otherwise the newest unclaimed intent for the
tool in the calling session is claimed as an inferred one. Failing to claim
leaves the execution unpaired rather than failing the call, which has
already returned to the client.
Copyright (c) systemprompt.io — Business Source License 1.1. See https://systemprompt.io for licensing details.
Modules§
- jsonrpc
- Minimal JSON-RPC / MCP frame parsing for the tool-call audit tap.
- tap
- Observe-while-forwarding tap that captures an external MCP tool-call result and stamps the execution id into it.