Guides

Configure MCP

Connect AI agents to your Monospace workspace through the Model Context Protocol.

Overview

Monospace exposes a Model Context Protocol (MCP) server so AI agents and tools can read and write your data through the same governed API as the rest of your stack. Every tool call runs under the permissions of the API key you connect with — agents can only do what that key is allowed to do.

The MCP server is per workspace. Each workspace has its own endpoint:

https://{your-instance}/api/{workspace}/mcp
PropertyValue
TransportStreamable HTTP (stateless)
MethodPOST only
AuthenticationAuthorization: Bearer <API key> or access_token query parameter
Pass your API key in the Authorization header, as shown below. For clients that accept only a URL and cannot set headers, use the access_token query parameter instead.

Prerequisites

Before connecting a client, you need:

  • An API key — create one in the Studio under Account Settings > Access. The key inherits the permissions of whoever it belongs to — a regular user or a service account — so the agent can only access what they can. See Authentication for details.
  • The ai:mcp entitlement — granted through the role attached to the key's owner. If tools never appear in your client, this is the first thing to check.
  • Your instance host and workspace name — these fill the {your-instance} and {workspace} placeholders in the endpoint URL.
An API key grants the same access as its owner. Scope that owner's role to only what the agent needs, and never commit keys to source control — use an environment variable or your agent's secret store.

Connect Your Client

Every client needs the same three facts: the remote HTTP transport, the per-workspace URL, and the Authorization: Bearer header. Replace the {your-instance} and {workspace} placeholders below with your instance host and workspace name. The server label (monospace in the examples) is an arbitrary name you choose to identify the connection in your client.

Claude Code

Add the server with the claude mcp command:

Claude Code
claude mcp add --transport http monospace https://{your-instance}/api/{workspace}/mcp \
  --header "Authorization: Bearer YOUR_API_KEY"

Or configure it directly in a project-level .mcp.json:

.mcp.json
{
  "mcpServers": {
    "monospace": {
      "type": "http",
      "url": "https://{your-instance}/api/{workspace}/mcp",
      "headers": {
        "Authorization": "Bearer ${MONOSPACE_API_KEY}"
      }
    }
  }
}

Claude Code expands ${MONOSPACE_API_KEY} from your environment, keeping the key out of the file.

Claude Desktop

Claude Desktop's Add custom connector dialog only supports OAuth, so a static API key cannot be entered there yet. Connect it instead through mcp-remote, a local stdio-to-HTTP bridge, in claude_desktop_config.json:

claude_desktop_config.json
{
  "mcpServers": {
    "monospace": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://{your-instance}/api/{workspace}/mcp",
        "--header",
        "Authorization:${AUTH_HEADER}"
      ],
      "env": {
        "AUTH_HEADER": "Bearer YOUR_API_KEY"
      }
    }
  }
}

Splitting the header as Authorization:${AUTH_HEADER} (no space) with the value in env avoids Claude Desktop mishandling the space in the argument. Restart Claude Desktop fully after editing — it reads the config only on launch.

Use a long-lived API key here, not a login access token — Claude Desktop stays connected, and an access token expires within minutes.

Codex

Add the server with the codex mcp add command:

Codex
codex mcp add monospace --url https://{your-instance}/api/{workspace}/mcp \
  --bearer-token-env-var MONOSPACE_API_KEY

--bearer-token-env-var names the environment variable holding your key — Codex sends its value as the Authorization: Bearer token, keeping the key out of the command.

OpenAI

Attach the server as a remote MCP tool. With the Responses API, add an entry to the tools array and pass the key in headers:

Responses API
{
  "type": "mcp",
  "server_label": "monospace",
  "server_url": "https://{your-instance}/api/{workspace}/mcp",
  "headers": {
    "Authorization": "Bearer YOUR_API_KEY"
  },
  "require_approval": "never"
}

With the Agents SDK (Python), use MCPServerStreamableHttp:

Agents SDK
from agents.mcp import MCPServerStreamableHttp

async with MCPServerStreamableHttp(
    name="monospace",
    params={
        "url": "https://{your-instance}/api/{workspace}/mcp",
        "headers": {"Authorization": "Bearer YOUR_API_KEY"},
    },
) as server:
    ...

Gemini CLI

Add the server to .gemini/settings.json with url, and pass the key in headers:

.gemini/settings.json
{
  "mcpServers": {
    "monospace": {
      "url": "https://{your-instance}/api/{workspace}/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}

Cursor

Add the server to ~/.cursor/mcp.json (global) or .cursor/mcp.json (project), with the url and a headers object:

.cursor/mcp.json
{
  "mcpServers": {
    "monospace": {
      "url": "https://{your-instance}/api/{workspace}/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}

Connect a URL-Only Client

Some MCP clients accept only a connection URL and cannot attach an Authorization header. Append the API key as the access_token query parameter — the MCP server accepts it exactly like the header.

https://{your-instance}/api/{workspace}/mcp?access_token=YOUR_API_KEY
A URL with an embedded token lands in browser history, proxy and web-server access logs, and client configuration files. Prefer the Authorization header, use a key scoped to only what the agent needs, and rotate it if the URL is exposed. See Authenticate with a Query Parameter for the full trade-offs.

Provide the token through one source only. Sending both an Authorization header and an access_token query parameter fails with 400 Bad Request.

Available Tools

The server exposes seven tools. Each call is checked against the connecting key's permissions.

ToolDescriptionPermission required
list_itemsQuery items in a collection (filter, sort, paginate)read
create_itemsCreate one or more itemscreate
update_itemUpdate an itemupdate
delete_itemDelete an itemdelete
read_schemaInspect collections, fields, and relationsdataModel:read
read_data_sourcesList configured data sourcesdataModel:read + dataSource:read
mutate_schemaCreate or alter schemadataModel:edit
mutate_schema can alter or drop collections and fields. Grant the dataModel:edit permission only to keys that genuinely need to change schema.

For how permissions are configured, see Access & Permissions. For the underlying data operations, see Reading Data and Writing Data.

Verify the Connection

Send an unauthenticated POST to the endpoint to confirm it is reachable:

curl -s -o /dev/null -w "%{http_code}" \
  -X POST https://{your-instance}/api/{workspace}/mcp

A 403 confirms the server is up and the path is correct — the request is rejected because it is unauthenticated. A 404 means the path is wrong; a connection refused or timeout means the host or port is wrong.

Once configured in your client with an entitled key, the seven tools above should appear in its tool list.

Troubleshooting

  • No tools appear — confirm the credential is present (the Authorization: Bearer header or the access_token query parameter) and the key is valid, and that the key's owner has the ai:mcp entitlement. Missing tools almost always means auth or entitlement, not transport.
  • Wrong URL — the path must be /api/{workspace}/mcp with the correct workspace name. There is no /api/mcp or system-wide MCP endpoint.
  • A tool returns forbidden — the key lacks the permission for that tool (for example, read_schema requires dataModel:read). Create a key whose owner has the needed permissions.
  • 405 Method Not Allowed — the MCP server accepts POST only. Ensure your client uses the streamable-HTTP transport, not SSE.

Next Steps

Copyright © 2026