Salesforce MCP 服务器是官方的吗?
是的。`@salesforce/mcp` 由 Salesforce 发布,在 `salesforcecli/mcp` / `forcedotcom/mcp` 仓库中维护,文档位于 Salesforce DX Developer Guide。
@salesforcecli
基本信息
用于与 Salesforce 实例交互的 MCP 服务器
使用下面的配置,将此服务器添加到你的 MCP 客户端。
{
"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"
]
}
}
}Intelligently determines the appropriate username or alias for Salesforce operations. WHEN TO USE THIS TOOL: - When uncertain which org username a user wants for Salesforce operations. 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.
Resume 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
Run a SOQL query against a Salesforce org.
Creates 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
Creates 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
Deletes 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
Lists 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 a Salesforce org in the browser. You can specify a metadata file you want to open.
Deploy 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.
Retrieve 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
Assign a permission set to one or more org users.
Run 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
Salesforce DX MCP 服务器是 Salesforce 官方的本地 Salesforce MCP 服务器,以 @salesforce/mcp 发布,让 AI 助手能够在你已授权的 Salesforce 组织(org)中查询数据、部署和检索元数据、管理组织并运行 Apex 测试。
它由 Salesforce 在开源仓库 salesforcecli/mcp(镜像为 forcedotcom/mcp)中维护,采用 Apache-2.0 许可证,文档见 Salesforce DX Developer Guide。重要: README 说明该本地服务器将于 2026 年 11 月 2 日停止维护(End of Life)。此后仓库将被归档、npm 包将被标记为已弃用;它仍可安装(固定版本 0.30.15 仍可使用),Salesforce 建议改用 forcedotcom/sf-skills 中的 skills。
前提条件:
engines 字段要求 >=20.0.0),以便 npx 运行它。sf org login web,或在 VS Code 命令面板中执行 SFDX: Authorize an Org。MCP 配置中不需要填写 API 密钥,服务器使用你本地已授权的组织。所有客户端都使用相同的 args。--orgs 为必填;--toolsets、--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"]
}
}
}
这会启用 orgs、metadata、data、users 工具集中的全部工具以及 run_apex_test,并包含尚未正式发布(非 GA)的工具。
将上面的配置片段添加到项目根目录的 .mcp.json 文件中,然后重启 Claude Code。
将同样的 mcpServers 配置块添加到 Cursor 的 mcp.json 文件中。README 中的 Cursor 和 Cline 示例使用 @salesforce/mcp@latest,以始终获取最新版本。
在使用 GitHub Copilot 时,在项目中创建 .vscode/mcp.json。VS Code 使用 servers 键,而不是 mcpServers:
{
"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"]
}
}
}
Cline 在 cline_mcp_settings.json 中使用相同的配置块。对于 Windsurf、Trae 和 Zed,README 建议在各客户端的 MCP 设置中按相同模式配置。
--orgs:DEFAULT_TARGET_ORG、DEFAULT_TARGET_DEV_HUB、ALLOW_ALL_ORGS(请谨慎使用),或具体的用户名或别名。多个值用逗号分隔。--toolsets:以逗号分隔的工具集,或 all。--tools:单个工具名称,可与工具集组合使用。--allow-non-ga-tools、--debug、--dynamic-tools(实验性)、--no-telemetry(遥测默认开启)。npx -y @salesforce/mcp 在本地运行。--orgs 中指定的组织。all。--tools 精细选择工具,并可与工具集混合使用。--allow-non-ga-tools,否则非 GA 工具保持关闭。--dynamic-tools 模式先启动最小核心工具集,再按需加载工具(文档说明适用于 VS Code 和 Cline)。get_username 选择正确的组织用户名或别名,resume_tool_operation 恢复部署、创建 scratch org 等长时间运行的任务。list_all_orgs、create_scratch_org、create_org_snapshot、delete_org 和 open_org。除 list_all_orgs 外均为非 GA。run_soql_query 运行 SOQL 查询。assign_permission_set 分配权限集。deploy_metadata 和 retrieve_metadata 在 DX 项目与组织之间同步源代码。run_apex_test 和 run_agent_test。code-analysis(run_code_analyzer)、lwc-experts、aura-experts、devops、mobile/mobile-core、scale-products(scan_apex_class_for_antipatterns)、experts-validation 和 enrichment。DX MCP 服务器是一个本地、面向开发者的工具,基于 Salesforce CLI 和你已授权的组织。Salesforce 还提供 Salesforce Hosted MCP Servers(2025 年 10 月以 Beta 形式发布),无需在本地运行任何程序即可向 AI 智能体开放 Salesforce API 和数据。相比 DX 工作流,该方案更适合业务用户和数据访问。基于 REST API 的社区版 Salesforce MCP 服务器也存在,但并非由 Salesforce 维护。由于这个 salesforce dx mcp 包将于 2026 年 11 月 2 日停止维护,新项目也应考虑 forcedotcom/sf-skills 中 Salesforce 的 skills。
--orgs 为必填项,且每个组织都必须先在本地授权。运行 sf org login web 并检查用户名或别名。DEFAULT_TARGET_ORG 和 DEFAULT_TARGET_DEV_HUB 会在每次工具调用时根据工作目录的默认值解析。若要将服务器固定到特定组织,请传入明确的用户名或别名。create_scratch_org 等工具: 它属于非 GA 工具。添加 --allow-non-ga-tools,并确保已启用其所属工具集。all 会加载 60 多个工具。只启用需要的工具集,或尝试 --dynamic-tools。--debug。注意并非所有 MCP 客户端都会显示 MCP 服务器日志。是的。`@salesforce/mcp` 由 Salesforce 发布,在 `salesforcecli/mcp` / `forcedotcom/mcp` 仓库中维护,文档位于 Salesforce DX Developer Guide。
会。README 宣布其将于 2026 年 11 月 2 日停止维护。此后不再发布新版本,仓库将被归档,npm 包将被标记为已弃用,但仍可安装。
该服务器基于 Apache-2.0 开源,通过 `npx` 在本地运行。你仍需要能够授权访问的 Salesforce 组织。
MCP 配置中不需要填写密钥。服务器使用你通过 Salesforce CLI(`sf org login web`)或 VS Code 授权的组织,并通过 `--orgs` 列出它们。
支持。README 提供了 Claude Code(`.mcp.json`)、Cursor(`mcp.json`)、VS Code 搭配 Copilot(`.vscode/mcp.json`)和 Cline 的配置,并说明 Windsurf、Trae 和 Zed 按相同模式配置。
本地。它通过 `npx` 在你的机器上以 stdio 方式运行。Salesforce 的托管 MCP 服务器是另一款独立产品。
将 `--orgs` 限制为特定别名而不是 `ALLOW_ALL_ORGS`,只启用需要的工具集;如果不希望使用 `delete_org` 等工具,就不要添加 `--allow-non-ga-tools`。
可以。遥测默认开启,在 `args` 中添加 `--no-telemetry` 即可关闭。

DeepMark helps teachers deliver rapid, consistent marking with meaningful feedback for every student — in a fraction of the time. What once took a week, now takes one free period.
Painless E2E Automation for Mobile and Web
🚀 The fast, Pythonic way to build MCP servers and clients.

B2B competitive intelligence, live sales battlecards, 5-axis ICP prospect fit scoring, and tech stack teardowns over MCP and REST with cited public-web evidence.
不止于 CSS
评论