Get MCP server usage by pull request
curl --request GET \
--url https://api.coderabbit.ai/v1/metrics/mcp \
--header 'x-coderabbitai-api-key: <api-key>'import requests
url = "https://api.coderabbit.ai/v1/metrics/mcp"
headers = {"x-coderabbitai-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-coderabbitai-api-key': '<api-key>'}};
fetch('https://api.coderabbit.ai/v1/metrics/mcp', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.coderabbit.ai/v1/metrics/mcp",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-coderabbitai-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.coderabbit.ai/v1/metrics/mcp"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-coderabbitai-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.coderabbit.ai/v1/metrics/mcp")
.header("x-coderabbitai-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coderabbit.ai/v1/metrics/mcp")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-coderabbitai-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": [
{
"pr_url": "<string>",
"organization_id": "<string>",
"repository_id": "<string>",
"author_id": "<string>",
"merged_at": "2023-11-07T05:31:56Z",
"servers": [
{
"server_name": "<string>",
"insight_count": 123,
"tools": [
{
"tool_name": "<string>",
"call_count": 123
}
]
}
]
}
],
"next_cursor": "<string>"
}MCP server usage
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.
GET
/
v1
/
metrics
/
mcp
Get MCP server usage by pull request
curl --request GET \
--url https://api.coderabbit.ai/v1/metrics/mcp \
--header 'x-coderabbitai-api-key: <api-key>'import requests
url = "https://api.coderabbit.ai/v1/metrics/mcp"
headers = {"x-coderabbitai-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-coderabbitai-api-key': '<api-key>'}};
fetch('https://api.coderabbit.ai/v1/metrics/mcp', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.coderabbit.ai/v1/metrics/mcp",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-coderabbitai-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.coderabbit.ai/v1/metrics/mcp"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-coderabbitai-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.coderabbit.ai/v1/metrics/mcp")
.header("x-coderabbitai-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coderabbit.ai/v1/metrics/mcp")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-coderabbitai-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": [
{
"pr_url": "<string>",
"organization_id": "<string>",
"repository_id": "<string>",
"author_id": "<string>",
"merged_at": "2023-11-07T05:31:56Z",
"servers": [
{
"server_name": "<string>",
"insight_count": 123,
"tools": [
{
"tool_name": "<string>",
"call_count": 123
}
]
}
]
}
],
"next_cursor": "<string>"
}
Use a non-agentic API key to measure which MCP servers and tools contributed context to merged pull requests. Join results to the Metrics Data API using
pr_url; usage counts are best-effort telemetry.
For MCP setup and review behavior, see the MCP Servers documentation.Authorizations
API key for authentication. You can create an API key from the CodeRabbit dashboard.
Headers
Query Parameters
Workspace API keys only; scopes the request to one provider organization.
Comma-separated provider organization IDs. Self-hosted only; maximum 10.
Comma-separated provider repository IDs; maximum 10.
Comma-separated provider PR-author IDs; maximum 10.
Required range:
1 <= x <= 1000Opaque next_cursor from the previous response.
Was this page helpful?