SyncGTM now works inside Claude and ChatGPT. Learn moreDonate to Nepal’s flood relief
SyncGTM logoSyncGTM logo
  • Platform

    • Waterfall Enrichment
    • Real-time signals
    • Integrations
    • Enrichment MCP

    Person Data

    • Work Email
    • Mobile Number
    • Personal Email
    • Experience
    • Verify Emails
    View all →

    Company

    • Techstack
    • Website Traffic
    • Revenue
    • Google Ads
    • LinkedIn Posts
    View all →

    Person signals

    • Job Change
    • Promotions
    • Leadership Change
    • LinkedIn Posts
    • WhatsApp Validation
    View all →

    Account signals

    • Headcount Growth
    • Job Openings
    • Techstack Change
    • Funding
    • Product Launched
    View all →
    • Sales
    • RevOps
    • Agency
    • Startups
    • GTM Engineers
    • CRM Enrichment
    • Account Research
    • Inbound Automation
    • Outbound Automation
    • Monitor Signals
  • Fractional GTMe
  • Pricing
  • Learn

    • Blog
    • Docs
    • Templates
    • Reports
    • Video Tutorials
    • Product Tour

    Resource

    • Affiliate
    • Free Tools
    • Credit Estimator
    • Compare Coverage
    • Agency Directory
    • Product Updates
    • Roadmap
    • Join community

    AI

    • GTM agents
    • GTM skills
  • Login
  • vsClay logoClay
  • Platform

    • Waterfall Enrichment
    • Real-time signals
    • Integrations
    • Enrichment MCP

    Person Data

    • Work Email
    • Mobile Number
    • Personal Email
    • Experience
    • Verify Emails
    • View all →

    Company

    • Techstack
    • Website Traffic
    • Revenue
    • Google Ads
    • LinkedIn Posts
    • View all →

    Person signals

    • Job Change
    • Promotions
    • Leadership Change
    • LinkedIn Posts
    • WhatsApp Validation
    • View all →

    Account signals

    • Headcount Growth
    • Job Openings
    • Techstack Change
    • Funding
    • Product Launched
    • View all →
    • Sales
    • RevOps
    • Agency
    • Startups
    • GTM Engineers
    • CRM Enrichment
    • Account Research
    • Inbound Automation
    • Outbound Automation
    • Monitor Signals
  • Fractional GTMe
  • Pricing
    • Blog
    • Docs
    • Templates
    • Reports
    • Video Tutorials
    • Product Tour

    Resource

    • Affiliate
    • Free Tools
    • Credit Estimator
    • Compare Coverage
    • Agency Directory
    • Product Updates
    • Roadmap
    • Join community

    AI

    • GTM agents
    • GTM skills
  • Login
  • vsClay logoClay
SyncGTM logo
support@syncgtm.com
Built withfrom&

Platform

  • Waterfall Enrichment
  • Real-time signals
  • Integrations
  • Enrichment MCP
  • Enrichment CLIsoon

Use Cases

  • CRM Enrichment
  • Account Research
  • Inbound Automation
  • Outbound Automation
  • Monitor Signals

Person Data

  • Work Email
  • Mobile Number
  • Personal Email
  • Experience
  • Verify Emails
  • View all →

Company Data

  • Techstack
  • Website Traffic
  • Job Listing
  • Google Ads
  • LinkedIn Posts
  • View all →

Person Signals

  • Job Change
  • Promotions
  • Leadership Change
  • LinkedIn Posts
  • WhatsApp Validation
  • View all →

Account Signals

  • Headcount Growth
  • Job Openings
  • Techstack Change
  • Funding
  • Product Launched
  • View all →

Solutions

  • Sales
  • Agency
  • RevOps
  • Startups
  • GTM Engineers
  • Fractional GTMe

Company

  • Contact
  • Affiliate
  • Sign Up
  • Login
  • Terms
  • Affiliate Terms
  • Privacy

Resources

  • Pricing
  • Credit Estimator
  • Templates
  • Blog
  • Video Tutorials
  • Slack Community
  • Docs
  • Agency Directory
  • Free Tools
  • Product Updates
  • Roadmap

Copyright ©2026 SyncGTM

Featured on SaaSBison
Claude Code Salesforce MCP setup and installation guide 2026 — connected app configuration and first SOQL query

In this Blog

  • TL;DR
  • What Is the Salesforce MCP Setup?
  • Prerequisites
  • Step 1: Install Salesforce CLI and Node.js
  • Step 2: Create a Connected App (Optional for DX)
  • Step 3: Authorize Your Salesforce Org
  • Step 4: Configure .mcp.json for Claude Code
  • Step 5: Token Management and Session Refresh
  • Step 6: Test Your First Queries
  • Advanced Configuration Options
  • Windows-Specific Setup Notes
  • Pair With SyncGTM for Enrichment Workflows
  • FAQ

Claude Code Salesforce MCP Setup: Installation and Configuration Guide (2026)

Kushal Magar

By Kushal Magar · April 26, 2026 · 16 min read

Key Takeaway

The Salesforce MCP server connects Claude Code to your org in under 30 minutes. Install Node.js 18+, run sf org login web, drop a .mcp.json in your project root, and Claude can run SOQL queries, update records, and deploy metadata — all from natural language. For enrichment workflows, pair it with SyncGTM.

This guide covers the complete Claude Code Salesforce MCP setup — from installing the CLI to running your first SOQL query. The Salesforce MCP server gives you natural language access to your entire org: SOQL queries, bulk record updates, metadata deployment, Apex tests, and more. Setup takes under 30 minutes.

Most tutorials jump straight to the .mcp.json file and skip the parts that cause 80% of failures: Node version mismatches, org authorization edge cases, token expiry, and Windows PATH issues. This guide covers all of them, step by step.

It also covers connected app creation for teams using the Hosted MCP server, token management patterns for shared environments, and five starter SOQL queries you can paste straight into Claude Code to confirm everything is working.


TL;DR

  • What it is: Model Context Protocol server published by Salesforce as @salesforce/mcp — connects Claude Code directly to your org
  • Setup time: 20–30 minutes for a clean install; under 15 minutes if Salesforce CLI is already installed
  • Two server options: DX MCP (local, via npx, free) and Hosted MCP (cloud OAuth, beta as of April 2026)
  • No Connected App needed for the DX server — Salesforce CLI handles OAuth automatically
  • Key file: .mcp.json in your project root tells Claude Code which MCP servers to load
  • For enrichment: SyncGTM handles what MCP cannot — adding emails, phone numbers, and firmographics to your Salesforce records

What Is the Salesforce MCP Setup?

The Claude Code Salesforce MCP setup is the process of connecting Claude Code to a live Salesforce org using Model Context Protocol — Anthropic's open standard for giving AI models access to external tools and data sources.

Salesforce published its own MCP implementation as @salesforce/mcp — an open-source npm package maintained by the Salesforce CLI team. Once configured, Claude Code can interact with your org using natural language: query records, deploy metadata, run tests, and manage users.

The setup has three components: authenticating your Salesforce org with the CLI, configuring Claude Code via .mcp.json, and optionally creating a Connected App for teams using the cloud-hosted OAuth server. This guide covers all three.

What Claude Code can do after Salesforce MCP setup

  • Run SOQL queries and return formatted pipeline data
  • Create, update, and delete Salesforce records in bulk
  • Retrieve and deploy metadata (Flows, custom fields, page layouts)
  • Run Apex tests and return detailed pass/fail output
  • List org users, check permissions, manage permission sets
  • Analyze Apex code for security vulnerabilities and best practices
  • Inspect org limits and feature flags

According to Salesforce's April 2026 developer announcement, every Developer Edition org now includes access to Salesforce-Hosted MCP Servers at no additional cost. The @salesforce/mcp package exposes 60+ tools across 15 toolsets — covering data operations, metadata, users, Apex testing, code analysis, and DevOps Center pipelines.


Prerequisites

Confirm you have the following before starting. Missing any one of these is the cause of most setup failures.

  • Node.js 18+ — required by the @salesforce/mcp package. Check: node --version. If below 18, install Node.js LTS or use nvm: nvm install 20 && nvm use 20
  • Salesforce CLI (@salesforce/cli) — the unified SF CLI (not the legacy sfdx). Install: npm install -g @salesforce/cli. Check: sf --version
  • Claude Code — install: npm install -g @anthropic-ai/claude-code
  • Salesforce org access — Developer Edition, sandbox, or production. You need a user with API access and permission to run CLI commands
  • npx — ships with Node.js. Verify: npx --version

Important: SF CLI vs SFDX CLI

The MCP server requires the unified sf CLI (@salesforce/cli), not the legacy sfdx CLI. If sf --version shows an older sfdx-based version, uninstall it and reinstall with npm install -g @salesforce/cli.


Step 1: Install Salesforce CLI and Node.js

If you already have Node.js 18+ and the unified Salesforce CLI installed, skip this step and go to Step 2.

Install or upgrade Node.js

# Check current Node version
node --version

# Using nvm (recommended — lets you switch versions per project)
nvm install 20
nvm use 20
nvm alias default 20

# Verify
node --version  # Should show v20.x.x

Install the Salesforce CLI

# Install the unified SF CLI
npm install -g @salesforce/cli

# Verify installation
sf --version

# Expected output (version numbers will vary):
# @salesforce/cli/2.x.x ...

Verify the MCP package is accessible

Test that npx can resolve the @salesforce/mcp package before configuring Claude Code. This catches network or proxy issues early.

npx -y @salesforce/mcp --help

# Expected output includes flags:
# --orgs        Comma-separated list of org aliases
# --toolsets    Comma-separated list of toolsets to enable
# --tools       Specific tools to load
# --dynamic-tools  Load tools on-demand
# --debug       Enable debug logging

If this command returns an error, confirm that your npm registry is accessible and that Node.js 18+ is active. On corporate networks with proxy settings, you may need to configure npm config set proxy before proceeding.


Step 2: Create a Connected App (Optional for DX)

For the DX MCP server (local npx), you do not need to create a Connected App. The Salesforce CLI ships with its own registered connected app, and sf org login web uses it automatically. Skip to Step 3.

You need a custom Connected App only if you are configuring the Hosted MCP serverfor team-wide access, or if your org's admin has restricted the default CLI app.

Create a Connected App in Salesforce Setup

  1. Go to Setup → search for App Manager → click New Connected App
  2. Set a name (e.g., Claude Code MCP) and enter your email as the contact
  3. Check Enable OAuth Settings
  4. Set Callback URL to http://localhost:1717/OauthRedirect (standard Salesforce CLI callback)
  5. Add OAuth scopes: api, refresh_token, offline_access. For Hosted MCP, also add sfap_api
  6. Save. Salesforce will take 2–10 minutes to activate the app after creation

After the app activates, copy the Consumer Key (Client ID) and Consumer Secret. Store them securely — you'll need them when running sf org login web --client-id <consumer-key> to authorize with your custom app.

# Authorize using your custom Connected App
sf org login web   --client-id YOUR_CONSUMER_KEY   --alias my-org-custom-app

# Confirm
sf org list

When you do need a custom Connected App

  • Setting up Hosted MCP with sfap_api scope for Agentforce access
  • Your org admin has blocked the default Salesforce CLI connected app
  • You need IP restriction policies beyond what the CLI app supports
  • CI/CD pipelines requiring a dedicated app per environment

Step 3: Authorize Your Salesforce Org

The Salesforce MCP server uses credentials stored by the Salesforce CLI — it does not handle authentication itself. This keeps secrets off disk and out of your config files.

Authorize production or developer org

# Standard web-based OAuth login
sf org login web --alias my-prod-org

# Confirms authorization and opens a browser for Salesforce login
# After login, the token is stored in your system credential store

Authorize a sandbox

# Sandbox requires the test.salesforce.com instance URL
sf org login web   --instance-url https://test.salesforce.com   --alias my-sandbox

# List all authorized orgs
sf org list

Set a default org for a project

Setting a project-level default means you can use DEFAULT_TARGET_ORG in your MCP config. Each developer sets their own local default — safe for shared repos.

# Set a default for this directory only (not global)
sf config set target-org my-sandbox --global false

# Verify
sf config get target-org

# Output shows:
# key         value
# ──────────  ─────────────
# target-org  my-sandbox

Authorize without a browser (JWT flow)

For CI/CD environments where interactive browser login is not possible, use the JWT bearer flow. This requires a private key and a Connected App configured with a certificate.

# JWT-based authorization for CI/CD
sf org login jwt   --username ci-user@myorg.com   --jwt-key-file server.key   --client-id YOUR_CONSUMER_KEY   --alias ci-org

For most individual developers and RevOps teams, sf org login web is sufficient. JWT flow is for automated pipelines only.


Step 4: Configure .mcp.json for Claude Code

The .mcp.jsonfile is Claude Code's address book for MCP servers. Place it in your project root. Claude reads it on startup and launches the configured servers automatically.

Minimal configuration

{
  "mcpServers": {
    "salesforce": {
      "command": "npx",
      "args": [
        "-y",
        "@salesforce/mcp",
        "--orgs",
        "DEFAULT_TARGET_ORG"
      ]
    }
  }
}

DEFAULT_TARGET_ORG is resolved at runtime from whichever org you set with sf config set target-org.

With toolsets and dynamic loading (recommended)

The full MCP server exposes 60+ tools. Loading all of them at once consumes Claude's context window. Use --toolsets to limit scope, and --dynamic-tools to load tools on-demand.

{
  "mcpServers": {
    "salesforce": {
      "command": "npx",
      "args": [
        "-y",
        "@salesforce/mcp",
        "--orgs",
        "my-sandbox",
        "--toolsets",
        "data,metadata,users",
        "--dynamic-tools"
      ]
    }
  }
}

For GTM and RevOps use cases, data,metadata,users covers everything you need: SOQL queries, record operations, field creation, and user management. Avoid enabling testing or devops-center unless your workflow specifically requires them.

Available toolsets reference

ToolsetFlagUse case
Data OperationsdataSOQL queries, CRUD operations, bulk updates
MetadatametadataRetrieve and deploy Flows, fields, layouts
UsersusersList users, manage permission sets
OrgsorgsOrg limits, scratch orgs, feature flags
TestingtestingRun Apex tests, return results
Code Analysiscode-analyzerApex security scanning, best practices
DevOps Centerdevops-centerPipeline management, work item promotions

Multi-org configuration

{
  "mcpServers": {
    "salesforce": {
      "command": "npx",
      "args": [
        "-y",
        "@salesforce/mcp",
        "--orgs",
        "my-sandbox,my-prod-org",
        "--toolsets",
        "data,metadata",
        "--dynamic-tools"
      ]
    }
  }
}

With multiple orgs, Claude can compare records between sandbox and production, or verify that a metadata deployment matches what is live. Separate aliases with commas — no spaces.


Step 5: Token Management and Session Refresh

Salesforce OAuth tokens expire. The MCP server does not handle token refresh on its own — it relies on the CLI's credential store. When a session expires, Claude will return an authentication error on the next MCP call.

Refresh an expired token

# Re-authorize the specific org that expired
sf org login web --alias my-sandbox

# Check org status after refresh
sf org display --target-org my-sandbox

After re-authorizing, restart Claude Code from your project directory. The MCP server picks up the refreshed credentials automatically on next launch.

Extend session timeout in Salesforce Setup

If sessions expire more frequently than expected, check the session timeout setting in Salesforce. Go to Setup → Security → Session Settings and increase the Timeout Value to 8 or 24 hours.

For developer orgs and sandboxes, a longer timeout reduces friction during active development. For production orgs connected to sensitive data, maintain a shorter timeout and re-authorize before each work session.

Token storage location

The Salesforce CLI stores OAuth tokens in your operating system credential store — not in any file Claude Code can read. On macOS: Keychain. On Windows: Windows Credential Manager. On Linux: the ~/.config/@salesforce directory (encrypted).

Never store Salesforce credentials in .mcp.json, CLAUDE.md, or environment variables. The CLI credential store is the secure pattern — use it.

Check token validity without starting Claude Code

# Display org details including token expiry
sf org display --target-org my-sandbox --json

# Output includes:
# "expirationDate": "2026-05-26T10:00:00.000Z"
# "connectedStatus": "Connected"

Step 6: Test Your First Queries

Start Claude Code from the directory containing your .mcp.json file. Claude reads the config on launch and connects to the MCP server automatically.

# Launch Claude Code from your project root
claude

Use these five starter prompts to confirm end-to-end connectivity. Each tests a different part of the MCP setup.

Test 1: Verify org connection

Prompt

“List all Salesforce orgs you have access to and show their alias, username, and org type.”

A successful response shows your authorized orgs. This confirms the CLI connection works before you run any data queries.

Test 2: Run a basic SOQL query

Prompt

“Run this SOQL query and return the results as a table: SELECT Id, Name, StageName, Amount, CloseDate FROM Opportunity WHERE IsClosed = false ORDER BY CloseDate ASC LIMIT 10”

Test 3: Query account data

Prompt

“Query the 5 most recently modified Accounts. Show Name, Industry, AnnualRevenue, and LastModifiedDate.”

Test 4: Check org limits

Prompt

“Show me this org's API usage limits and what percentage of the daily limit has been consumed.”

Test 5: List custom fields on Opportunity

Prompt

“List all custom fields on the Opportunity object. Show the field API name, label, data type, and whether it is required.”

If all five prompts return structured data, your claude code salesforce mcp setup is complete and working. If any return errors, jump to the troubleshooting section below.

For more complex automation workflows using Claude Code with Salesforce, see our guide on Claude Code Salesforce MCP workflows and how GTM teams use Claude Code for revenue operations.


Advanced Configuration Options

Hosted MCP server via mcp-remote (Beta)

The Hosted MCP server lets teams share Salesforce access without per-machine CLI setup. It requires the mcp-remote package as an OAuth proxy.

{
  "mcpServers": {
    "salesforce-hosted": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://mcp.salesforce.com/sse"
      ]
    }
  }
}

On first connection, a browser opens for OAuth. Approve scopes api, refresh_token, and sfap_api. The DX server remains more stable for individual developers — prefer the Hosted server once it reaches GA.

Debug logging

Add the --debug flag to your MCP args to log all server activity. Copy the output when filing issues on the salesforcecli/mcp GitHub repository.

{
  "mcpServers": {
    "salesforce": {
      "command": "npx",
      "args": [
        "-y",
        "@salesforce/mcp",
        "--orgs",
        "DEFAULT_TARGET_ORG",
        "--toolsets",
        "data,metadata",
        "--dynamic-tools",
        "--debug"
      ]
    }
  }
}

Scoping specific tools (not toolsets)

If you want even finer control, use --tools instead of --toolsets to load only specific named tools. Run npx -y @salesforce/mcp --help to see the full list of available tool names.


Windows-Specific Setup Notes

The Salesforce MCP setup works on Windows, but two issues come up consistently: PATH configuration and shell compatibility.

Issue 1: 'sf' not recognized after install

After running npm install -g @salesforce/cli on Windows, the sf command may not be recognized in PowerShell or Command Prompt. Fix: close all terminal windows, then open a new one. If the issue persists, add the npm global bin directory to your PATH manually.

# Find npm global bin directory
npm config get prefix

# Add <prefix>in to Windows PATH via System Properties
# > Environment Variables > Path > New > paste the path

Issue 2: npx path resolution in .mcp.json

On Windows, Claude Code may fail to resolve npx if it is not in the system PATH. Use the absolute path to npx in your .mcp.json as a fallback.

{
  "mcpServers": {
    "salesforce": {
      "command": "C:\\Users\\YourName\\AppData\\Roaming\\npm\\npx.cmd",
      "args": [
        "-y",
        "@salesforce/mcp",
        "--orgs",
        "DEFAULT_TARGET_ORG",
        "--toolsets",
        "data,metadata"
      ]
    }
  }
}

Find your npx path by running where npx in PowerShell. Replace backslashes with double backslashes in the JSON value.

Issue 3: nvm-windows vs nvm (Unix)

The nvm command on Windows uses nvm-windows (different from the Unix version). Commands are the same: nvm install 20 and nvm use 20. After switching versions, restart your terminal before running any npm commands.


Pair With SyncGTM for Enrichment Workflows

The Salesforce MCP server is a query and modification tool. It reads and writes data that already exists in your org. It does not source new data from external providers.

If your Salesforce contacts are missing emails, phone numbers, or firmographic fields — that is an enrichment problem, not an MCP problem. SyncGTM connects to Salesforce and auto-enriches every contact and account with data from 50+ providers — waterfall enrichment, ICP scoring, and direct sync. See SyncGTM pricing for plans starting at $99/mo.

WorkflowSalesforce MCPSyncGTM
Pipeline SOQL queriesYesNo
Bulk record updatesYesPartial
Metadata deploymentYesNo
Email enrichment from 50+ providersNoYes
Phone number waterfall enrichmentNoYes
ICP scoring and firmographic dataNoYes
Buying signal detectionNoYes

A common pattern: use Claude Code with the MCP server to create custom fields (e.g., ICP_Score__c), then use SyncGTM to populate those fields with enrichment data automatically. See the sign-up enrichment workflow and the best Salesforce enrichment tools in 2026 for the full picture.

For GTM engineers building broader automation stacks, the top GTM MCPs for Claude Code lists the other MCP servers worth adding alongside the Salesforce one.


MCP Queries Your Salesforce Data. SyncGTM Fills What's Missing.

The MCP setup connects Claude to the records you already have. SyncGTM enriches those records with verified emails, phone numbers, and firmographics from 50+ providers — automatic Salesforce sync at $99/mo.

Try SyncGTM Free — No Credit Card

Frequently Asked Questions

Enrichment for your Salesforce org?

SyncGTM waterfall-enriches every Salesforce contact with emails, phone numbers, and firmographics from 50+ providers — automatic sync, no code required.

Share Article


Ask AI

Enrich Salesforce Data with SyncGTM

Connect SyncGTM to Salesforce and auto-fill missing emails, phone numbers, ICP scores, and buying signals across every account and contact — starting at $99/mo.