smartlead-cli
Allows managing Gmail accounts as email accounts for cold email campaigns via SMTP/IMAP.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@smartlead-clilist my campaigns"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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-cliRelated MCP server: SmartLead MCP Server
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 456MCP 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" --quietErrors go to stderr as JSON: {"error":"...","code":"AUTH_ERROR"}
Exit codes: 0 success · 1 error
Commands
campaigns
Command | Description |
| List all campaigns |
| Get a campaign by ID |
| Create a campaign (starts in DRAFTED status) |
| Set status: |
| Tracking, stop rules, unsubscribe text, AI ESP matching |
| Timezone, days, hours, max leads/day |
| 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 ACTIVEsequences
Command | Description |
| Fetch all steps with variants and delays |
| 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:
savereplaces the full sequence. Always send all steps.
email-accounts
Command | Description |
| List all email accounts |
| Get an account by ID |
| Add SMTP/IMAP account |
| Update account settings |
| Configure warmup (enable, daily volume, ramp-up) |
| Last 7 days warmup stats |
| List accounts for a campaign |
| Assign account to 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 2leads
Command | Description |
| Find lead by email across all campaigns |
| List leads in a campaign (paginated) |
| Add leads JSON array to a campaign |
| Update lead fields |
| Pause sending to a lead |
| Resume a paused lead |
| Unsubscribe from one campaign |
| Globally unsubscribe (all campaigns) |
| Delete lead from campaign |
| Get all campaigns a lead is in |
| Block an entire domain |
| 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 |
| Full email thread for a lead in a campaign |
| 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 |
| Opens, clicks, replies, bounces summary |
| Top-level performance metrics |
| Time-series data by date range |
| 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 webhooks on a campaign |
| Create a webhook |
| Update a webhook |
| 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 all client sub-accounts |
| Create or update a client |
| List client API keys |
| Generate a new API key |
| Delete an API key |
| 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 --prettyAPI Reference
Base URL:
https://server.smartlead.ai/api/v1Auth:
?api_key=<key>query param (auto-injected)Rate limit: 10 requests / 2 seconds (auto-retried with backoff)
Full docs: api.smartlead.ai
License
MIT
This server cannot be installed
Maintenance
Latest Blog Posts
- 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/bcharleson/smartlead-cli'
If you have feedback or need assistance with the MCP directory API, please join our Discord server