MCP Server

The Model Context Protocol (MCP) server allows AI tools and LLMs to interact withRepo Cat programmatically.

Introduction

The Model Context Protocol (MCP) is an open standard that enables AI assistants to interact with external systems.Repo Cat provides an MCP server that exposes tools, resources, and prompts for repository analysis.

With the MCP server, AI tools like Claude, GPT, and others can trigger scans, retrieve results, manage settings, and more — all through a standardized protocol.

Server Name: repo-cat-mcp
Version: 1.0.0
Transport: Streamable HTTP (Stateless)

Authentication

The MCP server uses the same API key authentication as the REST API. You must include a valid API key with each request.

Authentication Methods

  • Header: Authorization: Bearer <api-key> (recommended for MCP clients)
  • Legacy Header: x-api-key: <api-key> (backward compatibility)
  • Query Parameter: ?apiKey=<api-key>

Stateless Mode

The MCP server operates in stateless mode. Each request creates a new transport instance with no session persistence. The user context (userId) is extracted from the API key and passed to tools via the request context.

Endpoint

The MCP server is available at the following endpoint:

https://repocat.cloud/mcp

Transport Details

PropertyValue
TransportStreamable HTTP
SessionStateless (no session persistence)
MethodPOST (Streamable HTTP)
Content-Typeapplication/json

Tools

The MCP server exposes 9 tools for interacting with Repo Cat. All tools require authentication.

trigger_scan

Trigger a new repository scan (async)

ParameterTypeDescription
repostringGitHub repository in format "owner/repo"
levelstring"basic", "standard", or "deep"
referencestringBranch or tag to scan (optional)

get_scan

Get scan details by ID

ParameterTypeDescription
scanIdnumberThe ID of the scan to retrieve

list_scans

List user's scans with filtering

ParameterTypeDescription
pagenumberPage number for pagination
statusstringFilter by status (optional)
levelstringFilter by scan level (optional)

cancel_scan

Cancel an in-progress scan

ParameterTypeDescription
scanIdnumberThe ID of the scan to cancel

delete_scan

Delete a scan by ID

ParameterTypeDescription
scanIdnumberThe ID of the scan to delete

get_scan_pdf

Generate and retrieve PDF report (returns base64-encoded PDF)

ParameterTypeDescription
scanIdnumberThe ID of the scan for PDF generation

get_user_info

Get current user details and subscription

No parameters required

get_settings

Retrieve user settings

No parameters required

update_settings

Update user settings

ParameterTypeDescription
email_notifications_enabledbooleanEnable email notifications (optional)
email_on_scan_startedbooleanReceive email when scan starts (optional)
email_on_scan_completedbooleanReceive email when scan completes (optional)
email_on_scan_failedbooleanReceive email when scan fails (optional)
email_on_scan_cancelledbooleanReceive email when scan is cancelled (optional)
webhook_enabledbooleanEnable webhook notifications (optional)
webhook_urlstringWebhook URL for notifications (optional)
webhook_on_scan_startedbooleanTrigger webhook when scan starts (optional)
webhook_on_scan_completedbooleanTrigger webhook when scan completes (optional)
webhook_on_scan_failedbooleanTrigger webhook when scan fails (optional)
webhook_on_scan_cancelledbooleanTrigger webhook when scan is cancelled (optional)

Resources

Resources provide access to data entities. The MCP server exposes one resource for accessing scan results.

URIDescription
scan://{scanId}Full scan result with metadata, heuristics, and analysis

Example: Accessing a Scan Resource

// Access scan resource via MCP
const result = await client.readResource({
  uri: 'scan://123',
});

console.log(result.contents[0].text);

Prompts

Prompts are guided templates that help AI tools perform complex tasks. The MCP server provides a prompt for analyzing repositories.

analyze-repo

Guided prompt template that helps AI tools analyze a GitHub repository by triggering a scan and polling for results.

When an AI tool uses this prompt, it guides the assistant through:

  • Calling the trigger_scan tool to start a scan
  • Polling the get_scan tool to check progress
  • Providing a comprehensive summary once complete

Opencode Integration

Opencode is an AI-powered coding assistant that supports connecting to custom MCP servers via its configuration file. You can add Repo Cat's MCP server to Opencode to trigger scans, retrieve results, and manage settings directly from your terminal.

Configuration

Add the following entry to your Opencode config file (located at ~/.config/opencode/opencode.jsonc for global availability, or a project-level opencode.jsonc):

{
  "mcp": {
    "repo-cat": {
      "type": "remote",
      "url": "https://repocat.cloud/mcp",
      "headers": { "Authorization": "Bearer <your-api-key>" }
    }
  }
}

Getting an API Key

Generate an API key from the Dashboard > API Key Management section. Use it in place of <your-api-key> in the config above.

Restart Required

Opencode loads its configuration once at startup and does not hot-reload. After saving the config change, quit and restart Opencode for the MCP server to be picked up.

Available Capabilities

Once connected, Opencode automatically discovers all tools, resources, and prompts exposed by the server. You can use them in chat like any other Opencode tool:

  • trigger_scan — Start a new repository scan
  • get_scan — Check scan status by ID
  • get_scan_pdf — Download a PDF report
  • list_scans — List your recent scans
  • cancel_scan — Cancel an in-progress scan
  • delete_scan — Delete a completed or failed scan
  • get_user_info — View account and subscription details
  • get_settings / update_settings — Manage preferences

For the full list of available tools and their parameters, see the Tools section above.

Example Usage

Connect to the MCP server using the official MCP SDK.

JavaScript: Connecting with MCP SDK

import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';

const transport = new StreamableHTTPClientTransport(
  new URL('https://repocat.cloud/mcp'),
  { headers: { Authorization: 'Bearer <your-api-key>' } }
);

const client = new Client(
  { name: 'example-client', version: '1.0.0' },
  { capabilities: {} }
);

await client.connect(transport);

// Call a tool
const result = await client.callTool({
  name: 'trigger_scan',
  arguments: {
    repo: 'facebook/react',
    level: 'standard',
  },
});

console.log(result);

cURL: Calling a Tool Directly

You can also call MCP tools directly using cURL with JSON-RPC:

curl -X POST "https://repocat.cloud/mcp" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-api-key-here" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "trigger_scan",
      "arguments": {
        "repo": "facebook/react",
        "level": "standard"
      }
    }
  }'

Use Case: AI Repository Analysis

An AI tool can use the analyze-repo prompt to analyze a repository:

  1. AI loads the analyze-repo prompt
  2. Prompt guides AI to call trigger_scan with repo details
  3. AI polls get_scan to check scan status
  4. Once complete, AI reads the scan://{scanId} resource
  5. AI provides a comprehensive analysis to the user
API Reference - For REST API documentation instead of MCP