Quick Start Using the VS Code With Copilot MCP Client
Get started with the Salesforce DX MCP Server using Visual Studio Code (VS Code) as the MCP client. After you configure it with the Salesforce DX MCP Server, you then use GitHub Copilot and natural language to easily execute typical Salesforce DX development tasks, such as creating scratch orgs, deploying or retrieving metadata, and viewing org records.
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.
-
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.jsonfile at the root of your DX project and add this JSON: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:serverssection.The
--orgsflag is required and specifies the authorized orgs you’re allowing the DX MCP Server to access. The--toolsetsflag 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.
You can also get to the command palette by pressing Ctrl+Shift+P (Windows or Linux) or Command-Shift-P (macOS).
-
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):
-
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.
See Also