Claude Code Salesforce MCP: Connect Your CRM to AI in 2026
By Kushal Magar · April 25, 2026 · 14 min read
Key Takeaway
The Salesforce MCP server lets Claude Code read and write your Salesforce org using natural language. Setup takes under 30 minutes — install the CLI, authorize your org, add .mcp.json, and Claude handles the rest. GTM teams get the most value from SOQL-based pipeline queries, bulk record updates, and metadata retrieval.
Your Salesforce org holds your pipeline, accounts, and contact history. Claude Code can reason over data and write code. The Salesforce MCP server connects the two in under 30 minutes.
This guide covers the full setup — installing the DX MCP server, authenticating your org, and configuring Claude Code. It also covers when to reach for SyncGTM instead for enrichment-heavy workflows.
Most tutorials stop at “Claude can now talk to Salesforce.” This one shows five GTM automations your RevOps team can run today.
TL;DR
- Salesforce MCP server connects Claude Code to your Salesforce org — query data, update records, deploy metadata, run tests
- Two options: DX MCP server (local, via npx, free) and Hosted MCP server (cloud, OAuth, currently in beta)
- Setup takes ~30 minutes — install Salesforce CLI, authorize org, create .mcp.json, start Claude Code
- 60+ tools across 15 toolsets: metadata, data, users, testing, code analysis, DevOps Center, and more
- Best for GTM teams: pipeline queries, bulk record updates, SOQL reporting, and opportunity stage automation
- For enrichment workflows (adding emails, phone numbers, firmographics to Salesforce), SyncGTM is a better fit than the MCP server
What Is the Salesforce MCP Server?
The Salesforce MCP server is Salesforce's open-source implementation of Model Context Protocol — Anthropic's standard for connecting AI models to external tools. Published as @salesforce/mcp on npm.
Once connected, Claude operates under the same Salesforce permissions as the authenticated CLI user. Ask “What are the 10 largest open opportunities closing this quarter?” and Claude runs the SOQL query and formats the results.
This is not Agentforce. Agentforce is declarative, admin-configured, and built for non-developers. The MCP server is for developers — full programmatic access from Claude Code, Cursor, VS Code Copilot, or any MCP-compatible client.
What Claude Code can do with the Salesforce MCP server
- Run SOQL queries and return formatted results
- Create, update, and delete Salesforce records
- Retrieve and deploy metadata (Flows, fields, page layouts)
- Run Apex tests and return pass/fail results
- List and manage org users and permissions
- Analyze code for security vulnerabilities
- Interact with DevOps Center pipelines
Prerequisites
Before setup, confirm you have the following:
- Node.js 18+ — the MCP server requires Node.js 18 or higher. Check with
node --version - Salesforce CLI — install via
npm install -g @salesforce/clior the official installer - Claude Code — install via
npm install -g @anthropic-ai/claude-code - Salesforce org access — Developer Edition, sandbox, or production. You need a user account with permission to run Salesforce CLI commands
- npx — included with Node.js. No separate install needed
The MCP server inherits your CLI user's Salesforce profile and permission sets. If that user can't read Opportunity records, Claude can't either — match permissions to the operations you plan to run before setup.
Install the Salesforce DX MCP Server
The DX MCP server runs locally via npx — no global install required. The package is @salesforce/mcp, published by Salesforce on npm.
Step 1: Verify Node.js and Salesforce CLI
# Check Node.js version (must be 18+) node --version # Check Salesforce CLI sf --version # Install Salesforce CLI if missing npm install -g @salesforce/cli
Step 2: Test the MCP server package directly
Run the package once to confirm it loads without errors. You will not use this command day-to-day — Claude Code handles launching the server — but it confirms the package is accessible.
npx -y @salesforce/mcp --help
A successful output lists available flags: --orgs, --toolsets, --tools, and others. If you see an error, confirm Node.js is 18+ and npx is in your PATH.
Configure Claude Code (.mcp.json)
Claude Code reads MCP server configuration from a .mcp.json file in your project root. Create this file with the following structure:
Minimal configuration (default org)
{
"mcpServers": {
"salesforce": {
"command": "npx",
"args": [
"-y",
"@salesforce/mcp",
"--orgs",
"DEFAULT_TARGET_ORG"
]
}
}
}Configuration with specific toolsets
Use the --toolsets flag to enable only the tool categories you need. This keeps Claude's context window smaller and reduces the risk of unintended operations.
{
"mcpServers": {
"salesforce": {
"command": "npx",
"args": [
"-y",
"@salesforce/mcp",
"--orgs",
"my-sandbox",
"--toolsets",
"data,metadata,users,orgs"
]
}
}
}Multi-org configuration
To give Claude access to multiple orgs simultaneously, pass multiple aliases to the --orgs flag.
{
"mcpServers": {
"salesforce": {
"command": "npx",
"args": [
"-y",
"@salesforce/mcp",
"--orgs",
"my-sandbox,my-prod-org",
"--toolsets",
"data,metadata"
]
}
}
}Verify the connection
Start Claude Code from the same directory as your .mcp.json file, then ask:
claude # Inside Claude Code, test with: > List all Salesforce orgs you have access to > Run a SOQL query: SELECT Id, Name, StageName, CloseDate FROM Opportunity WHERE StageName != 'Closed Won' AND StageName != 'Closed Lost' ORDER BY CloseDate ASC LIMIT 10
A successful response returns your open pipeline records. If you see a connection error, check the troubleshooting section below.
Toolsets and Permissions Explained
The Salesforce MCP server exposes 60+ tools organized into 15 toolsets. You choose which toolsets to enable in your --toolsets flag. Enabling all toolsets at once fills Claude's context window unnecessarily — use only what your workflow requires.
| Toolset | Flag value | What it enables |
|---|---|---|
| Data Operations | data | SOQL queries, record CRUD, bulk data operations |
| Metadata | metadata | Retrieve and deploy metadata, manage org settings |
| Users | users | List and manage org users, permission sets |
| Orgs | orgs | Org info, limits, feature flags, scratch org management |
| Testing | testing | Run Apex tests, return pass/fail with error details |
| Code Analysis | code-analyzer | Static analysis, security scanning, Apex best practices |
| DevOps Center | devops-center | Pipeline management, work item tracking, promotions |
For GTM automation use cases, enable only data,metadata,users. This covers SOQL queries, record updates, and field management — everything a RevOps team needs — without exposing testing or deployment tools that could cause unintended changes.
Dynamic tool loading (reduces context usage)
{
"mcpServers": {
"salesforce": {
"command": "npx",
"args": [
"-y",
"@salesforce/mcp",
"--orgs",
"DEFAULT_TARGET_ORG",
"--toolsets",
"data,metadata",
"--dynamic-tools"
]
}
}
}The --dynamic-tools flag loads tools on-demand instead of declaring all 60+ tools in Claude's context upfront. Recommended for long sessions.
Hosted MCP Server with OAuth (Beta)
The Hosted MCP server is Salesforce's cloud-managed alternative to running npx locally. Claude Code connects via OAuth 2.0 through the mcp-remote package as a proxy. As of April 2026, it's in beta.
When to use the Hosted server
- Sharing Salesforce access across a team without per-machine CLI setup
- CI/CD pipelines where local CLI credentials are not practical
- Environments where installing Salesforce CLI is restricted
Hosted MCP configuration
{
"mcpServers": {
"salesforce-hosted": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://mcp.salesforce.com/sse"
]
}
}
}On first connection, mcp-remote opens a browser for OAuth. Salesforce prompts you to select an org and approve three scopes: api, refresh_token, and sfap_api.
Required OAuth scopes
api— access Salesforce APIs on behalf of the userrefresh_token— maintain persistent sessions without re-authorizingsfap_api— required for Agentforce and AI features
The DX server remains the more stable option for individual developers. Use the Hosted server once it reaches GA — beta limitations include slower response times and occasional endpoint downtime.
5 Real GTM Automations You Can Run
Here are five concrete workflows RevOps and sales engineers run with Claude Code connected to Salesforce — copy the prompts directly.
1. End-of-quarter pipeline report
Ask Claude to pull open opportunities closing this quarter, group by stage and owner, calculate weighted pipeline value, and flag deals with no activity in 14+ days. Paste the result straight into your leadership Slack channel.
Example prompt
“Query all open Opportunities closing before 2026-06-30. Group by StageName and OwnerId. Show total Amount per group, count of deals with no activity in 14+ days, and weighted pipeline using Probability. Format as a markdown table.”
2. Bulk opportunity stage update
After a strategy change, bulk-updating opportunity stages is tedious. Claude identifies the affected records, shows you the count and a sample, then executes the update — with your review before any write runs.
Example prompt
“Find all Opportunities where StageName is 'Proposal/Price Quote' and CloseDate is before 2026-03-01. Show me the count and a sample of 5 records. Then update StageName to 'Closed Lost' and set Description to 'Closed Lost: stale Q1 deal' for all of them.”
3. Custom field creation and metadata deployment
Add a custom field to the Opportunity object without touching Salesforce Setup. Claude drafts the metadata XML, validates it against your org's schema, and deploys it.
Example prompt
“Add a custom Number field called ICP_Score__c to the Opportunity object. Label: 'ICP Score'. Precision: 3, scale: 0, min 0, max 100. Deploy it to my sandbox org.”
This pairs directly with sign-up enrichment workflows that push ICP scores from external providers into Salesforce — the MCP server creates the field, SyncGTM populates it.
4. Account health check and re-engagement targeting
Find accounts that have gone dark — no open opportunities, no activity in 90 days, above your revenue threshold. Claude returns a prioritized list with account owner, last activity date, and a draft re-engagement message per industry.
Example prompt
“Find Accounts where Type is 'Customer', AnnualRevenue > 5000000, and LastActivityDate < 2026-01-25. Show Account Name, Owner, Industry, and LastActivityDate. Suggest one re-engagement message per account based on their Industry.”
5. Lead routing audit
Find unassigned leads, unconverted leads sitting 30+ days, and which rep has the highest backlog. Claude surfaces the distribution in a table and flags routing gaps.
Example prompt
“Query all unconverted Leads created before 2026-03-26. Group by OwnerId. Show count per owner, oldest lead date, and average CreatedDate. Flag any owner with more than 50 unworked leads.”
For more GTM automation ideas built on Claude Code, see how GTM teams use Claude Code and the top GTM MCPs that work with Claude Code in 2026.
Troubleshooting Common Errors
Error: “No org found for DEFAULT_TARGET_ORG”
Your Salesforce CLI has no default org configured. Run sf org list to see authorized orgs. Either set a default with sf config set target-org <alias> or replace DEFAULT_TARGET_ORG in your .mcp.json with a specific alias.
Error: “INSUFFICIENT_ACCESS_OR_READONLY”
The authenticated CLI user does not have permission to perform the requested operation in Salesforce. Check the user's profile and permission sets in Salesforce Setup. Ensure the profile has the required object and field-level access for your MCP queries.
Error: “MCP server failed to start”
Usually a Node.js version issue. Run node --version — it must be 18 or higher. If you manage Node with nvm, run nvm use 20 before starting Claude Code. Also confirm npx -y @salesforce/mcp --help returns output without errors.
Error: “Session expired” or token refresh failures
Salesforce OAuth tokens expire. Re-authorize the org with sf org login web --alias <alias>. If this happens frequently, check your org's session timeout setting in Salesforce Setup — it may be configured for a shorter duration than the default.
Enable debug logging
{
"mcpServers": {
"salesforce": {
"command": "npx",
"args": [
"-y",
"@salesforce/mcp",
"--orgs",
"DEFAULT_TARGET_ORG",
"--toolsets",
"data,metadata",
"--debug"
]
}
}
}The --debug flag logs all MCP server activity to stderr. In Claude Code, server logs appear in the session output. Copy the full error message when filing an issue on the GitHub repository.
When to Use SyncGTM Instead
The Salesforce MCP server is the right tool when you want Claude Code to read and modify data that already exists in Salesforce — pipeline queries, bulk updates, field creation, metadata deployment.
It's not designed for enriching records with external data. Adding emails, phone numbers, firmographics, or buying signals to Salesforce contacts requires a different tool.
| Task | Salesforce MCP | SyncGTM |
|---|---|---|
| SOQL pipeline queries | Yes | No |
| Bulk record updates | Yes | Partial (via sync actions) |
| Metadata deployment | Yes | No |
| Contact email enrichment | No | Yes (50+ providers) |
| Phone number waterfall | No | Yes |
| Firmographic enrichment | No | Yes |
| Buying signal detection | No | Yes |
| ICP scoring | No | Yes |
| Automated outreach enrollment | No | Yes |
The two tools are complementary — use the MCP server for developer and RevOps engineering tasks, and SyncGTM to keep your Salesforce data enriched and action-ready.
For the full picture on Salesforce enrichment, see the best Salesforce enrichment tools in 2026. For broader Claude Code GTM workflows, see the best Claude Code GTM skills for revenue teams.
Your Salesforce Data Is Only as Good as What's In It
The MCP server queries what's already there. SyncGTM fills in what's missing — waterfall enrichment from 50+ providers, ICP scoring, and automatic Salesforce sync at $99/mo.
Enrich Your Salesforce Data Free