MCP.so
ログイン

Salesforce MCP Server (Official)

@salesforcecli

基本情報

カテゴリ

その他

ライセンス

Apache-2.0

トランスポート

stdio

作者

salesforcecli

Salesforce MCP Server について

Salesforce インスタンスと連携するための MCP サーバー

Salesforce MCP Server の設定

以下の設定を使って、このサーバーを 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"
      ]
    }
  }
}

Salesforce MCP Server のツール

12

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 MCP Server (Official) とは?

Salesforce DX MCP サーバーは、@salesforce/mcp として公開されている Salesforce 公式のローカル 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 を案内しています。

Salesforce MCP Server (Official) の使い方

前提条件:

  • Node.js 20 以降(パッケージの engines フィールドが >=20.0.0 を要求)。npx で実行するために必要です。
  • マシン上で少なくとも 1 つの組織を認可済みであること。Salesforce CLI コマンド 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)されていないツールも含まれます。

Claude Code

上記のスニペットをプロジェクトルートの .mcp.json ファイルに追加し、Claude Code を再起動します。

Cursor

同じ mcpServers ブロックを Cursor の mcp.json ファイルに追加します。README の Cursor と Cline の例では、常に最新リリースを取得するために @salesforce/mcp@latest を使っています。

VS Code

GitHub Copilot を使う場合は、プロジェクトに .vscode/mcp.json を作成します。VS Code では mcpServers ではなく servers キーを使います:

{
  "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(テレメトリはデフォルトで有効)。

Salesforce MCP Server (Official) の主な機能

  • 公式の Salesforce DX MCP サーバーで、npx -y @salesforce/mcp によりローカルで実行します。
  • 組織の許可リスト:サーバーは --orgs で指定した組織にのみアクセスできます。
  • ツールセットで LLM のコンテキストを削減できます。README によるとツールは 60 以上あるため、all の有効化は推奨されていません。
  • --tools でツールを細かく選択でき、ツールセットと組み合わせられます。
  • GA ツールと非 GA ツール。--allow-non-ga-tools を指定しない限り、非 GA ツールは無効のままです。
  • 実験的な --dynamic-tools モードは最小限のコアで起動し、必要に応じてツールを読み込みます(VS Code と Cline で動作すると記載)。
  • 組織操作以外の開発者向けツールセット:LWC と Aura のエキスパート、Code Analyzer、DevOps Center、モバイル、Apex パフォーマンススキャン。

Salesforce MCP Server (Official) のツール

  • コア(常に有効): 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。

Salesforce MCP Server (Official) のユースケース

  • 自然言語でレコードをクエリ:「List the 10 most recently created accounts in my default org.」
  • 作業中の変更をデプロイ:「Deploy my changes to my org and run the AccountServiceTest Apex tests.」
  • 組織の変更をソース管理に取り込む:「Retrieve the metadata in the manifest from my org.」
  • scratch org を管理:「Create a scratch org aliased as MyNewOrg that lasts 3 days.」
  • ユーザーを管理:「Assign the Sales_Ops permission set to this user.」
  • コード品質をレビュー:Apex や LWC ファイルに Salesforce Code Analyzer を実行し、違反を要約します。

Salesforce MCP Server (Official) と代替ツールの比較

DX MCP サーバーは、Salesforce CLI と認可済みの組織を基盤とするローカルで開発者向けのツールです。Salesforce は Salesforce Hosted MCP Servers(2025 年 10 月にベータとして発表)も提供しており、ローカルで何も実行せずに Salesforce の API とデータを AI エージェントに公開できます。こちらは DX ワークフローよりも、ビジネスユーザーやデータアクセスに適しています。REST API ベースのコミュニティ製 Salesforce MCP サーバーもありますが、Salesforce が保守しているものではありません。この salesforce dx mcp パッケージは 2026 年 11 月 2 日にサポート終了となるため、新規プロジェクトでは forcedotcom/sf-skills の Salesforce の skills も検討してください。

Salesforce MCP Server (Official) のトラブルシューティング

  • 組織のエラーでツールが失敗する: --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 サーバーのログを表示するわけではありません。

よくある質問

1

Salesforce MCP サーバーは公式ですか?

はい。`@salesforce/mcp` は Salesforce が公開し、`salesforcecli/mcp` / `forcedotcom/mcp` リポジトリで保守されており、ドキュメントは Salesforce DX Developer Guide にあります。

2

Salesforce DX MCP サーバーは提供終了になりますか?

はい。README は 2026 年 11 月 2 日のサポート終了を告知しています。その後は新しいリリースは出ず、リポジトリはアーカイブされ、npm パッケージは非推奨になりますが、インストールは引き続き可能です。

3

無料ですか?

サーバーは Apache-2.0 のオープンソースで、`npx` によりローカルで実行します。ただし、認可できる Salesforce 組織へのアクセスは必要です。

4

API キーやトークンは必要ですか?

MCP 設定にキーは不要です。サーバーは Salesforce CLI(`sf org login web`)または VS Code で認可した組織を使い、それらを `--orgs` で指定します。

5

Salesforce MCP サーバーは Claude Code、Cursor、VS Code で使えますか?

はい。README には Claude Code(`.mcp.json`)、Cursor(`mcp.json`)、Copilot 付き VS Code(`.vscode/mcp.json`)、Cline の設定があり、Windsurf、Trae、Zed も同じパターンで設定できるとしています。

6

リモートサーバーですか、ローカルサーバーですか?

ローカルです。`npx` を通じてマシン上で stdio で動作します。Salesforce のホスト型 MCP サーバーは別の製品です。

7

AI が組織内でできることを制限するには?

`ALLOW_ALL_ORGS` ではなく特定のエイリアスに `--orgs` を絞り、必要なツールセットだけを有効にします。`delete_org` などのツールを使わせたくない場合は `--allow-non-ga-tools` を付けないでください。

8

テレメトリは無効にできますか?

はい。テレメトリはデフォルトで有効ですが、`args` に `--no-telemetry` を追加すると無効になります。

コメント

「その他」の他のコンテンツ