---
title: "Get MCP server usage by pull request"
method: GET
path: "/v1/metrics/mcp"
tags: ["Metrics"]
---

# Get MCP server usage by pull request

`GET /v1/metrics/mcp`

## Request

- Base URL: `https://api.coderabbit.ai`
- URL: `https://api.coderabbit.ai/v1/metrics/mcp`
- Auth: API key in header `x-coderabbitai-api-key`

Returns one JSON row per merged, reviewed pull request that used MCP, with MCP servers and tools nested under servers. Join to GET /v1/metrics/reviews on pr_url. Counts are best-effort usage telemetry. Access is controlled by an organization-scoped feature flag. Pagination is in write order rather than by merge date, so a pull request written after your cursor already passed its merge date (a backfill) still appears on a later page instead of being silently skipped. Each page request consumes one token when admitted by the request rate limiter. Reviews, review comments, and MCP share the Metrics quota for the configured quota owner. With verified owner scope, coordinate calls across API keys for the same organization, workspace, or Git-provider instance; changing an organization selector does not add quota.

## Query parameters

- `org_id` string
- `start_date` string, date, required
- `end_date` string, date, required
- `organization_ids` string
- `repository_ids` string
- `user_ids` string
- `limit` integer
- `cursor` string

## Headers

- `x-coderabbitai-api-key` string, required

## Response `200`

MCP server usage for merged pull requests

- object
  - `data` object[], required
    - `pr_url` string, required
    - `organization_id` string, required
    - `repository_id` string, required
    - `author_id` string, nullable, required
    - `merged_at` string, date-time, required
    - `servers` object[], required: MCP servers used during the review.
      - `server_name` string, required: Most recently recorded MCP server name for this PR, or the current connection name/internal ID for historical rows without a snapshot.
      - `insight_count` integer, required: Best-effort count of review insights that cited this server as a source.
      - `tools` object[], required
        - `tool_name` string, required: Original MCP tool name when recorded; historical rows may contain the previously stored agent-facing name.
        - `call_count` integer, required: Recorded calls for this tool.
  - `next_cursor` string, nullable, required

## Other responses

- `400`: Invalid query parameters, or the response exceeds 16 MB (RESPONSE_TOO_LARGE). Add filters or reduce the limit.
- `401`: Unauthorized - invalid or missing API key
- `403`: Forbidden - Enterprise plan required or agentic key not allowed
- `404`: No matching organization exists
- `429`: Request rate limit exceeded (RATE_LIMIT_EXCEEDED), active metrics query capacity reached (METRICS_BUSY), or an identical authorized query is still running (METRICS_QUERY_IN_PROGRESS). Wait at least the full Retry-After interval after receiving the response, then retry the same cursor and query parameters. Do not advance the cursor on an error. Other calls sharing the quota can cause another rejection after the wait. X-RateLimit headers are present only for RATE_LIMIT_EXCEEDED, not for the other 429 errors.
- `500`: Internal server error
- `503`: Metrics are preparing (METRICS_PREPARING), active-query admission cannot safely proceed (METRICS_UNAVAILABLE), or API quota custody cannot be proved (POLICY_SCOPE_UNAVAILABLE). Retry the same request after Retry-After when present; otherwise retry later.

## Changes

- **2026-11-06** `a9e20f8748a9`: 2 info
  - added the media type `application/json` for the response with the status `429`
  - added the media type `application/json` for the response with the status `503`
- **2026-09-23** `9bc9920c014e`: 1 info
  - added the non-success response with the status `503`
- **2026-08-31** `342932e3f001`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/coderabbit/apis/coderabbit-api-spec/changes/v1/metrics/mcp/get.md)

---

[API](https://skmtc.dev/coderabbit/apis/coderabbit-api-spec.md) - [All operations](https://skmtc.dev/coderabbit/apis/coderabbit-api-spec/llms.txt) - [OpenAPI document](https://skmtc.dev/coderabbit/apis/coderabbit-api-spec/revisions/a9e20f8748a9?raw)
