Instantly MCP Server
Click on "Deploy 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., "@Instantly MCP Server show me my campaign analytics for the last week"
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.
Instantly MCP Server (Python)
A lightweight, robust Model Context Protocol (MCP) server for the Instantly.ai V2 API, built with FastMCP.
Features
38 tools across 6 categories (accounts, campaigns, leads, emails, analytics, background_jobs)
Dual transport support: HTTP (remote deployment) + stdio (local)
Lazy loading: Reduce context window by loading only specific tool categories
Multi-tenant support: Per-request API keys for HTTP deployments
Comprehensive error handling: Detailed, actionable error messages
Rate limiting: Automatic tracking from API response headers
Dynamic timeouts: Extended timeouts for search and bulk operations
Related MCP server: SmartLead MCP Server
Quick Start
Installation
# Clone or navigate to the repository
cd instantly-mcp-python
# Install with pip
pip install -e .
# Or install dependencies directly
pip install fastmcp httpx pydantic python-dotenvConfiguration
Set your Instantly API key:
export INSTANTLY_API_KEY="your-api-key-here"Or create a .env file:
INSTANTLY_API_KEY=your-api-key-hereRunning the Server
HTTP Mode (Recommended for Remote Deployment)
# Using FastMCP CLI
fastmcp run src/instantly_mcp/server.py --transport http --port 8000
# Using Python directly
python -m instantly_mcp.server --transport http --port 8000
# Or with uvicorn for production
uvicorn instantly_mcp.server:mcp.app --host 0.0.0.0 --port 8000stdio Mode (Local Development)
# Using FastMCP CLI
fastmcp run src/instantly_mcp/server.py
# Using Python directly
python -m instantly_mcp.serverTool Categories
Accounts (6 tools)
Tool | Description |
| List email accounts with filtering |
| Get account details and warmup status |
| Create account with IMAP/SMTP credentials |
| Update account settings |
| Pause, resume, warmup control, test vitals |
| ⚠️ Permanently delete account |
Campaigns (8 tools)
Tool | Description |
| Create email campaign (two-step process) |
| List campaigns with pagination |
| Get campaign details and sequences |
| Update campaign settings |
| Start campaign sending |
| Stop campaign sending |
| ⚠️ Permanently delete campaign |
| Find campaigns a contact is enrolled in |
Leads (12 tools)
Tool | Description |
| List leads with filtering |
| Get lead details |
| Create single lead |
| Update lead (⚠️ custom_variables replaces all) |
| List lead lists |
| Create lead list |
| Update lead list |
| Get email verification stats |
| Bulk add up to 1,000 leads |
| ⚠️ Permanently delete lead |
| ⚠️ Permanently delete lead list |
| Move/copy leads between campaigns/lists |
Emails (6 tools)
Tool | Description |
| List emails with filtering |
| Get email details |
| 🚨 Send real email reply |
| Count unread inbox emails |
| Verify email deliverability |
| Mark email thread as read |
Analytics (3 tools)
Tool | Description |
| Campaign metrics (opens, clicks, replies) |
| Day-by-day performance |
| Account warmup metrics |
Background Jobs (2 tools)
Tool | Description |
| List async background jobs with pagination |
| Get details of a specific background job |
Lazy Loading (Context Window Optimization)
Reduce context window usage by loading only the categories you need:
# Load only accounts and campaigns (14 tools instead of 38)
export TOOL_CATEGORIES="accounts,campaigns"
# Load only leads and analytics
export TOOL_CATEGORIES="leads,analytics"Valid categories: accounts, campaigns, leads, emails, analytics, background_jobs
Authentication Methods
The server supports multiple authentication methods for flexibility:
1. URL-based Authentication
Include your API key directly in the URL path:
https://your-server.com/mcp/YOUR_API_KEY2. Header Authentication
URL: https://your-server.com/mcp
Header: Authorization: YOUR_API_KEYNote: Bearer token prefix is optional
3. Custom Header
URL: https://your-server.com/mcp
Header: x-instantly-api-key: YOUR_API_KEY4. Environment Variable
export INSTANTLY_API_KEY="your-api-key-here"MCP Client Configuration
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
stdio Mode (Local)
{
"mcpServers": {
"instantly": {
"command": "python",
"args": ["-m", "instantly_mcp.server"],
"env": {
"INSTANTLY_API_KEY": "your-api-key-here"
}
}
}
}HTTP Mode with URL Auth (Recommended)
{
"mcpServers": {
"instantly": {
"url": "https://your-server.com/mcp/YOUR_API_KEY"
}
}
}HTTP Mode with Header Auth
{
"mcpServers": {
"instantly": {
"url": "https://your-server.com/mcp",
"transport": "streamable-http",
"headers": {
"Authorization": "your-api-key-here"
}
}
}
}Cursor IDE
Add to ~/.cursor/mcp.json:
With URL Authentication
{
"mcpServers": {
"instantly": {
"url": "https://your-server.com/mcp/YOUR_API_KEY"
}
}
}With Header Authentication
{
"mcpServers": {
"instantly": {
"url": "https://your-server.com/mcp",
"transport": "streamable-http",
"headers": {
"x-instantly-api-key": "your-api-key-here"
}
}
}
}DigitalOcean App Platform Deployment
App Spec
name: instantly-mcp
services:
- name: instantly-mcp
source:
git:
branch: main
repo_clone_url: https://github.com/your-username/instantly-mcp-python.git
build_command: pip install -e .
run_command: python -m instantly_mcp.server --transport http --port 8080
http_port: 8080
instance_size_slug: basic-xxs
instance_count: 1
envs:
- key: INSTANTLY_API_KEY
scope: RUN_TIME
type: SECRET
- key: PORT
scope: RUN_TIME
value: "8080"Dockerfile (Alternative)
FROM python:3.11-slim
WORKDIR /app
COPY pyproject.toml .
COPY src/ src/
RUN pip install -e .
EXPOSE 8000
CMD ["python", "-m", "instantly_mcp.server", "--transport", "http", "--host", "0.0.0.0", "--port", "8000"]Multi-Tenant HTTP Mode
For deployments serving multiple users, the server supports per-request API keys:
# Start server without default API key
python -m instantly_mcp.server --transport http --port 8000
# Clients provide API key via header
curl -X POST http://localhost:8000/mcp \
-H "x-instantly-api-key: user-specific-api-key" \
-H "Content-Type: application/json" \
-d '{"method": "tools/list"}'Error Handling
The server provides detailed, actionable error messages:
{
"error": {
"code": "invalid_api_key",
"message": "Instantly API key is required. Provide via:\n - INSTANTLY_API_KEY environment variable\n - api_key parameter\n - x-instantly-api-key header (HTTP mode)"
}
}Rate Limiting
The server automatically tracks rate limits from API response headers:
# Access via get_server_info tool
{
"rate_limit": {
"remaining": 95,
"limit": 100,
"reset_at": "2024-01-15T12:00:00"
}
}Project Structure
instantly-mcp-python/
├── src/
│ └── instantly_mcp/
│ ├── __init__.py # Package exports
│ ├── server.py # FastMCP server (~180 lines)
│ ├── client.py # API client (~200 lines)
│ ├── models/ # Pydantic models
│ │ ├── __init__.py
│ │ ├── common.py # Pagination
│ │ ├── accounts.py # Account models
│ │ ├── campaigns.py # Campaign models
│ │ ├── leads.py # Lead models
│ │ ├── emails.py # Email models
│ │ └── analytics.py # Analytics models
│ └── tools/ # Tool implementations
│ ├── __init__.py # Lazy loading logic
│ ├── accounts.py # 6 account tools
│ ├── campaigns.py # 8 campaign tools
│ ├── leads.py # 12 lead tools
│ ├── emails.py # 6 email tools
│ ├── analytics.py # 3 analytics tools
│ └── background_jobs.py # 2 background job tools
├── pyproject.toml # Dependencies
├── env.example # Environment template
└── README.md # This fileComparison with TypeScript Version
Aspect | TypeScript | Python FastMCP |
Lines of Code | ~5,000+ | ~1,500 |
Tool Registration | Manual handlers |
|
Input Validation | Zod schemas | Pydantic (auto) |
Error Messages | Manual | Auto from Pydantic |
HTTP Server | Custom transport | Built-in |
Context Window | Larger schemas | Smaller, cleaner |
API Reference
For detailed API documentation, see: Instantly V2 API Docs
License
MIT License
Contributing
Contributions welcome! Please open an issue or PR.
Available Tools
27 toolsactivate_campaignA
Activate campaign to start sending.
Prerequisites (all required):
At least one sender account assigned (email_list)
At least one lead added to the campaign
Email sequences configured
Schedule configured
Use get_campaign to verify all prerequisites are met.
Inputs: params (required). Returns: result
add_leads_to_campaign_or_list_bulkA
Bulk add up to 1,000 leads. 10-100x faster than create_lead.
Provide EITHER campaign_id OR list_id (not both).
Each lead requires at minimum an email address. Custom variables must match campaign field definitions.
Use skip_if_in_campaign=true to prevent duplicates (recommended).
Inputs: params (required). Returns: result
create_accountA
Create email account with IMAP/SMTP credentials.
Provider codes:
1: IMAP (generic)
2: Google Workspace
3: Microsoft 365
4: AWS SES
Requires valid IMAP and SMTP credentials for email sending.
Inputs: params (required). Returns: result
create_campaignA
Create email campaign. Two-step process:
Step 1: Call with name/subject/body to discover available sender accounts Step 2: Call again with email_list to assign senders
Personalization variables:
{{firstName}}, {{lastName}}, {{companyName}}
{{email}}, {{website}}, {{phone}}
Any custom variables defined for leads
Use sequence_steps for multi-step follow-up sequences.
IMPORTANT API v2 Structure:
Each step must have type="email"
Subject/body wrapped in variants array: variants=[{subject, body}]
Delay is in DAYS (not minutes)
Body should be HTML formatted
Inputs: params (required). Returns: result
create_leadA
Create a single lead with custom variables.
Use skip_if_in_campaign=true to prevent duplicates (recommended).
Custom variables must match field names defined in the campaign. Example: {"industry": "Technology", "company_size": "50-100"}
For bulk imports (10+ leads), use add_leads_to_campaign_or_list_bulk instead.
Inputs: params (required). Returns: result
create_lead_listB
Create a lead list.
Set has_enrichment_task=true to enable automatic lead enrichment. Enrichment adds company info, social profiles, and other data.
Inputs: params (required). Returns: result
delete_accountADestructive
🚨 PERMANENTLY delete an email account. CANNOT UNDO!
This action:
Removes the account from all campaigns
Deletes all account data
Cannot be reversed
Confirm with user before executing!
Inputs: params (required). Returns: result
delete_campaignADestructive
🚨 PERMANENTLY delete a campaign. CANNOT UNDO!
⚠️ REQUIRES USER CONFIRMATION before executing!
This action:
Permanently removes the campaign
Deletes all campaign data, sequences, and settings
Removes leads from this campaign (leads themselves are NOT deleted)
Cannot be reversed
Before calling this tool, you MUST:
Confirm with the user that they want to delete this campaign
Verify the campaign_id is correct
Warn them this action cannot be undone
Inputs: params (required). Returns: result
delete_leadADestructive
🗑️ PERMANENTLY delete a lead. CANNOT UNDO!
This action:
Removes the lead from all campaigns and lists
Deletes all lead data and history
Cannot be reversed
Confirm with user before executing!
Inputs: params (required). Returns: result
delete_lead_listADestructive
🚨 PERMANENTLY delete a lead list. CANNOT UNDO!
⚠️ REQUIRES USER CONFIRMATION before executing!
This action:
Permanently removes the lead list
Leads in the list may be orphaned (check your workflow)
Cannot be reversed
Before calling this tool, you MUST:
Confirm with the user that they want to delete this list
Verify the list_id is correct
Warn them this action cannot be undone
Inputs: params (required). Returns: result
get_accountARead-only
Get account details, warmup status, and campaign eligibility by email.
Returns comprehensive account information including:
Connection status and provider info
Warmup configuration and progress
Daily limits and sending gaps
Tracking domain settings
Inputs: params (required). Returns: result
get_campaignARead-only
Get campaign details: config, sequences, schedules, sender accounts, tracking, status.
Returns comprehensive campaign information including:
Email sequences and their content
Schedule configuration
Sender account assignments
Tracking settings (opens, clicks)
Campaign status and statistics
Inputs: params (required). Returns: result
get_leadBRead-only
Get lead details by ID.
Returns comprehensive lead information including:
Contact details (email, name, company, phone)
Custom variables
Campaign/list membership
Sequence status and history
Interest status
Inputs: params (required). Returns: result
get_server_infoARead-only
Get Instantly MCP server information.
Returns server version, loaded categories, and configuration status. Useful for debugging and verifying server setup.
Inputs: no named parameters. Returns: result
get_verification_stats_for_lead_listBRead-only
Get email verification statistics for a lead list.
Returns breakdown of verification results:
Valid emails
Invalid/bounced emails
Risky emails
Unknown status
Inputs: params (required). Returns: result
list_accountsARead-only
List email accounts with cursor-based pagination (100 per page).
PAGINATION: If response contains pagination.next_starting_after, there are MORE results. Call again with starting_after= to get next page. Continue until pagination.next_starting_after is null.
Status codes: 1=Active, 2=Paused, -1/-2/-3=Errors Provider codes: 1=IMAP, 2=Google, 3=Microsoft, 4=AWS
Returns accounts with warmup status and campaign eligibility.
Inputs: params. Returns: result
list_campaignsARead-only
List campaigns with cursor-based pagination (100 per page).
PAGINATION: If response contains pagination.next_starting_after, there are MORE results. Call again with starting_after= to get next page. Continue until pagination.next_starting_after is null.
Note: search filters by campaign NAME only, not by status. To filter by status, use campaign_status in get_daily_campaign_analytics.
Returns campaign list with status, lead counts, and performance metrics.
Inputs: params. Returns: result
list_lead_listsARead-only
List lead lists with cursor-based pagination (100 per page).
PAGINATION: If response contains pagination.next_starting_after, there are MORE results. Call again with starting_after= to get next page. Continue until pagination.next_starting_after is null.
Lead lists are containers for organizing leads outside of campaigns. Use has_enrichment_task filter to find lists with auto-enrichment enabled.
Inputs: params. Returns: result
list_leadsARead-only
List leads with cursor-based pagination (100 per page).
PAGINATION: If response contains pagination.next_starting_after, there are MORE results. Call again with starting_after= to get next page. Continue until pagination.next_starting_after is null.
Filter values:
FILTER_VAL_CONTACTED: Leads that have been contacted
FILTER_VAL_NOT_CONTACTED: Leads not yet contacted
FILTER_VAL_COMPLETED: Leads that completed sequence
FILTER_VAL_ACTIVE: Currently active leads
Use distinct_contacts=true to deduplicate by email.
Inputs: params. Returns: result
manage_account_stateA
Manage account state: pause, resume, enable/disable warmup, or test vitals.
Actions:
pause: Stop all sending from this account
resume: Re-enable sending
enable_warmup: Start warmup process
disable_warmup: Stop warmup process
test_vitals: Test IMAP/SMTP connectivity
Use test_vitals to diagnose connection issues.
Inputs: params (required). Returns: result
move_leads_to_campaign_or_listA
Move or copy leads between campaigns/lists.
Runs as background job for large operations.
Source selection (use one):
ids: Specific lead IDs to move
search + campaign/list_id: Filter leads by search term
filter + campaign/list_id: Filter by status
Destination (use one):
to_campaign_id: Target campaign
to_list_id: Target list
Set copy_leads=true to copy instead of move.
Inputs: params (required). Returns: result
pause_campaignA
Pause campaign to stop sending.
Effects:
Immediately stops all email sending
Leads remain in the campaign
In-progress sequences are paused
Use activate_campaign to resume sending.
Inputs: params (required). Returns: result
search_campaigns_by_contactARead-only
Find all campaigns that a specific contact/lead is part of.
Useful for:
Checking if a lead is already in any campaigns
Finding duplicate enrollments
Auditing lead campaign membership
Returns list of campaigns the contact email is enrolled in.
Inputs: params (required). Returns: result
update_accountA
Update account settings (partial update).
Common updates:
first_name, last_name: Display name
warmup: Warmup configuration (limit, advanced settings)
daily_limit: Max emails per day (1-100)
sending_gap: Minutes between emails (0-1440)
tracking_domain_name: Custom tracking domain
Only include fields you want to update.
Inputs: params (required). Returns: result
update_campaignA
Update campaign settings (partial update).
Common updates:
name: Campaign display name
sequences: Email sequence steps
email_list: Sender account assignments
daily_limit: Max emails per day per account
email_gap: Minutes between sends
open_tracking, link_tracking: Tracking toggles
Only include fields you want to update.
Inputs: params (required). Returns: result
update_leadA
Update lead (partial update).
⚠️ IMPORTANT: custom_variables REPLACES the entire object! To preserve existing custom variables:
First call get_lead to retrieve current values
Merge your changes with existing values
Pass the complete merged object
Example: If lead has {"industry": "Tech"} and you want to add {"size": "Large"}, you must pass {"industry": "Tech", "size": "Large"} - not just {"size": "Large"}
Inputs: params (required). Returns: result
update_lead_listB
Update lead list name, enrichment settings, or owner.
Inputs: params (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 27 tools
Most tools have distinct purposes targeting specific resources (campaigns, leads, accounts, lists) and actions (create, get, update, delete, list, manage). However, some overlap exists: 'add_leads_to_campaign_or_list_bulk' and 'move_leads_to_campaign_or_list' both handle lead transfers, and 'pause_campaign' vs 'manage_account_state' with pause/resume actions could cause minor confusion, but descriptions clarify their scopes.
Tool names follow a highly consistent verb_noun pattern throughout, such as 'activate_campaign', 'create_account', 'get_campaign', 'list_leads', 'update_lead', and 'delete_lead_list'. All tools use snake_case uniformly, with verbs like create, get, list, update, delete, pause, search, and manage applied predictably across resources.
With 27 tools, the count is borderline high for an email marketing server, potentially overwhelming. While it covers comprehensive operations for campaigns, leads, accounts, and lists, some tools like 'get_server_info' and 'search_campaigns_by_contact' might be consolidated or deemed non-essential, making the set feel slightly heavy but still manageable within the domain scope.
The tool set provides complete CRUD/lifecycle coverage for the email marketing domain: full create, read, update, delete, and list operations for campaigns, leads, accounts, and lead lists, plus specialized actions like activation, pausing, bulk operations, and analytics. No obvious gaps exist; agents can handle end-to-end workflows from setup to management and analysis without dead ends.
Maintenance
Related MCP Connectors
Run B2B outreach from your AI agent: 250+ tools for campaigns, leads, LinkedIn and email workflows.
Run cold email outbound from an AI agent: campaigns, leads, replies, sender accounts, autopilot.
One gateway, every app: Gmail, GitHub, Notion and more. Connect once, call any tool. Managed auth.
Automate HeyReach: campaigns, voice notes, ElevenLabs voices, leads, unibox, webhooks, analytics.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables AI assistants to manage email campaigns, leads, email accounts, and analytics through the Smartlead API, providing 28 tools for automated email outreach and campaign management.30260 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables cold email marketing automation with campaign management, lead tracking, deliverability optimization, and analytics, integrating with 113 tools via zero-config NPX installation.1,089 npm7MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with the Instantly.ai v2 API to manage campaigns, leads, accounts, replies, blocklist, and webhooks, with tools organized into read, write, and dangerous safety tiers.3 npmMIT
- AlicenseAqualityAmaintenanceEnables MCP clients to read Instantly.ai analytics and manage leads, campaigns, Unibox, sender accounts, blocklist, and webhooks, with write actions gated behind confirm prompts and configurable safety policies.4088 PyPIMIT