Pre-Black Friday: 20% off, for as long as you stayEARLYBFon Solo and AgencyEnds Nov 28Start free

How-to guide

How to Connect Claude Code to Salesforce with MCP (Salesforce DX Server and LeadOcean)

Wire Claude Code to your org through the Salesforce DX MCP server, run a SOQL query, then add LeadOcean MCP so Claude can size and enrich the records Salesforce lacks.

Get your free API key →Free to start. No credit card. 1,000 records to spend whenever you like.

TL;DR

  • Claude Code talks to Salesforce through the local Salesforce DX MCP server (@salesforce/mcp). You authorize an org with the sf CLI, add one JSON block, and Claude can run SOQL.
  • It takes about 25 minutes. The LeadOcean step spends about 1 of your 1,000 free records.
  • Salesforce has announced end of life for that server on 2 November 2026 and points to skills instead. The package stays installable, so pin the version.

Prerequisites

  • A Salesforce sandbox or developer org. Do not point this at production on day one.
  • Salesforce CLI (sf), Node.js (for npx) and Claude Code installed.
  • A LeadOcean account from app.leadocean.io. The free plan has no card and 1,000 records, one-off.
  • A key exported as $LEADOCEAN_API_KEY for the REST check.
bash
sf --version
node --version
claude --version
export LEADOCEAN_API_KEY="paste-your-key-here"

Examples use Acme, acme.com and Jane Doe as placeholders.

Step 1: Authorize your org with the sf CLI

The MCP server only reaches orgs you already authorized on your machine. Log in once and set it as the default.

bash
sf org login web --alias dev-sandbox --set-default
sf org list

sf org list should show dev-sandbox with a connected status. If it does not, fix this before touching MCP.

Step 2: Add the Salesforce DX MCP server to Claude Code

Put this in .mcp.json at your project root. It follows the Claude Code example in the Salesforce DX MCP README, September 2026, trimmed to two toolsets.

json
{
  "mcpServers": {
    "Salesforce DX": {
      "command": "npx",
      "args": ["-y", "@salesforce/mcp@0.30.15",
               "--orgs", "dev-sandbox",
               "--toolsets", "orgs,data"]
    }
  }
}

Three choices matter here:

  • --orgs dev-sandbox locks the server to one named org. DEFAULT_TARGET_ORG follows whatever your default becomes, and ALLOW_ALL_ORGS opens every authorized org.
  • --toolsets orgs,data keeps the tool list short. The full server has over 60 tools and the README warns that enabling all of them can overwhelm the model's context.
  • @0.30.15 pins the version the end-of-life notice names as pinned and still working (issue 46, September 2026).

Start Claude Code in the project and run /mcp. The server should show as connected.

Step 3: Run a first SOQL query

The data toolset has one tool, run_soql_query. Ask for something small and read-only.

text
Use the Salesforce DX server. Run a SOQL query for the 5 most recently
created Leads: Id, FirstName, LastName, Company, Email, CreatedDate.
Show the query you ran. Do not modify any records.

Claude should show the tool call, then a table. Check the SOQL it sent before you trust the rows. If you want writes later, add that as a separate step with a sandbox backup, not in this first session.

Step 4: Add LeadOcean MCP for the data Salesforce does not hold

Salesforce knows your records. It does not know the 693M people and 67M companies you have not entered yet. LeadOcean's hosted server fills that gap. The command format is from the Claude Code MCP docs, September 2026.

bash
claude mcp add --transport http leadocean https://api.leadocean.io/mcp
claude mcp login leadocean

Sign-in uses OAuth, so no key is pasted into the config. The server exposes 13 tools. Seven cost nothing, among them leadocean_count_leads, leadocean_count_companies, leadocean_list_filters and leadocean_list_enum_values. Details are in the LeadOcean MCP docs.

Step 5: Size a list for free, then enrich one Lead

Now use both servers in one prompt. Counting first costs nothing.

text
Use LeadOcean. Count US people with jobLevel VP and jobFunction
"Sales & Business Development". Tell me exactly what you filtered on.
Then use the Salesforce DX server to find one Lead where Email is blank
and LinkedIn URL is present, and enrich that person with LeadOcean.
Do not write anything back to Salesforce.

The enrich call is one record. The REST twin, if you want to test outside Claude, takes exactly one of linkedin_url, email, phone or person_id:

bash
curl -s -X POST https://api.leadocean.io/v1/people/enrich \
  -H "x-api-key: $LEADOCEAN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"linkedin_url": "https://www.linkedin.com/in/jane-doe-acme", "reveal_email": true}'

A person LeadOcean holds nothing for returns 404 and costs nothing.

What you get

A count from the free tool, run on 21 October 2026:

json
{
  "filters": { "jobLevel": ["VP"], "jobFunction": ["Sales & Business Development"], "country": ["US"] },
  "total": 129494,
  "totalIsExact": true,
  "totalAll": 350517,
  "distinctCompanies": 58121,
  "credits": 0
}

total counts people with a verified, catch-all-valid or catch-all email (the tool default). totalAll is the same filter with no email condition. Pick the one that matches what you plan to send.

Enrich response shape from the API reference (enrich docs, placeholder values, not a real person):

json
{
  "success": true,
  "data": {
    "profile_data": { "profile_full_name": "Jane Doe" },
    "contact_data": {
      "email_status": "verified",
      "contact_emails": [{ "email": "jane.doe@acme.com", "type": "work", "status": "verified" }],
      "contact_current_experiences": [{ "job_title": "VP Sales", "company_name": "Acme" }]
    },
    "resume_data": { "experiences": [] }
  },
  "meta": { "credits": 1 }
}

Troubleshooting

ErrorCauseFix
Salesforce server shows failed in /mcpOrg not authorized, or alias in --orgs does not match sf org listRe-run sf org login web, then use the exact alias
npx cannot find the packageNode missing or a proxy blocks npmRun node --version, then npx -y @salesforce/mcp@0.30.15 --help
401 from LeadOceanMissing or wrong x-api-keyCopy a fresh key from the app and re-export it
429 from LeadOceanAbove the plan's rate limit (5 a second on Free, 200 on Agency)Honour Retry-After and slow the loop
402 from LeadOceanThe 1,000 free records are spentMove to a paid plan, see pricing. The free 1,000 does not refill
Count returns 0Enum value spelled wrong (vp instead of VP)Call leadocean_list_enum_values with job_level and copy the string

FAQ

Does Claude Code have a built-in Salesforce connector?

No. You add one as an MCP server. The Salesforce DX server runs locally through npx and uses the orgs you authorized with the sf CLI.

Is the Salesforce DX MCP server being retired?

Salesforce lists 2 November 2026 as end of life. The repo goes read-only and the npm package is marked deprecated but stays installable. Salesforce now ships its tooling as skills in forcedotcom/sf-skills, installed with npx skills add forcedotcom/sf-skills.

Can I let Claude write to Salesforce?

Yes, with the right toolset, but start read-only. Use a sandbox, name one org in --orgs, and review every tool call. Our workflow automation guide covers controlled writes.

How many LeadOcean records does this cost?

About 1: the single enrichment in Step 5. Counts, filter lists and a 404 are free. See pricing for the plans.

Where do skills fit in?

Skills package a repeatable job, such as an admin audit. See Claude Code Salesforce skills for admins. For Apex work, see Claude Code for Salesforce Apex development. The wider setup lives on LeadOcean MCP for Claude Code.

Give Claude Code the contacts Salesforce is missing

Free to start. No credit card. 1,000 records to spend whenever you like.

Get your free API key →