Claude Code Salesforce Integration: Connect AI to Your CRM in 2026
By Kushal Magar · April 25, 2026 · 16 min read
Key Takeaway
Claude Code integrates with Salesforce via OAuth-authenticated MCP, enabling bi-directional read/write access, natural language SOQL queries, automated lead routing, and workflow triggers — all from plain English prompts. Pair with SyncGTM to close the enrichment gap and keep every record complete.
Salesforce holds your pipeline, your contacts, and your revenue history. But keeping it clean, routing leads correctly, and triggering the right workflows still takes too much manual effort. The Claude Code Salesforce integration changes that.
By connecting Claude Code to Salesforce through OAuth and the Model Context Protocol (MCP), you get live bi-directional access to your CRM from a terminal conversation. Query records, update fields, automate lead routing, and trigger workflows — all in plain English. No Apex required.
This guide covers the complete setup: OAuth Connected App configuration, MCP registration, bi-directional sync patterns, SOQL query automation, workflow triggers, and how SyncGTM fits as an enrichment layer to fill the gaps Claude Code cannot.
How does the Claude Code Salesforce integration work?
Create a Salesforce Connected App with OAuth enabled, register the Salesforce MCP server in Claude Code (via Composio or self-hosted), and authenticate. Once connected, Claude Code has live bi-directional access to your Salesforce org — read records, write updates, run SOQL queries, and trigger workflow logic, all from natural language prompts.
TL;DR
- OAuth is the foundation. Create a Salesforce Connected App with
api,refresh_token, andoffline_accessscopes before anything else. - MCP enables the live connection. Register the Salesforce MCP server once and Claude Code can interact with your org in every subsequent conversation.
- Bi-directional sync is fully supported. Read records, create new ones, bulk-update fields, and write activity logs — all via MCP tool calls.
- SOQL queries become plain English. Ask for stale deals, missing emails, or pipeline-by-stage — Claude Code generates and runs the SOQL.
- Workflow triggers are conversation-driven. Describe the trigger condition and Claude Code executes the Salesforce API calls. For persistent triggers, combine with Flow Builder or n8n.
- SyncGTM closes the enrichment gap. Claude Code finds records with missing data; SyncGTM fills them from 20+ providers and writes back.
What Is the Claude Code Salesforce Integration?
Claude Code is an AI coding agent from Anthropic that runs in your terminal. It reads files, writes code, executes commands, and — crucially — connects to external APIs via the Model Context Protocol (MCP).
MCP is an open standard that lets Claude Code interact with live data sources as structured tools. When you register a Salesforce MCP server, Claude Code can issue API calls to your Salesforce org in real time — not as a one-time export, but as a live connection that persists across every conversation.
The result: a Salesforce admin or RevOps engineer can query records, update fields, route leads, and trigger automations using plain English — without writing Apex, clicking through Flow Builder, or opening a Salesforce tab.
For context on the broader GTM use cases, see How GTM Teams Use Claude Code: 6 Workflows That Replace Manual Ops.
Why Connect AI to Salesforce in 2026
Connecting AI to Salesforce eliminates the manual data work that consumes 28% of every sales rep’s week — and does it without changing your existing Salesforce configuration.
Salesforce is used by over 150,000 companies globally. Despite its power, three manual tasks drain time from every Salesforce org:
- Data entry: Reps spend 28% of their week on data entry — logging calls, updating stages, filling contact fields after every interaction
- Lead routing: Manually assigning inbound leads to the right rep based on territory, size, or source — often delayed by hours
- Pipeline hygiene: Finding stale deals, missing next steps, and overdue close dates before every forecast call
The Claude Code Salesforce integration automates all three. And because it operates through MCP with OAuth authentication, it works within Salesforce’s existing permission model — no security exceptions required.
Step 1: OAuth Setup — Create a Salesforce Connected App
OAuth is the authentication layer for the Claude Code Salesforce integration. Before registering the MCP server, you need a Salesforce Connected App with the correct OAuth scopes configured.
Create the Connected App
- Log into Salesforce and go to Setup → App Manager → New Connected App
- Set a name (e.g., Claude Code MCP Integration) and contact email
- Check Enable OAuth Settings
- Set the Callback URL to your MCP provider’s redirect URI. For Composio:
https://backend.composio.dev/api/v1/auth-apps/add - Add these OAuth Scopes:
api— Full access to Salesforce APIrefresh_token,offline_access— Token persistence without re-authenticationopenid— Identity verification
- Save. Salesforce generates a Consumer Key and Consumer Secret
Security best practices
- Never use admin credentials. Create a dedicated integration user with minimum required permissions.
- Enable IP allowlisting on the Connected App to restrict which servers can use the credentials.
- Restrict object-level security (OLS) and field-level security (FLS) on the integration user’s profile to only what Claude Code needs to access.
- Rotate the Consumer Secret periodically and store it in a secrets manager, not in a plain
.envfile committed to version control.
Step 2: MCP Configuration — Register the Salesforce Server
With OAuth configured, the next step is registering the Salesforce MCP server with Claude Code. The fastest path is Composio, which hosts a managed MCP server with 50+ Salesforce operations and handles token refresh automatically.
Prerequisites
- Claude Code installed:
npm install -g @anthropic-ai/claude-code - Salesforce Connected App with OAuth configured (Step 1)
- Composio account (free tier available) or self-hosted MCP server
- Python 3.9+ for the MCP URL generator script
Register via Composio
- Generate your Composio API key from the dashboard. Add to
.env:COMPOSIO_API_KEY=your_key_here - Install Composio library:
pip install composio-core python-dotenv - Run the MCP URL generator script to get your personal MCP endpoint URL
- Register the MCP server with Claude Code:
claude mcp add --transport http salesforce-composio "YOUR_MCP_URL" - Authenticate via OAuth — Claude Code opens a browser window to authorize your Salesforce org
- Verify the connection:
claude mcp listshould showsalesforce-composioas active
Self-hosted MCP option
For teams with strict data residency requirements, you can run an open-source Salesforce MCP server locally. The server receives tool calls from Claude Code, translates them into Salesforce REST API requests using your Connected App credentials, and returns structured results. Self-hosted requires more setup but keeps all API traffic within your network.
See the Salesforce Developer Blog post on MCP servers for the official hosted MCP option now included in every Developer Edition org.
Step 3: Bi-Directional Sync — Read and Write Salesforce Records
Once the MCP server is registered, Claude Code has live bi-directional access to your Salesforce org. Every conversation can read from or write to Salesforce in real time.
What Claude Code can read
- Any standard Salesforce object: Lead, Contact, Account, Opportunity, Task, Event
- Custom objects and custom fields defined in your org
- Related records via SOQL relationship queries
- Reports and dashboards (read metadata, not rendered output)
- Salesforce metadata: flow definitions, page layouts, validation rules
What Claude Code can write
- Create records: New Leads, Contacts, Accounts, Opportunities, Tasks, Activities
- Update fields: Opportunity Stage, CloseDate, OwnerId, any custom field
- Bulk updates: Modify hundreds of records in one command based on SOQL results
- Activity logging: Create Task records to log call summaries or meeting notes
- Lead conversion: Convert qualified leads to Contacts and Accounts with associated Opportunities
Bi-directional sync patterns
Pattern 1: Audit then fix
Read all leads with missing email fields (SOQL). Display the list for review. Then write a status update tagging them for enrichment follow-up.
Pattern 2: Ingest and route
Paste a CSV of new leads into the conversation. Claude Code creates the Lead records in Salesforce and assigns owners based on routing rules you describe.
Pattern 3: Close-loop reporting
Read pipeline data, generate a Markdown summary report, then write a Campaign Activity record back to Salesforce to document the review was completed.
For teams building more complex Salesforce data pipelines, the CRM automation tools guide covers complementary platforms for scheduled sync and dashboard outputs.
Step 4: Run SOQL Queries with Natural Language
With the Claude Code Salesforce integration active, you can run SOQL queries by describing what you need in plain English — no knowledge of field API names or query syntax required.
SOQL (Salesforce Object Query Language) is the SQL-like syntax used to query Salesforce records. Writing it correctly requires knowing field API names, relationship traversal syntax, and object structure. Claude Code eliminates that barrier.
Describe what you need in plain English. Claude Code generates the SOQL, runs it against your live org via MCP, and returns results directly in the conversation.
Practical SOQL examples
Find stale opportunities
SELECT Id, Name, StageName, CloseDate, LastActivityDate, Owner.Name
FROM Opportunity
WHERE StageName NOT IN ('Closed Won', 'Closed Lost')
AND LastActivityDate < LAST_N_DAYS:14
ORDER BY CloseDate ASCFind leads with missing email addresses
SELECT Id, FirstName, LastName, Company, Phone, LeadSource
FROM Lead
WHERE Email = null
AND IsConverted = false
ORDER BY CreatedDate DESCPull pipeline by stage for current quarter
SELECT StageName, COUNT(Id) OpportunityCount, SUM(Amount) TotalValue
FROM Opportunity
WHERE CloseDate = THIS_QUARTER
AND IsClosed = false
GROUP BY StageName
ORDER BY SUM(Amount) DESCList accounts with no activity in 30 days
SELECT Id, Name, Industry, AnnualRevenue, Owner.Name
FROM Account
WHERE LastActivityDate < LAST_N_DAYS:30
AND Type = 'Customer'
ORDER BY AnnualRevenue DESC NULLS LASTStep 5: Automated Workflow Triggers
Workflow triggers are the highest-leverage Claude Code use case inside Salesforce. Instead of clicking through Flow Builder, you describe the trigger condition and action in plain English — Claude Code handles the API calls.
Conversation-driven triggers (on-demand)
These run when you initiate a Claude Code session. You describe the trigger logic and Claude Code executes it immediately against your Salesforce org.
Example trigger prompt
“Find all Opportunities that moved to Negotiation stage in the last 24 hours. For each one, create a follow-up Task assigned to the Opportunity owner with a due date of 3 days from now and the subject 'Negotiation follow-up — send redlined contract'. Then update the Next Step field on each Opportunity to 'Await contract review'.”
Claude Code translates this into three steps:
- SOQL query to find matching opportunities
- Loop to create Task records for each with correct OwnerId and DueDate
- Bulk update to set NextStep field on all matched opportunities
Common workflow triggers Claude Code handles
- Stage-change actions: Create tasks, send Slack alerts, update fields when a deal moves to a new stage
- Inactivity alerts: Flag deals with no activity for N days and create reminder tasks for owners
- Lead assignment triggers: Route unassigned leads created in the last 24 hours based on territory and company size rules
- Close date pushes: Find deals with overdue close dates and update them to a new date based on last activity
- Data quality gates: Before a deal can move past Discovery, verify required fields are filled and flag the rep if not
Persistent triggers: Claude Code + n8n or Zapier
Claude Code triggers are conversation-driven — they run when you prompt them. For event-driven triggers that fire automatically (e.g., every time a new lead is created), pair Claude Code’s logic design with a workflow orchestration layer.
| Need | Claude Code | Persistent option |
|---|---|---|
| On-demand logic execution | Native | — |
| Event-driven real-time trigger | Not supported | Salesforce Flow Builder, n8n |
| Scheduled recurring automation | Manual scheduling only | Zapier, Make, n8n |
| Complex conditional logic design | Excellent (prototyping) | — |
Design trigger logic with Claude Code. Port production-ready workflows into n8n or Salesforce Flow Builder for event-driven execution.
Step 6: Pipeline Hygiene Automation
Dirty pipeline is the silent killer of sales forecasting accuracy. Deals with no next step, past close dates, and missing contact roles inflate pipeline numbers and skew forecast calls. Claude Code runs a pipeline hygiene audit on demand.
Pipeline hygiene checks Claude Code runs automatically
- Stale deals: No activity in 14+ days with a close date this quarter
- Missing next steps: Open opportunities where Next Step field is blank
- Overdue close dates: Deals with CloseDate in the past, not Closed Won or Closed Lost
- No contact roles: Opportunities with no Opportunity Contact Role associated
- Single-threaded deals: Opportunities linked to only one contact (high churn risk)
- Amount anomalies: Deals with no Amount or an Amount that is a statistical outlier
Schedule a weekly prompt that pulls all flagged records and generates a Markdown report. Share in Slack before your Monday pipeline review. Reps see exactly which deals need attention — no manual cross-referencing required.
This connects directly to the CRM data hygiene practices that RevOps teams use to maintain forecast accuracy.
“We run a Claude Code pipeline audit every Friday. It catches 30–40 deals each week that need attention before the Monday forecast call. What used to take a RevOps analyst 3 hours now takes 8 minutes.”
— RevOps Manager, Series B SaaS company
Step 7: Enrich Salesforce Records with SyncGTM
Claude Code excels at identifying what is wrong with your Salesforce data. It cannot fill those gaps — that requires an external data layer. SyncGTM runs waterfall enrichment across 20+ data providers to find verified emails, direct phone numbers, and firmographic data for every record Claude Code flags.
The complete Claude Code + SyncGTM workflow
- Claude Code audits Salesforce — SOQL queries identify all records with missing email, phone, job title, or firmographic fields
- Export the gap list — Claude Code generates a CSV of records needing enrichment with name, company, and any available identifiers
- SyncGTM enriches the list — waterfall enrichment across 20+ providers returns verified contact and company data
- Claude Code writes back to Salesforce — updates enriched fields on each record via MCP, closing the loop
- Pipeline is clean — reps see complete, accurate records with no manual research
This workflow integrates directly with the Salesforce enrichment tools used by top RevOps teams to maintain a continuously clean CRM.
What SyncGTM enriches
- Verified business email addresses (multi-waterfall, 85%+ hit rate)
- Direct phone numbers and mobile numbers
- Current job title and seniority level
- LinkedIn profile URL
- Company headcount, industry, and technology stack
- Funding stage and total funding raised
SyncGTM pricing
SyncGTM uses a usage-based model — you pay per enrichment credit, not per seat. Visit syncgtm.com/pricing for current plans. Most teams see positive ROI in the first week by recovering pipeline stuck behind missing contact data.
Limitations to Know Before You Start
Claude Code is powerful inside Salesforce, but it has real constraints. Knowing them upfront saves you from building on shaky foundations.
| Task | Claude Code | Better alternative |
|---|---|---|
| One-off SOQL queries | Excellent | — |
| Bulk record updates | Good (with preview) | — |
| Lead routing (ad hoc) | Good | — |
| Real-time event-driven triggers | Not supported | Salesforce Flow Builder |
| Production deployment with rollback | No rollback capability | Gearset, Copado |
| Visual Flow Builder | Cannot build visually | Salesforce Flow Builder |
| Contact data enrichment | Cannot source new data | SyncGTM waterfall enrichment |
| Audit trails and governance | Manual logging only | Salesforce setup audit trail |
Use Claude Code for exploration, prototyping, and one-off automation. Promote reliable workflows into Salesforce’s native tools or dedicated platforms for production execution. See the guide to CRM automation workflows that eliminate busywork for the broader automation stack.
Conclusion
The Claude Code Salesforce integration gives RevOps and GTM teams a live, bidirectional connection to their CRM through OAuth and MCP. Tasks that previously required a developer — custom SOQL reports, bulk record updates, lead routing, pipeline audits, workflow trigger logic — now take minutes in plain English.
The setup is a one-time investment: configure the Connected App, register the MCP server, authenticate once. From that point, every Claude Code session has live access to your Salesforce org.
Pair it with SyncGTM to close the enrichment gap. Claude Code identifies every record with missing data. SyncGTM fills it using waterfall enrichment across 20+ providers. Your Salesforce org stays clean, complete, and ready for outreach — without anyone doing manual research.
If you are building a GTM engineering practice, the Claude Code + Salesforce + SyncGTM stack is one of the highest-ROI starting points available in 2026. Start with OAuth, register MCP, and run your first pipeline hygiene audit today.
