> This page is for version v1 (default).
> For other versions, use one of these documentation indexes:
> - v1 (default): https://docs.rightbrain.ai/v-1/llms.txt

> 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.

# Create Task MCP Server

POST https://app.rightbrain.ai/api/v1/org/{org_id}/project/{project_id}/task_mcp_server
Content-Type: application/json

Register a remote MCP server in this project.

`transport` is `streamable_http` or `sse`. Supplying it registers the server without ever contacting it; omit it and Rightbrain probes the server to detect the transport, which is the only part of registration that needs the server to be reachable. Either way the tools are not read here — register them against the server afterwards, which does contact it.

Authentication is optional: supply `api_key` with `api_key_strategy` and `api_key_header_name` for a key-based server, or complete the OAuth flow above and pass `auth_session_id`. Credentials are stored, never returned.

Reference: https://docs.rightbrain.ai/api-reference/api-reference/connections/agent-mcp-servers/create-task-mcp-server

## Authentication

- `Authorization` header (bearer token, required) — API key or access token, sent as `Authorization: Bearer <token>`. The simplest option: create an API key in your dashboard under Settings, then paste it here.

## Servers

- `https://app.rightbrain.ai/api/v1` (Production, default)
- `https://app.rightbrain.ai/api/v1` (Staging API)
- `https://app.rblocal.dev/api/v1` (Local development)

## Request

### Path parameters

- `org_id` (string, required) — The unique identifier of the organization.
- `project_id` (string, required) — The unique identifier of the project.

### Body (application/json)

This endpoint expects a TaskMcpServerCreate.

- `name` (string, required)
- `server_url` (string, required)
- `description` (string, optional, nullable)
- `enabled` (boolean, optional, default: true)
- `auth_session_id` (string, optional, nullable)
- `api_key` (string, optional, nullable)
- `api_key_strategy` (enum, optional, nullable)
  - Allowed values: `bearer`, `api_key_header`
- `api_key_header_name` (string, optional, nullable)
- `transport` (enum, optional, nullable)
  - Allowed values: `streamable_http`, `sse`

## Response

### 200

The registered MCP server

- `name` (string, required)
- `server_url` (string, required)
- `id` (string, required)
- `canonical_resource` (string, required)
- `transport` (enum, required)
  - Allowed values: `streamable_http`, `sse`
- `auth_state` (enum, required)
  - Allowed values: `connected`, `expired`, `reauth_required`, `none`
- `auth_type` (enum, required)
  - Allowed values: `none`, `oauth`, `api_key`
- `project_id` (string, required)
- `created` (string, required)
- `modified` (string, required)
- `description` (string, optional, nullable)
- `enabled` (boolean, optional, default: true)
- `catalog_server_id` (string, optional, nullable)
- `catalog_server_slug` (string, optional, nullable)
- `auth_state_reason` (enum, optional, nullable)
  - Allowed values: `no_refresh_token`, `token_refresh_failed`, `credentials_rejected`, `server_unreachable`
- `auth_strategy` (enum, optional, nullable)
  - Allowed values: `bearer`, `api_key_header`
- `auth_header_name` (string, optional, nullable)

## Errors

### 400 Bad Request Error

The registration was refused: this user already registered a server with that `name` in the project, `auth_session_id` does not name a live authorization session, or — only when `transport` is omitted — the server could not be probed to detect its transport.

- `detail` (ErrorResponseDetail, required) — A plain error message, a list of field-level validation errors, a service validation error, or a domain error object with `reason` and `message`.

### 401 Unauthorized Error

Unauthorized - Authentication failed **Common causes:** - Missing `Authorization` header - Expired access token - Invalid or malformed token - Using API key in wrong format **Resolution:** Ensure you're including a valid Bearer token or API key in the Authorization header.

- `detail` (ErrorResponseDetail, required) — A plain error message, a list of field-level validation errors, a service validation error, or a domain error object with `reason` and `message`.

### 403 Forbidden Error

Forbidden - Insufficient permissions for project **Common causes:** - Your role lacks the required permission for this action - The project belongs to a different organization or project - The action requires admin or owner privileges **Resolution:** Contact your organization admin to request appropriate access.

- `CreateTaskMcpServerRequestForbiddenError`
  - PermissionCheckFailedErrorResponse: PermissionCheckFailedErrorResponse
  - MissingAuthenticationErrorResponse: MissingAuthenticationErrorResponse

### 409 Conflict Error

Conflict - MCP server already exists

- `detail` (ErrorResponseDetail, required) — A plain error message, a list of field-level validation errors, a service validation error, or a domain error object with `reason` and `message`.

### 422 Unprocessable Entity Error

Unprocessable Entity - Invalid MCP server **Common causes:** - Request is well-formed but violates business rules - Invalid combination of fields (e.g., mutually exclusive options) - Referenced resource doesn't exist or is in wrong state - Field value is valid type but out of acceptable range **Resolution:** Check the error message for specific validation failures and adjust your request.

- `detail` (ErrorResponseDetail, required) — A plain error message, a list of field-level validation errors, a service validation error, or a domain error object with `reason` and `message`.

### 500 Internal Server Error

Internal Server Error - Failed to register the MCP server

- `detail` (ErrorResponseDetail, required) — A plain error message, a list of field-level validation errors, a service validation error, or a domain error object with `reason` and `message`.

### 503 Service Unavailable Error

Redis is not configured for this deployment, so the `auth_session_id` cannot be read and the credentials cannot be attached.

- `detail` (ErrorResponseDetail, required) — A plain error message, a list of field-level validation errors, a service validation error, or a domain error object with `reason` and `message`.

## Types

### ErrorResponseDetail

A plain error message, a list of field-level validation errors, a service validation error, or a domain error object with `reason` and `message`.

- string
- list of ErrorResponseDetailOneOf1Items
- ErrorResponseDetail2
- ErrorResponseDetail3
- ErrorResponseDetail4

### PermissionCheckFailedErrorResponse

- `detail` (PermissionCheckFailedErrorPayload, required) — The error payload.

### MissingAuthenticationErrorResponse

- `detail` (MissingAuthenticationErrorPayload, required) — The error payload.

### ErrorResponseDetailOneOf1Items

- `type` (string, required) — Error type identifier
- `loc` (list of ErrorResponseDetailOneOf1ItemsLocItems, optional) — Path to the error location. Integer segments index into a list.
- `msg` (string, optional) — Human-readable error message. Present on errors produced by FastAPI's own request validation.
- `message` (string, optional) — Human-readable error message. Used instead of `msg` by Rightbrain's own validators.

### ErrorResponseDetail2

Validation error returned by a service after request parsing, such as a Task clone dependency failure.

- `type` ("validation_error", required)
- `errors` (list of ErrorResponseDetailOneOf2ErrorsItems, required)

### ErrorResponseDetail3

Domain error raised via a brain.exc.BaseError subclass. The exact extra field name and shape vary by error type.

- `reason` (string, required) — Machine-readable, upper-snake-case error reason, e.g. RESOURCE_NOT_FOUND, PERMISSION_CHECK_FAILED, TAG_NAME_CONFLICT.
- `message` (string, required) — Human-readable error message

### ErrorResponseDetail4

Integration precondition failure. Uses `code` rather than `reason`, and carries no extra field. Raised by the Gmail trigger routes when the underlying integration is not authorized.

- `code` (string, required) — Machine-readable code, e.g. GMAIL_INTEGRATION_AUTH_REQUIRED.
- `message` (string, required) — Human-readable error message

### PermissionCheckFailedErrorPayload

- `message` (string, required) — Human readable representation of the error
- `reason` (enum, required) — The machine-readable error reason.
  - Allowed values: `PERMISSION_CHECK_FAILED`
- `permissionCheckFailedError` (PermissionCheckFailedErrorDetails, required) — Metadata detailing more information about the error.

### MissingAuthenticationErrorPayload

- `message` (string, required) — Human readable representation of the error
- `reason` (enum, required) — The machine-readable error reason.
  - Allowed values: `MISSING_AUTHENTICATION`
- `missingAuthenticationError` (EmptyErrorDetails, required) — Metadata detailing more information about the error.

### ErrorResponseDetailOneOf1ItemsLocItems

- string
- integer

### ErrorResponseDetailOneOf2ErrorsItems

- `type` (string, required) — Error type identifier
- `loc` (list of ErrorResponseDetailOneOf2ErrorsItemsLocItems, optional) — Path to the error location. Integer segments index into a list.
- `msg` (string, optional) — Human-readable error message. Present on errors produced by FastAPI's own request validation.
- `message` (string, optional) — Human-readable error message. Used instead of `msg` by Rightbrain's own validators.

### PermissionCheckFailedErrorDetails

- `permission` (string, required)
- `subject` (IAMObjectErrorDetails, optional, nullable)
- `resource` (IAMObjectErrorDetails, optional, nullable)

### EmptyErrorDetails

### ErrorResponseDetailOneOf2ErrorsItemsLocItems

- string
- integer

### IAMObjectErrorDetails

- `type` (string, required)
- `id` (string, optional, nullable)

## Examples

**Request**

```json
{
  "name": "docs-search",
  "server_url": "https://docs.rightbrain.ai/mcp",
  "description": "Rightbrain documentation search.",
  "enabled": true,
  "transport": "streamable_http"
}
```

**Response**

```json
{
  "name": "docs-search",
  "server_url": "https://docs.rightbrain.ai/mcp",
  "id": "019dddec-95cf-f920-e103-a11283fe0819",
  "canonical_resource": "https://docs.rightbrain.ai/mcp",
  "transport": "streamable_http",
  "auth_state": "none",
  "auth_type": "none",
  "project_id": "0190a234-9876-5432-10ab-cdef01234567",
  "created": "2026-07-29T09:15:00.000000Z",
  "modified": "2026-07-29T09:15:00.000000Z",
  "description": "Rightbrain documentation search.",
  "enabled": true,
  "catalog_server_id": null,
  "catalog_server_slug": null,
  "auth_state_reason": null,
  "auth_strategy": null,
  "auth_header_name": null
}
```

**SDK Code**

```python Public server over streamable HTTP
import requests

url = "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task_mcp_server"

payload = {
    "name": "docs-search",
    "server_url": "https://docs.rightbrain.ai/mcp",
    "description": "Rightbrain documentation search.",
    "enabled": True,
    "transport": "streamable_http"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Public server over streamable HTTP
const url = 'https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task_mcp_server';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"name":"docs-search","server_url":"https://docs.rightbrain.ai/mcp","description":"Rightbrain documentation search.","enabled":true,"transport":"streamable_http"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Public server over streamable HTTP
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task_mcp_server"

	payload := strings.NewReader("{\n  \"name\": \"docs-search\",\n  \"server_url\": \"https://docs.rightbrain.ai/mcp\",\n  \"description\": \"Rightbrain documentation search.\",\n  \"enabled\": true,\n  \"transport\": \"streamable_http\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Public server over streamable HTTP
require 'uri'
require 'net/http'

url = URI("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task_mcp_server")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"docs-search\",\n  \"server_url\": \"https://docs.rightbrain.ai/mcp\",\n  \"description\": \"Rightbrain documentation search.\",\n  \"enabled\": true,\n  \"transport\": \"streamable_http\"\n}"

response = http.request(request)
puts response.read_body
```

```java Public server over streamable HTTP
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task_mcp_server")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"docs-search\",\n  \"server_url\": \"https://docs.rightbrain.ai/mcp\",\n  \"description\": \"Rightbrain documentation search.\",\n  \"enabled\": true,\n  \"transport\": \"streamable_http\"\n}")
  .asString();
```

```php Public server over streamable HTTP
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task_mcp_server', [
  'body' => '{
  "name": "docs-search",
  "server_url": "https://docs.rightbrain.ai/mcp",
  "description": "Rightbrain documentation search.",
  "enabled": true,
  "transport": "streamable_http"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Public server over streamable HTTP
using RestSharp;

var client = new RestClient("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task_mcp_server");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"docs-search\",\n  \"server_url\": \"https://docs.rightbrain.ai/mcp\",\n  \"description\": \"Rightbrain documentation search.\",\n  \"enabled\": true,\n  \"transport\": \"streamable_http\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Public server over streamable HTTP
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "docs-search",
  "server_url": "https://docs.rightbrain.ai/mcp",
  "description": "Rightbrain documentation search.",
  "enabled": true,
  "transport": "streamable_http"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task_mcp_server")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```