Insights

Salesforce and Claude Integration

How to Use Claude Code With the Salesforce DX MCP Server

Akshit KandiDecember 6, 2026 5 min read

Short answer

To use Claude Code with the Salesforce DX MCP server, install the Salesforce CLI, authorize a sandbox, add the DX MCP server to Claude Code with only the orgs and toolsets you need, and work in a source-tracked project. Claude can then inspect metadata, write Apex and tests, run tests and prepare deployments, with production kept out of reach.

  • →The DX MCP server gives Claude Code structured access to orgs through the Salesforce CLI.
  • →Restrict it to sandbox orgs and the toolsets you need; keep production out of scope.
  • →Work in a source-tracked project with Git so every change is reviewable.
  • →Use it for tests, refactors and metadata analysis first, where review is easy.

Salesforce development has always carried a lot of ceremony: retrieving metadata, writing test classes to hit coverage, chasing deployment errors, reading someone else’s Flow at 11pm. Claude Code with the Salesforce DX MCP server takes a large share of that ceremony off developers, provided you set it up so that mistakes land in a sandbox and a pull request, not in production.

What is the Salesforce DX MCP server?

Salesforce DX MCP server

An MCP server from Salesforce that exposes Salesforce CLI capabilities, such as org management, metadata, data queries and testing, as tools an AI coding assistant like Claude Code can call.

Claude Code is Anthropic’s agentic coding tool. It works in your terminal or IDE, reads and edits files in your project, runs commands and can call MCP servers. With the DX MCP server added, it gets structured tools for your Salesforce orgs instead of guessing at CLI commands. Salesforce groups those tools into toolsets and lets you choose which orgs the server can touch when you start it. The flags and toolset names evolve, so read the current README before configuring.

How do you set it up?

  1. 01

    Install the Salesforce CLI

    Use the current release, and authorize a developer or sandbox org with a scratch or sandbox user.

  2. 02

    Open a source-tracked project

    A Salesforce DX project under Git, so Claude’s edits become reviewable diffs.

  3. 03

    Add the DX MCP server

    Register it in Claude Code’s MCP configuration, passing only the sandbox org alias you want it to use.

  4. 04

    Enable minimal toolsets

    Start with metadata and testing. Add data or user management only when a task needs it.

  5. 05

    Write a project memory file

    Put conventions in CLAUDE.md: naming, trigger framework, test patterns, what never to touch.

  6. 06

    Confirm with a dry run

    Ask Claude to list org metadata and run existing tests before asking it to change anything.

The single most important setting is which orgs the server can reach. Do not authorize production in the same configuration. If a developer genuinely needs production read access for diagnostics, use a separate, read-only setup and a separate session.

Which tasks work well, and which need care?

TaskFitNotes
Write Apex test classesStrongAsk for meaningful assertions, not just coverage
Explain an inherited Flow or triggerStrongRead only; great for onboarding and audits
Refactor Apex to a trigger frameworkGoodRun all tests before and after
Fix deployment errorsGoodClaude reads errors and proposes fixes in source
Generate LWC componentsGoodReview accessibility and security patterns
Data loads or bulk updatesCareSandbox only, small batches, explicit approval
Permission and sharing changesCareHuman review by the security owner, always

What team workflow holds up?

Guardrails for Claude Code on Salesforce
  • Only sandbox and scratch orgs are configured in the MCP server
  • Every change goes through Git and a pull request with human review
  • Claude runs the full relevant test suite before proposing a merge
  • CLAUDE.md documents conventions, forbidden areas and the deployment path
  • Permission set, profile and sharing changes require a named reviewer
  • Production deployment stays in your existing pipeline, not in Claude Code

The pattern is simple: Claude Code does the work, Git records it, a human approves it, and your normal pipeline deploys it. That keeps the speed gain without changing your change-control story for auditors.

What should go in your CLAUDE.md for a Salesforce project?

Claude Code reads a project memory file, CLAUDE.md, at the start of each session. For Salesforce work this file does more to improve output quality than any individual prompt, because it carries the conventions your org depends on and that no model can guess.

Keep it short and specific. Describe the trigger framework and where handlers live. State naming conventions for classes, Flows and custom fields. Say how tests should be written: test data factories, no reliance on org data, real assertions, bulk tests for triggers. List the areas Claude must not change without a human, such as permission sets, sharing rules and integration user settings. Note the deployment path, so Claude prepares changes for your pipeline instead of trying to deploy directly. Add known governor limit hot spots.

Illustrative example
Claude Code · CLAUDE.md for a Salesforce project
prompt 1# Salesforce project notes for Claude Code 2- Orgs: only the dev-sandbox and scratch aliases 3- Never deploy. Commit to a branch and open a PR 4- Triggers: one per object, logic in *TriggerHandler 5- Services live in classes/service, selectors in /selector 6- Tests: no SeeAllData, bulk test with 200 records 7- Use Assert class methods, not System.assert 8- Flow names: Object_Purpose_TriggerType 9- Run tests for every class you touch before finishing10- Ask before editing permission sets or profiles
Illustrative project memory file. Short, specific rules beat long style guides, and it grows when reviewers repeat a fix.
  • Architecture: trigger framework, service layer pattern, where shared utilities live.
  • Conventions: naming for Apex, LWC, Flows, custom objects and fields.
  • Testing rules: data factories, bulk tests, meaningful assertions, coverage targets.
  • Forbidden zones: permissions, sharing, integration users, managed package code.
  • Delivery: branch naming, pull request template, how deployments actually happen.

Update the file whenever a reviewer catches the same mistake twice. Over a few weeks it becomes a living record of how your team builds on Salesforce, useful for new human developers as much as for Claude.

Measure the change the same way you would any process improvement. Before rollout, note how long typical tasks take: writing a test class for a new trigger, diagnosing a failed deployment, documenting an inherited Flow. After a month, compare. Also track review findings per pull request, because faster output that needs more rework is not a gain. Teams usually find the biggest time savings in test writing and code comprehension, and the smallest in tasks that depend on undocumented business rules, which is another reason to keep CLAUDE.md current.

SkySync practice

SkySync’s delivery team in Hyderabad and New York uses Claude Code against sandboxes for test generation, refactors and Flow analysis, with every change through pull request review. We teach the same setup in Claude Training Cohorts and the Claude Architects program, and Claude Help Desk supports developers once they are using it day to day.

How does this fit the bigger integration picture?

The developer door is often the first one teams open because the risk is contained and the value is visible in a week. It also builds the internal skills you need for the other doors, such as MCP configuration and permission design. See the integration options overview and the integration playbook for how it connects to Agentforce and Claude agents.

Frequently asked questions

Is the Salesforce DX MCP server free and open source?

Salesforce has published it as an open-source project that runs locally alongside the Salesforce CLI. Your org licenses and Claude Code plan still apply. Check the repository and release notes for current status, supported toolsets and any features still marked beta.

Can Claude Code deploy to production?

Technically it could if you authorize a production org, which is why we recommend not doing so. Keep production deployment in your existing pipeline with its approvals and audit trail, and let Claude Code work in sandboxes, producing changes that humans review and merge.

Do we still need experienced Salesforce developers?

Yes. Claude Code speeds up writing and analysis, but someone has to judge architecture, governor limits, sharing implications and whether a test actually proves anything. It makes good developers faster; it does not replace the judgment that keeps an org healthy.

Go deeper

Claude and Salesforce: The Integration Playbook

MCP, Agentforce, Data 360 and Slack: which door to use, how to secure it, and how to run it after launch

  • ✓The Four Doors Model: every way Claude and Salesforce can meet, and what each one is good for
  • ✓A decision table for Agentforce vs a custom Claude agent, with the questions that settle it
  • ✓An MCP security checklist: integration users, OAuth scopes, read vs write, audit
  • ✓How Data 360 grounding changes what an agent can answer correctly
Free whitepaper

Download the whitepaper

By continuing you agree to be contacted by SkySync about this material.

More on Salesforce and Claude Integration