Monitor MCP traffic, errors, and latency

To observe traffic, track performance, and diagnose errors across your remote Model Context Protocol (MCP) servers, you can use Cloud Monitoring. Remote MCP servers for Google Cloud services automatically send request telemetry to Monitoring under the consumed_mcp_api monitored resource type.

You can view these metrics in Metrics Explorer or on custom dashboards. You can also configure alerting policies to monitor MCP server activity across your Google Cloud projects.

Monitored resource type

Monitoring groups telemetry for remote MCP servers under the consumed_mcp_api monitored resource type. The display name for this resource type is Consumed MCP Method.

The consumed_mcp_api resource type includes the following labels:

Label Description Example
resource_container The identifier of the Google Cloud project or container associated with the resource. frontend-development
service The service that provides the MCP tools. pubsub.googleapis.com
method The MCP method invoked by the client. tools/call, tools/list
primitive The name of the MCP primitive (such as a tool, resource, or prompt name). list_topics
version The MCP tool version. v1
location The location of the service (such as a region, zone, or global). global, us-central1

Metric types

Monitoring provides the following metric types, which define the structure of data, for remote MCP servers under the serviceruntime.googleapis.com service:

Metric type Kind and type Unit Description Labels
serviceruntime.googleapis.com/mcp/request_count DELTA, INT64 1 The count of MCP requests.
  • response_code: the HTTP status code for HTTP requests or the equivalent code for MCP requests
  • response_code_class: the response code class (for example, 2xx, 4xx, or 5xx)
serviceruntime.googleapis.com/mcp/request_durations DELTA, DISTRIBUTION s (seconds) The duration of the MCP request from the time the request is sent until the response or acknowledgment is received. None

For more information about serviceruntime metrics, see Google Cloud metrics: serviceruntime.

Required roles

To get the permissions that you need to view MCP metrics in Monitoring, ask your administrator to grant you the Monitoring Viewer (roles/monitoring.viewer) IAM role on your Google Cloud project. For more information about granting roles, see Manage access to projects, folders, and organizations.

You might also be able to get the required permissions through custom roles or other predefined roles.

View MCP metrics in Metrics Explorer

To view MCP server metrics in the Google Cloud console, follow these steps:

  1. In the Google Cloud console, go to the  Metrics explorer page:

    Go to Metrics explorer

    If you use the search bar to find this page, then select the result whose subheading is Monitoring.

  2. On the Google Cloud console toolbar, click the resource selector, and then select your Google Cloud project.

  3. In the Metric element, select the metric that you want to view:

    1. Expand the Select a metric menu.
    2. Optional: To show metrics that haven't recorded recent data, click Active to clear the active-only filter.
    3. In the Filter by resource or metric name field, enter Consumed MCP Method or consumed_mcp_api.
    4. Select a metric:
      • To view request volume and response codes, select Consumed MCP Method > Mcp > MCP Request Count (serviceruntime.googleapis.com/mcp/request_count).
      • To view request latency distributions, select Consumed MCP Method > Mcp > MCP Request Duration (serviceruntime.googleapis.com/mcp/request_durations).
    5. Click Apply.
  4. Optional: To filter by resource labels such as service (for example, bigquery.googleapis.com) or primitive (for example, the tool name), in the Filter element, click Add filter. For MCP Request Count, you can also filter by metric labels such as response_code_class (for example, 4xx or 5xx).

  5. Optional: In the Aggregation element, select an aggregation function (such as Sum for request counts or 95th percentile for request durations) and group by primitive, service, or (for MCP Request Count) response_code_class.

  6. Verify that the chart displays time series for your MCP server requests over the selected time range.

Example PromQL queries

To run a PromQL query in Metrics Explorer, click < > PromQL in the toolbar of the query-builder pane, enter a query, and then, if Auto-Run is turned off, click Run Query. You can enter PromQL queries even if the metric has not recorded recent data; however, if no time series data exists for the selected time range, the query result is empty.

Total MCP request rate by service

The following query calculates the per-second rate of MCP requests grouped by service over the past five minutes:

sum by (service) (
  rate({
    __name__="serviceruntime.googleapis.com/mcp/request_count",
    monitored_resource="consumed_mcp_api"
  }[5m])
)

Error rate by tool primitive

The following query calculates the per-second rate of client (4xx) and server (5xx) errors grouped by tool primitive:

sum by (primitive, response_code_class) (
  rate({
    __name__="serviceruntime.googleapis.com/mcp/request_count",
    monitored_resource="consumed_mcp_api",
    response_code_class=~"4xx|5xx"
  }[5m])
)

Ninety-ninth percentile latency by primitive

The ninety-ninth percentile (p99) latency represents the slowest 1% of requests. Monitoring p99 latency helps you detect tail latency and identify performance outliers that average latency metrics conceal. In interactive AI agent workflows, a slow tool call can block model response generation or cause client timeouts, degrading the end-user experience. Tracking p99 latency per primitive helps you isolate which specific MCP tools experience latency spikes or need timeout tuning.

The following query calculates the ninety-ninth percentile request latency grouped by tool primitive:

histogram_quantile(
  0.99,
  sum by (le, primitive) (
    rate({
      __name__="serviceruntime.googleapis.com/mcp/request_durations_bucket",
      monitored_resource="consumed_mcp_api"
    }[5m])
  )
)

What's next