@advanced-communities/salesforce-mcp-server
MCP server enabling AI assistants to interact with Salesforce orgs through the Salesforce CLI
Versions
1.6.6latest1.6.51.6.41.6.31.6.2+ show 17 moreshow less
1.6.11.5.61.5.51.5.31.5.21.5.11.5.01.4.01.3.21.3.11.3.01.2.61.2.51.2.41.2.31.2.21.2.1Tools 47
generate_component Generate Lightning Web Components (LWC) or Aura components with customizable templates and output directories
list_connected_salesforce_orgs List connected Salesforce Orgs. This command retrieves a list of all Salesforce Orgs that are currently connected to the Salesforce CLI. The results are returned in JSON format, providing details about each Org, including its alias, username, and other metadata. Use this command to see which Salesforce Orgs you have access to and can interact with using the Salesforce CLI.
login_into_org Authenticate and login to a Salesforce org via web browser. This command opens a browser window for OAuth authentication flow, allowing you to securely connect to a Salesforce org. After successful authentication, the org credentials are stored locally by the Salesforce CLI for future use. Use isProduction=true for production/developer orgs (login.salesforce.com) or isProduction=false for sandboxes/scratch orgs (test.salesforce.com). The alias parameter creates a convenient shorthand name for accessing this org in subsequent commands. IMPORTANT: This tool requires both 'alias' and 'isProduction' parameters to be provided before execution - do not proceed until all required parameters are supplied.
assign_permission_set Assign a permission set to one or more org users. To specify an alias for the --target-org or --on-behalf-of flags, use the CLI username alias, such as the one you set with the 'alias set' command. Don't use the value of the Alias field of the User Salesforce object for the org user. To assign multiple permission sets, specify multiple names in the permissionSetNames array. Enclose names that contain spaces in the array elements. The same syntax applies to onBehalfOf array for specifying multiple users.
assign_permission_set_license Assign a permission set license to one or more org users. To specify an alias for the --target-org or --on-behalf-of flags, use the CLI username alias, such as the one you set with the 'alias set' command. Don't use the value of the Alias field of the User Salesforce object for the org user. To assign multiple permission set licenses, specify multiple names in the licenseNames array. Enclose names that contain spaces in the array elements. The same syntax applies to onBehalfOf array for specifying multiple users.
display_user Display information about a Salesforce user. Output includes the profile name, org ID, access token, instance URL, login URL, and alias if applicable. The username, org ID, instance URL and login URL are masked for privacy. The displayed alias is local and different from the Alias field of the User sObject record of the new user, which you set in the Setup UI.
list_metadata List the metadata components and properties of a specified type. Use this command to identify individual components in your manifest file or if you want a high-level view of particular metadata types in your org. For example, you can use this command to return a list of names of all the CustomObject or Layout components in your org, then use this information in a retrieve command that returns a subset of these components. The username that you use to connect to the org must have the Modify All Data or Modify Metadata Through Metadata API Functions permission.
list_metadata_types Display details about the metadata types that are enabled for your org. The information includes Apex classes and triggers, custom objects, custom fields on standard objects, tab sets that define an app, and many other metadata types. Use this information to identify the syntax needed for a <name> element in a manifest file (package.xml). The username that you use to connect to the org must have the Modify All Data or Modify Metadata Through Metadata API Functions permission.
logout Log out of a Salesforce org. Use targetOrg to logout of a specific org, or set all to true to logout of all orgs. The logout is performed with --no-prompt flag to avoid confirmation prompts. Be careful! If you log out of a scratch org without having access to its password, you can't access the scratch org again, either through the CLI or the Salesforce UI.
open Open your Salesforce org in a browser. To open a specific page, specify the portion of the URL after 'https://mydomain.my.salesforce.com' as the path value. Use sourceFile to open ApexPage, FlexiPage, Flow, or Agent metadata from your local project in the associated Builder.
get_default_org Get the current default target org configured in the Salesforce CLI. Returns only the org's alias, which is used as the default when no targetOrg is specified in other tool calls. If the default org has no alias, a masked username is returned with a hint asking the user to set an alias; usernames, org IDs and instance URLs are never returned.
set_default_org Set the default target org for the Salesforce CLI. Once set, all tools will use this org by default when no targetOrg is specified. The value persists across sessions.
clear_default_org Clear the default target org from the Salesforce CLI configuration. After clearing, all tools will require an explicit targetOrg parameter until a new default is set.
execute_anonymous_apex Execute Apex code in a Salesforce Org. This command allows you to run Apex code directly against a specified Salesforce Org. The code is executed in the context of the Org, and the results are returned in JSON format. You can use this command to test Apex code snippets, run batch jobs, or perform other Apex-related tasks. You can review the debug logs of the execution to see the results of the code execution.
run_apex_tests Run Apex tests in a Salesforce Org. This command allows you to execute unit tests with various options including test level, specific classes, suites, and code coverage collection. Tests can be run synchronously or asynchronously. Use this to validate your Apex code and ensure proper test coverage.
get_apex_test_results Retrieve results from a previous asynchronous Apex test run. Use this command with a test run ID to get detailed test results including pass/fail status, error messages, stack traces, and optionally code coverage information.
get_apex_code_coverage Get code coverage information for a Salesforce Org. This command allows you to retrieve org-wide coverage percentage or coverage details from a specific test run. Use this to monitor and ensure your code meets the 75% coverage requirement.
generate_class Generates the Apex *.cls file and associated metadata file. These files must contained in a parent directory called "classes" in your package directory. Either run this command existing directory of this name, or use the --output-dir flag to generate one or point to an existing one.
generate_trigger Generates the Apex trigger *.trigger file and associated metadata file. These files must be contained in a parent directory called "triggers" in your package directory. Either run this command from an existing directory of this name, or use the --output-dir flag to generate one or point to an existing one. If you don\'t specify the --sobject flag, the .trigger file contains the generic placeholder SOBJECT; replace it with the Salesforce object you want to generate a trigger for. If you don\'t specify --event, "before insert" is used.
apex_log_list Fetch the list of apex debug logs returning the logs with their IDs.
apex_get_log Fetch the specified log or given number of most recent logs from the org.
open_record Opens a Salesforce record in a browser.
create_record Create a new record in a Salesforce org using the REST API. Returns the ID of the created record on success. Input must be a JSON object with keys: sObject (string), recordJson (string), and optionally targetOrg (string).
update_record Update an existing record in a Salesforce org using the REST API. Updates specified fields on the record. Input must be a JSON object with keys: sObject (string), recordId (string), recordJson (string), and optionally targetOrg (string).
delete_record Delete a record from a Salesforce org using the REST API. Permanently removes the specified record. Input must be a JSON object with keys: sObject (string), recordId (string), and optionally targetOrg (string).
package_install Install or upgrade a package version in a Salesforce org. Supports both package IDs (04t) and aliases with various configuration options.
package_uninstall Uninstall a second-generation package from the target org. Specify the package ID (starts with 04t) or alias for the package to uninstall.
get_server_permissions Get current server permission settings
run_code_analyzer Analyze code for quality and security issues. Run list_code_analyzer_rules first to select appropriate rules for ruleSelector parameter.
list_code_analyzer_rules List available code analysis rules with details. Use to determine rules for code-analyzer run command.
sobject_list List all standard and custom objects in a Salesforce Org. This command retrieves a list of all standard and custom objects available in the specified Salesforce Org. The results are returned in JSON format, providing details about each object, including its name, label, and other metadata. Use this command to explore the objects in your Salesforce Org and understand their structure and properties, especially if asked to work with specific objects in your Apex code or SOQL queries and you don't know their API names. Always execute this tool before writing Apex code or SOQL queries to ensure you have the correct object names.
sobject_describe Describe a Salesforce SObject. This command retrieves detailed metadata about a specific Salesforce SObject, including its fields, relationships, and other properties. The results are returned in JSON format, providing a comprehensive view of the SObject's structure. Use this command to understand the schema of a specific SObject, which is especially useful when writing Apex code or SOQL queries that interact with that SObject. Always execute this tool before querying or manipulating records in the SObject to ensure you have the correct field names and types.
search_records Search for text across multiple Salesforce objects simultaneously. USE THIS TOOL when searching for records that mention, contain, or reference specific text (like company names, keywords, phrases) across different objects. This is the PRIMARY tool for text-based searches across your org - it's much more efficient than running multiple SOQL queries. Perfect for finding all records mentioning a competitor, customer name, or any text across Accounts, Opportunities, Cases, Contacts, etc. SOSL (Salesforce Object Search Language) performs full-text search across all searchable fields.
query_records Query records from a SINGLE Salesforce object using structured field conditions. Use this for precise queries on ONE object with specific field criteria (e.g., Status = 'Open', Amount > 1000). NOT for text searches across multiple objects - use search_records for that. This executes SOQL queries with SELECT, WHERE, ORDER BY, and LIMIT clauses on a single SObject. The results are returned in JSON format. IMPORTANT: Always execute the `sobject_list` tool first to understand which objects are available in the org, and optionally execute `sobject_describe` for the specific SObject to understand its fields and structure before querying.
query_records_to_file Query records from a Salesforce SObject and save to a file. This command allows you to execute a SOQL query against a specified Salesforce SObject in a given Org and save the results to a file. You can specify the SELECT clause (fields, functions like COUNT(), aggregations, etc.), an optional WHERE clause, and save the results in various formats. The results can be saved in CSV format by default, or in other formats if specified. IMPORTANT: Always execute the `sobject_list` tool first to understand which objects are available in the org, and optionally execute `sobject_describe` for the specific SObject to understand its fields and structure before querying.
deploy_start Deploy metadata to Salesforce org with test execution options.
schema_generate_tab Generate metadata source files for a new custom tab on a custom object. Custom tabs display custom object data in Salesforce navigation.
bulk_insert_records Insert many records with the Bulk API 2.0 (asynchronous, for large volumes). Provide exactly one of 'records' (inline JSON objects, max 2000), 'csvPath' (a CSV file on the server's machine) or 'csvContent' (raw CSV text with its header row, for files the server cannot read, such as uploads into a sandboxed client; max 10 MB). Returns the jobId, state, processed and failed counts, and up to 10 sample failures when the job finishes within 'wait' seconds. Use bulk_job_results for full result files. Do not include Id values for inserts. Null values are written as #N/A, which clears a field.
bulk_update_records Update many existing records by Id with the Bulk API 2.0. Each record (or each CSV row) must include 'Id'; only the provided fields are changed. Provide exactly one of 'records', 'csvPath' or 'csvContent'. Inline Ids are format-checked before the job is created; Ids in CSV text are not, and a malformed one fails only its own row. Null values are written as #N/A, which clears a field. Updates above 500 rows ask the user to confirm when the client supports confirmation. Returns the jobId, state, processed and failed counts, and sample failures when the job finishes within 'wait' seconds.
bulk_upsert_records Insert or update many records with the Bulk API 2.0, matching existing records on an external ID field. Each record (or CSV row) must include the externalIdField value; do not include Id. Provide exactly one of 'records', 'csvPath' or 'csvContent'. Upserts above 500 rows ask the user to confirm when the client supports confirmation. Returns the jobId, state, processed and failed counts, and sample failures when the job finishes within 'wait' seconds.
bulk_delete_records Soft-delete many records with the Bulk API 2.0 (moves them to the Recycle Bin). Provide exactly one of 'ids' (max 2000 Salesforce record Ids), 'csvPath' (a CSV file on the server's machine with an 'Id' column) or 'csvContent' (raw CSV text with an 'Id' column, for files the server cannot read). If the client can show a confirmation prompt, the user is asked and declining blocks the delete. If it cannot, pass confirm: 'DELETE <sobject>' (for example 'DELETE Account') and the user's approval of this call in the client is the remaining gate. Returns the jobId, state, processed and failed counts. Use bulk_hard_delete_records to permanently delete.
bulk_hard_delete_records PERMANENTLY delete many records with the Bulk API 2.0 hardDelete operation. Records bypass the Recycle Bin and cannot be restored. Requires the 'Bulk API Hard Delete' permission on the user. Provide exactly one of 'ids', 'csvPath' or 'csvContent' (CSV with an 'Id' column), and the exact 'confirm' string 'HARD DELETE <sobject>' (for example 'HARD DELETE Account'). If the client can show a confirmation prompt, the user is also asked and declining blocks the delete. Otherwise the typed 'confirm' string and the user's approval of this call in the client are the gates.
bulk_job_status Check the state and record counts of a Bulk API 2.0 job created by a bulk_* tool. Use it after a start call returned a non-final state. Read-only.
bulk_job_results Write the successful, failed and unprocessed records of a finished Bulk API 2.0 job to CSV files and return their paths and row counts. Files go to <home>/salesforce-bulk-results/<jobId>/ unless outputDir is given. The result folder itself must not be a symbolic link (default or custom); symbolic links in parent folders are not checked. A custom outputDir must be an absolute path and must not already contain these files. Read-only in the org; writes local CSV files.
bulk_job_abort Abort a Bulk API 2.0 job that has not finished (Open, UploadComplete or InProgress). Records already processed are not rolled back. Jobs are never deleted by these tools.
scanner_run Scan codebase with security and quality rules. Defaults to all rules if none specified.
scanner_run_dfa Run Graph Engine for Apex data flow analysis. Detects complex security issues like SOQL/SQL injection.
Permissions 3
network medium shell high env_vars low