smartlead-cli

smartlead-cli

MCP server for managing cold email campaigns, leads, email accounts, sequences, analytics, webhooks, and client sub-accounts via the Smartlead API.

Category
访问服务器

README

smartlead-cli

CLI and MCP server for the Smartlead.ai API. Manage cold email campaigns, leads, email accounts, sequences, analytics, webhooks, and client sub-accounts from the terminal or from any AI agent via MCP.

Install

npm install -g @bcharleson/smartlead-cli

Authenticate

# Option 1: environment variable (recommended for agents and CI)
export SMARTLEAD_API_KEY="your_api_key_here"

# Option 2: interactive login (stores to ~/.smartlead-cli/config.json)
smartlead login

# Option 3: per-command flag
smartlead campaigns list --api-key "your_api_key_here"

Get your API key from Smartlead → Settings → API Key.

Quick Start

# List all campaigns
smartlead campaigns list

# Create a campaign
smartlead campaigns create --name "Q1 Outreach"

# Add leads to a campaign
smartlead leads add-to-campaign --campaign-id 456 \
  --lead-list '[{"email":"ceo@acme.com","first_name":"John","company_name":"Acme"}]'

# Activate a campaign
smartlead campaigns update-status 456 --status ACTIVE

# Get campaign analytics
smartlead analytics campaign-stats --campaign-id 456

MCP Setup (AI Agents)

Add to your MCP client config (e.g. ~/.claude.json or Claude Desktop settings.json):

{
  "mcpServers": {
    "smartlead": {
      "command": "npx",
      "args": ["-y", "@bcharleson/smartlead-cli", "mcp"],
      "env": {
        "SMARTLEAD_API_KEY": "your_api_key_here"
      }
    }
  }
}

Or if installed globally:

{
  "mcpServers": {
    "smartlead": {
      "command": "smartlead",
      "args": ["mcp"],
      "env": {
        "SMARTLEAD_API_KEY": "your_api_key_here"
      }
    }
  }
}

All 41 CLI commands are available as MCP tools instantly. Tool names use snake_case: campaigns_list, leads_add_to_campaign, analytics_overview, etc.

Output

All commands output compact JSON to stdout by default — ready for piping and agent parsing.

# Compact JSON (default)
smartlead campaigns list
# → [{"id":123,"name":"Q1 Outreach","status":"ACTIVE",...}]

# Pretty-printed
smartlead campaigns list --pretty

# Filter fields
smartlead campaigns list --fields id,name,status

# Suppress output (exit code only)
smartlead campaigns create --name "Test" --quiet

Errors go to stderr as JSON: {"error":"...","code":"AUTH_ERROR"}

Exit codes: 0 success · 1 error

Commands

campaigns

Command Description
list List all campaigns
get <id> Get a campaign by ID
create Create a campaign (starts in DRAFTED status)
update-status <id> Set status: ACTIVE, PAUSED, STOPPED
update-settings <id> Tracking, stop rules, unsubscribe text, AI ESP matching
schedule <id> Timezone, days, hours, max leads/day
delete <id> Delete a campaign (irreversible)
smartlead campaigns create --name "Cold Outreach Q2"
smartlead campaigns schedule 456 \
  --timezone "America/New_York" \
  --days-of-week "[1,2,3,4,5]" \
  --start-hour "08:00" \
  --end-hour "17:00" \
  --max-leads-per-day 50
smartlead campaigns update-status 456 --status ACTIVE

sequences

Command Description
get <campaign_id> Fetch all steps with variants and delays
save <campaign_id> Replace entire sequence (all steps at once)
smartlead sequences save 456 --sequences '[
  {
    "seq_number": 1,
    "seq_delay_details": {"delay_in_days": 0},
    "variant_distribution_type": "MANUAL_EQUAL",
    "variants": [{
      "subject": "Quick question, {{first_name}}",
      "email_body": "<p>Hi {{first_name}},</p><p>...</p>",
      "variant_label": "A"
    }]
  },
  {
    "seq_number": 2,
    "seq_delay_details": {"delay_in_days": 3},
    "variant_distribution_type": "MANUAL_EQUAL",
    "variants": [{
      "subject": "Following up",
      "email_body": "<p>Just checking in...</p>",
      "variant_label": "A"
    }]
  }
]'

Note: save replaces the full sequence. Always send all steps.

email-accounts

Command Description
list List all email accounts
get <id> Get an account by ID
create Add SMTP/IMAP account
update <id> Update account settings
update-warmup <id> Configure warmup (enable, daily volume, ramp-up)
warmup-stats <id> Last 7 days warmup stats
list-campaign List accounts for a campaign
add-to-campaign Assign account to campaign
remove-from-campaign Remove account from campaign
smartlead email-accounts create \
  --from-name "John Smith" \
  --from-email "john@yourdomain.com" \
  --username "john@yourdomain.com" \
  --password "app_password" \
  --smtp-host "smtp.gmail.com" \
  --smtp-port 587 \
  --imap-host "imap.gmail.com" \
  --imap-port 993

smartlead email-accounts add-to-campaign --campaign-id 456 --account-id 789
smartlead email-accounts update-warmup 789 --warmup-enabled --total-warmup-per-day 20 --daily-rampup 2

leads

Command Description
get-by-email Find lead by email across all campaigns
list-campaign List leads in a campaign (paginated)
add-to-campaign Add leads JSON array to a campaign
update Update lead fields
pause Pause sending to a lead
resume Resume a paused lead
unsubscribe-campaign Unsubscribe from one campaign
unsubscribe-global Globally unsubscribe (all campaigns)
delete Delete lead from campaign
get-campaigns Get all campaigns a lead is in
add-domain-block Block an entire domain
export Export leads as CSV
# Add multiple leads at once
smartlead leads add-to-campaign --campaign-id 456 --lead-list '[
  {"email":"ceo@acme.com","first_name":"John","last_name":"Smith","company_name":"Acme Corp"},
  {"email":"vp@globex.com","first_name":"Jane","company_name":"Globex"}
]'

# Pause a lead
smartlead leads pause --campaign-id 456 --lead-id 789

# Block a domain
smartlead leads add-domain-block --domain "competitor.com"

Template variables in sequences: {{first_name}}, {{last_name}}, {{company_name}}, {{email}}, {{custom_field_name}}

inbox

Command Description
message-history Full email thread for a lead in a campaign
reply Reply to a lead via the Master Inbox
smartlead inbox message-history --campaign-id 456 --lead-id 789
smartlead inbox reply \
  --campaign-id 456 \
  --lead-id 789 \
  --email-body "<p>Thanks for your reply! Let's connect.</p>" \
  --email-stats-id 111 \
  --reply-message-id "abc123@mail.gmail.com"

analytics

Command Description
campaign-stats Opens, clicks, replies, bounces summary
campaign-analytics Top-level performance metrics
campaign-analytics-by-date Time-series data by date range
lead-stats Lead funnel: interested, in progress, completed, etc.
smartlead analytics campaign-stats --campaign-id 456
smartlead analytics campaign-analytics-by-date \
  --campaign-id 456 \
  --start-date "2024-01-01" \
  --end-date "2024-01-31"

webhooks

Command Description
list --campaign-id <id> List webhooks on a campaign
create Create a webhook
update <id> Update a webhook
delete <id> Delete a webhook
smartlead webhooks create \
  --name "Reply Notifications" \
  --url "https://your-server.com/hook" \
  --events "EMAIL_REPLIED,EMAIL_BOUNCED,LEAD_UNSUBSCRIBED"

Available events: EMAIL_OPENED, EMAIL_CLICKED, EMAIL_REPLIED, EMAIL_BOUNCED, LEAD_UNSUBSCRIBED, LEAD_CATEGORY_UPDATED, SEQUENCE_COMPLETED

clients (agency/white-label)

Command Description
list List all client sub-accounts
save Create or update a client
list-api-keys List client API keys
create-api-key Generate a new API key
delete-api-key <id> Delete an API key
reset-api-key <id> Regenerate an API key
smartlead clients save \
  --name "Acme Corp" \
  --email "admin@acme.com" \
  --password "securepass123"

smartlead clients create-api-key --client-id 123 --key-name "Production"

Full Campaign Launch Workflow

# 1. Create campaign
CAMPAIGN=$(smartlead campaigns create --name "Q2 Outreach" | jq -r '.id')

# 2. Schedule
smartlead campaigns schedule $CAMPAIGN \
  --timezone "America/Chicago" \
  --days-of-week "[1,2,3,4,5]" \
  --start-hour "09:00" \
  --end-hour "17:00" \
  --max-leads-per-day 40 \
  --min-time-between-emails 15

# 3. Configure settings
smartlead campaigns update-settings $CAMPAIGN \
  --track-settings '["DONT_LINK_CLICK"]' \
  --unsubscribe-text "Unsubscribe"

# 4. Assign email account
smartlead email-accounts add-to-campaign \
  --campaign-id $CAMPAIGN --account-id 789

# 5. Save sequence
smartlead sequences save $CAMPAIGN --sequences '[
  {"seq_number":1,"seq_delay_details":{"delay_in_days":0},"variant_distribution_type":"MANUAL_EQUAL","variants":[{"subject":"{{first_name}}, quick thought on {{company_name}}","email_body":"<p>Hi {{first_name}},</p><p>Noticed {{company_name}} is...</p>","variant_label":"A"}]},
  {"seq_number":2,"seq_delay_details":{"delay_in_days":3},"variant_distribution_type":"MANUAL_EQUAL","variants":[{"subject":"Re: {{first_name}}, quick thought on {{company_name}}","email_body":"<p>Wanted to follow up...</p>","variant_label":"A"}]},
  {"seq_number":3,"seq_delay_details":{"delay_in_days":5},"variant_distribution_type":"MANUAL_EQUAL","variants":[{"subject":"Last touch","email_body":"<p>I'll leave you alone after this...</p>","variant_label":"A"}]}
]'

# 6. Import leads
smartlead leads add-to-campaign --campaign-id $CAMPAIGN \
  --lead-list '[{"email":"ceo@target.com","first_name":"Sarah","company_name":"Target Co"}]'

# 7. Launch
smartlead campaigns update-status $CAMPAIGN --status ACTIVE

# 8. Monitor
smartlead analytics campaign-stats --campaign-id $CAMPAIGN --pretty

API Reference

  • Base URL: https://server.smartlead.ai/api/v1
  • Auth: ?api_key=<key> query param (auto-injected)
  • Rate limit: 10 requests / 2 seconds (auto-retried with backoff)
  • Full docs: api.smartlead.ai

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选