assign_permission_set
Assign a permission set to one or more org users.
Create a scratch org from a snapshot, deploy the local project into it, and run the Apex tests with code coverage without moving to a terminal.
LABSCO SUMMARY
Create an org from a snapshot or definition file, deploy the project into it, run Apex tests with coverage, delete it — the whole loop is covered, and a long job can be picked back up by id, which is the step that usually strands an agent halfway through a deploy. Worth knowing before you wire it up: the delete tool is destructive enough that its own instruction is to confirm with the user first.
Salesforce's own server over the CLI's operations, organised into toolsets you switch on by name: org resolution, scratch orgs and snapshots, metadata deploy and retrieve, SOQL, permission sets and Apex tests, with further sets for LWC and Aura work, code analysis, mobile, DevOps Center and Apex performance.
Node.js, an org you are already authorized to from this machine, and a local Salesforce project directory for the metadata and Apex tools. The --orgs flag is mandatory and decides what the server may touch: name usernames or aliases to pin it, or pass DEFAULT_TARGET_ORG, which resolves per call and follows whatever your default org happens to be at the time. ALLOW_ALL_ORGS exists and hands over everything you are authorized to. Scratch orgs and snapshots additionally need a Dev Hub. Enabling every toolset puts more than sixty tools in front of the model, which is why the toolsets exist. Apache-2.0.
One command — npx -y @salesforce/mcp@latest --orgs DEFAULT_TARGET_ORG --toolsets orgs,metadata,data,users --tools run_apex_test --allow-non-ga-tools
USE CASES
Create the scratch org from a definition file or an existing snapshot, alias it, and make it the default for what follows.
Deploy the metadata, then run the Apex tests with coverage — the test scope taken from what you are working on if you do not name it.
Retrieve the metadata into the local project rather than reconstructing it by hand.
Run the SOQL against the org — through the Tooling API when the question is about metadata rather than records.
Resume the operation by its id instead of starting it again and racing the first one.
Assign the permission set to the users who need it, without opening setup.
Counted once with only startup setup. Other versions, modes or optional credentials may expose a different list.
assign_permission_setAssign a permission set to one or more org users.
create_org_snapshotCreates a new snapshot of an org
AGENT INSTRUCTIONS:
Example usage: Create a snapshot called 07042025 create a snapshot called 07042025 with the description, "this is a snapshot for commit 5b1a09b1743 - new login flow working" create a snapshot of my MyScratch in myDevHub
create_scratch_orgCreates a scratch org with the specified parameters.
AGENT INSTRUCTIONS:
Example usage: Create a scratch org create a scratch org with the definition file myDefinition.json that lasts 3 days create a scratch org aliased as MyNewOrg and set as default and don't wait for it to finish
delete_orgDeletes specified salesforce org.
AGENT INSTRUCTIONS: ALWAYS confirm with the user before deleting an org
Example usage: Can you delete my org Can you delete MyAliasedOrg Can you delete test-fe2n4tc8pgku@example.com
deploy_metadataDeploy metadata to an org from your local project.
AGENT INSTRUCTIONS: If the user doesn't specify what to deploy exactly ("deploy my changes"), leave the "sourceDir", "ignoreConflicts" and "manifest" params empty so the tool calculates which files to deploy.
EXAMPLE USAGE: Deploy changes to my org Deploy this file to my org Deploy the manifest Deploy X metadata to my org Deploy X local files to my org and ignore any conflicts between the local project and org Deploy X to my org and run A,B and C apex tests.
get_usernameIntelligently determines the appropriate username or alias for Salesforce operations.
WHEN TO USE THIS TOOL:
To resolve the default org username, set the defaultTargetOrg param to true and defaultDevHub to false. To resole the default devhub org username, set the defaultTargetOrg param to false and defaultDevHub to true. If it's not clear which type of org to resolve, set both defaultTargetOrg and defaultDevHub to false to an allow-listed org username available.
list_all_orgsLists all configured Salesforce orgs.
AGENT INSTRUCTIONS: DO NOT use this tool to try to determine which org a user wants, use #get_username instead. Only use it if the user explicitly asks for a list of orgs.
Example usage: Can you list all Salesforce orgs for me List all Salesforce orgs List all orgs
open_orgOpen a Salesforce org in the browser.
You can specify a metadata file you want to open.
resume_tool_operationResume a long running operation that was not completed by another tool.
AGENT INSTRUCTIONS: Use this tool to resume a long running operation.
EXAMPLE USAGE: Resume the metadata deploy job 0Af1234567890 Resume the deployment and wait for 10 minutes Resume the deployment to my org Resume scratch org creation Resume job 2SR1234567890 Resume agent tests Resume org snapshot with ID 0OoKa000000XZAbKAO Report on my org snapshot
retrieve_metadataRetrieve metadata from an org to your local project.
AGENT INSTRUCTIONS: If the user doesn't specify what to retrieve exactly ("retrieve my changes"), leave the "sourceDir", "ignoreConflicts", and "manifest" params empty so the tool calculates which files to retrieve.
EXAMPLE USAGE: Retrieve changes Retrieve changes from my org Retrieve this file from my org Retrieve the metadata in the manifest Retrieve X metadata from my org Retrieve X metadata from my org and ignore any conflicts between the local project and org
run_apex_testRun Apex tests in an org.
AGENT INSTRUCTIONS: If the user doesn't specify what to test, take context from the currently open file This will ONLY run APEX tests, NOT agent tests, lightning tests, flow tests, or any other type of test.
this should be chosen when a file in the 'classes' directory is mentioned
EXAMPLE USAGE: Run tests A, B, C. Run the myTestMethod in this file Run this test and include success and failures Run all tests in the org. Test the "mySuite" suite asynchronously. I’ll check results later. Run tests for this file and include coverage What are the results for 707XXXXXXXXXXXX
run_soql_queryRun a SOQL query against a Salesforce org.
BEFORE YOU INSTALL
12 tools when we connected; the project documents 89. The example config enables only the orgs, metadata, data and users toolsets plus core and run_apex_test. Use --toolsets all for every tool; non-GA tools such as create_scratch_org and delete_org also need --allow-non-ga-tools.
All 4 documented clients run the server on your machine.
INSTALLATION
npx -y @salesforce/mcp@latest --orgs DEFAULT_TARGET_ORG --toolsets orgs,metadata,data,users --tools run_apex_test --allow-non-ga-tools{
"servers": {
"Salesforce DX": {
"command": "npx",
"args": [
"-y",
"@salesforce/mcp",
"--orgs",
"DEFAULT_TARGET_ORG",
"--toolsets",
"orgs,metadata,data,users",
"--tools",
"run_apex_test",
"--allow-non-ga-tools"
]
}
}
}{
"mcpServers": {
"Salesforce DX": {
"command": "npx",
"args": [
"-y",
"@salesforce/mcp",
"--orgs",
"DEFAULT_TARGET_ORG",
"--toolsets",
"orgs,metadata,data,users",
"--tools",
"run_apex_test",
"--allow-non-ga-tools"
]
}
}
}{
"mcpServers": {
"Salesforce DX": {
"command": "npx",
"args": [
"-y",
"@salesforce/mcp@latest",
"--orgs",
"DEFAULT_TARGET_ORG",
"--toolsets",
"orgs,metadata,data,users",
"--tools",
"run_apex_test",
"--allow-non-ga-tools"
]
}
}
}