UNPKG

smartlead-mcp-by-leadmagic

Version:

💜 The Premier Model Context Protocol Server for SmartLead's Cold Email Automation Platform - Complete API coverage with 116+ tools for campaign management, lead tracking, smart delivery, and analytics. Beautiful purple-gradient installer, zero-config set

135 lines • 4.14 kB
/** * SmartLead MCP Server - Server Implementation * * A comprehensive Model Context Protocol (MCP) server that exposes SmartLead API * endpoints as MCP tools. This server provides seamless integration with MCP-compatible * clients like Claude Desktop, Cursor, Windsurf, and others. * * Architecture: * - Built on the official MCP SDK for maximum compatibility * - Modular tool structure for better maintainability * - Comprehensive error handling and user-friendly responses * - Type-safe parameter validation using Zod schemas * - Professional logging and debugging capabilities * - Production-ready with graceful degradation * * Tool Categories: * - Campaign Management (14 tools) * - Lead Management (17 tools) * - Analytics & Reporting (20 tools) * - Email Account Management (16 tools) * - Smart Delivery (16 tools) * - Webhooks (12 tools) * - Client Management (12 tools) * - Smart Senders (15 tools) * * @author LeadMagic Team * @version 1.5.0 */ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import { SmartLeadClient } from './client/index.js'; /** * SmartLead MCP Server * * Main server class that orchestrates the MCP server functionality. * Handles client initialization, tool registration, and request processing. */ export declare class SmartLeadMCPServer { private server; private client; /** * Creates a new SmartLead MCP Server instance * * @param apiKey - SmartLead API key for authentication * @param options - Optional configuration for the client */ constructor(apiKey: string, options?: { baseUrl?: string; timeout?: number; maxRetries?: number; retryDelay?: number; rateLimit?: number; }); /** * Sets up the MCP server with tools and handlers * @private */ private setupServer; /** * Tests the SmartLead API connection * @private */ private testConnection; /** * Registers all SmartLead API endpoints as MCP tools * * This method sets up SmartLead tools using a tiered approach to prevent overwhelming * MCP clients. Tools are organized into categories that can be selectively enabled: * * **Essential Tools (Always Loaded):** * - Campaign Management (13 tools) * - Lead Management (17 tools) * - Basic Email Accounts (10 tools) * - Basic Statistics (9 tools) * * **Advanced Tools (Optional - Set SMARTLEAD_ADVANCED_TOOLS=true):** * - Smart Delivery (25 tools) * - Global Analytics (20 tools) * - Webhooks (5 tools) * * **Administrative Tools (Optional - Set SMARTLEAD_ADMIN_TOOLS=true):** * - Client Management (6 tools) * - Smart Senders (5 tools) * * @private */ private setupTools; /** * Calculates the number of loaded tools based on enabled features * @private */ private getLoadedToolCount; /** * Sets up error handlers for the MCP server * @private */ private setupErrorHandlers; /** * Formats successful API responses for MCP clients * * @param message - User-friendly message describing the operation * @param data - Raw API response data * @param summary - Optional summary for quick overview * @returns Formatted MCP tool response * @private */ private formatSuccessResponse; /** * Handles and formats errors for MCP clients * * Provides comprehensive error information while maintaining user-friendly messaging. * Includes specific guidance for common error scenarios. * * @param error - The error that occurred * @returns Formatted MCP error response * @private */ private handleError; /** * Connects the MCP server to stdio */ connect(): Promise<void>; /** * Gets the MCP server instance */ getServer(): McpServer; /** * Gets the SmartLead client instance */ getClient(): SmartLeadClient; /** * Closes the MCP server */ close(): Promise<void>; } //# sourceMappingURL=server.d.ts.map