Twenty MCP
A remote MCP server that connects Claude to a Twenty CRM workspace, enabling users to interact with CRM objects (People, Companies, Opportunities, and custom objects) through schema-driven tools for querying, creating, updating, and deleting records.
README
Twenty MCP
A remote MCP (Model Context Protocol) server that connects Claude to a Twenty CRM workspace, deployed on Cloudflare Workers with OAuth for one-click team install.
What it does
Exposes 9 generic, schema-driven tools that work on any Twenty object (Person, Company, Opportunity, or any custom object). The MCP introspects Twenty's metadata API at runtime — you never need to update the MCP when you add fields or objects.
Tools
list_objects,describe_object— discover what's in the CRMfind_records,get_record— query with filter/orderBy/paginationcreate_record,update_record,delete_record— mutations (only when connected in write mode)run_graphql— escape hatch for raw metadata/graphqlget_primer— org-specific domain context + live schema snapshot
Resources (auto-loaded by Claude on session start)
twenty://primer— organisation context merged with a compact schema snapshottwenty://api/info— connector status and current scopes
Install (team member)
- In Claude → Settings → Connectors → Add custom connector
- URL:
https://<your-worker>.workers.dev/mcp - Claude redirects you to a consent page where you'll need your personal Twenty API key. To get one:
- Log into your Twenty workspace in the browser
- Click the gear icon (bottom-left) → Settings
- Go to Developers (under the Workspace section in the sidebar)
- Click + Create API key, give it a name (e.g. "Claude MCP"), and copy the key
- Paste the API key into the consent form. Choose permission (read-only or read+write) and optional object scopes.
- Done. Your key is stored encrypted in Cloudflare KV, bound to your session.
Changes you make in Twenty are attributed to your Twenty user, not to a shared service account.
Deploy (admin, first time)
Prerequisites
- A Cloudflare account (free plan works)
- Node.js 18+
- A running Twenty CRM instance (self-hosted or cloud)
Steps
# 1. Clone the repo
git clone https://github.com/High-Impact-Athletes/hia-twenty-mcp.git
cd hia-twenty-mcp
npm install
# 2. Create the KV namespace
npx wrangler kv namespace create twenty-mcp-oauth
# Note the ID from the output (e.g. "3cd89a10677c4d2ba32c9e59482afa23")
# 3. Create your local config (not committed to git)
cp wrangler.jsonc wrangler.local.jsonc
# Edit wrangler.local.jsonc:
# - Set "account_id" to your Cloudflare account ID
# - Replace <OAUTH_KV_ID> with the KV namespace ID from step 2
# 4. Set secrets
npx wrangler secret put COOKIE_ENCRYPTION_KEY --config wrangler.local.jsonc
# Paste the output of: openssl rand -hex 32
# This is just a random string for encrypting OAuth cookies — not a Twenty secret.
npx wrangler secret put TWENTY_BASE_URL --config wrangler.local.jsonc
# Paste your Twenty instance URL, e.g. https://crm.example.com
# This is whatever URL you use to log into Twenty in your browser.
# 5. Deploy
npm run deploy
Your Worker URL will be https://hia-twenty-mcp.<your-subdomain>.workers.dev. Share <url>/mcp with the team.
For Claude managed teams: register <url>/mcp once in the Claude team admin console — it will appear in every team member's connector list. Each member still completes the one-time consent page to paste their own Twenty API key.
Optional: set an admin token
Enables the /admin/* endpoints for uploading org-specific primer context (see Customising the primer):
npx wrangler secret put ADMIN_TOKEN --config wrangler.local.jsonc
# Paste the output of: openssl rand -hex 32
Customising the primer
The twenty://primer resource gives Claude context about your CRM before any tool calls. It contains two parts:
- Organisation context — a markdown doc describing your domain model, custom objects, business rules, and conventions. Things introspection can't capture (e.g. "Object A and Object B are independent — don't infer one from the other").
- Schema snapshot — auto-generated from Twenty's metadata API, cached for 1 hour.
Out of the box, part (1) is a generic Twenty template. To upload your org-specific context:
# Upload your context markdown:
curl -X PUT https://<your-worker>.workers.dev/admin/primer \
-H "Authorization: Bearer <your-admin-token>" \
-H "Content-Type: text/markdown" \
--data-binary @path/to/your-context.md
# Verify it's loaded:
curl https://<your-worker>.workers.dev/admin/primer \
-H "Authorization: Bearer <your-admin-token>"
# Revert to the bundled default:
curl -X DELETE https://<your-worker>.workers.dev/admin/primer \
-H "Authorization: Bearer <your-admin-token>"
The context markdown should describe: what your organisation does, what each custom object means and how they relate, classification models, naming conventions, and any "do this / don't do that" rules for AI. See src/primer/default-context.md for the template structure.
Local development
npm install
cp .dev.vars.example .dev.vars
# Edit .dev.vars — set COOKIE_ENCRYPTION_KEY, TWENTY_BASE_URL, and optionally ADMIN_TOKEN
# Make sure you have wrangler.local.jsonc set up (see Deploy section)
npm run dev # wrangler dev on http://localhost:8787
npm run typecheck
To connect a local Claude Desktop to the dev worker, add http://localhost:8787/mcp as a connector.
How auth works
Twenty has no upstream OAuth provider — authentication is via per-workspace API keys. So:
- The Worker runs its own OAuth 2.1 endpoint (required by Claude connectors).
- During the OAuth consent step, the user pastes their Twenty API key into an HTML form.
- The Worker validates the key against Twenty's
/metadataendpoint, then stores{twentyApiKey, mode, allowedObjects, label}as encrypted OAuth props. - Every subsequent MCP tool call has the user's key available via
this.props.
This means the MCP is OAuth on the outside (for Claude) and API key on the inside (for Twenty).
Scoping
Each connection can be narrowed at install time:
- Mode: read-only hides
create_record/update_record/delete_record. - Allowed objects: comma-separated list to restrict to specific objects.
Object-level permissions are also enforced by Twenty itself via the role attached to the user's API key — belt and braces.
Twenty version compatibility
Tested against Twenty v0.40+. The MCP uses:
- REST API (
/rest/<objects>) for record CRUD — depth limited to 0 or 1 - GraphQL metadata API (
/metadata) for schema introspection — uses thesettingsfield on Field type for relation info - Composite fields (e.g.
name.firstName,emails.primaryEmail) must be dot-notated in filters
If you're on a significantly older Twenty version, the metadata query shape may differ. Open an issue if you hit errors.
Architecture
Claude ↔ OAuth 2.1 ↔ Worker ↔ REST+GraphQL ↔ Twenty workspace
│
├─ McpAgent Durable Object (per session)
├─ OAUTH_KV (token store, schema cache, primer)
└─ twenty://primer (org context + live schema)
License
Apache-2.0
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。