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:

You also need a GitHub account.

Okay, let’s do it!

  1. 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.

  2. 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).

    Tip

  3. 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
  4. 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.
  5. 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.
  6. To stop, restart, or view the DX MCP Server configuration, run the MCP: List Servers command, click Salesforce DX, then click the appropriate option.