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

# Custom MCP Servers

> Extend Copilot with your own MCP servers - attach customer or vendor tools to your agent and use them safely from chat.

Custom MCPs let you connect Copilot to any external HTTP MCP server you operate or trust - your own internal service, a vendor product, or a partner integration - and expose its tools inside Copilot chat. Every custom tool is namespaced, isolated from Corsa's internal auth, and gated by explicit user approval before it runs.

Use this when you want Copilot to reach data or take actions that live outside Corsa - a data warehouse, an internal ticketing system, a vendor's API - without waiting for a native integration.

## How It Works

1. A platform admin registers a custom MCP server (URL + auth) under **Developers Hub > Agent Configuration**.
2. Corsa tests the connection, discovers the server's tools, and stores an encrypted copy of the auth material.
3. The admin **applies** one or more connections to the Copilot agent config.
4. When a user chats with Copilot, the agent can call any tool from the applied servers - prefixed as `custom__<connection>__<tool>` - and the user must approve each call before it executes.

Custom MCPs are separate from Corsa's own MCP server (`ask_corsa`). One exposes Corsa data to your tools; the other exposes your tools to Copilot. They do not share auth material.

## Adding a Connection

Go to **Agent Configuration > Custom MCPs** and click **Add server**. You will be asked for:

* **Name** - short identifier used in tool names and audit logs. Letters, digits, dashes.
* **URL** - HTTPS endpoint of the MCP server. HTTP is only accepted for local development.
* **Authentication** - `None`, `Headers`, or `OAuth`.

### Headers auth

Add one or more request headers (typically `Authorization: Bearer …` or a vendor-specific API key). Values are treated as secrets - they are stored encrypted, shown as `***` on read, and never logged.

### OAuth auth

Corsa runs a standard **Authorization Code + PKCE** flow against the MCP server's authorization server. Click **Authenticate** on the connection card, complete the flow in the new tab, and Corsa will store the access and refresh tokens. Refreshes happen automatically.

The OAuth server must advertise Protected Resource Metadata (RFC 9728) and Authorization Server Metadata (RFC 8414). Auth0-compatible providers work out of the box.

### JSON view

Prefer configuration-as-data? Toggle to **JSON view** for a Cursor-style `mcp.json` editor. Saving round-trips through the same backend - existing header secrets stay redacted as `***` and are preserved unless you replace them.

## Applying to Your Agent

A registered connection is inert until you apply it. On the agent config page, flip the **Apply to agent** switch for each connection you want Copilot to use. Save. From the next chat onward, Copilot's planner will consider those tools when routing user questions.

Multiple connections can be applied at once. Each server's tools stay namespaced, so name collisions between vendors are safe.

## Using Custom Tools in Chat

When Copilot decides a custom tool is the right call, it stops and asks the user to approve the invocation - showing the tool name, arguments, and target server. Nothing runs until the user approves. Approvals are per-call.

Failures degrade gracefully: if an external server is unreachable, its tools disappear from that chat turn without breaking the rest of Copilot.

## Security Model

* **Header isolation** - only the headers or OAuth token you configured are sent to the external server. Corsa's JWT, `platformId`, `userId`, and request metadata never leave the pod.
* **SSRF protection** - URLs are validated on save, on test, and on every tool call. HTTP is blocked in production, non-standard ports are rejected, and hostnames resolving to private / loopback / link-local ranges (including IPv4-mapped IPv6) are refused.
* **Encryption at rest** - header values and OAuth tokens are encrypted with your platform's KMS key before being written to the database.
* **Approval required** - every custom tool is marked `requireApproval`, so nothing runs without an explicit user click.
* **Audit trail** - every mutation, OAuth event, and approved tool call is emitted as a structured audit event. Payloads never contain header values, tokens, or tool arguments.

## Managing Connections

From the cards view you can:

* **Test** - re-run the discovery + connectivity check. The status badge reflects `lastTestStatus`.
* **Configure** - edit URL, auth, or replace header values. Leaving a header value as `***` keeps the stored ciphertext untouched.
* **Enable / Disable** - flip a connection off without deleting it. Disabled connections are skipped at chat time.
* **Delete** - remove the connection. Any agent that had it applied will silently drop it from its tool list.

## Limitations

* Only HTTP MCP transports are supported. Stdio and websocket servers are not.
* Tools discovered by a custom server must fit within Copilot's tool budget. Very large tool catalogs may be truncated - keep the exposed tool surface focused.
* Custom MCP servers are not available to Corsa's external `ask_corsa` MCP endpoint. They only run inside Copilot chat.

***

Have an MCP server you want to plug in? [Contact support](mailto:support@corsa.finance) or open a ticket with your platform admin.
