Quick Start Using the VS Code With Copilot MCP Client
For the best getting-started experience, make sure that you have a standard Salesforce DX environment set up on your computer. In particular:
- Install Node.js on your computer. We recommend you use the Active LTS version.
- Install Salesforce CLI on your computer.
- Install VS Code on your computer.
- Create a Salesforce DX project and open it in VS Code. You can also clone an example repo, such as dreamhouse-lwc, which is a ready-to-use DX project that contains a simple Salesforce application, with metadata and test data.
-
Authorize at least one development Salesforce
org to use with your DX project, such as a Trailhead playground,
sandbox, scratch org, or Developer Edition org, and set it as your default org.
If you want to create a scratch org using MCP, then you must also authorize a Dev Hub org.
You also need a GitHub account.
Okay, let’s do it!
-
Create a .vscode/mcp.json file at the root
of your DX project and add this JSON:
1{ 2 "servers": { 3 "Salesforce DX": { 4 "command": "npx", 5 "args": ["-y", "@salesforce/mcp@latest", 6 "--orgs", "DEFAULT_TARGET_ORG", 7 "--toolsets", "orgs,metadata,data,users,testing"] 8 } 9 } 10}You can also configure the DX MCP Server globally by editing the VS Code settings.json file and adding a similar JSON snippet but contained in an mcp:servers section.The --orgs flag is required and specifies the authorized orgs you're allowing the DX MCP Server to access. The --toolsets flag specifies the toolsets it should consult when determining the specific tool to run. See Configure the Salesforce DX MCP Server for Your Environment for the available values for the two flags.
-
Open VS Code, go to View -> Command Palette and find and
click MCP: List Servers.
-
Click Salesforce DX, then Start
Server.
Click Yes if you’re asked if the DX MCP Server is trustworthy.
Check the Output tab for the server status and errors. The output also shows information such as the MCP tools and toolsets that were registered, and which MCP tool registration was skipped because they’re not generally available (NON-GA).
When the DX MCP Server is ready, you see a message like this (your server version might be different):
1✅ Salesforce MCP Server v0.21.2 running on stdio -
Run Chat: Open Chat (Agent) from the command palette to
start a new GitHub Copilot chat session. If necessary, you’re asked to log in to
GitHub and authorize VS Code to access it.
Be sure your GitHub Copilot chat window is in Agent mode; if you're in Ask or Edit mode, use the little drop-down to switch.
-
In the GitHub Copilot chat window, use natural language to explain what you
want to do. The DX MCP Server determines which configured tool to use, and then
shows it to you along with other information. Review the chosen tool and
parameters, then click Continue to run the tool and see
the results of your request.
Try out these sample prompts:
- Do I have any active scratch orgs? What about inactive scratch orgs?
- Show me all the available information about all my orgs.
- Show me all the accounts in the org with the alias my-org.
- Deploy the Apex classes in my DX project to the org with the alias my-org.
- Retrieve all agents from my org.
- To stop, restart, or view the DX MCP Server configuration, run the MCP: List Servers command, click Salesforce DX, then click the appropriate option.