二十进制图形库mcp
MCP(模型上下文协议)服务器 二十CRM 这将GraphQL工具暴露给AI助手。
用法
直接使用npx运行(无需安装):
TWENTY_API_TOKEN=your_token npx twentycrm-graphql-mcp环境变量
| 变量 | 必填 | 描述 |
|---|---|---|
TWENTY_API_TOKEN | 是 | 您的二十个API令牌(设置>API和Webhook) |
TWENTY_GQL_URL | 否 | 您的Twenty实例的GraphQL端点。对于云托管,它是 https://[your-org].twenty.com/graphql。对于自托管,它是 https://[your-domain]/graphql. |
Claude桌面配置
添加到您的 claude_desktop_config.json:
{
"mcpServers": {
"twentycrm": {
"command": "npx",
"args": ["-y", "twentycrm-graphql-mcp"],
"env": {
"TWENTY_API_TOKEN": "your_token_here",
"TWENTY_GQL_URL": "https://your-instance.com/graphql"
}
}
}
}部署到Google Cloud Run
注: 此部署当前未处于活动状态。建议使用此软件包的方式是通过 npx 如上所述。这 terraform/ 目录包含基础架构代码,用于将其部署为Cloud Run(GCP项目)上的托管MCP服务器 decodedata-crm,地区 europe-west2).
先决条件
- 地形>=1.5
gcloudCLI已通过身份验证decodedata-crm项目- 码头工人
创建的资源
| 资源 | 描述 |
|---|---|
| 工件注册表仓库 | europe-west2-docker.pkg.dev/decodedata-crm/mcp/ |
| 云运行服务 | twentycrm-mcp --可公开访问,由应用程序强制执行身份验证 |
| 秘密经理的秘密 | twenty-api-token, mcp-auth-token |
| 服务帐户 | twentycrm-mcp@decodedata-crm.iam.gserviceaccount.com |
部署
# 1. Build and push the Docker image
gcloud auth configure-docker europe-west2-docker.pkg.dev
IMAGE=europe-west2-docker.pkg.dev/decodedata-crm/mcp/twentycrm-graphql-mcp:latest
docker build -t $IMAGE .
docker push $IMAGE
# 2. Apply infrastructure
cd terraform
terraform init
terraform apply \
-var="image=europe-west2-docker.pkg.dev/decodedata-crm/mcp/twentycrm-graphql-mcp:latest" \
-var="twenty_gql_url=https://crm.decodedata.io/graphql"秘密
首次应用后,在GCP Secret Manager中填充机密:
# Twenty API token (from Twenty Settings > API & Webhooks)
echo -n "your-twenty-api-token" | gcloud secrets versions add twenty-api-token --data-file=-
# MCP bearer token (any strong random string — required by clients to call the service)
echo -n "your-mcp-auth-token" | gcloud secrets versions add mcp-auth-token --data-file=-摧毁
cd terraform
terraform destroy \
-var="image=europe-west2-docker.pkg.dev/decodedata-crm/mcp/twentycrm-graphql-mcp:latest" \
-var="twenty_gql_url=https://crm.decodedata.io/graphql"HTTP服务器
部署后,该服务将公开:
GET /sse--MCP客户端的SSE端点(需要Authorization: Bearer)POST /messages--MCP消息端点GET /health--健康检查(未经验证)
可用工具
inspect_schema
列出工作区中的所有对象和字段,包括自定义字段。
execute_graphql
对Twenty运行任何原始GraphQL查询或变异。
参数:
query(string,必填):GraphQL查询或变异variables(object,可选):查询的变量
execute_metadata
针对Twenty Metadata API运行任何原始GraphQL查询或突变(模式管理:自定义对象、字段、关系)。
参数:
query(string,必填):GraphQL查询或变异variables(object,可选):查询的变量
