Skip to content

GH-4560: Add MCP server tool observations#6059

Open
Grandys wants to merge 1 commit into
spring-projects:mainfrom
Grandys:gh-4560
Open

GH-4560: Add MCP server tool observations#6059
Grandys wants to merge 1 commit into
spring-projects:mainfrom
Grandys:gh-4560

Conversation

@Grandys
Copy link
Copy Markdown

@Grandys Grandys commented May 17, 2026

Summary

Adds Micrometer observability for MCP server tools/call execution.

This introduces a dedicated spring.ai.mcp.server.tool observation for stateful/stateless and sync/async MCP server tool handlers, with MCP-specific low-
cardinality tags and opt-in high-cardinality tool call content.

Changes

  • Add MCP server tool observation support for:
    • stateful sync handlers
    • stateful async handlers
    • stateless sync handlers
    • stateless async handlers
  • Add MCP observation context, convention, documentation enum, and content observation filter.
  • Add spring.ai.mcp.server.observations.include-content to opt into tool call arguments/result span attributes.
  • Record MCP protocol-level error results as observation errors.
  • Document MCP server observability fields and configuration.
  • Add tests for observation emission, errors, content filtering, custom conventions, and async cancellation.

Fixes GH-4560

Add Micrometer observations for MCP server tool calls, including stateful and stateless sync/async handlers, MCP-specific observation metadata, tests, and documentation.

Fixes spring-projectsGH-4560
Signed-off-by: Michal Grandys <grandys.michal@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose server-side metrics for MCP @McpTool invocations

1 participant