Twenty MCP
Twenty MCP
ClaudeをTwenty CRMワークスペースに接続するリモートMCP(Model Context Protocol)サーバーです。Cloudflare Workers上にデプロイされ、OAuthによるワンクリックでのチーム導入が可能です。
機能
あらゆるTwentyオブジェクト(人、会社、商談、またはカスタムオブジェクト)で動作する、9つの汎用的なスキーマ駆動型ツールを提供します。MCPは実行時にTwentyのメタデータAPIをイントロスペクション(自己検査)するため、フィールドやオブジェクトを追加するたびにMCPを更新する必要はありません。
ツール
list_objects,describe_object— CRM内の情報を探索find_records,get_record— フィルタ/並び替え/ページネーションによるクエリcreate_record,update_record,delete_record— ミューテーション(書き込みモードで接続されている場合のみ)run_graphql— 生のメタデータ/GraphQLへのエスケープハッチget_primer— 組織固有のドメインコンテキスト + ライブスキーマのスナップショット
リソース(セッション開始時にClaudeによって自動読み込み)
twenty://primer— コンパクトなスキーマスナップショットと統合された組織コンテキストtwenty://api/info— コネクタのステータスと現在のスコープ
Related MCP server: twentycrm-graphql-mcp
インストール(チームメンバー向け)
Claude → 設定 → コネクタ → カスタムコネクタを追加
URL:
https://<your-worker>.workers.dev/mcpClaudeが同意ページにリダイレクトします。そこで個人用のTwenty APIキーが必要になります。取得方法は以下の通りです:
ブラウザでTwentyワークスペースにログイン
歯車アイコン(左下)をクリック → 設定
開発者(サイドバーの「ワークスペース」セクション内)へ移動
+ APIキーを作成をクリックし、名前(例: "Claude MCP")を付けてキーをコピー
同意フォームにAPIキーを貼り付けます。権限(読み取り専用または読み取り+書き込み)と、必要に応じてオブジェクトスコープを選択します。
完了です。キーは暗号化されてCloudflare KVに保存され、セッションに紐付けられます。
Twentyで行った変更は、共有サービスアカウントではなく、あなたのTwentyユーザーによる操作として記録されます。
デプロイ(管理者向け、初回のみ)
前提条件
Cloudflareアカウント(無料プランで動作可能)
Node.js 18以上
実行中のTwenty CRMインスタンス(セルフホストまたはクラウド)
手順
# 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 deployWorkerのURLは https://hia-twenty-mcp.<your-subdomain>.workers.dev となります。<url>/mcp をチームと共有してください。
Claude管理チームの場合: Claudeチーム管理コンソールで <url>/mcp を一度登録すると、すべてのチームメンバーのコネクタリストに表示されます。各メンバーは、自分のTwenty APIキーを貼り付けるための1回限りの同意ページを完了する必要があります。
オプション: 管理者トークンの設定
組織固有のプライマーコンテキストをアップロードするための /admin/* エンドポイントを有効にします(プライマーのカスタマイズを参照):
npx wrangler secret put ADMIN_TOKEN --config wrangler.local.jsonc
# Paste the output of: openssl rand -hex 32プライマーのカスタマイズ
twenty://primer リソースは、ツール呼び出しの前にCRMに関するコンテキストをClaudeに提供します。これには2つの部分が含まれます:
組織コンテキスト — ドメインモデル、カスタムオブジェクト、ビジネスルール、慣習を記述したマークダウン文書。イントロスペクションでは取得できない情報(例:「オブジェクトAとオブジェクトBは独立しており、一方から他方を推論してはならない」など)。
スキーマスナップショット — TwentyのメタデータAPIから自動生成され、1時間キャッシュされます。
デフォルトでは、(1)は汎用的なTwentyテンプレートになっています。組織固有のコンテキストをアップロードするには:
# 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>"コンテキストのマークダウンには、組織の業務内容、各カスタムオブジェクトの意味と関連性、分類モデル、命名規則、およびAIに対する「すべきこと/してはいけないこと」のルールを記述してください。テンプレート構造については src/primer/default-context.md を参照してください。
ローカル開発
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ローカルのClaude Desktopを開発用Workerに接続するには、コネクタとして http://localhost:8787/mcp を追加してください。
認証の仕組み
TwentyにはアップストリームのOAuthプロバイダーがないため、認証はワークスペースごとのAPIキーで行われます。そのため:
Workerは(Claudeコネクタで要求される)独自のOAuth 2.1エンドポイントを実行します。
OAuth同意ステップ中に、ユーザーはTwenty APIキーをHTMLフォームに貼り付けます。
WorkerはTwentyの
/metadataエンドポイントに対してキーを検証し、{twentyApiKey, mode, allowedObjects, label}を暗号化されたOAuthプロパティとして保存します。その後のすべてのMCPツール呼び出しでは、
this.propsを通じてユーザーのキーが利用可能になります。
つまり、このMCPは外側(Claudeに対して)はOAuth、内側(Twentyに対して)はAPIキーとして機能します。
スコーピング
各接続はインストール時に制限を設けることができます:
モード: 読み取り専用にすると
create_record/update_record/delete_recordが非表示になります。許可されたオブジェクト: カンマ区切りのリストで特定のオブジェクトのみに制限できます。
オブジェクトレベルの権限は、ユーザーのAPIキーに紐付けられたロールを通じてTwenty自体によっても強制されます(二重の安全策)。
Twentyのバージョン互換性
Twenty v0.40+ でテスト済みです。このMCPは以下を使用します:
REST API (
/rest/<objects>):レコードのCRUD用(深さは0または1に制限)GraphQLメタデータAPI (
/metadata):スキーマイントロスペクション用(リレーション情報にはField型のsettingsフィールドを使用)複合フィールド(例:
name.firstName,emails.primaryEmail)は、フィルタ内でドット表記にする必要があります
大幅に古いTwentyバージョンを使用している場合、メタデータクエリの形式が異なる可能性があります。エラーが発生した場合はIssueを作成してください。
アーキテクチャ
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)ライセンス
Apache-2.0
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables interaction with Twenty CRM through a Model Context Protocol server. Provides comprehensive CRM operations including managing people, companies, opportunities, notes, tasks, and custom objects with support for filtering, pagination, and AI-powered automations.30MIT
- FlicenseNot gradedqualityCmaintenanceMCP server for Twenty CRM that enables AI assistants to interact with the CRM via GraphQL, including schema inspection and query execution.171
- AlicenseAqualityBmaintenanceA comprehensive MCP server providing Claude with enterprise-grade access to HubSpot CRM, including contacts, deals, quotes, workflows, and automation through 37 tools.3742MIT
- AlicenseAqualityBmaintenanceEnables MCP clients to read, search, create, update, and manage records in Twenty CRM with a safe, composable 14-tool interface and guarded destructive operations.14MIT
Related MCP Connectors
Managed LinkedIn MCP server for AI agents: search, connect, message and enrich on accounts you own.
Hosted Amazon Seller Central and Amazon Ads MCP server for Claude, ChatGPT, Cursor, and agents.
MCP server for LeadDelta — manage LinkedIn connections and CRM data via AI assistants.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/High-Impact-Athletes/hia-twenty-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server