Skip to main content

mcpfleet-obs

Shared error taxonomy, metrics middleware, and client tracking for the mcpfleet MCP servers. One call installs the whole stack:

from mcpfleet_obs import install

install(mcp, prefix="uk_legal")

This registers ClientTrackingMiddleware, FleetMetricsMiddleware, and a GET /metrics route on the FastMCP instance.

Metrics

All metric names are prefixed ({prefix}_tool_calls_total, etc.).

  • {prefix}_tool_calls_total — labels tool, transport, region, status (ok/error), error_category, source.
    • error_category: transient, validation, not_found, auth_required, configuration, unknown. Empty on success.
    • source: middleware (schema rejection / unknown tool name), tool (failed inside this server's tool body), upstream (failed in a create_proxy mount — see proxy_namespaces).
    • Calls to unregistered tool names fold into tool="_unknown_" (not_found/middleware) so client-supplied names can't mint series.
    • Both FastMCP error paths are counted: raised exceptions and result objects with is_error=True.
  • {prefix}_tool_duration_seconds — histogram, labels tool, transport, region. The tool label uses the same _unknown_ fold as the counter.
  • {prefix}_client_connections_total — labels client_name, client_version, transport, region. Counted on both initialize and server/discover handshakes; reads client_info and clientInfo (MCP SDK 1.x/2.x). Distinct client names are bounded: the first client_label_max keep their own label, the rest fold to "other" (versions fold too). Default 40, override via the CLIENT_LABEL_MAX env var or install(..., client_label_max=N).
  • {prefix}_build_info — gauge, labels server, obs_version, fastmcp_version, python_version. Always 1.

install() signature

install(mcp, *, prefix, proxy_namespaces=(), client_label_max=CLIENT_LABEL_MAX, registry=None)
  • proxy_namespaces: mount namespaces that forward via create_proxy() (e.g. ("gov", "law")), so their tool errors are labelled source="upstream".
  • registry: defaults to the global prometheus_client.REGISTRY; pass a CollectorRegistry for isolated tests.

Error taxonomy

Tools produce structured errors with raise_tool_error / raise_http_tool_error (from mcpfleet_obs), which raise ToolError carrying a FleetErrorPayload JSON body (error_category, is_retryable, attempted, description). The middleware parses the payload back out for the error_category label; consumers emitting the same JSON shape are classified identically. See probes/fastmcp-error-shapes/PROBE-REPORT.md in the mcpfleet workspace for the wire-contract research.

Metadata

Release files for mcpfleet-obs 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcpfleet-obs 0.6.0
File Size Uploaded Provenance Actions
mcpfleet_obs-0.6.0.tar.gz 114.3 kB Without provenance Details for mcpfleet_obs-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mcpfleet-obs 0.6.0
File Interpreter ABI Platform Actions
mcpfleet_obs-0.6.0-py3-none-any.whl Python 3 none any Details for mcpfleet_obs-0.6.0-py3-none-any.whl

Total release size: 126.2 kB

Release files / mcpfleet_obs-0.6.0.tar.gz

Download URL mcpfleet_obs-0.6.0.tar.gz
Size 114.3 kB
Tags Source
SHA-256 checksum
How to use checksums
fb911d23e715a31b43fa408b61992b30fb3a15d16f98df9bdd19cde9dfa0c166
BLAKE2b-256 checksum
How to use checksums
c123cb770e9a67cf72979343e26e32218f596cd0dba01a29e9fc25de523e555d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.11

Release files / mcpfleet_obs-0.6.0-py3-none-any.whl

Download URL mcpfleet_obs-0.6.0-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e4d3f18b6c94a3b4390d3b6099458ae06654bd1f6beca36ceeb76057cb139b37
BLAKE2b-256 checksum
How to use checksums
813ed7fde96efca83352105585abe0fa39089e0c3c1383c85110c9a74c155d71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.11

Security for mcpfleet-obs 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page