Instantly MCP Server
Enables interaction with Instantly.ai email outreach platform through 31 tools across accounts, campaigns, leads, emails, and analytics. Supports both local and remote deployment with multi-tenant authentication.
README
Instantly MCP Server (Python)
A lightweight, robust Model Context Protocol (MCP) server for the Instantly.ai V2 API, built with FastMCP.
Features
- 31 tools across 5 categories (accounts, campaigns, leads, emails, analytics)
- 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
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-dotenv
Configuration
Set your Instantly API key:
export INSTANTLY_API_KEY="your-api-key-here"
Or create a .env file:
INSTANTLY_API_KEY=your-api-key-here
Running 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 8000
stdio Mode (Local Development)
# Using FastMCP CLI
fastmcp run src/instantly_mcp/server.py
# Using Python directly
python -m instantly_mcp.server
Tool Categories
Accounts (6 tools)
| Tool | Description |
|---|---|
list_accounts |
List email accounts with filtering |
get_account |
Get account details and warmup status |
create_account |
Create account with IMAP/SMTP credentials |
update_account |
Update account settings |
manage_account_state |
Pause, resume, warmup control, test vitals |
delete_account |
⚠️ Permanently delete account |
Campaigns (6 tools)
| Tool | Description |
|---|---|
create_campaign |
Create email campaign (two-step process) |
list_campaigns |
List campaigns with pagination |
get_campaign |
Get campaign details and sequences |
update_campaign |
Update campaign settings |
activate_campaign |
Start campaign sending |
pause_campaign |
Stop campaign sending |
Leads (11 tools)
| Tool | Description |
|---|---|
list_leads |
List leads with filtering |
get_lead |
Get lead details |
create_lead |
Create single lead |
update_lead |
Update lead (⚠️ custom_variables replaces all) |
list_lead_lists |
List lead lists |
create_lead_list |
Create lead list |
update_lead_list |
Update lead list |
get_verification_stats_for_lead_list |
Get email verification stats |
add_leads_to_campaign_or_list_bulk |
Bulk add up to 1,000 leads |
delete_lead |
⚠️ Permanently delete lead |
move_leads_to_campaign_or_list |
Move/copy leads between campaigns/lists |
Emails (5 tools)
| Tool | Description |
|---|---|
list_emails |
List emails with filtering |
get_email |
Get email details |
reply_to_email |
🚨 Send real email reply |
count_unread_emails |
Count unread inbox emails |
verify_email |
Verify email deliverability |
Analytics (3 tools)
| Tool | Description |
|---|---|
get_campaign_analytics |
Campaign metrics (opens, clicks, replies) |
get_daily_campaign_analytics |
Day-by-day performance |
get_warmup_analytics |
Account warmup metrics |
Lazy Loading (Context Window Optimization)
Reduce context window usage by loading only the categories you need:
# Load only accounts and campaigns (12 tools instead of 31)
export TOOL_CATEGORIES="accounts,campaigns"
# Load only leads and analytics
export TOOL_CATEGORIES="leads,analytics"
Valid categories: accounts, campaigns, leads, emails, analytics
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_KEY
2. Header Authentication
URL: https://your-server.com/mcp
Header: Authorization: YOUR_API_KEY
Note: Bearer token prefix is optional
3. Custom Header
URL: https://your-server.com/mcp
Header: x-instantly-api-key: YOUR_API_KEY
4. 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 # 6 campaign tools
│ ├── leads.py # 11 lead tools
│ ├── emails.py # 5 email tools
│ └── analytics.py # 3 analytics tools
├── pyproject.toml # Dependencies
├── env.example # Environment template
└── README.md # This file
Comparison with TypeScript Version
| Aspect | TypeScript | Python FastMCP |
|---|---|---|
| Lines of Code | ~5,000+ | ~1,500 |
| Tool Registration | Manual handlers | @mcp.tool decorator |
| 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.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。