Expand description
Tower hot path for MCP authentication, caching, and terminal-delivery billing.
Request metadata is classified from the mandatory MCP headers. Bodies are deserialized only for cache keys, durable-task attribution, and the terminal response decision. Response bodies remain streaming: the wrapper observes frames as the client consumes them and records usage only after a terminal JSON-RPC response reaches end-of-stream.
Structs§
- Classified
Call - Validated identity shared by pricing and metering.
- Deferred
Completions - Queue of terminal accounting waiting for somewhere to await.
- Edge
Config - Runtime configuration shared by every cloned metering service.
- Edge
Metrics - Process-local edge counters.
- InMemory
Task Store - Process-local task attribution for an embedded server.
- InMemory
Tenant Store - Mutable in-memory tenant table for development and embedded deployments.
- Meter
Layer - Tower layer that installs
MeterService. - Meter
Service - Service produced by
MeterLayer. - Metrics
Snapshot - Point-in-time metric values.
- Open
Telemetry Metrics - Registration guard for the OpenTelemetry observable instruments.
- Protocol
Headers - Trusted protocol metadata lifted from request headers.
- Task
Attribution - Pre-priced durable-task attribution without the original name or URI.
- Tenant
- Authenticated tenant configuration used by the edge.
Enums§
- Classification
- The outcome of looking at the request headers alone.
- Classification
Error - Why mandatory MCP request metadata could not be trusted.
- Credential
Error - Missing or ambiguous tenant credentials.
- Edge
Config Error - Invalid edge configuration.
- Task
Origin Kind - Non-identifying method category retained for a durable task.
- Task
Store Error - A sanitized durable-task store failure.
- Unaccounted
Reason - Why a response the edge observed produced no accounting at all.
- Weak
ApiKey - Why an API key was refused as too weak to be safe.
Constants§
- API_
KEY_ HEADER - API-key header accepted in addition to
Authorization: Bearer. - METHOD_
HEADER - Mirrored JSON-RPC method request header.
- MIN_
API_ KEY_ BYTES - Shortest API key accepted by
validate_api_key_strength. - NAME_
HEADER - Mirrored tool, prompt, or resource name request header.
- PROTOCOL_
VERSION_ HEADER - Standard protocol-version request header.
Traits§
- Task
Attribution Store - Persists pre-priced, non-identifying attribution under a durable task ID.
- Tenant
Store - Resolves a presented high-entropy API key without retaining its plaintext.
Functions§
- classify_
protocol_ headers - Validate and classify raw MCP header values.
- classify_
request_ headers - Validate unique protocol headers before authenticating or reading a body.
- extract_
api_ key - Extract exactly one API key or Bearer credential.
- hash_
api_ key - SHA-256 lookup hash for an API key.
- install_
opentelemetry - Register low-cardinality observable counters with an application-owned meter.
- validate_
api_ key_ strength - Reject API keys that are obviously too weak to be compared by digest.
Type Aliases§
- Meter
Body - Response body returned by
MeterService. - Task
Store Future - Boxed future returned by object-safe task stores.