Connect CodeRabbit to Claude: Monitor security and audit logs
Learn how to connect CodeRabbit to Claude using a managed MCP server. Execute security deep scans, audit roles, and automate bulk license assignments with AI.
If your team needs to connect CodeRabbit to Claude to monitor deep scan security findings, audit user permissions, or aggregate PR review metrics, you need a Model Context Protocol (MCP) server. This server acts as the translation layer between Claude's LLM function calling capabilities and CodeRabbit's REST API. You can either build, host, and maintain this infrastructure yourself, or use a managed integration platform like Truto to dynamically generate a secure, authenticated MCP server URL.
If your team uses ChatGPT, check out our guide on /connect-coderabbit-to-chatgpt-manage-seats-and-analyze-reviews/ or explore our broader architectural overview on /connect-coderabbit-to-ai-agents-sync-roles-and-code-learnings/.
Giving a Large Language Model (LLM) read and write access to a core code review and security tool like CodeRabbit is an engineering challenge. You have to handle API key scopes, map highly nested finding schemas to MCP tool definitions, and deal with telemetry endpoints that require strict date windowing. Every time CodeRabbit updates an endpoint or adds new reachability evidence to a scan, you have to update your server code, redeploy, and test the integration.
This guide breaks down exactly how to use Truto to generate a secure, managed MCP server for CodeRabbit, connect it natively to Claude Desktop, and execute complex security and audit workflows using natural language.
The Engineering Reality of the CodeRabbit API
A custom MCP server is essentially a self-hosted integration layer. While the open MCP standard provides a predictable way for models to discover tools, the reality of implementing it against specialized B2B APIs is painful. CodeRabbit is built to analyze code logic, generate complex learnings, and manage enterprise seat assignments. Its API reflects that complexity.
If you decide to build a custom CodeRabbit MCP server, here are the specific integration challenges you will face:
Deep Scan Findings and Call Stack Schemas
CodeRabbit's security findings are not flat records. The list_all_code_rabbit_security_code_findings operation returns deeply nested JSON objects containing reachability evidence and execution call stacks. Exposing this directly to an LLM without strict schema definitions will lead to hallucinations, as the model will struggle to differentiate between a finding's description and the underlying code context. Your MCP server must accurately map these nested arrays into a strictly typed JSON Schema so Claude knows exactly how to interpret the payload.
API Key Scoping and Seat Assignment Complexity
Authentication in CodeRabbit changes how operations behave. Workspace-scoped API keys return data across every active organization in the workspace, while Organization-scoped keys return only bound organization data. This becomes particularly tricky when executing bulk operations like code_rabbit_seats_bulk_assign. If authenticated via a Workspace key, the API expects seat assignments by email or internal cr_user_id. If using Organization keys, it expects the identity provider's user_ids. Your MCP server must provide context to the LLM on which payload structure to use based on the current auth context, otherwise bulk updates will silently fail.
Strict Telemetry Date Windowing
When querying metrics using operations like list_all_code_rabbit_review_metrics or list_all_code_rabbit_review_comments, CodeRabbit requires explicit start_date and end_date parameters. Unlike typical pagination where you can cursor through history, these endpoints aggregate data dynamically over the requested window. An LLM must be explicitly instructed on how to format these UTC date strings, requiring tightly defined query_schema properties injected into the tool description.
Generating a Managed MCP Server for CodeRabbit
Instead of building a JSON-RPC router from scratch, managing token state, and manually translating CodeRabbit API schemas into MCP tool definitions, you can use Truto. Truto dynamically generates an MCP server for any connected integration based on its underlying API documentation and resources.
There are two ways to generate an MCP server for CodeRabbit using Truto.
Method 1: Via the Truto UI
This is the fastest method for internal tooling and immediate testing.
- Connect your CodeRabbit account via the Truto dashboard using your API key.
- Navigate to the Integrated Account page for your CodeRabbit connection.
- Click the MCP Servers tab.
- Click Create MCP Server.
- Select your desired configuration (e.g., restrict to
readmethods only, or filter by specific tags likesecurity). - Copy the generated MCP server URL. (It will look like
https://api.truto.one/mcp/a1b2c3d4...)
Method 2: Via the Truto API
For teams building multi-tenant AI products, you can generate MCP servers programmatically. When you issue this request, Truto validates the configuration, generates a secure, hashed token in its edge KV storage, and returns a ready-to-use endpoint.
Make a POST request to /integrated-account/:id/mcp:
curl -X POST https://api.truto.one/api/integrated-account/YOUR_ACCOUNT_ID/mcp \
-H "Authorization: Bearer YOUR_TRUTO_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "CodeRabbit Security Auditor",
"config": {
"methods": ["read", "custom"],
"tags": ["security", "audit"]
},
"expires_at": "2026-12-31T23:59:59Z"
}'This returns a secure payload containing the URL you will pass to your MCP client.
Connecting the MCP Server to Claude
Once you have your Truto MCP server URL, you need to connect it to Claude. Because Truto MCP URLs encode the authentication token directly in the path, no additional complex configuration is required. You can connect it via the UI or a configuration file.
Method A: Via the Claude UI
- Open the Claude Desktop app or Web interface.
- Navigate to Settings → Integrations (or Connectors depending on your tier).
- Click Add MCP Server or Add custom connector.
- Paste the Truto MCP URL.
- Click Add. Claude will automatically perform the JSON-RPC initialization handshake and load the CodeRabbit tools.
(Note: If your team uses ChatGPT, the process is similar: Settings → Apps → Advanced settings → Enable Developer mode → Add custom connector).
Method B: Via the Claude Configuration File
If you prefer to configure Claude Desktop locally (or are running a headless agent framework), you can edit the claude_desktop_config.json file. Truto provides an SSE (Server-Sent Events) transport utility for this.
Add the following to your configuration file:
{
"mcpServers": {
"coderabbit": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-sse",
"https://api.truto.one/mcp/YOUR_GENERATED_TOKEN"
]
}
}
}Restart Claude Desktop, and the CodeRabbit tools will appear in the UI.
Hero Tools for CodeRabbit Security & Ops
Truto automatically derives tool definitions from CodeRabbit's endpoint documentation, creating descriptive snake_case names and flat argument schemas that LLMs can easily parse. Here are the highest-leverage tools available for AI agents.
list_all_code_rabbit_security_code_findings
Retrieves Deep Scan code findings for the repositories in scope. This includes saved reachability evidence (call stacks) and explanations. Crucial for security triage.
"Claude, list all open security code findings for repository ID 98765. Summarize any findings with critical severity and explain the call stack reachability."
list_all_code_rabbit_audit_logs
Lists CodeRabbit audit log entries, returning timestamps, actor IDs, and actions taken. Vital for compliance tracking and SOC 2 evidence gathering.
"Pull the audit logs for the last 7 days and identify if any users had their custom roles changed or modified."
code_rabbit_seats_bulk_assign
Bulk assigns or unassigns CodeRabbit seats for up to 500 users at once. Handles the complex provider mapping required by the API.
"Unassign CodeRabbit seats for the following provider user IDs: user_123, user_456, and assign a new seat to user_789. Let me know the success status for each."
list_all_code_rabbit_review_metrics
Aggregates PR review metrics over a specific date range, providing data on review iterations, estimated review minutes, and accepted vs. posted comments.
"Get the review metrics for our organization between 2026-10-01 and 2026-10-31. Calculate the average estimated review minutes per merged PR."
list_all_code_rabbit_roles
Lists all built-in and Enterprise custom roles for the authenticated organization, including their exact permission access types.
"List all active roles in CodeRabbit and tell me which ones have 'learning:write' permissions."
create_a_code_rabbit_report
Generates a report within CodeRabbit by invoking the report.generate operation.
"Generate a CodeRabbit review summary report for the backend team covering the Q3 release cycle."
For the complete inventory of available tools, query parameters, and body schemas, visit the CodeRabbit integration page.
Workflows in Action
When Claude has access to these tools, it can chain them together to execute complex, multi-step operations that would normally require manual dashboard navigation or custom scripts.
Scenario 1: Automated Security Triage and Audit
A DevSecOps engineer asks Claude to evaluate recent code vulnerabilities and correlate them with administrative changes.
"Pull the latest security code findings for our main repo. If there are any high-severity issues, check the audit logs from the past 48 hours to see if any custom roles were modified that might relate to the PR authors."
How the agent executes this:
- Calls
list_all_code_rabbit_security_code_findingsfiltering by the targetrepo_idandstate=open. - Parses the JSON response, specifically looking at the severity flags and reachability evidence.
- Identifies high-severity issues and the associated PR authors.
- Calls
list_all_code_rabbit_audit_logsto retrieve the recent administrative history. - Correlates the data and returns a natural language summary to the engineer, warning them if suspicious role changes coincided with vulnerable code merges.
sequenceDiagram
participant Dev as DevSecOps
participant Claude as Claude
participant Truto as Truto MCP Server
participant CodeRabbit as CodeRabbit API
Dev->>Claude: "Pull findings and check audit logs..."
Claude->>Truto: call list_all_code_rabbit_security_code_findings
Truto->>CodeRabbit: GET /api/v1/findings
CodeRabbit-->>Truto: { findings: [...] }
Truto-->>Claude: JSON-RPC Result
Claude->>Truto: call list_all_code_rabbit_audit_logs
Truto->>CodeRabbit: GET /api/v1/audit-logs
CodeRabbit-->>Truto: { logs: [...] }
Truto-->>Claude: JSON-RPC Result
Claude-->>Dev: "Found 2 critical issues. No suspicious role changes detected."Scenario 2: End-of-Month License and Productivity Review
An Engineering Manager wants to optimize seat allocation based on actual PR review activity.
"Get the review metrics for October. Identify any users who had zero review iterations. Then, remove their CodeRabbit seat assignments to free up licenses."
How the agent executes this:
- Calls
list_all_code_rabbit_review_metricsusing explicitstart_dateandend_dateparameters for October. - Iterates through the returned PR data to map author IDs against review iterations.
- Identifies authors with zero review iterations.
- Calls
code_rabbit_seats_bulk_assignpassingaction: "unassign"and the array of identifieduser_ids. - Reports back to the manager with the number of licenses freed and the success status from the bulk operation.
flowchart TD
A["User Prompt<br>(Optimize licenses)"] --> B["Claude Engine"]
B -->|call: review metrics| C["Truto MCP Server"]
C -->|GET| D["CodeRabbit API"]
D -->|Metrics Payload| C
C -->|JSON-RPC| B
B -->|Analyze active users| E["Identify Inactive IDs"]
E -->|call: bulk unassign| C
C -->|POST| D
D -->|Success Status| C
C -->|JSON-RPC| B
B --> F["Final Output<br>(Seats unassigned)"]Security and Access Control
Exposing an enterprise security tool like CodeRabbit to an LLM requires strict boundary controls. Truto enforces access at the server generation level, ensuring the agent cannot overstep its boundaries.
- Method Filtering: You can restrict an MCP server to strictly read-only operations by passing
config.methods: ["read"]. The LLM will only seegetandlistoperations, physically preventing it from altering seat assignments or custom roles. - Tag Filtering: If you only want the agent handling security data, you can pass
config.tags: ["security"]. Truto will filter out unrelated tools (like billing or general repo management) at generation time. - Mandatory API Token Auth: For high-security deployments, setting
require_api_token_auth: truemeans possession of the MCP URL is not enough. The client must also pass a valid Truto API token in theAuthorizationheader to execute tools. - Automated Expiration: You can pass an
expires_atISO datetime when creating the server. Truto's durable object alarm system will automatically permanently delete the token and KV entries at the exact moment of expiration, perfect for temporary audit access.
Handling Rate Limits in Production
When automating workflows, an AI agent can quickly fire off multiple requests to CodeRabbit's API. It is critical to understand how this is handled at the network layer.
Truto does not retry, throttle, or apply backoff on rate limit errors. When CodeRabbit returns an HTTP 429 Too Many Requests response, Truto passes that error directly back to the caller (your MCP client) via the JSON-RPC error format.
However, Truto normalizes upstream rate limit information into standardized IETF headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset). This transparent passthrough ensures that the calling agent or framework retains full control over the backoff strategy. You are responsible for implementing retry logic in your orchestration layer; do not expect the MCP server to silently absorb rate limit failures.
Moving Forward
Connecting CodeRabbit to Claude via a managed MCP server turns a static code review tool into an interactive, agentic security platform. Instead of navigating dashboards to audit roles, pull telemetry, or triage deep scan findings, engineers can converse directly with the data using natural language.
By leveraging Truto's documentation-driven tool generation, you bypass the friction of writing JSON-RPC handlers, mapping complex payload schemas, and managing integration lifecycle debt. Your agents get immediate, strictly-typed access to CodeRabbit's capabilities, secured by explicit method filtering and time-bound tokens.
FAQ
- How do I create a CodeRabbit MCP server in Truto?
- You can create it via the Truto UI by navigating to the Integrated Account, selecting the MCP Servers tab, and clicking Create. Alternatively, you can use the API by making a POST request to /integrated-account/:id/mcp with your desired configuration.
- Can I restrict the Claude agent to read-only CodeRabbit operations?
- Yes. When generating the MCP server in Truto, you can apply method filtering by setting config.methods to ["read"]. This ensures the LLM only sees non-destructive tools and cannot alter roles or seat assignments.
- How does Truto handle CodeRabbit API rate limits?
- Truto does not retry or throttle rate limits. If CodeRabbit returns a 429 error, Truto passes it directly to the caller while normalizing the rate limit data into standard IETF headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset). Your application is responsible for the retry logic.
- Do I need to manually define the MCP tools for CodeRabbit?
- No. Truto dynamically generates the MCP tools (including descriptions, query schemas, and body schemas) directly from CodeRabbit's API documentation, ensuring accurate and up-to-date schema definitions.