> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.rightbrain.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.rightbrain.ai/_mcp/server.

# MCP

> Publish Rightbrain tasks over the Model Context Protocol so MCP clients can discover and call them.

Rightbrain speaks the **Model Context Protocol (MCP)**, the open standard for connecting AI applications to external tools. This page covers the outbound direction: exposing Rightbrain tasks as MCP tools that external clients discover and run.

> **Note**
>
> **Two directions, one protocol.** This page is about exposing Rightbrain *as* an MCP server so tools like Claude and Cursor can call your work. For the other direction, where a Rightbrain agent connects *out* to an external MCP server as a client, see [Connections](/docs/concepts/connections).

```mermaid
flowchart LR
  subgraph server["Rightbrain as server — this page"]
    CL["MCP clients<br />Claude · Cursor · Windsurf"] -- "call your tasks" --> RB["Rightbrain<br />MCP gateway"]
  end
  subgraph client["Rightbrain as client — Connections"]
    RB2["Rightbrain<br />agent or task"] -- "calls external tools" --> EX["External MCP server<br />Notion, your own, …"]
  end
```

## What you get

When you expose a task over MCP, compatible clients can discover and run it as a native tool. Rightbrain runs the task with its configured model, prompt, and schema, then returns the structured result.

| Without MCP                     | With MCP                                   |
| ------------------------------- | ------------------------------------------ |
| Callable only through your app  | Callable from any MCP-enabled client       |
| Requires manual API integration | Discovered automatically by the client     |
| One integration surface         | Reused across every MCP client you connect |

## Expose a task over MCP

A task is served over MCP once it is flagged for agent exposure. Clients authenticate with a bearer credential that resolves to a user with access to the project; an API key is the simplest option for machine clients.

#### Flag the task for exposure

Set the task's `exposed_to_agents` flag. The MCP gateway advertises every exposed task in the project as a callable tool.

#### Choose a bearer credential

Mint or select an API key, or use an OAuth access token. The task runs with the resolved user's project permissions.

#### Connect from your client

Add Rightbrain's gateway URL as an MCP server in any MCP-compatible client (Claude, Cursor, Windsurf). The task appears as a native tool, backed entirely by your Rightbrain configuration.

## The MCP gateway

Under the hood, exposed tasks are served through Rightbrain's MCP gateway over **Streamable HTTP**. Clients that let you add a server by URL connect to the project-scoped gateway endpoint:

```
POST https://app.rightbrain.ai/api/v1/{project_id}/mcp
```

Send the API key or OAuth access token as a bearer credential:

```
Authorization: Bearer <credential>
```

The gateway advertises each enabled task as a tool. Tool calls run the task and stream results back to the client.

## Next steps

#### [Author a task](/docs/concepts/tasks)

Build the task you want to expose as an MCP tool.

#### [Connect to external MCP servers](/docs/concepts/connections)

Let a Rightbrain agent call out to third-party MCP servers.

#### [A2A protocol](/docs/interop/a2a)

Expose a task to other agent frameworks over A2A.

#### [MCP specification](https://modelcontextprotocol.io/)

Read the open standard behind the protocol.