> ## Documentation Index
> Fetch the complete documentation index at: https://docs.raisegate.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP overview

> The Partner API as a remote Model Context Protocol server.

RaiseGate exposes the Partner API as a remote [Model Context Protocol](https://modelcontextprotocol.io) server, so AI assistants and agents (Claude, Cursor, custom agents) can work with a VC's RaiseGate tracker directly: list and add companies, read signals and alerts, and triage leads.

|                |                                                                                           |
| -------------- | ----------------------------------------------------------------------------------------- |
| Endpoint       | `https://app.raisegate.com/api/mcp`                                                       |
| Transport      | Streamable HTTP (stateless, JSON responses). `POST` only; `GET` and `DELETE` return `405` |
| Authentication | Same API keys as the REST API: `Authorization: Bearer rg_live_...`                        |
| Server name    | `raisegate` (version 1.0.0)                                                               |

## What the connection can do

The MCP server uses exactly the same credentials and rules as `/api/v1`:

* The key decides the organisation. A connection can only see and change that organisation's data.
* Each tool call is checked against the key's scopes. A tool the key is not allowed to use returns a tool error with `insufficient_scope`; the rest keep working. A read-only key (`tracker:read`, `leads:read`) can browse but cannot add, change or track anything.
* Each tool call counts against the key's rate limits (600 reads/min, 120 writes/min, 200 creates or lead tracks/hour, 60 refreshes/hour). Over the limit, the tool returns `rate_limited` with `retryAfterSeconds`.
* A missing, unknown, revoked or expired key is rejected before the MCP handshake with HTTP `401`.

<Warning>
  Draft enrichment (`POST /tracker/enrich`) is deliberately not exposed. It waits up to four minutes, longer than most MCP client timeouts. `add_company` returns in seconds and enriches in the background.
</Warning>

## Server instructions

On connection the server sends instructions that orient the model: what companies, signals, alerts and leads are; that lists are compact; that names can be passed instead of IDs and ambiguity should go back to the user; and that removing, pausing and rejecting need the user's confirmation.

## Example session

A VC asking their assistant "what's new with my portfolio, and anything worth tracking?" typically results in:

<Steps>
  <Step title="Signals worth acting on">
    `list_signals { "needsAttention": true, "since": "2026-09-18" }`
  </Step>

  <Step title="What was emailed">
    `list_alerts { "since": "2026-09-18" }`
  </Step>

  <Step title="The lead inbox">
    `list_leads { "decision": "unreviewed" }`
  </Step>

  <Step title="Decide">
    After the user picks one: `track_lead { "id": "…", "thingsToTrack": "…", "alertEmails": ["…"] }`. After they dismiss another: `decide_lead { "id": "…", "accepted": false }`.
  </Step>
</Steps>

## Implementation

Tools call the service layer directly, not the REST routes over HTTP. Built on `@modelcontextprotocol/sdk` (`McpServer` and `WebStandardStreamableHTTPServerTransport`).

| Path                         | Purpose                                                          |
| ---------------------------- | ---------------------------------------------------------------- |
| `app/api/mcp/route.ts`       | Verifies the key, then serves a stateless MCP server per request |
| `lib/partner-api/mcp.ts`     | Tool definitions, schemas, annotations, instructions             |
| `lib/partner-api/auth.ts`    | Shared with the REST routes                                      |
| `lib/partner-api/service.ts` | The operations every tool calls                                  |

Tested end to end with the official MCP TypeScript client over Streamable HTTP (34 checks), locally and against production.
