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

# MCP Server

> Connect AI assistants to your Twenty workspace using the Model Context Protocol.

## Overview

Twenty exposes an [MCP](https://modelcontextprotocol.io/) server so that AI assistants — Claude Desktop, Claude Code, Cursor, ChatGPT, and others — can read and write your CRM data through natural language.

Use your **workspace URL** (the URL you use to access Twenty) as the MCP endpoint. On Twenty Cloud, your workspace URL might be `https://{mycompany}.twenty.com` or a custom domain. The server is available at:

| Environment | MCP Endpoint |
| - | - |
| **Cloud** | `https://{your-workspace-url}/mcp` (e.g. `https://mycompany.twenty.com/mcp`) |
| **Self-Hosted** | `https://{your-domain}/mcp` |

The endpoint speaks MCP protocol `2026-07-28` and the earlier revisions back to `2024-11-05` over Streamable HTTP. Clients on `2026-07-28` call `server/discover` and send each request on its own; older clients start with `initialize` as before.

## Authentication Methods

You have two ways to authenticate your MCP client: **OAuth** (recommended) or **API Key**.

### Option A — OAuth (Recommended)

With OAuth, your MCP client opens a browser window for you to log in. No secrets are stored in config files, and tokens refresh automatically.

> [!NOTE]
>
> OAuth requires an MCP client that supports the [MCP Authorization specification](https://modelcontextprotocol.io/specification/2025-03-26/basic/authorization). Claude Desktop, Claude Code, Cursor, and ChatGPT support it.

Add this to your MCP client configuration, replacing `{your-workspace-url}` with your workspace host (e.g. `mycompany.twenty.com`):

```json theme={null}
{
  "mcpServers": {
    "twenty": {
      "type": "streamable-http",
      "url": "https://{your-workspace-url}/mcp"
    }
  }
}
```

That's it — no API key needed. When the client connects for the first time it will:

1. Discover Twenty's OAuth metadata via `/.well-known/oauth-protected-resource` and `/.well-known/oauth-authorization-server`
2. Register itself as an OAuth client via dynamic client registration (RFC 7591)
3. Open your browser to authorize access
4. Receive tokens and connect to the MCP server

Subsequent connections reuse the stored tokens and refresh them automatically.

### Option B — API Key

If your MCP client does not support OAuth, or you prefer static credentials, pass an API key in the `Authorization` header:

```json theme={null}
{
  "mcpServers": {
    "twenty": {
      "type": "streamable-http",
      "url": "https://{your-workspace-url}/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}
```

> [!WARNING]
>
> Your API key grants access to workspace data. Keep it out of version control and shared dotfiles.

To create an API key, go to **Settings → Developers → API → Create API key**. See [APIs](https://docs.twenty.com/developers/extend/api.md#create-an-api-key) for details.

## Quick Start

### 1. Copy the config

Go to **Settings → AI → MCP** in Twenty. Choose your authentication method (OAuth or API Key), copy the JSON snippet (it will already use your workspace URL), and paste it into your MCP client's config file.

| Client | Config file location |
| - | - |
| **Claude Desktop** | `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows) |
| **Claude Code** | `~/.claude.json` (user) or `.mcp.json` (project) |
| **Cursor** | `.cursor/mcp.json` in your project, or `~/.cursor/mcp.json` globally |
| **ChatGPT** | Turn on Developer Mode in **Settings → Apps & Connectors → Advanced settings**, then use **Create** in **Settings → Apps & Connectors** to add the MCP server |

### 2. Connect

Restart your MCP client (or reload the config). If using OAuth you will be redirected to Twenty to authorize access. If using an API key the connection is immediate.

### 3. Start using it

Ask your AI assistant to interact with your CRM:

* *"Show me the 5 most recently created companies"*
* *"Create a new person named Jane Doe at Acme Corp"*
* *"Find all open opportunities worth more than \$10k"*

## Available Tools

Once connected, the MCP server lists the same tools in every workspace:

* **Record tools** take the object as an argument: `find_records`, `group_records`, `create_records`, `update_record`, `update_records`, `upsert_records`, `delete_records` and `merge_records`. For example, `find_records({ objectName: "company", select: ["name"] })`. To find a record by name, `search_records` searches every object you can read at once, as the search bar does: `search_records({ query: "acme" })`.
* **Discovery tools** tell the assistant what your workspace contains: `get_workspace_schema` describes every object you can read, with its fields, relations and select values, in one call. `list_object_metadata_names` lists objects and `get_field_metadata` the fields of one object.
* **Metadata tools** to read and change the data model, such as `get_object_metadata` or `create_field_metadata`.
* **Every other built-in tool**, each listed with its input schema: workflows, dashboards, views, navigation, webhooks, roles, agents, front components, and email, calendar and file tools.
* **Skills and help**: `list_skills`, `load_skills` and `search_help_center`.

Because the list does not depend on your objects, it stays valid for clients that store it, such as apps published in a directory. Which of these tools you see still depends on your role.

The functions of your installed apps and the tools of MCP servers you connected to Twenty differ per workspace, so this list leaves them out. Use direct mode to reach them.

The list holds about a hundred tool definitions. Clients that load tools on demand, as Claude, Claude Code, Codex and ChatGPT do by default, handle it well. A client that loads every tool definition up front can use a large part of its context: connect it to meta mode instead.

### Direct mode

Connect to `/mcp?mode=direct` to list one tool per object and operation instead, each with the exact input schema of that object: `find_many_companies`, `create_one_person`, and several hundred more. Direct mode also lists the other built-in tools, the functions of your installed apps and the tools of your connected MCP servers. Tools for objects created while you are connected appear after reconnecting.

This needs a client that loads tools on demand, as Claude, Claude Code, Codex and OpenCode do by default. A client that loads every tool definition up front, including Claude Code with tool search turned off, can run out of context.

### Meta mode

Connect to `/mcp?mode=meta` to list only a few meta-tools, which reach every tool, including app functions and connected MCP servers:

1. **`learn_tools`** — get the input schema for specific tools
2. **`execute_tool`** — run a tool

Meta mode also lists `get_workspace_schema`, `search_records` and the skills and help tools directly.

Record operation names follow a grammar, so an assistant can build them without a discovery call: `find_many_companies`, `find_one_person`, `update_one_opportunity`. If a name is wrong, `learn_tools` reports it under `notFound` along with the closest matching names.

For anything else, `get_tool_catalog` browses the remaining tools one category at a time. It is a fallback: an unfiltered call returns hundreds of operations and most assistants will truncate the response.

## Permissions

MCP connections inherit the permissions of the authenticated user (OAuth) or the role assigned to the API key. To restrict what the MCP server can do:

* **OAuth**: The user's workspace role applies.
* **API Key**: Assign a role to the API key under **Settings → Members → Roles**. See [Permissions](https://docs.twenty.com/user-guide/permissions-access/capabilities/permissions.md).

## Self-Hosted Configuration

For self-hosted instances, replace `{your-workspace-url}` with your server URL. Make sure `SERVER_URL` in your environment matches the public URL of your Twenty instance — this is used to generate the OAuth discovery metadata.

```bash theme={null}
SERVER_URL=https://twenty.yourcompany.com
```

The MCP endpoint, OAuth endpoints, and discovery metadata all derive from this value.

## Troubleshooting

**"Unauthorized" or 401 errors**

* OAuth: re-authorize by clearing the stored tokens in your MCP client and reconnecting.
* API Key: verify the key is valid and hasn't expired. Regenerate it if needed.

**OAuth flow doesn't open a browser**

* Ensure your MCP client supports MCP Authorization. Fall back to the API Key method if it doesn't.

**Connection timeout**

* Confirm the MCP endpoint URL is reachable from your machine. For self-hosted instances, check that the server is running and `SERVER_URL` is set correctly.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.