使用说明
关闭crmcli
功能齐全的CLI和MCP服务器 关闭CRM 平台。每个可用作终端命令的API端点 和 作为人工智能代理的MCP工具。
特性
- 160+命令 跨越30个资源组-全面关闭API
- 内置MCP服务器 --奔跑
close mcp将所有命令作为Claude/Cursor工具公开 - JSON输出 默认情况下--管道
jq、自由编写脚本,或直接馈送给AI代理 - 认证 通过env-var、flag或存储的配置(
close login) - HTTP基本身份验证 --Close的本机身份验证方法,自动处理
- 分页 --基于偏移量
_limit/_skip分页功能has_more - 重试+速率限制处理 --429/5xx上的自动指数回退
安装
npm install -g close-crm-cli
或者在不安装的情况下使用:
npx close-crm-cli leads list
认证
从获取API密钥 https://app.close.com/settings/api
# Option 1: Environment variable (recommended)
export CLOSE_API_KEY="your-api-key"
# Option 2: Interactive login (stores in ~/.close/config.json)
close login
# Option 3: Per-command flag
close leads list --api-key "your-api-key"
快速开始
# Get your user profile
close users me
# List leads
close leads list
# Create a lead
close leads create --name "Acme Corp" --url "https://acme.com"
# Create a contact on a lead
close contacts create --lead-id lead_abc123 --name "Jane Doe" \
--emails '[{"email":"jane@acme.com","type":"office"}]'
# Log a call
close calls create --lead-id lead_abc123 --direction outbound --duration 900 \
--note "Discussed Q2 priorities"
# Create a follow-up task
close tasks create --lead-id lead_abc123 --text "Send proposal" \
--type email --due-date "2025-04-07T09:00:00"
# Move opportunity to next stage
close opportunities update oppo_abc123 --status-id "stat_demo_scheduled"
输出选项
# Default: compact JSON (machine-readable)
close leads list
# Pretty-printed JSON
close leads list --pretty
# Select specific fields
close leads list --fields id,display_name,status_label
# Suppress output (exit codes only: 0=success, 1=error)
close leads list --quiet
命令组
| 组 | 命令 | 描述 |
|---|---|---|
leads |
列出、获取、创建、更新、删除、合并、搜索 | CRM潜在客户 |
contacts |
列表、获取、创建、更新、删除 | 潜在客户中的联系人 |
opportunities |
列出、获取、创建、更新、删除 | 工作流机会 |
tasks |
列表、获取、创建、更新、删除、批量更新 | 任务和跟进 |
activities |
list | 统一活动流 |
calls |
列表、获取、创建、更新、删除 | 通话记录 |
notes |
列表、获取、创建、更新、删除 | 备注 |
emails |
列表、获取、创建、更新、删除 | 电子邮件活动 |
sms |
列出、获取、创建、删除 | 短信活动 |
meetings |
列表、获取、更新、删除 | 会议 |
users |
我、列表、获取、可用性 | 用户 |
pipelines |
列表、获取、创建、更新、删除 | 销售渠道 |
lead-statuses |
列表、获取、创建、更新、删除 | 潜在客户状态标签 |
opportunity-statuses |
列表、获取、创建、更新、删除 | 工作流阶段 |
custom-fields |
列表/获取/创建/更新/删除-{潜在客户 | 联系人 |
webhooks |
列表、获取、创建、更新、删除 | Webhook订阅 |
sequences |
列表、获取、创建、更新、删除、订阅、列出订阅 | 外展序列 |
email-templates |
列表、获取、创建、更新、删除、呈现 | 电子邮件模板 |
sms-templates |
列表、获取、创建、更新、删除 | 短信模板 |
smart-views |
列表、获取、创建、更新、删除 | 已保存的视图 |
reports |
活动指标、活动报告、漏斗 | 分析 |
phone-numbers |
列表、获取、更新、删除 | 电话号码 |
connected-accounts |
列表,获取 | 已连接的电子邮件帐户 |
organizations |
获取、更新 | 组织设置 |
groups |
列表、获取、创建、更新、删除 | 用户组 |
roles |
list,get | 用户角色 |
exports |
列出、获取、创建潜在客户、创造机会 | 数据导出 |
unsubscribe |
列表、添加、删除 | 电子邮件取消订阅列表 |
MCP 服务器
将所有命令作为Claude、Cursor、Windsurf或任何兼容MCP的AI的工具公开:
close mcp
Claude桌面/光标配置
添加到MCP配置(~/.claude/config.json 或光标设置):
{
"mcpServers": {
"close": {
"command": "npx",
"args": ["close-crm-cli", "mcp"],
"env": {
"CLOSE_API_KEY": "your-api-key"
}
}
}
}
或者进行全局安装:
{
"mcpServers": {
"close": {
"command": "close",
"args": ["mcp"],
"env": {
"CLOSE_API_KEY": "your-api-key"
}
}
}
}
配置后,Claude可以直接调用任何关闭CRM操作。示例提示:
- “列出所有具有潜在状态的潜在客户”
- “为Acme Corp创造价值5万美元的新机会”
- “向lead_abc123记录15分钟的出站呼叫”
- “将Jane Doe纳入Q1随访序列”
- “显示本周的活动指标”
分页
# First page
close leads list --limit 50
# Next page
close leads list --limit 50 --skip 50
自定义字段
# List available custom fields
close custom-fields list-lead
# Set custom fields on create/update
close leads create --name "Acme Corp" --custom '{"cf_budget":"500000","cf_industry":"SaaS"}'
close leads update lead_abc123 --custom '{"cf_stage":"Pilot"}'
高级搜索
# Simple query string
close leads list --query "Acme"
# Advanced DSL via POST /data/search/
close leads search --query '{
"type": "and",
"queries": [
{"type":"field","field":{"type":"regular","field_name":"status_label"},"negate":false,"condition":{"type":"text","mode":"equals","value":"Potential"}}
]
}' --limit 100
发展
git clone https://github.com/bcharleson/close-crm-cli
cd close-crm-cli
npm install
# Run in dev mode
npm run dev -- leads list
# Build
npm run build
# Type check
npm run typecheck
建筑
CLI构建在 CommandDefinition pattern-每个API端点一个对象,作为CLI子命令和MCP工具的唯一真相来源:
interface CommandDefinition {
name: string; // MCP tool name (e.g. "leads_create")
group: string; // CLI group (e.g. "leads")
subcommand: string; // CLI subcommand (e.g. "create")
description: string; // Used in --help and MCP tool description
inputSchema: ZodObject; // Shared input validation
cliMappings: CliMapping; // How fields map to CLI args/options
endpoint: { method, path }; // HTTP endpoint
fieldMappings: Record<string, 'path'|'query'|'body'>; // Where fields go
handler: Function; // Executes the request
}
看 代理商.md 获取完整的AI代理集成指南。
许可证
麻省理工学院