---
title: MCP Observability
description: Monitor Model Context Protocol (MCP) servers deployed on Vercel. Inspect tool calls, error reasons, latency, clients, and traces from the dashboard...
url: "https://vercel.com/docs/observability/mcp"
last_updated: 2026-11-26
related:
  - /docs/observability/observability-plus
  - /docs/tracing
  - /docs/agent-resources/vercel-mcp
  - /docs/tracing/instrumentation
  - /docs/tracing/configure-tracing
install_vercel_plugin: npx plugins add vercel/vercel-plugin
search_with_vercel_cli: npx vercel@latest docs search "<query>"
search_kb_with_vercel_cli: npx vercel@latest kb search "<query>"
---

# MCP Observability

Monitor Model Context Protocol (MCP) servers deployed on Vercel in the **Observability** dashboard and from the Vercel CLI. Track tool call volume, failure reasons, latency, and client usage from standard OpenTelemetry spans, then open matching traces directly from any chart or table row.

MCP Observability is in public beta on Hobby, Pro, and Enterprise plans and does not require [Observability Plus](/docs/observability/observability-plus). It builds on [Vercel Tracing](/docs/tracing). This page covers monitoring MCP servers you deploy on Vercel. To connect an AI agent to Vercel's own MCP server, see [Use Vercel's MCP server](/docs/agent-resources/vercel-mcp).

## Send MCP spans with OpenTelemetry

Vercel recognizes standard OpenTelemetry MCP `SERVER` spans by `mcp.method.name` and reads `gen_ai.tool.name`, `gen_ai.prompt.name`, and `error.type` when present. No Vercel-specific span attributes are required.

On Vercel Functions, this works with `mcp-handler` 2.4.0 or later when you register OpenTelemetry with [`@vercel/otel`](/docs/tracing/instrumentation).

### Set up `mcp-handler`

Starting in version 2.4.0, `createMcpHandler` emits one `SERVER` span per MCP request or notification when your application registers an OpenTelemetry tracer provider.

To instrument a project using `mcp-handler`:

1. Install `mcp-handler` and the OpenTelemetry packages:

**pnpm**

```bash
pnpm i mcp-handler @vercel/otel @opentelemetry/api @opentelemetry/api-logs
```

**yarn**

```bash
yarn add mcp-handler @vercel/otel @opentelemetry/api @opentelemetry/api-logs
```

**npm**

```bash
npm i mcp-handler @vercel/otel @opentelemetry/api @opentelemetry/api-logs
```

**bun**

```bash
bun add mcp-handler @vercel/otel @opentelemetry/api @opentelemetry/api-logs
```

2. Register OpenTelemetry in `instrumentation.ts` at your project root (or in `src/instrumentation.ts` if your Next.js project uses a `src` directory) with `registerMcpOTel()` from `mcp-handler/otel`:

```ts filename="instrumentation.ts"
import { registerMcpOTel } from 'mcp-handler/otel';

export function register() {
  registerMcpOTel();
}
```

`registerMcpOTel()` wraps `registerOTel()` from `@vercel/otel` 2.x, names the service after your Vercel project, and strips raw `User-Agent` and `Referer` attributes from spans. If you already call `registerOTel()`, either keep your existing setup (`mcp-handler` writes spans to any registered tracer provider, though raw `User-Agent` and `Referer` stay on root spans) or replace `registerOTel()` with `registerMcpOTel()` using the same options. Do not call both, because OpenTelemetry ignores the second global tracer provider registration.

> **💡 Note:** If your server already emits custom `SERVER` spans with `mcp.method.name`,
> remove those spans or pass `telemetry: false` to `createMcpHandler` so Vercel
> does not count each MCP message twice.

3. Turn on tracing and add a sampling rule for your MCP route (such as `/mcp` or `/api/mcp`) in [**Settings → Tracing**](https://vercel.com/d?to=%2F%5Bteam%5D%2F%5Bproject%5D%2Fsettings%2Ftracing\&title=Go+to+Tracing+settings). Charts count sampled spans, so set the sampling rate to 100% on your MCP route if you need exact counts. See [Configuring Tracing](/docs/tracing/configure-tracing#turn-on-tracing) for step-by-step instructions.

### Classify tool errors

By default, `mcp-handler` records a tool call that returns `isError: true` as `execution_failure` with `error.type` set to `internal_error`. When a tool knows why it failed, such as an upstream HTTP 403 error, call `experimental_setToolOutcome()` before returning:

```ts filename="app/api/mcp/route.ts"
import { createMcpHandler, experimental_setToolOutcome } from 'mcp-handler';

const handler = createMcpHandler((server) => {
  server.registerTool('list_projects', {}, async (ctx) => {
    const response = await fetch('https://api.example.com/projects');
    if (!response.ok) {
      experimental_setToolOutcome(ctx, {
        outcome: 'api_error',
        errorType: response.status === 403 ? 'forbidden' : 'upstream_error',
      });
      return { isError: true, content: [{ type: 'text', text: 'Failed' }] };
    }
    return { content: [{ type: 'text', text: await response.text() }] };
  });
});
```

`outcome` sets `vercel.rpc.outcome` (the coarse failure class shown in the **Tools** table columns), while `errorType` sets `error.type` (the specific error code shown in **Failed Calls by Reason**). If you omit `errorType`, `mcp-handler` uses the default `error.type` for that outcome:

| `outcome` (`vercel.rpc.outcome`) | When to use it                                         | Default `error.type` (if omitted) |
| -------------------------------- | ------------------------------------------------------ | --------------------------------- |
| `api_error`                      | An upstream API that the tool called failed.           | `api_error`                       |
| `tool_error`                     | The tool failed in an expected way, such as a timeout. | `tool_error`                      |
| `execution_failure`              | The tool raised an unexpected error.                   | `internal_error`                  |
| `request_error`                  | The caller sent an invalid or unsupported request.     | `invalid_request`                 |

### Span attributes

Every MCP message should emit one `SERVER` span. The following table lists the standard OpenTelemetry attributes and optional Vercel attributes that MCP Observability reads:

| Attribute                 | Required         | Description                                                                                                                   |
| ------------------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `mcp.method.name`         | Yes              | MCP method name, such as `tools/call` or `initialize`.                                                                        |
| `gen_ai.tool.name`        | On `tools/call`  | Tool name on `tools/call` spans. Set only for registered tools.                                                               |
| `gen_ai.prompt.name`      | On `prompts/get` | Prompt name on `prompts/get` spans. Set only for registered prompts.                                                          |
| `error.type`              | No               | Short error code on failure, such as `invalid_request`, `rate_limited`, or `forbidden`. Leave unset on success.               |
| `vercel.rpc.client.name`  | No               | Bounded client name, such as `claude`, `cursor`, `codex`, `opencode`, `ai-sdk`, `node`, `python`, `go`, or `other`. Populates **Top Clients** and **Clients**. |
| `vercel.rpc.outcome`      | No               | Outcome override (`success`, `input_required`, `request_error`, `execution_failure`, `api_error`, `tool_error`).              |
| `vercel.rpc.route`        | No               | Bounded label for the MCP endpoint when a project serves multiple endpoints. Defaults to `mcp` in `mcp-handler`.              |
| `vercel.rpc.auth.outcome` | No               | Authentication status (`authorized` or `anonymous`).                                                                          |

`mcp-handler` does not record tool arguments, tool results, error messages, user IDs, or raw user agents. It records tool and prompt names only for registered tools and prompts so callers cannot inject arbitrary names into your metrics.

## Inspect MCP traffic in the dashboard

Open your project's [**Observability → MCP**](https://vercel.com/d?to=%2F%5Bteam%5D%2F%5Bproject%5D%2Fobservability%2Fmcp\&title=Go+to+MCP+Observability) tab to inspect live MCP server traffic.

The dashboard displays five summary panels:

| Panel                      | What it shows                                                                                         |
| -------------------------- | ----------------------------------------------------------------------------------------------------- |
| **Tool Calls**             | Tool call volume over time split into **Succeeded** and **Failed**, with total count and failure rate. |
| **Failed Calls by Reason** | Failed tool calls over time grouped by `error.type` (top four error types plus **Others**).           |
| **Tool Call Latency**      | P50, P75, and P95 tool call duration over time, with P75 and P95 summary values.                      |
| **Top Tools**              | Busiest tools ranked by call volume with each tool's failure rate.                                    |
| **Top Clients**            | Busiest named MCP clients ranked by call volume with each client's failure rate.                      |

Below the charts, switch between four breakdown tables:

- **Tools**: Per-tool call volume, latency, and failure rates split by **API Errors**, **Tool Errors**, **Execution Failures**, **Invalid Requests**, and **Errors**.
- **Errors**: Failed tool calls and MCP messages grouped by tool or method, error type, and outcome, with trend lines.
- **Clients**: Per-client tool call volume, latency, and error rates.
- **Events**: Delivery attempts for MCP Events by event type, showing delivery count, success, retry, gone, and discarded rates, plus P75 latency. Event delivery runs in your own worker, so this table populates when your delivery worker emits an `mcp.event.deliver {eventType}` span per attempt with `vercel.mcp.event.type` and `vercel.mcp.event.outcome` (`accepted`, `retry`, `gone`, or `discarded`).

### Drill into traces

Hover over any chart and select **View Traces** to open [**Traces**](https://vercel.com/d?to=%2F%5Bteam%5D%2F%5Bproject%5D%2Ftraces\&title=Go+to+Traces) pre-filtered to the matching spans. For example, selecting **View Traces** on **Failed Calls by Reason** opens failed MCP tool call spans.

To narrow to a single tool, error type, client, or event type, select its row in **Tools**, **Errors**, **Clients**, or **Events**. Open any span in **Traces** to inspect the full request trace, including infrastructure and outbound fetch spans.

## Query MCP data from the Vercel CLI

Vercel automatically derives the `vercel.rpc.duration_ms` metric from your MCP spans at ingest, so you can query aggregated MCP metrics with [`vercel metrics`](/docs/cli/metrics) and inspect individual MCP spans with [`vercel traces search`](/docs/cli/traces) without Observability Plus.

### Dimensions for `vercel.rpc.duration_ms`

Use these dimensions with `--query` and `--group-by` when querying `vercel.rpc.duration_ms`:

| Dimension     | Description                                                                        |
| ------------- | ---------------------------------------------------------------------------------- |
| `protocol`    | Protocol name (`mcp` for MCP servers).                                             |
| `method`      | MCP method from `mcp.method.name`, such as `tools/call` or `initialize`.           |
| `target`      | Tool or prompt name from `gen_ai.tool.name` or `gen_ai.prompt.name`.               |
| `outcome`     | Call outcome (`success`, `error`, or `vercel.rpc.outcome` when set).               |
| `errorType`   | Error code from `error.type` on failed calls.                                      |
| `clientName`  | Client name from `vercel.rpc.client.name`, when set.                               |
| `route`       | Endpoint label from `vercel.rpc.route`, when set.                                  |
| `authOutcome` | Authentication status from `vercel.rpc.auth.outcome`, when set.                    |

### Query examples

Count MCP tool calls by tool and outcome over the last hour:

```bash filename="terminal"
vercel metrics vercel.rpc.duration_ms \
  --project your_project_name \
  --aggregation count \
  --query 'protocol:"mcp" AND method:"tools/call"' \
  --group-by target --group-by outcome \
  --since 1h
```

Filter to failed tool calls and group by tool and error type:

```bash filename="terminal"
vercel metrics vercel.rpc.duration_ms \
  --project your_project_name \
  --aggregation count \
  --query 'protocol:"mcp" AND method:"tools/call" AND errorType:*' \
  --group-by target --group-by errorType \
  --since 1h
```

Check P75 tool call latency for one client (`claude`):

```bash filename="terminal"
vercel metrics vercel.rpc.duration_ms \
  --project your_project_name \
  --aggregation p75 \
  --query 'protocol:"mcp" AND method:"tools/call" AND clientName:"claude"' \
  --group-by target \
  --since 1h
```

Search individual failed MCP tool call spans from the last hour using Kibana Query Language (KQL):

```bash filename="terminal"
vercel traces search \
  --project your_project_name \
  --kind server \
  --query 'mcp.method.name:"tools/call" AND error.type:*' \
  --since 1h
```

Narrow `vercel traces search` to a specific tool, error type, or client:

```bash filename="terminal"
# Spans for one tool that hit rate_limited
vercel traces search \
  --project your_project_name \
  --kind server \
  --query 'mcp.method.name:"tools/call" AND gen_ai.tool.name:"search_docs" AND error.type:"rate_limited"' \
  --since 1h

# Tool call spans from one MCP client
vercel traces search \
  --project your_project_name \
  --kind server \
  --query 'mcp.method.name:"tools/call" AND vercel.rpc.client.name:"claude"' \
  --since 1h
```

Add `--json` to either command for structured output in scripts and coding agents.

## Pricing and retention

MCP spans are standard Vercel Tracing spans with no separate add-on or Observability Plus requirement. Vercel measures usage in span units, counting indexed spans after sampling:

Plan

Pricing

Hobby

1

million span units included per month

Pro

$0.50

per 1 million span units

Enterprise

Starting at

$0.50

per 1 million span units

An indexed span up to 2 KiB (2,048 bytes) counts as one span unit, and larger spans count in additional 2 KiB increments. On the Hobby plan, Vercel pauses tracing for every project on the team when you use all of the included span units for the usage period. Tracing doesn't resume on its own: after the period ends, someone who can update every project must select **Resume Tracing** in **Settings → Tracing**, or upgrade to Pro to resume right away. See [Usage and pricing](/docs/tracing/configure-tracing#usage-and-pricing) for details.

To stop tracing charges for a project, remove all sampling rules in **Settings → Tracing** (see [Turn off tracing](/docs/tracing/configure-tracing#turn-off-tracing)). To stop collecting only MCP spans while keeping tracing enabled for the rest of the project, pass `telemetry: false` to `createMcpHandler`.

The MCP tab and `vercel.rpc` metrics follow your plan's trace retention window:

| Plan       | Retention |
| ---------- | --------- |
| Hobby      | 3 days    |
| Pro        | 14 days   |
| Enterprise | 14 days   |

## Limitations

- Charts and tables count only sampled spans. Requests dropped by sampling rules or arriving with a not-sampled `traceparent` header are excluded.
- Custom OpenTelemetry spans from functions using the [Edge runtime](/docs/functions/runtimes/edge) are not collected.
- HTTP requests rejected before reaching the MCP server, such as requests rejected by authentication middleware, do not produce MCP spans.
- Values for `mcp.method.name`, `gen_ai.tool.name`, and `gen_ai.prompt.name` must match `^[A-Za-z0-9_.:/ -]{1,128}$` or Vercel groups them under `other`.

## More resources

- [Tracing overview](/docs/tracing)
- [Configuring Tracing](/docs/tracing/configure-tracing)
- [Instrumentation](/docs/tracing/instrumentation)
- [`vercel metrics`](/docs/cli/metrics)
- [`vercel traces`](/docs/cli/traces)
- [`mcp-handler` observability guide](https://github.com/vercel-labs/mcp-handler/blob/main/docs/OBSERVABILITY.md)
- [OpenTelemetry MCP semantic conventions](https://github.com/open-telemetry/semantic-conventions-genai/blob/main/docs/gen-ai/mcp.md)

## Search the docs from your terminal

Search the Vercel docs and read pages as Markdown with the Vercel CLI. No login required.

```bash
# Find docs pages by keyword
npx vercel@latest docs search "environment variables"
npx vercel@latest docs search "function timeout"

# Print a docs page as Markdown, by path or URL
npx vercel@latest docs inspect <page>
```

## Search guides from your terminal

Search the Knowledge Base and read guides as Markdown with the Vercel CLI. No login required.

```bash
# Find guides by keyword
npx vercel@latest kb search "rewrites and redirects"
npx vercel@latest kb search "AI SDK streaming"

# Show the latest guides
npx vercel@latest kb

# Print a guide as Markdown, by slug or URL
npx vercel@latest kb inspect <guide>
```

---

[View full sitemap](/docs/sitemap)


If you encounter incorrect information, can’t find what you need, need a capability Vercel doesn’t currently offer, or have any other feedback to report, please do it by following the instructions at https://vercel.com/feedback.md.
