Skip to content

Add MCP server monitoring metrics to the metrics reference lists #8508

Description

@IssacAX123

Add MCP server monitoring metrics to the metrics reference lists

Problem description

The mcpServer-1.0 feature ships monitoring support via three auto-features that activate automatically when paired with existing monitoring features:

  • io.openliberty.mcpServer-1.0-monitor-1.0.feature JMX/MXBean support (via monitor-1.0)
  • io.openliberty.mcpServer-1.0-mpTelemetry-2.0.feature OpenTelemetry histograms (via mpTelemetry-2.0)

None of these metrics are documented in either:

  • mptelemetry-metrics-list.adoc
  • jmx-metrics-list.adoc

Changes needed mptelemetry-metrics-list.adoc

Add two rows to the MicroProfile Telemetry 2.0 and later metrics reference table:

mcp.server.operation.duration

  • Type: DoubleHistogram / seconds
  • Description: Duration of every MCP operation one data point per tools/call, tools/list, initialize, notifications/initialized, ping, and notifications/cancelled request.
  • Monitoring component: MCP
  • Features required: feature:mcpServer-1.0 and feature:mpTelemetry-2.0
  • Bucket boundaries: [0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1.0, 2.0, 5.0, 10.0, 30.0, 60.0, 120.0, 300.0]
  • Attributes:
Attribute Present Description
mcp.method.name Always Which MCP method was called, e.g. tools/call, initialize, tools/list, ping
rpc.response.status_code Always ok on success, error on failure
jsonrpc.protocol.version Always The JSON-RPC version used by the request, e.g. 2.0
network.protocol.name Always The HTTP protocol name, e.g. HTTP
network.protocol.version Always The HTTP protocol version, e.g. 1.1
network.transport Always The transport layer. Always tcp
mcp.protocol.version After initialize The MCP protocol version negotiated with the client, e.g. 2025-11-25
gen_ai.tool.name tools/call only The name of the tool that was called
error.type On failure only Why the operation failed: tool_error, internal_error, http_error, or a JSON-RPC error code such as INVALID_PARAMS

mcp.server.session.duration

  • Type: DoubleHistogram / seconds
  • Description: Duration of each MCP session from initialize to session end. Only emitted in stateful mode.
  • Monitoring component: MCP
  • Features required: feature:mcpServer-1.0 and feature:mpTelemetry-2.0
  • Bucket boundaries: [0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1.0, 2.0, 5.0, 10.0, 30.0, 60.0, 120.0, 300.0]
  • Attributes:
Attribute Present Description
jsonrpc.protocol.version Always The JSON-RPC version used when the session was created, e.g. 2.0
mcp.protocol.version Always The MCP protocol version negotiated during initialize, e.g. 2025-11-25
network.protocol.name Always The HTTP protocol name from when the session was created, e.g. HTTP
network.protocol.version Always The HTTP protocol version from when the session was created, e.g. 1.1
network.transport Always The transport layer. Always tcp
error.type On abnormal end only Why the session ended abnormally, e.g. timeout. Only present when the session did not close cleanly

Filter attribute update

Also update the filter attribute example to include MCP as a valid monitoring component value:

<monitor filter="ConnectionPool,ThreadPool,RequestTiming,Session,HTTP,MCP"/>

Both metrics are also emitted via mpMetrics-5.0 with the same metric names.


Changes needed jmx-metrics-list.adoc

Add a new MCP monitoring section. Both MXBeans activate automatically when mcpServer-1.0 and monitor-1.0 are both enabled. The monitoring component filter value is MCP. MXBean instances are created dynamically as operations and sessions are observed, and are removed when the associated application is unloaded.

McpOperationStatistics MXBean

Object name: WebSphere:type=McpOperationStatistics,name=*

MXBean attribute Units Description
McpMethodName Not applicable The MCP JSON-RPC method name e.g. tools/call, initialize, tools/list, ping. Always present.
GenAiToolName Not applicable The name of the tool that was called. Only present on tools/call data points.
GenAiPromptName Not applicable The prompt name for prompt operations. Null if not applicable.
GenAiOperationName Not applicable The GenAI operation name. Null if not applicable.
ErrorType Not applicable Why the operation failed. Null for successful operations. Values include tool_error, internal_error, http_error, or a JSON-RPC error code such as INVALID_PARAMS.
RpcResponseStatusCode Not applicable ok on success, error on failure.
JsonrpcProtocolVersion Not applicable The JSON-RPC protocol version e.g. 2.0.
McpProtocolVersion Not applicable The MCP protocol version negotiated with the client e.g. 2025-11-25.
NetworkProtocolName Not applicable The network protocol name e.g. HTTP.
NetworkProtocolVersion Not applicable The network protocol version e.g. 1.1.
NetworkTransport Not applicable The network transport. Always tcp.
McpResourceUri Not applicable The MCP resource URI for resource operations. Null if not applicable.
Count Not applicable The total number of times this operation has been recorded.
CountDetails Not applicable Detailed counter information including the last update timestamp.
Duration Nanoseconds The total cumulative duration of all recorded executions of this operation.
DurationDetails Nanoseconds Statistical details about operation duration including minimum, maximum, and total values.

McpSessionStatistics MXBean

Object name: WebSphere:type=McpSessionStatistics,name=*

MXBean attribute Units Description
ErrorType Not applicable Why the session ended abnormally. Null for sessions that closed cleanly.
JsonrpcProtocolVersion Not applicable The JSON-RPC protocol version used when the session was created e.g. 2.0.
McpProtocolVersion Not applicable The MCP protocol version negotiated during initialize e.g. 2025-11-25.
NetworkProtocolName Not applicable The network protocol name e.g. HTTP.
NetworkProtocolVersion Not applicable The network protocol version e.g. 1.1.
NetworkTransport Not applicable The network transport. Always tcp.
Count Not applicable The total number of sessions recorded for this set of attributes.
CountDetails Not applicable Detailed counter information including the last update timestamp.
Duration Nanoseconds The total cumulative duration of all recorded sessions.
DurationDetails Nanoseconds Statistical details about session duration including minimum, maximum, and total values.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions