inboxassure-mcp-server
Version:
Comprehensive MCP server for InboxAssure email marketing platform with full API coverage including campaigns, replies, and email account management.
996 lines (984 loc) • 65.7 kB
JavaScript
import fetch from 'node-fetch';
import readline from 'readline';
const SERVER_URL = 'https://bison.imnodev.com/api';
export function startMcpBridge(apiKey) {
if (!apiKey) {
console.error('[MCPX] Error: No API key provided');
process.exit(1);
}
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false
});
console.error(`[MCPX] v5.0.0 Bridge initialized with all 52 endpoints...`);
rl.on('line', async (line) => {
try {
const message = JSON.parse(line);
if (message.method === 'initialize') {
console.log(JSON.stringify({
jsonrpc: '2.0',
id: message.id,
result: {
protocolVersion: '2024-11-05',
capabilities: { tools: { listChanged: true } },
serverInfo: {
name: 'InboxAssure MCP Server',
version: '5.0.0',
description: 'Complete InboxAssure MCP server with all 52 endpoints (32 Campaigns + 10 Replies + 10 Email Accounts)'
}
}
}));
}
else if (message.method === 'notifications/initialized') {
console.error(`[MCPX] Initialized`);
}
else if (message.method === 'tools/list') {
console.log(JSON.stringify({
jsonrpc: '2.0',
id: message.id,
result: {
tools: [
// Original test tool
{
name: 'get_bison_hello',
description: 'Test endpoint to verify API connectivity',
inputSchema: {
type: 'object',
properties: {
random_string: { type: 'string', description: 'Dummy parameter' }
},
additionalProperties: false
}
},
// Campaigns API (32 tools)
{
name: 'list_campaigns',
description: 'Retrieve all campaigns in your workspace with optional filtering and pagination',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID to list campaigns for' },
params: {
type: 'object',
properties: {
search: { type: 'string', description: 'Search term for campaign names' },
status: { type: 'string', description: 'Filter by status (active, paused, draft)' },
tag_ids: { type: 'array', items: { type: 'string' }, description: 'Array of tag IDs for filtering' },
page: { type: 'number', description: 'Page number for pagination' },
per_page: { type: 'number', description: 'Items per page (max 100)' }
}
}
},
required: ['workspace_id'],
additionalProperties: false
}
},
{
name: 'create_campaign',
description: 'Create a new email marketing campaign',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID to create the campaign in' },
name: { type: 'string', description: 'Name of the campaign' },
type: { type: 'string', description: 'Type of campaign (default: outbound)', enum: ['outbound', 'inbound'] }
},
required: ['workspace_id', 'name'],
additionalProperties: false
}
},
{
name: 'get_campaign_details',
description: 'Retrieve detailed information about a specific campaign',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
campaign_id: { type: 'string', description: 'The campaign ID to get details for' }
},
required: ['workspace_id', 'campaign_id'],
additionalProperties: false
}
},
{
name: 'pause_campaign',
description: 'Temporarily stop a running campaign without losing progress',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
campaign_id: { type: 'string', description: 'The campaign ID to pause' }
},
required: ['workspace_id', 'campaign_id'],
additionalProperties: false
}
},
{
name: 'resume_campaign',
description: 'Restart a paused campaign from where it left off',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
campaign_id: { type: 'string', description: 'The campaign ID to resume' }
},
required: ['workspace_id', 'campaign_id'],
additionalProperties: false
}
},
{
name: 'archive_campaign',
description: 'Archive a completed campaign',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
campaign_id: { type: 'string', description: 'The campaign ID to archive' }
},
required: ['workspace_id', 'campaign_id'],
additionalProperties: false
}
},
{
name: 'update_campaign_settings',
description: 'Update campaign configuration and settings',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
campaign_id: { type: 'string', description: 'The campaign ID to update' },
name: { type: 'string', description: 'New campaign name' },
type: { type: 'string', description: 'Campaign type', enum: ['outbound', 'inbound'] }
},
required: ['workspace_id', 'campaign_id'],
additionalProperties: false
}
},
{
name: 'create_campaign_schedule',
description: 'Set up when your campaign sends emails (days, times, timezone)',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
campaign_id: { type: 'string', description: 'The campaign ID to create schedule for' },
monday: { type: 'boolean', description: 'Send emails on Monday' },
tuesday: { type: 'boolean', description: 'Send emails on Tuesday' },
wednesday: { type: 'boolean', description: 'Send emails on Wednesday' },
thursday: { type: 'boolean', description: 'Send emails on Thursday' },
friday: { type: 'boolean', description: 'Send emails on Friday' },
saturday: { type: 'boolean', description: 'Send emails on Saturday' },
sunday: { type: 'boolean', description: 'Send emails on Sunday' },
start_time: { type: 'string', description: 'Start time in HH:MM format (e.g., 09:00)' },
end_time: { type: 'string', description: 'End time in HH:MM format (e.g., 17:00)' },
timezone: { type: 'string', description: 'Timezone (e.g., America/New_York)' }
},
required: ['workspace_id', 'campaign_id', 'start_time', 'end_time', 'timezone'],
additionalProperties: false
}
},
{
name: 'view_campaign_schedule',
description: 'Retrieve current campaign schedule settings',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
campaign_id: { type: 'string', description: 'The campaign ID' }
},
required: ['workspace_id', 'campaign_id'],
additionalProperties: false
}
},
{
name: 'update_campaign_schedule',
description: 'Modify existing campaign schedule',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
campaign_id: { type: 'string', description: 'The campaign ID' },
monday: { type: 'boolean' },
tuesday: { type: 'boolean' },
wednesday: { type: 'boolean' },
thursday: { type: 'boolean' },
friday: { type: 'boolean' },
saturday: { type: 'boolean' },
sunday: { type: 'boolean' },
start_time: { type: 'string' },
end_time: { type: 'string' },
timezone: { type: 'string' }
},
required: ['workspace_id', 'campaign_id'],
additionalProperties: false
}
},
{
name: 'get_schedule_templates',
description: 'Retrieve predefined schedule templates for quick setup',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' }
},
required: ['workspace_id'],
additionalProperties: false
}
},
{
name: 'get_available_timezones',
description: 'List all available timezone options',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' }
},
required: ['workspace_id'],
additionalProperties: false
}
},
{
name: 'create_schedule_from_template',
description: 'Apply a predefined schedule template to a campaign',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
campaign_id: { type: 'string', description: 'The campaign ID' },
template_id: { type: 'string', description: 'The schedule template ID' }
},
required: ['workspace_id', 'campaign_id', 'template_id'],
additionalProperties: false
}
},
{
name: 'show_sending_schedules',
description: 'View sending schedules across all campaigns for a specific day',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
date: { type: 'string', description: 'Date in YYYY-MM-DD format' }
},
required: ['workspace_id'],
additionalProperties: false
}
},
{
name: 'show_campaign_sending_schedule',
description: 'View sending schedule for a specific campaign',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
campaign_id: { type: 'string', description: 'The campaign ID' }
},
required: ['workspace_id', 'campaign_id'],
additionalProperties: false
}
},
{
name: 'view_sequence_steps',
description: 'Retrieve all sequence steps for a campaign',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
campaign_id: { type: 'string', description: 'The campaign ID' }
},
required: ['workspace_id', 'campaign_id'],
additionalProperties: false
}
},
{
name: 'create_sequence_steps',
description: 'Define the series of emails that will be sent to leads over time',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
campaign_id: { type: 'string', description: 'The campaign ID to create sequence for' },
title: { type: 'string', description: 'Title for the email sequence' },
sequence_steps: {
type: 'array',
description: 'Array of email steps in the sequence',
items: {
type: 'object',
properties: {
email_subject: { type: 'string', description: 'Subject line for the email' },
email_body: { type: 'string', description: 'Body content of the email' },
wait_in_days: { type: 'number', description: 'Days to wait before sending this email' },
order: { type: 'number', description: 'Order of this step in the sequence' }
},
required: ['email_subject', 'email_body', 'wait_in_days', 'order']
}
}
},
required: ['workspace_id', 'campaign_id', 'title', 'sequence_steps'],
additionalProperties: false
}
},
{
name: 'update_sequence_steps',
description: 'Modify existing sequence step content and timing',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
sequence_step_id: { type: 'string', description: 'The sequence step ID to update' },
email_subject: { type: 'string' },
email_body: { type: 'string' },
wait_in_days: { type: 'number' },
order: { type: 'number' }
},
required: ['workspace_id', 'sequence_step_id'],
additionalProperties: false
}
},
{
name: 'delete_sequence_step',
description: 'Remove a sequence step from the campaign',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
sequence_step_id: { type: 'string', description: 'The sequence step ID to delete' }
},
required: ['workspace_id', 'sequence_step_id'],
additionalProperties: false
}
},
{
name: 'send_test_email',
description: 'Send a test email for a specific sequence step',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
sequence_step_id: { type: 'string', description: 'The sequence step ID' },
test_email: { type: 'string', description: 'Email address to send test to' }
},
required: ['workspace_id', 'sequence_step_id', 'test_email'],
additionalProperties: false
}
},
{
name: 'get_campaign_replies',
description: 'View all replies received for a specific campaign',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
campaign_id: { type: 'string', description: 'The campaign ID' },
params: {
type: 'object',
properties: {
page: { type: 'number' },
per_page: { type: 'number' },
status: { type: 'string' }
}
}
},
required: ['workspace_id', 'campaign_id'],
additionalProperties: false
}
},
{
name: 'get_campaign_leads',
description: 'View all leads currently in the campaign with their status',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
campaign_id: { type: 'string', description: 'The campaign ID to get leads for' },
params: {
type: 'object',
properties: {
page: { type: 'number', description: 'Page number for pagination' },
per_page: { type: 'number', description: 'Items per page' },
status: { type: 'string', description: 'Filter by lead status' }
}
}
},
required: ['workspace_id', 'campaign_id'],
additionalProperties: false
}
},
{
name: 'remove_leads_from_campaign',
description: 'Remove specific leads from a campaign',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
campaign_id: { type: 'string', description: 'The campaign ID' },
lead_ids: { type: 'array', items: { type: 'string' }, description: 'Array of lead IDs to remove' }
},
required: ['workspace_id', 'campaign_id', 'lead_ids'],
additionalProperties: false
}
},
{
name: 'import_leads_from_list',
description: 'Add an entire existing lead list to your campaign',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
campaign_id: { type: 'string', description: 'The campaign ID to attach leads to' },
lead_list_id: { type: 'string', description: 'The ID of the lead list to attach' }
},
required: ['workspace_id', 'campaign_id', 'lead_list_id'],
additionalProperties: false
}
},
{
name: 'import_leads_by_ids',
description: 'Add specific leads to a campaign using their IDs',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
campaign_id: { type: 'string', description: 'The campaign ID' },
lead_ids: { type: 'array', items: { type: 'string' }, description: 'Array of lead IDs to add' }
},
required: ['workspace_id', 'campaign_id', 'lead_ids'],
additionalProperties: false
}
},
{
name: 'stop_future_emails_for_leads',
description: 'Prevent future emails from being sent to specific leads',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
campaign_id: { type: 'string', description: 'The campaign ID' },
lead_ids: { type: 'array', items: { type: 'string' }, description: 'Array of lead IDs to stop emails for' }
},
required: ['workspace_id', 'campaign_id', 'lead_ids'],
additionalProperties: false
}
},
{
name: 'get_scheduled_emails',
description: 'View all emails scheduled to be sent for a campaign',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
campaign_id: { type: 'string', description: 'The campaign ID' },
params: {
type: 'object',
properties: {
page: { type: 'number' },
per_page: { type: 'number' },
status: { type: 'string' }
}
}
},
required: ['workspace_id', 'campaign_id'],
additionalProperties: false
}
},
{
name: 'get_campaign_sender_emails',
description: 'View all email accounts assigned to a campaign',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
campaign_id: { type: 'string', description: 'The campaign ID' }
},
required: ['workspace_id', 'campaign_id'],
additionalProperties: false
}
},
{
name: 'attach_sender_emails',
description: 'Add email accounts to a campaign for sending',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
campaign_id: { type: 'string', description: 'The campaign ID' },
sender_email_ids: { type: 'array', items: { type: 'string' }, description: 'Array of email account IDs to attach' }
},
required: ['workspace_id', 'campaign_id', 'sender_email_ids'],
additionalProperties: false
}
},
{
name: 'remove_sender_emails',
description: 'Remove email accounts from a campaign',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
campaign_id: { type: 'string', description: 'The campaign ID' },
sender_email_ids: { type: 'array', items: { type: 'string' }, description: 'Array of email account IDs to remove' }
},
required: ['workspace_id', 'campaign_id', 'sender_email_ids'],
additionalProperties: false
}
},
{
name: 'get_campaign_stats',
description: 'Retrieve detailed performance metrics for a specific time period',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
campaign_id: { type: 'string', description: 'The campaign ID to get stats for' },
start_date: { type: 'string', description: 'Start date in YYYY-MM-DD format' },
end_date: { type: 'string', description: 'End date in YYYY-MM-DD format' }
},
required: ['workspace_id', 'campaign_id', 'start_date', 'end_date'],
additionalProperties: false
}
},
{
name: 'get_chart_statistics',
description: 'Retrieve time-series data for campaign performance charts',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
campaign_id: { type: 'string', description: 'The campaign ID' },
start_date: { type: 'string', description: 'Start date in YYYY-MM-DD format' },
end_date: { type: 'string', description: 'End date in YYYY-MM-DD format' }
},
required: ['workspace_id', 'campaign_id'],
additionalProperties: false
}
},
// Replies API (10 tools)
{
name: 'list_replies',
description: 'Retrieve all email replies across campaigns with filtering options',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
params: {
type: 'object',
properties: {
search: { type: 'string', description: 'Search term for emails, subjects' },
status: { type: 'string', description: 'Filter by status (interested, not_interested, automated_reply)' },
folder: { type: 'string', description: 'Email folder (inbox, sent, spam, bounced, all)' },
read: { type: 'boolean', description: 'Filter by read status' },
campaign_id: { type: 'string', description: 'Filter by campaign ID' },
sender_email_id: { type: 'string', description: 'Filter by sender email ID' },
lead_id: { type: 'string', description: 'Filter by lead ID' },
tag_ids: { type: 'array', items: { type: 'string' }, description: 'Array of tag IDs for filtering' },
page: { type: 'number', description: 'Page number for pagination' },
per_page: { type: 'number', description: 'Items per page' }
}
}
},
required: ['workspace_id'],
additionalProperties: false
}
},
{
name: 'get_reply_details',
description: 'Get complete details of a specific reply including full message content',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
reply_id: { type: 'string', description: 'The reply ID to get details for' }
},
required: ['workspace_id', 'reply_id'],
additionalProperties: false
}
},
{
name: 'get_email_account_replies',
description: 'View all replies for a specific email account',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
sender_email_id: { type: 'string', description: 'The sender email ID' },
params: {
type: 'object',
properties: {
page: { type: 'number' },
per_page: { type: 'number' },
status: { type: 'string' }
}
}
},
required: ['workspace_id', 'sender_email_id'],
additionalProperties: false
}
},
{
name: 'compose_new_email',
description: 'Send a standalone email outside of campaign sequences',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
sender_email_id: { type: 'string', description: 'ID of the sender email account' },
to_emails: { type: 'array', items: { type: 'string' }, description: 'Array of recipient email addresses' },
message: { type: 'string', description: 'The email message content' },
content_type: { type: 'string', description: 'Content type (text/plain or text/html)', enum: ['text/plain', 'text/html'] },
cc_emails: { type: 'array', items: { type: 'string' }, description: 'Array of CC email addresses' },
bcc_emails: { type: 'array', items: { type: 'string' }, description: 'Array of BCC email addresses' }
},
required: ['workspace_id', 'sender_email_id', 'to_emails', 'message'],
additionalProperties: false
}
},
{
name: 'reply_to_email',
description: 'Respond to an incoming email reply, maintaining conversation thread',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
reply_id: { type: 'string', description: 'The reply ID to respond to' },
sender_email_id: { type: 'string', description: 'ID of the sender email account' },
to_emails: { type: 'array', items: { type: 'string' }, description: 'Array of recipient email addresses' },
message: { type: 'string', description: 'The reply message content' },
content_type: { type: 'string', description: 'Content type (text/plain or text/html)', enum: ['text/plain', 'text/html'] }
},
required: ['workspace_id', 'reply_id', 'sender_email_id', 'to_emails', 'message'],
additionalProperties: false
}
},
{
name: 'forward_email',
description: 'Forward an existing reply to other recipients',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
reply_id: { type: 'string', description: 'The reply ID to forward' },
to_emails: { type: 'array', items: { type: 'string' }, description: 'Array of recipient email addresses' },
message: { type: 'string', description: 'Additional message to include' }
},
required: ['workspace_id', 'reply_id', 'to_emails'],
additionalProperties: false
}
},
{
name: 'mark_as_not_interested',
description: 'Mark a reply as not interested for lead qualification',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
reply_id: { type: 'string', description: 'The reply ID to mark as not interested' }
},
required: ['workspace_id', 'reply_id'],
additionalProperties: false
}
},
{
name: 'delete_reply',
description: 'Remove a reply from the system',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
reply_id: { type: 'string', description: 'The reply ID to delete' }
},
required: ['workspace_id', 'reply_id'],
additionalProperties: false
}
},
{
name: 'get_conversation_thread',
description: 'Retrieve the complete email conversation history for context',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
reply_id: { type: 'string', description: 'The reply ID to get conversation thread for' }
},
required: ['workspace_id', 'reply_id'],
additionalProperties: false
}
},
{
name: 'attach_scheduled_email_to_reply',
description: 'Link a scheduled email to a specific reply',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
reply_id: { type: 'string', description: 'The reply ID' },
scheduled_email_id: { type: 'string', description: 'The scheduled email ID to attach' }
},
required: ['workspace_id', 'reply_id', 'scheduled_email_id'],
additionalProperties: false
}
},
// Email Accounts API (10 tools)
{
name: 'list_email_accounts',
description: 'Get all email accounts configured in your workspace with their settings',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
params: {
type: 'object',
properties: {
search: { type: 'string', description: 'Search term for email addresses, names' },
tag_ids: { type: 'array', items: { type: 'string' }, description: 'Array of tag IDs for filtering' },
page: { type: 'number', description: 'Page number for pagination' },
per_page: { type: 'number', description: 'Items per page' }
}
}
},
required: ['workspace_id'],
additionalProperties: false
}
},
{
name: 'get_email_account_details',
description: 'Retrieve detailed configuration and statistics for a specific email account',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
sender_email_id: { type: 'string', description: 'The email account ID to get details for' }
},
required: ['workspace_id', 'sender_email_id'],
additionalProperties: false
}
},
{
name: 'update_email_account',
description: 'Modify email account configuration like daily limits and signatures',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
sender_email_id: { type: 'string', description: 'The email account ID to update' },
daily_limit: { type: 'number', description: 'New daily email sending limit' },
name: { type: 'string', description: 'New display name for the email account' },
email_signature: { type: 'string', description: 'New email signature' }
},
required: ['workspace_id', 'sender_email_id'],
additionalProperties: false
}
},
{
name: 'delete_email_account',
description: 'Remove an email account from the workspace',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
sender_email_id: { type: 'string', description: 'The email account ID to delete' }
},
required: ['workspace_id', 'sender_email_id'],
additionalProperties: false
}
},
{
name: 'get_account_campaigns',
description: 'See which campaigns are using this email account for sending',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
sender_email_id: { type: 'string', description: 'The email account ID to get campaigns for' }
},
required: ['workspace_id', 'sender_email_id'],
additionalProperties: false
}
},
{
name: 'get_account_replies',
description: 'View all replies received by this specific email account',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
sender_email_id: { type: 'string', description: 'The email account ID to get replies for' }
},
required: ['workspace_id', 'sender_email_id'],
additionalProperties: false
}
},
{
name: 'get_oauth_access_token',
description: 'Retrieve OAuth token for Google/Microsoft email accounts',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
sender_email_id: { type: 'string', description: 'The email account ID' }
},
required: ['workspace_id', 'sender_email_id'],
additionalProperties: false
}
},
{
name: 'check_mx_records',
description: 'Verify MX record configuration for the email account',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
sender_email_id: { type: 'string', description: 'The email account ID' }
},
required: ['workspace_id', 'sender_email_id'],
additionalProperties: false
}
},
{
name: 'bulk_update_email_signatures',
description: 'Update email signatures across multiple accounts simultaneously',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
sender_email_ids: { type: 'array', items: { type: 'string' }, description: 'Array of email account IDs to update' },
email_signature: { type: 'string', description: 'New email signature to apply to all selected accounts' }
},
required: ['workspace_id', 'sender_email_ids', 'email_signature'],
additionalProperties: false
}
},
{
name: 'bulk_update_daily_limits',
description: 'Update daily sending limits for multiple email accounts',
inputSchema: {
type: 'object',
properties: {
workspace_id: { type: 'string', description: 'The workspace ID' },
sender_email_ids: { type: 'array', items: { type: 'string' }, description: 'Array of email account IDs to update' },
daily_limit: { type: 'number', description: 'New daily sending limit to apply' }
},
required: ['workspace_id', 'sender_email_ids', 'daily_limit'],
additionalProperties: false
}
}
]
}
}));
}
else if (message.method === 'tools/call') {
const toolName = message.params?.name;
const args = message.params.arguments || {};
try {
let response;
const headers = { 'X-API-Key': apiKey };
if (toolName === 'get_bison_hello') {
response = await fetch(`${SERVER_URL}/hello`, { headers });
} else if (toolName === 'list_campaigns') {
const params = new URLSearchParams({ workspace_id: args.workspace_id, ...(args.params || {}) });
response = await fetch(`${SERVER_URL}/campaigns/campaigns?${params}`, { headers });
} else if (toolName === 'list_email_accounts') {
const params = new URLSearchParams({ workspace_id: args.workspace_id, ...(args.params || {}) });
response = await fetch(`${SERVER_URL}/email-accounts/sender-emails?${params}`, { headers });
} else if (toolName === 'list_replies') {
const params = new URLSearchParams({ workspace_id: args.workspace_id, ...(args.params || {}) });
response = await fetch(`${SERVER_URL}/replies/?${params}`, { headers });
} else if (toolName === 'get_campaign_replies') {
const params = new URLSearchParams({ workspace_id: args.workspace_id, ...(args.params || {}) });
response = await fetch(`${SERVER_URL}/campaigns/campaigns/${args.campaign_id}/replies?${params}`, { headers });
} else if (toolName === 'get_reply_details') {
const params = new URLSearchParams({ workspace_id: args.workspace_id });
response = await fetch(`${SERVER_URL}/replies/${args.reply_id}?${params}`, { headers });
} else if (toolName === 'get_campaign_details') {
const params = new URLSearchParams({ workspace_id: args.workspace_id });
response = await fetch(`${SERVER_URL}/campaigns/campaigns/${args.campaign_id}?${params}`, { headers });
} else if (toolName === 'create_campaign') {
response = await fetch(`${SERVER_URL}/campaigns/campaigns`, {
method: 'POST',
headers: { ...headers, 'Content-Type': 'application/json' },
body: JSON.stringify({
workspace_id: args.workspace_id,
name: args.name,
type: args.type || 'outbound'
})
});
} else if (toolName === 'pause_campaign') {
response = await fetch(`${SERVER_URL}/campaigns/campaigns/${args.campaign_id}/pause`, {
method: 'PATCH',
headers: { ...headers, 'Content-Type': 'application/json' },
body: JSON.stringify({ workspace_id: args.workspace_id })
});
} else if (toolName === 'resume_campaign') {
response = await fetch(`${SERVER_URL}/campaigns/campaigns/${args.campaign_id}/resume`, {
method: 'PATCH',
headers: { ...headers, 'Content-Type': 'application/json' },
body: JSON.stringify({ workspace_id: args.workspace_id })
});
} else if (toolName === 'get_campaign_stats') {
const params = new URLSearchParams({
workspace_id: args.workspace_id,
start_date: args.start_date,
end_date: args.end_date
});
response = await fetch(`${SERVER_URL}/campaigns/campaigns/${args.campaign_id}/stats?${params}`, {
method: 'POST',
headers: { ...headers, 'Content-Type': 'application/json' },
body: JSON.stringify({
start_date: args.start_date,
end_date: args.end_date
})
});
} else if (toolName === 'get_campaign_leads') {
const params = new URLSearchParams({ workspace_id: args.workspace_id, ...(args.params || {}) });
response = await fetch(`${SERVER_URL}/campaigns/campaigns/${args.campaign_id}/leads?${params}`, { headers });
} else if (toolName === 'get_email_account_details') {
const params = new URLSearchParams({ workspace_id: args.workspace_id });
response = await fetch(`${SERVER_URL}/email-accounts/sender-emails/${args.sender_email_id}?${params}`, { headers });
} else if (toolName === 'compose_new_email') {
response = await fetch(`${SERVER_URL}/replies/new`, {
method: 'POST',
headers: { ...headers, 'Content-Type': 'application/json' },
body: JSON.stringify({
workspace_id: args.workspace_id,
sender_email_id: args.sender_email_id,
to_emails: args.to_emails,
message: args.message,
content_type: args.content_type,
cc_emails: args.cc_emails,
bcc_emails: args.bcc_emails
})
});
} else if (toolName === 'archive_campaign') {
response = await fetch(`${SERVER_URL}/campaigns/campaigns/${args.campaign_id}/archive`, {
method: 'PATCH',
headers: { ...headers, 'Content-Type': 'application/json' },
body: JSON.stringify({ workspace_id: args.workspace_id })
});
} else if (toolName === 'update_campaign_settings') {
response = await fetch(`${SERVER_URL}/campaigns/campaigns/${args.campaign_id}/update`, {
method: 'PATCH',
headers: { ...headers, 'Content-Type': 'application/json' },
body: JSON.stringify({
workspace_id: args.workspace_id,
name: args.name,
type: args.type
})
});
} else if (toolName === 'create_campaign_schedule') {
response = await fetch(`${SERVER_URL}/campaigns/campaigns/${args.campaign_id}/schedule`, {
method: 'POST',
headers: { ...headers, 'Content-Type': 'application/json' },
body: JSON.stringify({
workspace_id: args.workspace_id,
monday: args.monday,
tuesday: args.tuesday,
wednesday: args.wednesday,
thursday: args.thursday,
friday: args.friday,
saturday: args.saturday,
sunday: args.sunday,
start_time: args.start_time,
end_time: args.end_time,
timezone: args.timezone
})
});