packages/twenty-docs/user-guide/ai/capabilities/mcp.mdx
Twenty exposes an MCP 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 |
You have two ways to authenticate your MCP client: OAuth (recommended) or API Key.
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. </Note>Add this to your MCP client configuration, replacing {your-workspace-url} with your workspace host (e.g. mycompany.twenty.com):
{
"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:
/.well-known/oauth-protected-resource and /.well-known/oauth-authorization-serverSubsequent connections reuse the stored tokens and refresh them automatically.
If your MCP client does not support OAuth, or you prefer static credentials, pass an API key in the Authorization header:
{
"mcpServers": {
"twenty": {
"type": "streamable-http",
"url": "https://{your-workspace-url}/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}
To create an API key, go to Settings > APIs & Webhooks > + Create key. See APIs for details.
Go to Settings > AI > More > MCP Server 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 |
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.
Ask your AI assistant to interact with your CRM:
Once connected, the MCP server exposes tools that mirror the Twenty API. The recommended workflow is:
get_tool_catalog — discover all available toolslearn_tools — get the input schema for specific toolsexecute_tool — run a toolYou don't need to remember tool names. Ask your AI assistant what it can do and it will call get_tool_catalog automatically.
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:
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.
SERVER_URL=https://twenty.yourcompany.com
The MCP endpoint, OAuth endpoints, and discovery metadata all derive from this value.
"Unauthorized" or 401 errors
OAuth flow doesn't open a browser
Connection timeout
SERVER_URL is set correctly.