Skip to main content
Glama
salesforce-marketing-mcp

salesforce-marketing-mcp

salesforce-marketing-mcp

MIT License Node.js MCP

A production-ready Model Context Protocol (MCP) server that gives AI assistants (Claude, Cursor, etc.) direct access to Salesforce CRM data. Built for marketing ops, revenue ops, and B2B marketing teams who want AI-assisted access to leads, contacts, campaigns, campaign members, tasks, and 14 reporting tools — all without writing SOQL.


Features

  • Leads — Search, get, create, update, and convert leads

  • Contacts — Search, get, create, update, and look up by email

  • Accounts — Search, get, and list contacts per account

  • Campaigns — List, get, create, and update campaigns

  • Campaign Members — List members, add individuals, bulk-add up to 200, update statuses

  • Tasks — Create tasks; list by lead, contact, or campaign

  • Analytics Reports — List, run, and describe Salesforce Analytics reports

  • Campaign Analytics — ROI calc, member status breakdown, top campaigns, performance trends

  • Attribution — Lead source breakdown, pipeline by campaign, CampaignInfluence, won revenue by campaign, lead conversion metrics

  • Pipeline — Pipeline summary, pipeline by lead source, MQL trend, forecast summary

  • Activity — Activity summary by dimension, recent activities by lead or contact

  • Power tools — Raw SOQL, SObject describe, list all objects


Prerequisites

  • A Salesforce org (any edition with API access)

  • Your Salesforce username, password, and security token

    • To get/reset your security token: Settings > Personal Information > Reset My Security Token

  • Node.js 20 or later

No connected app or OAuth setup required.


Setup

1. Install

npm install -g salesforce-marketing-mcp
# or run directly with npx
npx salesforce-marketing-mcp

2. Environment variables

Variable

Required

Default

Description

SF_USERNAME

Yes

—

Salesforce login email

SF_PASSWORD

Yes

—

Salesforce password

SF_SECURITY_TOKEN

Yes

—

Security token (appended to password on login)

SF_LOGIN_URL

No

https://login.salesforce.com

Use https://test.salesforce.com for sandboxes

SF_API_VERSION

No

60.0

Salesforce API version

Create a .env file or set them in your shell:

export SF_USERNAME="you@yourcompany.com"
export SF_PASSWORD="yourpassword"
export SF_SECURITY_TOKEN="yourtoken"
# For sandbox:
export SF_LOGIN_URL="https://test.salesforce.com"

Usage

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "salesforce": {
      "command": "npx",
      "args": ["salesforce-marketing-mcp"],
      "env": {
        "SF_USERNAME": "you@yourcompany.com",
        "SF_PASSWORD": "yourpassword",
        "SF_SECURITY_TOKEN": "yourtoken",
        "SF_LOGIN_URL": "https://login.salesforce.com"
      }
    }
  }
}

Claude Code

claude mcp add salesforce-marketing-mcp \
  -e SF_USERNAME=you@yourcompany.com \
  -e SF_PASSWORD=yourpassword \
  -e SF_SECURITY_TOKEN=yourtoken \
  -- npx salesforce-marketing-mcp

Cursor

In .cursor/mcp.json:

{
  "mcpServers": {
    "salesforce": {
      "command": "npx",
      "args": ["salesforce-marketing-mcp"],
      "env": {
        "SF_USERNAME": "you@yourcompany.com",
        "SF_PASSWORD": "yourpassword",
        "SF_SECURITY_TOKEN": "yourtoken"
      }
    }
  }
}

Tools reference

Tool

Description

sf_search_leads

SOSL search across lead name, email, and company

sf_get_lead

Full lead record by ID

sf_create_lead

Create a new lead

sf_update_lead

Update any lead fields

sf_convert_lead

Convert lead to Account / Contact / Opportunity

sf_search_contacts

SOSL search across contact name and email

sf_get_contact

Full contact record with Account name

sf_create_contact

Create a new contact

sf_update_contact

Update any contact fields

sf_contact_by_email

Find contacts by email address (up to 10 matches)

sf_search_accounts

SOSL search on account name

sf_get_account

Account record with open opp count and lead count

sf_list_account_contacts

Contacts associated with an account

sf_list_campaigns

List campaigns with optional status/type/active filters

sf_get_campaign

Full campaign record with all performance metrics

sf_create_campaign

Create a new campaign

sf_update_campaign

Update any campaign fields

sf_get_campaign_members

List campaign members with lead/contact details

sf_add_campaign_member

Add a single lead or contact to a campaign

sf_bulk_add_campaign_members

Add up to 200 leads/contacts in one call

sf_update_campaign_member_status

Update member status and HasResponded flag

sf_create_task

Create a task linked to a lead, contact, or campaign

sf_list_tasks_by_lead

Tasks associated with a lead

sf_list_tasks_by_contact

Tasks associated with a contact

sf_list_tasks_by_campaign

Tasks associated with a campaign

sf_list_reports

List available Salesforce Analytics reports

sf_run_report

Execute a report and return structured rows

sf_get_report_metadata

Column definitions and groupings for a report

sf_campaign_roi

ROI, CPL, CPO, and response rate per campaign

sf_campaign_member_status_breakdown

Member status counts for a campaign

sf_top_campaigns

Rank campaigns by responses, opps, or won revenue

sf_campaign_performance_trend

Member additions over time (week/month)

sf_lead_source_breakdown

Lead volume, conversions, and revenue by lead source

sf_pipeline_by_campaign

Open pipeline grouped by campaign and stage

sf_campaign_influence

CampaignInfluence records linking campaigns to opps

sf_won_revenue_by_campaign

Closed-won revenue grouped by primary campaign

sf_lead_conversion_metrics

Conversion rates by lead source or campaign

sf_pipeline_summary

Pipeline by stage: count, amount, probability, weighted

sf_pipeline_by_lead_source

Pipeline grouped by lead source

sf_mql_trend

MQL (or any status) volume over time

sf_forecast_summary

Expected revenue for opps closing in a date range

sf_activity_summary

Task/event counts by lead source, campaign, or owner

sf_recent_activities_by_lead

Tasks and events for a specific lead

sf_recent_activities_by_contact

Tasks and events for a specific contact

sf_run_soql

Execute raw SOQL (escape hatch for custom queries)

sf_describe_object

Full field metadata for any SObject

sf_list_objects

List all queryable SObjects with optional filter


Example prompts

Once connected, ask Claude questions like:

"What are my top 5 campaigns by won revenue this quarter?"

"Show me the lead source breakdown for the last 90 days — include conversion rates."

"Create a follow-up task for lead 00Q... due next Friday."

"Which campaigns have the highest ROI? Include cost per lead."

"Show me the MQL trend by month for this year."

"Add all leads from this list to the Q2 Webinar campaign with status 'Invited'."

"What's our current pipeline summary by stage with weighted values?"


How it works

  • Auth: Connects via Salesforce username + password + security token using jsforce. The connection is cached for 25 minutes and automatically refreshed on INVALID_SESSION_ID errors.

  • Production and sandbox: Set SF_LOGIN_URL=https://test.salesforce.com to target a sandbox.

  • Rate limits: All queries respect Salesforce API limits. Use limit parameters to control result sizes.


License

MIT

Available Tools

47 tools
sf_activity_summaryB

Summarize task and event activity counts grouped by lead source, campaign, or owner

Inputs: groupBy (required), dateFrom, dateTo.

sf_add_campaign_memberC

Add a single lead or contact to a Salesforce campaign

Inputs: campaignId (required), leadId, contactId, status.

sf_bulk_add_campaign_membersC

Add up to 200 leads and/or contacts to a Salesforce campaign in one call

Inputs: campaignId (required), leadIds, contactIds, status.

sf_campaign_influenceC

Query the CampaignInfluence object to see which campaigns influenced opportunities

Inputs: campaignId, dateFrom, dateTo, limit.

sf_campaign_member_status_breakdownB

Show a count breakdown of campaign member statuses for a specific campaign

Inputs: campaignId (required).

sf_campaign_performance_trendB

Show campaign member additions over time grouped by week or month

Inputs: campaignId (required), groupBy (required).

sf_campaign_roiC

Calculate ROI, cost-per-lead, cost-per-opportunity, and response rate for campaigns

Inputs: campaignId, dateFrom, dateTo, limit.

sf_contact_by_emailA

Find Salesforce contacts by email address (up to 10 matches)

Inputs: email (required).

sf_convert_leadC

Convert a Salesforce lead to Account, Contact, and optionally Opportunity

Inputs: id (required), accountId, contactId, opportunityName, +1 more.

sf_create_campaignC

Create a new Salesforce campaign

Inputs: name (required), type, status, startDate, +4 more.

sf_create_contactC

Create a new Salesforce contact

Inputs: lastName (required), email (required), firstName, accountId, +3 more.

sf_create_leadC

Create a new Salesforce lead

Inputs: lastName (required), email (required), company (required), firstName, +4 more.

sf_create_taskB

Create a new Salesforce task linked to a lead, contact, campaign, or opportunity

Inputs: subject (required), whoId, whatId, status, +3 more.

sf_describe_objectA

Describe a Salesforce SObject — returns all fields, types, and metadata

Inputs: object (required), fieldsOnly.

sf_forecast_summaryB

Show forecasted pipeline for open opportunities closing within a date range

Inputs: closeByDateFrom, closeByDateTo.

sf_get_accountA

Retrieve a Salesforce account with open opportunity count and lead count

Inputs: id (required).

sf_get_campaignB

Retrieve a full Salesforce campaign record with all performance metrics

Inputs: id (required).

sf_get_campaign_membersB

List members of a Salesforce campaign with lead/contact details

Inputs: campaignId (required), limit, status.

sf_get_contactB

Retrieve a full Salesforce contact record including Account name

Inputs: id (required).

sf_get_leadB

Retrieve a full Salesforce lead record by ID

Inputs: id (required).

sf_get_report_metadataA

Retrieve column definitions and groupings for a Salesforce Analytics report

Inputs: reportId (required).

sf_lead_conversion_metricsA

Show lead conversion rates grouped by lead source or campaign

Inputs: groupBy (required), dateFrom, dateTo.

sf_lead_source_breakdownB

Aggregate lead volume, conversion rate, and opportunity revenue by lead source

Inputs: dateFrom, dateTo.

sf_list_account_contactsC

List contacts associated with a Salesforce account

Inputs: accountId (required), limit.

sf_list_campaignsB

List Salesforce campaigns with optional filters for status, type, and active-only

Inputs: limit, activeOnly, type, status.

sf_list_objectsA

List all queryable Salesforce SObjects with optional name filter

Inputs: filter, customOnly.

sf_list_reportsC

List available Salesforce Analytics reports

Inputs: folder, limit.

sf_list_tasks_by_campaignC

List Salesforce tasks associated with a specific campaign

Inputs: campaignId (required), limit.

sf_list_tasks_by_contactC

List Salesforce tasks associated with a specific contact

Inputs: contactId (required), limit.

sf_list_tasks_by_leadC

List Salesforce tasks associated with a specific lead

Inputs: leadId (required), limit.

sf_mql_trendB

Show MQL (or any lead status) volume trend over time grouped by week or month

Inputs: groupBy (required), statusValue, dateFrom, dateTo.

sf_pipeline_by_campaignC

Show open pipeline grouped by campaign and stage

Inputs: dateFrom, dateTo, openOnly.

sf_pipeline_by_lead_sourceC

Summarize pipeline grouped by lead source with weighted values

Inputs: openOnly, dateFrom, dateTo.

sf_pipeline_summaryC

Summarize open pipeline by stage with count, total amount, average probability, and weighted pipeline

Inputs: openOnly.

sf_recent_activities_by_contactC

Retrieve recent tasks and events associated with a specific contact

Inputs: contactId (required), limit.

sf_recent_activities_by_leadB

Retrieve recent tasks and events associated with a specific lead

Inputs: leadId (required), limit.

sf_run_reportB

Execute a Salesforce Analytics report and return results as structured rows

Inputs: reportId (required), filters.

sf_run_soqlA

Execute a raw SOQL query against Salesforce (escape hatch for advanced queries)

Inputs: soql (required), limit.

sf_search_accountsA

Search Salesforce accounts by name using SOSL

Inputs: q (required), limit.

sf_search_contactsB

Search Salesforce contacts by name or email using SOSL

Inputs: q (required), limit.

sf_search_leadsB

Search Salesforce leads by name, email, or company using SOSL

Inputs: q (required), limit.

sf_top_campaignsC

Rank campaigns by responses, opportunities created, or won revenue

Inputs: metric (required), limit, dateFrom, dateTo.

sf_update_campaignB

Update any fields on an existing Salesforce campaign

Inputs: id (required), fields (required).

sf_update_campaign_member_statusB

Update the status and/or HasResponded flag of a campaign member

Inputs: campaignMemberId (required), status (required), hasResponded.

sf_update_contactB

Update any fields on an existing Salesforce contact

Inputs: id (required), fields (required).

sf_update_leadB

Update any fields on an existing Salesforce lead

Inputs: id (required), fields (required).

sf_won_revenue_by_campaignC

Show closed-won revenue grouped by primary campaign

Inputs: dateFrom, dateTo, limit.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.8/5.0

    Scored across 47 tools

    Disambiguation3/5

    Core CRUD tools for leads, contacts, accounts, and campaigns are mostly distinct, but the large analytics cluster contains overlapping aggregate tools (pipeline summaries, campaign ROI/trend/top campaigns, lead source metrics) that an agent could easily confuse. Descriptions help differentiate them, but the sheer number of similar reporting tools leaves room for misselection.

    Naming Consistency3/5

    All tool names consistently use the sf_ prefix and snake_case, and many follow a verb_noun pattern like create_lead, get_contact, update_campaign. However, several tools use noun-first or domain-specific names without clear verbs, such as sf_campaign_roi, sf_pipeline_summary, sf_lead_source_breakdown, and sf_mql_trend, creating a mixed convention.

    Tool Count2/5

    47 tools is well beyond the usual well-scoped range, even for a broad Salesforce marketing server. Many reporting and campaign metrics tools could be consolidated or parameterized, making the tool selection surface unnecessarily heavy.

    Completeness3/5

    The server covers core lead, contact, account, campaign, task, pipeline, and report workflows, but there are notable gaps such as no delete/remove tools (e.g., delete lead, delete contact, remove campaign member) and no direct opportunity CRUD despite opportunity-focused aggregate tools. The SOQL escape hatch is query-only, so some lifecycle workflows will dead-end.

    Related MCP Connectors