Architecture
This page documents Orleans.Lattice.Api.Mcp.Telemetry 10.5.0, in the documentation for Orleans.Lattice 10.5.0 (release line 10.5), built 2026-12-05. It is also published as markdown, with every table and list, at architecture.md, and llms.txt lists every page.Orleans.Lattice.Api.Mcp.Telemetry is the MCP binding over the transport-neutral Orleans.Lattice.Api.Telemetry package. That package owns the backend proxy, the range guardrails, the metric-access allow-list and the capability check; this one adds only the four read-only lattice_telemetry_* tools and wires them so the same rules apply as for every other transport. Internal collaborators are described by behaviour; for the public types see Public API.
Composition
AddTelemetryTools does four things:
- Binds and validates
LatticeApiMcpTelemetryOptions, and registersIOptions<LatticeTelemetryOptions>as that same instance, so the neutral proxy, policy and guardrails observe exactly the values the host configured. - Calls
AddLatticeTelemetryBackend, which registers theTelemetryMetricAccessPolicy(its wildcard patterns compiled once from the options) and, unless the host registered its ownIPrometheusQueryClientfirst, the defaultPrometheusQueryClientwith itsHttpClient. - Registers the
TelemetryAccessAuthorizercapability check. It is registered here, not inherited from the neutral facade's registration, because a host can expose the MCP tools without that facade and the tools must be gated either way. - Contributes the telemetry tool group (
LatticeApiMcpGroup.Telemetry) to the MCP server.
Request path
Discovery offers the group only to a caller holding LatticeOperation.Telemetry from an Allow rule at cluster-wide scope, and the MCP server's lock-step authorizer must admit each tool (see Orleans.Lattice.Api.Mcp architecture). Because a tool name is guessable, discovery is not the gate; each call then runs, in order:
- Capability. The handler checks the cluster-wide
Telemetrycapability throughTelemetryAccessAuthorizer, the seam the neutralILatticeTelemetryfacade also consults. It runs first, so an unauthorized caller learns nothing - not even the configured range budget from a guardrail message. - Guardrails. A range query is checked against
MaxRangeandMaxStepbyTelemetryRangeGuardrails. - Allow-list. The PromQL expression is checked against the metric-access policy by
TelemetryQueryAuthorizer, which fails closed: an unparseable or ambiguous metric-name matcher is treated as not allowed. The allow-list only narrows; under theReadAlldefault it admits every name, which is why the capability check precedes it. - Backend call.
IPrometheusQueryClientsends the query, stamping the backend credential selected byAuthMode. InDynamicBearermode the token comes from a registeredITelemetryBackendTokenProvideron every request; a missing provider or an empty token fails the request closed rather than sending it unauthenticated. - Projection. The backend envelope is mapped into the result records. Metric listing and metadata are filtered to admitted names under
DenyAllExceptAllowed.
Every refusal and fault becomes a Success = false result. A backend transport or payload fault carries a fixed message - exception text from the HTTP pipeline could echo the outbound Authorization header - and its detail is logged server-side, with the query string dropped from the logged path. A 404 from the metadata endpoint is read as "no metadata surface" and answered with an empty successful result. A genuine caller cancellation propagates.
The dual-credential boundary
The two halves of the trust boundary never meet. The caller's Lattice credential, stamped by the MCP server, is used only for the capability check. The backend sees only the configured backend credential: the proxy's collaborators are its HttpClient, the options, the optional token provider and a logger, none of which is a Lattice credential source. See Security.
Remote hosting
On a remote MCP head the telemetry tools always query the head's own configured backend; AddLatticeMcpRemote wires no gRPC adapter for telemetry. A Telemetry endpoint in the remote options only advertises where a region's telemetry facade is served, for discovery and routing. See Remote hosting.
Source map
Related
- Public API
- Configuration
- Security, Tools
Orleans.Lattice.Api.Mcp.Telemetry.Azurearchitecture - the managed-identity token provider forDynamicBearer.