MCPHub Docs

Direct Ingestion

Log tool calls to MCPHub without routing through the proxy — for agents that call MCP servers directly.

Direct Ingestion

The proxy is the easiest way to log tool calls, but some agents connect directly to MCP servers and can't be rerouted. For these cases, use the direct ingestion endpoint to push tool call records to MCPHub manually.

When to use direct ingestion

Use it when:

  • Your agent manages its own MCP connections and you can't change the transport layer
  • You want to log tool calls from a legacy system that predates MCPHub
  • You're running MCP servers in an environment where proxying isn't feasible (e.g. local dev tools, sandboxed environments)

Endpoint

POST /api/v1/tool-calls

Requires JWT or API key auth.

Request schema

{
  "server_id": "uuid-of-registered-server",
  "tool_name": "read_file",
  "caller_agent": "my-agent-v2",
  "input_tokens": 120,
  "output_tokens": 340,
  "duration_ms": 245,
  "status": "success",
  "error_message": null,
  "output_size_bytes": 1380
}
FieldTypeRequiredDescription
server_idUUIDyesMust be a server registered in your workspace
tool_namestringyesName of the tool that was called
caller_agentstringnoIdentifier for the calling agent or script
input_tokensintnoEstimated input tokens consumed
output_tokensintnoEstimated output tokens produced
duration_msintnoWall-clock duration of the tool call
statusstringyes"success" or "error"
error_messagestringnoError detail if status is "error"
output_size_bytesintnoSize of the tool response payload

Example (Python)

import httpx
 
httpx.post(
    "https://mcphub.aniruddha.fyi/api/v1/tool-calls",
    headers={"X-API-Key": "mhk_your_key"},
    json={
        "server_id": "your-server-uuid",
        "tool_name": "search_files",
        "caller_agent": "my-pipeline",
        "duration_ms": 312,
        "status": "success",
        "output_size_bytes": 4096,
    },
)

What you get

Directly ingested tool calls appear in:

  • Tool Calls audit log (same as proxy-logged calls)
  • Analytics — top tools, volume heatmap, error rates
  • Alert evaluation — alert rules fire on ingested data too

The only difference from proxy logging is that directly ingested calls don't have an MCPHub-generated request ID, so there's no link back to the raw request.

On this page