How to connect Salesforce MCP with Claude Code (5 steps)

Developers building RevOps automations, sales tooling, or AI-assisted workflows constantly need to reference Salesforce data, whether it's checking opportunity stages, pulling contact histories, or reading account firmographics. But each lookup means leaving the terminal and opening a browser.
To help your developers query and update Salesforce records directly from their coding session, we'll show you how to connect Salesforce with Merge Agent Handler's Salesforce MCP server.
How it works
Merge Agent Handler acts as a secure bridge between Claude Code and Salesforce's API.
When you configure a Tool Pack and Registered User, Merge generates a unique MCP URL that Claude Code accesses via HTTP, combined with an API key (generated in Merge Agent Handler) for authentication.
Here's how the command looks before you add your specific MCP URL and API key:
Claude Code sends requests to that MCP URL, and Merge handles authentication and API calls to Salesforce on the backend. You don't manage Salesforce OAuth tokens or Connected App credentials locally. Merge handles token storage and refresh from here on.
Prerequisites
Before getting started, you'll need the following:
- A Merge Agent Handler account
- Claude Code installed (run <code class="blog_inline-code">
claude --version</code>to confirm) - A Salesforce account with API access enabled
Related: A guide to integrating HubSpot MCP with Claude Code
1. Create a Tool Pack
Log into Merge Agent Handler and navigate to Tool Packs. Click Create Tool Pack and give it a name tied to the use case, like Deal pipeline agent.

Under connectors, select Salesforce, and select the tools to enable.

For most sales and RevOps workflows, enabling opportunity retrieval, account lookup, and contact search covers the common cases. Enable write tools if you want your agent to create leads, update opportunity stages, or log activity records directly.
Save the Tool Pack. You'll return here in step 4 to copy your MCP URL.
2. Add a Registered User
Inside your Tool Pack, create a Registered User. This is the identity context under which your agent operates: the account it acts on behalf of when calling Salesforce's API.

Give it a name that maps to your environment, like dev-local or your own name. Once created, Merge generates a unique MCP URL scoped to this user.
3. Authenticate Salesforce
From the Registered User detail page, click Add Connector and select Salesforce. This kicks off a standard OAuth flow.

Sign in with the Salesforce account that has API access to the objects and records you want Claude Code to reach, and grant the requested permissions.
Once the OAuth flow completes, Merge stores and manages the access token. You won't need to re-authenticate unless you revoke access.
4. Gather your credentials
You need two things before configuring Claude Code:
1. MCP URL: found on the Tool Pack detail page under the Registered User you just created. It looks like this:
2. API key: found in Settings > API Keys in your Merge Agent Handler dashboard. Create one if you don't have one yet.
Keep both handy for the next step.
5. Configure Claude Code with Salesforce
Run the following command in your terminal, substituting your actual MCP URL and API key:
Verify the connection registered by entering the command <code class="blog_inline-code">claude mcp list</code>.
<code class="blog_inline-code">agent-handler</code> should appear in the output with a connected status.
To confirm the connector is accessible, open a Claude Code session and run a command like: List my open opportunities closing this quarter and summarize the three largest by deal value.

{{this-blog-only-cta}}
Salesforce MCP FAQ
In case you have more questions on setting up and using the Salesforce MCP in Claude Code, we've addressed several more commonly-asked questions below.
What can you do once the Salesforce MCP is connected to Claude Code?
With Salesforce connected, Claude Code can:
- Search and retrieve opportunities: pull deals by stage, owner, close date, or amount without opening a browser or writing a SOQL query by hand
- Look up accounts and contacts: fetch full account records, contact details, and relationship hierarchies from within a coding session
- Read activity history: surface calls, emails, and meeting logs against any record to understand what's happened on an account before acting
- Create and update records: log a new lead, move an opportunity to a new stage, or update account fields directly from the terminal
- List pipeline by rep or team: aggregate open deals by owner or segment to give agents the context they need for automation logic
- Cross-reference CRM data: combine Salesforce records with other connected tools, pulling account data alongside Jira tickets or Slack threads in a single agent session
Why use Merge Agent Handler vs. a self-hosted Salesforce MCP server?
You can build a self-hosted MCP server that calls Salesforce's API directly. For a solo developer working against a single Salesforce sandbox, that's a manageable starting point. You create a Connected App, handle the OAuth flow, write tool schemas against the objects you need, and wire it to Claude Code.
The friction compounds quickly at the team level.
Salesforce's OAuth setup requires administrator access to create and configure a Connected App, and every developer who needs agent access ends up with their own token to manage. There's no central place to enforce which objects or fields an agent is allowed to read or write, no audit trail of what the agent queried, and no clean process for revoking access when someone leaves.
Salesforce's API surface is also unusually broad. Covering Opportunities, Accounts, Contacts, Leads, Cases, Tasks, and Activities with correct field mappings, pagination, and error handling is extremely difficult to build and maintain as Salesforce releases API updates.
Merge Agent Handler is a managed MCP layer. It centralizes authentication, scopes access per Tool Pack and Registered User so each agent only touches the objects and fields you explicitly allow, and logs every tool call. For teams building agents against production Salesforce data, Merge removes the per-developer credential problem and the maintenance burden of keeping the connector current.
Why connect Salesforce to Claude Code?
Salesforce holds the data that drives revenue decisions: who owns which account, where each deal stands, what activity has happened on a customer relationship, etc. Developers building agents that need to act on any of that have to reach Salesforce, and right now that typically means a browser, an API client, or a one-off script.
With the Salesforce MCP connected, Claude Code can query opportunities, update records, and surface account context without a context switch.
This matters most when the agent is part of a larger workflow: reading a Salesforce opportunity to decide which Slack message to send, pulling account history before drafting an email, or checking deal stage before triggering a downstream action. The terminal becomes the single place where CRM data and code execution meet, and agents can use both in one session.
.png)



.png)