fastmcp/tests/server
Chris Guidry 046f845ddf Add OpenTelemetry tracing support
Adds opt-in distributed tracing via OpenTelemetry for observability into
FastMCP server and client operations.

Server spans are created for tool calls, resource reads, and prompt
renders with attributes like component key, component type, provider
type, session ID, and auth context. Client spans wrap outgoing calls
with trace context propagation via W3C headers in request meta.

Components provide their own span attributes through a `get_span_attributes()`
method that subclasses override - this lets LocalProvider, FastMCPProvider,
and ProxyProvider each include relevant context (original names, backend URIs).

To enable: configure an OpenTelemetry SDK with a TracerProvider before
importing fastmcp. Traces export to any OTLP-compatible backend.

Closes ENG-2813

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 09:45:41 -05:00
..
auth Add loq file size limits and clean up type ignores (#2859) 2026-01-13 07:29:12 -05:00
http Add loq file size limits and clean up type ignores (#2859) 2026-01-13 07:29:12 -05:00
middleware Add loq file size limits and clean up type ignores (#2859) 2026-01-13 07:29:12 -05:00
providers Add loq file size limits and clean up type ignores (#2859) 2026-01-13 07:29:12 -05:00
sampling SEP-1577: Sampling with tools (#2551) 2025-12-14 13:51:05 -05:00
tasks Fix task capabilities location (issue #2870) 2026-01-13 22:26:13 -05:00
telemetry Add OpenTelemetry tracing support 2026-01-14 09:45:41 -05:00
__init__.py restore 1.x code 2025-04-09 11:54:42 -04:00
test_app_state.py Update docs and test 2025-06-20 13:06:48 -04:00
test_auth_integration.py Update FastMCP for MCP SDK 1.23.1 auth changes 2025-12-03 11:50:08 -05:00
test_context.py Add loq file size limits and clean up type ignores (#2859) 2026-01-13 07:29:12 -05:00
test_dependencies.py Make pydocket optional and unify DI systems (#2835) 2026-01-10 16:23:32 -05:00
test_event_store.py Replace type: ignore[attr-defined] with isinstance assertions in tests (#2665) 2025-12-21 16:37:20 -05:00
test_file_server.py Introduce ResourceResult as canonical resource return type (#2734) 2025-12-25 21:21:55 -05:00
test_icons.py Implement icon support (#2121) 2025-10-17 17:28:08 -04:00
test_input_validation.py Replace type: ignore[attr-defined] with isinstance assertions in tests (#2665) 2025-12-21 16:37:20 -05:00
test_log_level.py Add log level support for stdio and HTTP transports (#1840) 2025-09-19 13:46:30 -04:00
test_logging.py Fix uvicorn 0.39+ test timeouts and FastMCPError propagation (#2699) 2025-12-23 19:02:47 -05:00
test_mount.py Add transform system for modifying components in provider chains (#2836) 2026-01-12 22:11:16 -05:00
test_providers.py Decorators return functions instead of component objects (#2856) 2026-01-12 21:58:07 -05:00
test_run_server.py Update tests for prompts 2025-06-04 16:37:41 -04:00
test_server.py Add transform system for modifying components in provider chains (#2836) 2026-01-12 22:11:16 -05:00
test_server_docket.py Make pydocket optional and unify DI systems (#2835) 2026-01-10 16:23:32 -05:00
test_server_lifespan.py Add composable lifespans (#2828) 2026-01-10 11:16:50 -05:00
test_streamable_http_no_redirect.py Improve redirect handling to address 307's (#1387) 2025-08-08 11:55:30 -04:00
test_tool_annotations.py Consolidate get_* and _list_* methods into single API (#2719) 2025-12-24 22:26:52 -05:00
test_tool_transformation.py Add transform system for modifying components in provider chains (#2836) 2026-01-12 22:11:16 -05:00