@salesforce/mcp 0.17.1 → 0.17.2-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +1 -1
- package/lib/index.js +7 -5
- package/lib/main-server-provider.d.ts +7 -0
- package/lib/main-server-provider.js +31 -0
- package/lib/registry.d.ts +3 -29
- package/lib/registry.js +9 -113
- package/lib/scripts/build-index.js +1 -1
- package/lib/services.d.ts +12 -0
- package/lib/services.js +34 -0
- package/lib/sf-mcp-server.d.ts +12 -7
- package/lib/sf-mcp-server.js +6 -21
- package/lib/telemetry.d.ts +2 -1
- package/lib/tools/sf-enable-tools.d.ts +23 -0
- package/lib/tools/sf-enable-tools.js +77 -0
- package/lib/tools/sf-list-tools.d.ts +8 -0
- package/lib/{modules/platform-cli → tools}/sf-list-tools.js +33 -9
- package/lib/tools/sf-suggest-cli-command.d.ts +25 -0
- package/lib/{modules/platform-cli → tools}/sf-suggest-cli-command.js +46 -18
- package/lib/utils/assets.d.ts +21 -0
- package/lib/{assets.js → utils/assets.js} +23 -33
- package/lib/{shared → utils}/auth.d.ts +3 -8
- package/lib/{shared → utils}/auth.js +2 -42
- package/lib/utils/registry-utils.d.ts +4 -0
- package/lib/utils/registry-utils.js +87 -0
- package/lib/{modules/platform-cli/utils → utils}/tools.js +1 -1
- package/lib/utils/types.d.ts +5 -0
- package/package.json +8 -4
- package/README.md +0 -263
- package/lib/assets.d.ts +0 -44
- package/lib/modules/platform-cli/index.d.ts +0 -16
- package/lib/modules/platform-cli/index.js +0 -32
- package/lib/modules/platform-cli/sf-assign-permission-set.d.ts +0 -20
- package/lib/modules/platform-cli/sf-assign-permission-set.js +0 -89
- package/lib/modules/platform-cli/sf-create-org-snapshot.d.ts +0 -23
- package/lib/modules/platform-cli/sf-create-org-snapshot.js +0 -88
- package/lib/modules/platform-cli/sf-create-scratch-org.d.ts +0 -50
- package/lib/modules/platform-cli/sf-create-scratch-org.js +0 -132
- package/lib/modules/platform-cli/sf-delete-org.d.ts +0 -14
- package/lib/modules/platform-cli/sf-delete-org.js +0 -65
- package/lib/modules/platform-cli/sf-deploy-metadata.d.ts +0 -27
- package/lib/modules/platform-cli/sf-deploy-metadata.js +0 -164
- package/lib/modules/platform-cli/sf-enable-tools.d.ts +0 -2
- package/lib/modules/platform-cli/sf-enable-tools.js +0 -42
- package/lib/modules/platform-cli/sf-get-username.d.ts +0 -17
- package/lib/modules/platform-cli/sf-get-username.js +0 -109
- package/lib/modules/platform-cli/sf-list-all-orgs.d.ts +0 -11
- package/lib/modules/platform-cli/sf-list-all-orgs.js +0 -59
- package/lib/modules/platform-cli/sf-list-tools.d.ts +0 -2
- package/lib/modules/platform-cli/sf-org-open.d.ts +0 -17
- package/lib/modules/platform-cli/sf-org-open.js +0 -57
- package/lib/modules/platform-cli/sf-query-org.d.ts +0 -20
- package/lib/modules/platform-cli/sf-query-org.js +0 -66
- package/lib/modules/platform-cli/sf-resume.d.ts +0 -20
- package/lib/modules/platform-cli/sf-resume.js +0 -149
- package/lib/modules/platform-cli/sf-retrieve-metadata.d.ts +0 -2
- package/lib/modules/platform-cli/sf-retrieve-metadata.js +0 -128
- package/lib/modules/platform-cli/sf-suggest-cli-command.d.ts +0 -5
- package/lib/modules/platform-cli/sf-test-agents.d.ts +0 -21
- package/lib/modules/platform-cli/sf-test-agents.js +0 -84
- package/lib/modules/platform-cli/sf-test-apex.d.ts +0 -40
- package/lib/modules/platform-cli/sf-test-apex.js +0 -132
- package/lib/shared/params.d.ts +0 -5
- package/lib/shared/params.js +0 -46
- package/lib/shared/types.d.ts +0 -33
- package/lib/shared/utils.d.ts +0 -11
- package/lib/shared/utils.js +0 -71
- package/lib/tsconfig.tsbuildinfo +0 -1
- /package/lib/{shared → utils}/cache.d.ts +0 -0
- /package/lib/{shared → utils}/cache.js +0 -0
- /package/lib/{shared → utils}/rate-limiter.d.ts +0 -0
- /package/lib/{shared → utils}/rate-limiter.js +0 -0
- /package/lib/{modules/platform-cli/utils → utils}/tools.d.ts +0 -0
- /package/lib/{shared → utils}/types.js +0 -0
package/README.md
DELETED
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
# mcp
|
|
2
|
-
|
|
3
|
-
MCP Server for Interacting with Salesforce Orgs
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/@salesforce/mcp) [](https://opensource.org/license/apache-2-0)
|
|
6
|
-
|
|
7
|
-
## Overview of the Salesforce DX MCP Server (Developer Preview)
|
|
8
|
-
|
|
9
|
-
The Salesforce DX MCP Server is a specialized Model Context Protocol (MCP) implementation designed to facilitate seamless interaction between large language models (LLMs) and Salesforce orgs. This MCP server provides a robust set of tools and capabilities that enable LLMs to read, manage, and operate Salesforce resources securely.
|
|
10
|
-
|
|
11
|
-
Key Features:
|
|
12
|
-
|
|
13
|
-
- Direct interaction with Salesforce orgs through LLM-driven tools.
|
|
14
|
-
- Secure access using TypeScript libraries (not shelling out to the `sf` Salesforce CLI).
|
|
15
|
-
- Improved security by avoiding the exposure of secrets in plain text.
|
|
16
|
-
- Granular access control with org allowlisting.
|
|
17
|
-
- Modular tool architecture for easy extensibility.
|
|
18
|
-
|
|
19
|
-
**NOTE**: The Salesforce DX MCP Server is available as a developer preview. The feature isn’t generally available unless or until Salesforce announces its general availability in documentation or in press releases or public statements. All commands, parameters, and other features are subject to change or deprecation at any time, with or without notice. Don't implement functionality developed with these commands or tools. As we continue to enhance and refine the implementation, the available functionality and tools may evolve. We welcome feedback and contributions to help shape the future of this project.
|
|
20
|
-
|
|
21
|
-
### Security Features
|
|
22
|
-
|
|
23
|
-
The Salesforce DX MCP Server was designed with security as a top priority.
|
|
24
|
-
|
|
25
|
-
- **Uses TypeScript libraries directly**
|
|
26
|
-
|
|
27
|
-
- Greatly decreases the size of the MCP Server.
|
|
28
|
-
- Significantly reduces the risk of remote code execution (RCE).
|
|
29
|
-
|
|
30
|
-
- **No secrets needed in configuration**
|
|
31
|
-
|
|
32
|
-
- Eliminates the risk of plain text secret exposure.
|
|
33
|
-
- Accesses pre-existing (encrypted) auth files on the user's machine.
|
|
34
|
-
- Implements allowlisting for auth info key/values to prevent sensitive data exposure.
|
|
35
|
-
|
|
36
|
-
- **No secrets exposed via MCP tools**
|
|
37
|
-
|
|
38
|
-
- Prevents other tools from accessing unencrypted tokens.
|
|
39
|
-
- Tools pass usernames around instead of tokens.
|
|
40
|
-
|
|
41
|
-
- **Granular access control**
|
|
42
|
-
|
|
43
|
-
- MCP Server can access auth info for only orgs that have been explicitly allowlisted.
|
|
44
|
-
- Users specify allowed orgs when starting the server.
|
|
45
|
-
|
|
46
|
-
## Get Started Using VS Code as the Client
|
|
47
|
-
|
|
48
|
-
Want to jump in and see what all the fuss is about? Read on!
|
|
49
|
-
|
|
50
|
-
This example uses Visual Studio Code (VS Code) as the MCP client because it's a standard Salesforce DX development tool. 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 listing your authorized orgs, viewing org records, and deploying or retrieving metadata.
|
|
51
|
-
|
|
52
|
-
But you're not limited to using only VS Code and Copilot! You can [configure many other clients](README.md#configure-other-clients-to-use-the-salesforce-dx-mcp-server) to use the Salesforce DX MCP Server, such as Cursor, Cline, Claude Desktop, Zed, Windsurf, and more.
|
|
53
|
-
|
|
54
|
-
**Before You Begin**
|
|
55
|
-
|
|
56
|
-
For the best getting-started experience, make sure that you have a Salesforce DX environment set up on your computer. In particular:
|
|
57
|
-
|
|
58
|
-
- [Install Salesforce CLI](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_intro.htm) on your computer.
|
|
59
|
-
- [Install VS Code](https://code.visualstudio.com/docs) on your computer.
|
|
60
|
-
- [Create a Salesforce DX project](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_create_new.htm) and open it in VS Code. You can also clone an example repo, such as [dreamhouse-lwc](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_intro_sample_repo.htm), which is a ready-to-use DX project that contains a simple Salesforce application, with metadata and test data.
|
|
61
|
-
- [Authorize at least one Salesforce org](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth_web_flow.htm) to use with your DX project. You can also create a scratch org.
|
|
62
|
-
|
|
63
|
-
**Let's Do It**
|
|
64
|
-
|
|
65
|
-
1. Create a `.vscode/mcp.json` file at the root of your DX project and add this JSON:
|
|
66
|
-
|
|
67
|
-
```json
|
|
68
|
-
{
|
|
69
|
-
"servers": {
|
|
70
|
-
"Salesforce DX": {
|
|
71
|
-
"type": "stdio",
|
|
72
|
-
"command": "npx",
|
|
73
|
-
"args": ["-y", "@salesforce/mcp", "--orgs", "DEFAULT_TARGET_ORG", "--toolsets", "all"]
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
You can also configure the MCP server globally by editing the VS Code [settings.json](https://code.visualstudio.com/docs/configure/settings#_settings-file-locations) file and adding a similar JSON snippet but contained in an `mcp:servers` section.
|
|
80
|
-
|
|
81
|
-
The `--orgs` argument is required and specifies the authorized orgs you're allowing the MCP server to access. The `--toolsets` argument is optional and specifies the toolsets it should consult when determining the specific tool to run. See [Configure Orgs and Toolsets](README.md#configure-orgs-and-toolsets) for the available values for the two arguments.
|
|
82
|
-
|
|
83
|
-
1. Open VS Code, go to **View -> Command Palette** and enter **MCP: List Servers**.
|
|
84
|
-
|
|
85
|
-
TIP: You can also get to the command palette by pressing press Ctrl+Shift+P (Windows or Linux) or Command-Shift-P (macOS).
|
|
86
|
-
|
|
87
|
-
1. Click `Salesforce DX`, then **Start Server**.
|
|
88
|
-
|
|
89
|
-
Check the Output tab for the server status.
|
|
90
|
-
|
|
91
|
-
1. Run **Chat: Open Chat (Agent)** from the command palette to start a new GitHub Copilot chat session.
|
|
92
|
-
|
|
93
|
-
Be sure your Copilot chat window is in `Agent` mode; if you're in `Ask` or `Edit` mode, use the [little drop-down](https://github.blog/ai-and-ml/github-copilot/copilot-ask-edit-and-agent-modes-what-they-do-and-when-to-use-them/) to switch.
|
|
94
|
-
|
|
95
|
-
1. In the GitHub Copilot chat window, use natural language to explain what you want to do. The MCP server determines which configured tool to use, and then shows it to you along with other information. Click **Continue** to run the tool and see the results of your request.
|
|
96
|
-
|
|
97
|
-
Try out these examples:
|
|
98
|
-
|
|
99
|
-
- List all my orgs.
|
|
100
|
-
- Which are my active scratch orgs?
|
|
101
|
-
- Show me all the accounts in the org with alias my-org.
|
|
102
|
-
- Deploy everything in my project to the org with alias my-org.
|
|
103
|
-
|
|
104
|
-
1. To stop, restart, or view the MCP server configuration, run the **MCP: List Servers** command, click `Salesforce DX`, then click the appropriate option.
|
|
105
|
-
|
|
106
|
-
## Configure Orgs and Toolsets
|
|
107
|
-
|
|
108
|
-
You configure the Salesforce DX MCP Server by specifying at least one authorized org and an optional list of MCP toolsets.
|
|
109
|
-
|
|
110
|
-
### Configure Orgs
|
|
111
|
-
|
|
112
|
-
The Salesforce MCP tools require an org, and so you must include the required `--orgs` argument to specify at least one authorized org when you configure the MCP server. Separate multiple values with commas.
|
|
113
|
-
|
|
114
|
-
You must explicitly [authorize the orgs](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth_web_flow.htm) on your computer before the MCP server can access them. Use the `org login web` Salesforce CLI command or the VS Code **SFDX: Authorize an Org** command from the command palette.
|
|
115
|
-
|
|
116
|
-
These are the available values for the `--orgs` argument:
|
|
117
|
-
|
|
118
|
-
- `DEFAULT_TARGET_ORG` - Allow access to your default org. If you've set a local default org in your DX project, the MCP server uses it. If not, the server uses a globally-set default org.
|
|
119
|
-
- `DEFAULT_TARGET_DEV_HUB` - Allow access to your default Dev Hub org. If you've set a local default Dev Hub org in your DX project, the MCP server uses it. If not, the server uses a globally-set default Dev Hub org.
|
|
120
|
-
- `ALLOW_ALL_ORGS` - Allow access to all authorized orgs. Use this value with caution.
|
|
121
|
-
- `<username or alias>` - Allow access to a specific org by specifying its username or alias.
|
|
122
|
-
|
|
123
|
-
This example shows how to specify that the MCP tools run against your default org when you configure the MCP server for VS Code:
|
|
124
|
-
|
|
125
|
-
```json
|
|
126
|
-
"mcp": {
|
|
127
|
-
"servers": {
|
|
128
|
-
"Salesforce DX": {
|
|
129
|
-
"type": "stdio",
|
|
130
|
-
"command": "npx",
|
|
131
|
-
"args": ["-y", "@salesforce/mcp", "--orgs", "DEFAULT_TARGET_ORG"]
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
This sample snippet shows how to configure access to your default Dev Hub org and an org with username `test-org@example.com`:
|
|
138
|
-
|
|
139
|
-
```json
|
|
140
|
-
"args": ["-y", "@salesforce/mcp", "--orgs", "DEFAULT_TARGET_DEV_HUB,test-org@example.com"]
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
This sample snippet shows how to configure access to two orgs for which you specified aliases when you authorized them:
|
|
144
|
-
|
|
145
|
-
```json
|
|
146
|
-
"args": ["-y", "@salesforce/mcp", "--orgs", "my-scratch-org,my-dev-hub"]
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
### Configure Toolsets
|
|
150
|
-
|
|
151
|
-
The Salesforce DX MCP Server supports **toolsets** - a way to selectively enable different groups of MCP tools based on your needs. This allows you to run the MCP server with only the tools you require, which in turn reduces the context.
|
|
152
|
-
|
|
153
|
-
Use the `--toolsets` (or short name `-t`) argument to specify the toolsets when you configure the Salesforce DX MCP Server. Separate multiple toolsets with commas. The `--toolsets` argument is optional; if you don't specify it, the MCP server is configured with all toolsets.
|
|
154
|
-
|
|
155
|
-
These are the available toolsets:
|
|
156
|
-
|
|
157
|
-
- `all` (default) - Enables all available tools from all toolsets.
|
|
158
|
-
- `orgs` - [Tools to manage your authorized orgs.](README.md#orgs-toolset)
|
|
159
|
-
- `data` - [Tools to manage the data in your org, such as listing all accounts.](README.md#data-toolset)
|
|
160
|
-
- `users` - [Tools to manage org users, such as assigning a permission set.](README.md#users-toolset)
|
|
161
|
-
- `metadata` - [Tools to deploy and retrieve metadata to and from your org and your DX project.](README.md#metadata-toolset)
|
|
162
|
-
- `testing` - [Tools to test your code and features](README.md#testing-toolset)
|
|
163
|
-
|
|
164
|
-
This example shows how to enable the `data`, `orgs`, and `metadata` toolsets when configuring the MCP server for VS Code:
|
|
165
|
-
|
|
166
|
-
```json
|
|
167
|
-
"mcp": {
|
|
168
|
-
"servers": {
|
|
169
|
-
"Salesforce DX": {
|
|
170
|
-
"type": "stdio",
|
|
171
|
-
"command": "npx",
|
|
172
|
-
"args": ["-y", "@salesforce/mcp", "--orgs", "DEFAULT_TARGET_ORG", "--toolsets", "data,orgs,metadata"]
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
#### Dynamic Tools (Experimental)
|
|
179
|
-
|
|
180
|
-
The `--dynamic-tools` flag enables dynamic tool discovery and loading. When this flag is set, the MCP server starts with a minimal set of core tools and will load new tools as the need arises. This is useful for reducing initial context size and improving LLM performance.
|
|
181
|
-
|
|
182
|
-
**NOTE:** This feature works in VSCode and Cline but may not work in other environments.
|
|
183
|
-
|
|
184
|
-
#### Core Toolset (always enabled)
|
|
185
|
-
|
|
186
|
-
Includes these tools:
|
|
187
|
-
|
|
188
|
-
- `sf-get-username` - Determines the appropriate username or alias for Salesforce operations, handling both default orgs and Dev Hubs.
|
|
189
|
-
- `sf-resume` - Resumes a long-running operation that wasn't completed by another tool.
|
|
190
|
-
- `sf-suggest-cli-command` - Suggests an `sf` Salesforce CLI command based on a natural language query. The tool finds relevant CLI commands from a local index and uses an LLM to construct the precise command to fulfill your request.
|
|
191
|
-
|
|
192
|
-
#### Orgs Toolset
|
|
193
|
-
|
|
194
|
-
Includes this tool:
|
|
195
|
-
|
|
196
|
-
- `sf-list-all-orgs` - Lists all configured Salesforce orgs, with optional connection status checking.
|
|
197
|
-
|
|
198
|
-
#### Data Toolset
|
|
199
|
-
|
|
200
|
-
Includes this tool:
|
|
201
|
-
|
|
202
|
-
- `sf-query-org` - Runs a SOQL query against a Salesforce org.
|
|
203
|
-
|
|
204
|
-
#### Users Toolset
|
|
205
|
-
|
|
206
|
-
Includes this tool:
|
|
207
|
-
|
|
208
|
-
- `sf-assign-permission-set` - Assigns a permission set to the user or on behalf of another user.
|
|
209
|
-
|
|
210
|
-
#### Metadata Toolset
|
|
211
|
-
|
|
212
|
-
Includes these tools:
|
|
213
|
-
|
|
214
|
-
- `sf-deploy-metadata` - Deploys metadata from your DX project to an org.
|
|
215
|
-
- `sf-retrieve-metadata` - Retrieves metadata from your org to your DX project.
|
|
216
|
-
|
|
217
|
-
#### Testing Toolset
|
|
218
|
-
|
|
219
|
-
Includes these tools:
|
|
220
|
-
|
|
221
|
-
- `sf-test-agents` - Executes agent tests in your org.
|
|
222
|
-
- `sf-test-apex` - Executes apex tests in your org.
|
|
223
|
-
|
|
224
|
-
## Configure Other Clients to Use the Salesforce DX MCP Server
|
|
225
|
-
|
|
226
|
-
**Cursor**
|
|
227
|
-
|
|
228
|
-
To configure [Cursor](https://www.cursor.com/) to work with Salesforce DX MCP Server, add this snippet to your Cursor `mcp.json` file:
|
|
229
|
-
|
|
230
|
-
```json
|
|
231
|
-
{
|
|
232
|
-
"mcpServers": {
|
|
233
|
-
"Salesforce DX": {
|
|
234
|
-
"command": "npx",
|
|
235
|
-
"args": ["-y", "@salesforce/mcp", "--orgs", "DEFAULT_TARGET_ORG", "--toolsets", "all"]
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
**Cline**
|
|
242
|
-
|
|
243
|
-
To configure [Cline](https://cline.bot), add this snippet to your Cline `cline_mcp_settings.json` file:
|
|
244
|
-
|
|
245
|
-
```json
|
|
246
|
-
{
|
|
247
|
-
"mcpServers": {
|
|
248
|
-
"Salesforce DX": {
|
|
249
|
-
"command": "npx",
|
|
250
|
-
"args": ["-y", "@salesforce/mcp", "--orgs", "DEFAULT_TARGET_ORG", "--toolsets", "all"]
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
**Other Clients**
|
|
257
|
-
|
|
258
|
-
For these other clients, refer to their documentation for adding MCP servers and follow the same pattern as in the preceding VS Code and Cursor JSON snippets:
|
|
259
|
-
|
|
260
|
-
- [Claude Desktop](https://claude.ai/download)
|
|
261
|
-
- [Zed](https://github.com/zed-industries/zed)
|
|
262
|
-
- [Windsurf](https://www.windsurf.com/)
|
|
263
|
-
- [Trae](https://trae.ai)
|
package/lib/assets.d.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import faiss from 'faiss-node';
|
|
2
|
-
import { FeatureExtractionPipeline } from '@huggingface/transformers';
|
|
3
|
-
type CommandData = {
|
|
4
|
-
id: number;
|
|
5
|
-
command: string;
|
|
6
|
-
summary: string;
|
|
7
|
-
description: string;
|
|
8
|
-
examples?: string[];
|
|
9
|
-
flags?: Array<{
|
|
10
|
-
name: string;
|
|
11
|
-
description: string;
|
|
12
|
-
type?: string;
|
|
13
|
-
required?: boolean;
|
|
14
|
-
options?: string[];
|
|
15
|
-
atLeastOne?: boolean;
|
|
16
|
-
exactlyOne?: boolean;
|
|
17
|
-
relationships?: string[];
|
|
18
|
-
default?: string | boolean | number | string[];
|
|
19
|
-
}>;
|
|
20
|
-
embeddingText: string;
|
|
21
|
-
};
|
|
22
|
-
type Assets = {
|
|
23
|
-
commands: CommandData[];
|
|
24
|
-
commandNames: string[];
|
|
25
|
-
faissIndex: faiss.IndexFlatL2;
|
|
26
|
-
embedder: FeatureExtractionPipeline;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Conditionally builds or rebuilds a FAISS index based on its existence and age.
|
|
30
|
-
*
|
|
31
|
-
* This function checks if a FAISS index file exists in the specified output directory.
|
|
32
|
-
* If the index exists but is older than one week, it triggers a rebuild. If the index
|
|
33
|
-
* doesn't exist, it initiates the initial build process. The build process can run as a
|
|
34
|
-
* detached child process or in the same process depending on the detached parameter.
|
|
35
|
-
*
|
|
36
|
-
* @param outputDir - The directory path where the FAISS index should be located or created
|
|
37
|
-
* @param detached - Whether to run the build process detached (default: true)
|
|
38
|
-
*
|
|
39
|
-
* @remarks
|
|
40
|
-
* - Sets the global CACHED_DATA_DIR variable to the provided outputDir. This is used to locate the index file.
|
|
41
|
-
*/
|
|
42
|
-
export declare function maybeBuildIndex(outputDir: string, detached?: boolean): Promise<void>;
|
|
43
|
-
export declare function getAssets(): Promise<Assets>;
|
|
44
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export { assignPermissionSet } from './sf-assign-permission-set.js';
|
|
2
|
-
export { createOrgSnapshot } from './sf-create-org-snapshot.js';
|
|
3
|
-
export { createScratchOrg } from './sf-create-scratch-org.js';
|
|
4
|
-
export { deleteOrg } from './sf-delete-org.js';
|
|
5
|
-
export { deployMetadata } from './sf-deploy-metadata.js';
|
|
6
|
-
export { enableTools } from './sf-enable-tools.js';
|
|
7
|
-
export { getUsername } from './sf-get-username.js';
|
|
8
|
-
export { listAllOrgs } from './sf-list-all-orgs.js';
|
|
9
|
-
export { listTools } from './sf-list-tools.js';
|
|
10
|
-
export { orgOpen } from './sf-org-open.js';
|
|
11
|
-
export { queryOrg } from './sf-query-org.js';
|
|
12
|
-
export { resume } from './sf-resume.js';
|
|
13
|
-
export { retrieveMetadata } from './sf-retrieve-metadata.js';
|
|
14
|
-
export { suggestCliCommand } from './sf-suggest-cli-command.js';
|
|
15
|
-
export { testAgent } from './sf-test-agents.js';
|
|
16
|
-
export { testApex } from './sf-test-apex.js';
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2025, Salesforce, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
export { assignPermissionSet } from './sf-assign-permission-set.js';
|
|
17
|
-
export { createOrgSnapshot } from './sf-create-org-snapshot.js';
|
|
18
|
-
export { createScratchOrg } from './sf-create-scratch-org.js';
|
|
19
|
-
export { deleteOrg } from './sf-delete-org.js';
|
|
20
|
-
export { deployMetadata } from './sf-deploy-metadata.js';
|
|
21
|
-
export { enableTools } from './sf-enable-tools.js';
|
|
22
|
-
export { getUsername } from './sf-get-username.js';
|
|
23
|
-
export { listAllOrgs } from './sf-list-all-orgs.js';
|
|
24
|
-
export { listTools } from './sf-list-tools.js';
|
|
25
|
-
export { orgOpen } from './sf-org-open.js';
|
|
26
|
-
export { queryOrg } from './sf-query-org.js';
|
|
27
|
-
export { resume } from './sf-resume.js';
|
|
28
|
-
export { retrieveMetadata } from './sf-retrieve-metadata.js';
|
|
29
|
-
export { suggestCliCommand } from './sf-suggest-cli-command.js';
|
|
30
|
-
export { testAgent } from './sf-test-agents.js';
|
|
31
|
-
export { testApex } from './sf-test-apex.js';
|
|
32
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { SfMcpServer } from '../../sf-mcp-server.js';
|
|
3
|
-
export declare const assignPermissionSetParamsSchema: z.ZodObject<{
|
|
4
|
-
permissionSetName: z.ZodString;
|
|
5
|
-
usernameOrAlias: z.ZodString;
|
|
6
|
-
onBehalfOf: z.ZodOptional<z.ZodString>;
|
|
7
|
-
directory: z.ZodEffects<z.ZodString, string, string>;
|
|
8
|
-
}, "strip", z.ZodTypeAny, {
|
|
9
|
-
permissionSetName: string;
|
|
10
|
-
usernameOrAlias: string;
|
|
11
|
-
directory: string;
|
|
12
|
-
onBehalfOf?: string | undefined;
|
|
13
|
-
}, {
|
|
14
|
-
permissionSetName: string;
|
|
15
|
-
usernameOrAlias: string;
|
|
16
|
-
directory: string;
|
|
17
|
-
onBehalfOf?: string | undefined;
|
|
18
|
-
}>;
|
|
19
|
-
export type AssignPermissionSetOptions = z.infer<typeof assignPermissionSetParamsSchema>;
|
|
20
|
-
export declare const assignPermissionSet: (server: SfMcpServer) => void;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2025, Salesforce, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { Org, StateAggregator, User } from '@salesforce/core';
|
|
17
|
-
import { z } from 'zod';
|
|
18
|
-
import { directoryParam, usernameOrAliasParam } from '../../shared/params.js';
|
|
19
|
-
import { textResponse } from '../../shared/utils.js';
|
|
20
|
-
import { getConnection } from '../../shared/auth.js';
|
|
21
|
-
/*
|
|
22
|
-
* Assign permission set
|
|
23
|
-
*
|
|
24
|
-
* Assign a permission set to one or more org users.
|
|
25
|
-
*
|
|
26
|
-
* Parameters:
|
|
27
|
-
* - permissionSetName: Permission set to assign (required)
|
|
28
|
-
* Example: "Set the permission set MyPermSet", "Set the perm set MyPermSet"
|
|
29
|
-
* - usernameOrAlias: Username or alias for the Salesforce org (required)
|
|
30
|
-
* - onBehalfOf: Username or alias to assign the permission set to (optional)
|
|
31
|
-
* Note: This is only used when "on behalf of" is explicitly mentioned.
|
|
32
|
-
* Otherwise, the permission will be set to the usernameOrAlias user.
|
|
33
|
-
* Example: "Set the permission set MyPermSet on behalf of my-alias"
|
|
34
|
-
*
|
|
35
|
-
* Returns:
|
|
36
|
-
* - textResponse: Permission set assignment result
|
|
37
|
-
*/
|
|
38
|
-
export const assignPermissionSetParamsSchema = z.object({
|
|
39
|
-
permissionSetName: z.string().describe(`A single permission set to assign
|
|
40
|
-
|
|
41
|
-
EXAMPLE USAGE:
|
|
42
|
-
Set the permission set MyPermSet
|
|
43
|
-
Set the perm set MyPermSet`),
|
|
44
|
-
usernameOrAlias: usernameOrAliasParam,
|
|
45
|
-
onBehalfOf: z.string().optional()
|
|
46
|
-
.describe(`A single username or alias (other than the usernameOrAlias) to assign the permission set to
|
|
47
|
-
|
|
48
|
-
AGENT INSTRUCTIONS:
|
|
49
|
-
If the user does not specifically say "on behalf of" this will be empty.
|
|
50
|
-
If the user does specifically say "on behalf of", but it is unclear what the target-org is, run the #sf-get-username tool.
|
|
51
|
-
In that case, use the usernameOrAlias parameter as the org to assign the permission set to.
|
|
52
|
-
|
|
53
|
-
USAGE EXAMPLE:
|
|
54
|
-
Assign the permission set MyPermSet.
|
|
55
|
-
Set the permission set MyPermSet on behalf of test-3uyb8kmftiu@example.com.
|
|
56
|
-
Set the permission set MyPermSet on behalf of my-alias.`),
|
|
57
|
-
directory: directoryParam,
|
|
58
|
-
});
|
|
59
|
-
export const assignPermissionSet = (server) => {
|
|
60
|
-
server.tool('sf-assign-permission-set', 'Assign a permission set to one or more org users.', assignPermissionSetParamsSchema.shape, {
|
|
61
|
-
title: 'Assign Permission Set',
|
|
62
|
-
openWorldHint: false,
|
|
63
|
-
}, async ({ permissionSetName, usernameOrAlias, onBehalfOf, directory }) => {
|
|
64
|
-
try {
|
|
65
|
-
if (!usernameOrAlias)
|
|
66
|
-
return textResponse('The usernameOrAlias parameter is required, if the user did not specify one use the #sf-get-username tool', true);
|
|
67
|
-
process.chdir(directory);
|
|
68
|
-
// We build the connection from the usernameOrAlias
|
|
69
|
-
const connection = await getConnection(usernameOrAlias);
|
|
70
|
-
// We need to clear the instance so we know we have the most up to date aliases
|
|
71
|
-
// If a user sets an alias after server start up, it was not getting picked up
|
|
72
|
-
await StateAggregator.clearInstanceAsync();
|
|
73
|
-
// Must NOT be nullish coalescing (??) In case the LLM uses and empty string
|
|
74
|
-
const assignTo = (await StateAggregator.getInstance()).aliases.resolveUsername(onBehalfOf || usernameOrAlias);
|
|
75
|
-
if (!assignTo.includes('@')) {
|
|
76
|
-
return textResponse('Unable to resolve the username for alias. Make sure it is correct', true);
|
|
77
|
-
}
|
|
78
|
-
const org = await Org.create({ connection });
|
|
79
|
-
const user = await User.create({ org });
|
|
80
|
-
const queryResult = await connection.singleRecordQuery(`SELECT Id FROM User WHERE Username='${assignTo}'`);
|
|
81
|
-
await user.assignPermissionSets(queryResult.Id, [permissionSetName]);
|
|
82
|
-
return textResponse(`Assigned ${permissionSetName} to ${assignTo}`);
|
|
83
|
-
}
|
|
84
|
-
catch (error) {
|
|
85
|
-
return textResponse(`Failed to assign permission set: ${error instanceof Error ? error.message : 'Unknown error'}`, true);
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
};
|
|
89
|
-
//# sourceMappingURL=sf-assign-permission-set.js.map
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
-
export declare const createOrgSnapshotParams: z.ZodObject<{
|
|
4
|
-
directory: z.ZodEffects<z.ZodString, string, string>;
|
|
5
|
-
devHub: z.ZodString;
|
|
6
|
-
sourceOrg: z.ZodString;
|
|
7
|
-
description: z.ZodOptional<z.ZodString>;
|
|
8
|
-
name: z.ZodDefault<z.ZodString>;
|
|
9
|
-
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
name: string;
|
|
11
|
-
directory: string;
|
|
12
|
-
devHub: string;
|
|
13
|
-
sourceOrg: string;
|
|
14
|
-
description?: string | undefined;
|
|
15
|
-
}, {
|
|
16
|
-
directory: string;
|
|
17
|
-
devHub: string;
|
|
18
|
-
sourceOrg: string;
|
|
19
|
-
description?: string | undefined;
|
|
20
|
-
name?: string | undefined;
|
|
21
|
-
}>;
|
|
22
|
-
export type CreateOrgSnapshotOptions = z.infer<typeof createOrgSnapshotParams>;
|
|
23
|
-
export declare const createOrgSnapshot: (server: McpServer) => void;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2025, Salesforce, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { z } from 'zod';
|
|
17
|
-
import { Org } from '@salesforce/core';
|
|
18
|
-
import { textResponse } from '../../shared/utils.js';
|
|
19
|
-
import { directoryParam, usernameOrAliasParam } from '../../shared/params.js';
|
|
20
|
-
import { getConnection } from '../../shared/auth.js';
|
|
21
|
-
/*
|
|
22
|
-
* Create a new scratch org snapshot
|
|
23
|
-
*
|
|
24
|
-
* Parameters:
|
|
25
|
-
* - directory: directory to change to before running the command
|
|
26
|
-
* - devHub: Username or alias of the Dev Hub org
|
|
27
|
-
* - sourceOrg: ID or locally authenticated username or alias of scratch org to snapshot.
|
|
28
|
-
* - description: a description given to the snapshot
|
|
29
|
-
* - name: Unique name of snapshot
|
|
30
|
-
* Returns:
|
|
31
|
-
* - textResponse:
|
|
32
|
-
*/
|
|
33
|
-
export const createOrgSnapshotParams = z.object({
|
|
34
|
-
directory: directoryParam,
|
|
35
|
-
devHub: usernameOrAliasParam.describe('The default devhub username, use the #sf-get-username tool to get the default devhub if unsure'),
|
|
36
|
-
sourceOrg: usernameOrAliasParam.describe('The org username or alias to create a snapshot of, use the #sf-get-username tool to get the default target org if unsure'),
|
|
37
|
-
description: z.string().describe(' Description of snapshot.').optional(),
|
|
38
|
-
name: z.string().describe('Unique name of snapshot').max(15).default(Date.now().toString().substring(0, 15)),
|
|
39
|
-
});
|
|
40
|
-
export const createOrgSnapshot = (server) => {
|
|
41
|
-
server.tool('sf-create-org-snapshot', `Creates a new snapshot of an org
|
|
42
|
-
|
|
43
|
-
AGENT INSTRUCTIONS:
|
|
44
|
-
|
|
45
|
-
Example usage:
|
|
46
|
-
Create a snapshot called 07042025
|
|
47
|
-
create a snapshot called 07042025 with the description, "this is a snapshot for commit 5b1a09b1743 - new login flow working"
|
|
48
|
-
create a snapshot of my MyScratch in myDevHub
|
|
49
|
-
`, createOrgSnapshotParams.shape, {
|
|
50
|
-
title: 'Create a new snapshot',
|
|
51
|
-
}, async ({ directory, devHub, description, name, sourceOrg }) => {
|
|
52
|
-
try {
|
|
53
|
-
process.chdir(directory);
|
|
54
|
-
const sourceOrgId = (await Org.create({ aliasOrUsername: sourceOrg })).getOrgId();
|
|
55
|
-
const devHubConnection = await getConnection(devHub);
|
|
56
|
-
const createResponse = await devHubConnection.sobject('OrgSnapshot').create({
|
|
57
|
-
SourceOrg: sourceOrgId,
|
|
58
|
-
Description: description,
|
|
59
|
-
SnapshotName: name,
|
|
60
|
-
Content: 'metadatadata',
|
|
61
|
-
});
|
|
62
|
-
if (createResponse.success === false) {
|
|
63
|
-
return textResponse(`An error while created the org snapshot: ${JSON.stringify(createResponse)}`, true);
|
|
64
|
-
}
|
|
65
|
-
const result = await devHubConnection.singleRecordQuery(`SELECT Id,
|
|
66
|
-
SnapshotName,
|
|
67
|
-
Description,
|
|
68
|
-
Status,
|
|
69
|
-
SourceOrg,
|
|
70
|
-
CreatedDate,
|
|
71
|
-
LastModifiedDate,
|
|
72
|
-
ExpirationDate,
|
|
73
|
-
Error FROM OrgSnapshot WHERE Id = '${createResponse.id}'`);
|
|
74
|
-
return textResponse(`Successfully created the org snapshot: ${JSON.stringify(result)}`);
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
const e = error;
|
|
78
|
-
// dev hub does not have snapshot pref enabled
|
|
79
|
-
if (e.name === 'NOT_FOUND') {
|
|
80
|
-
return textResponse("Scratch Org Snapshots isn't enabled for your Dev Hub.", true);
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
return textResponse(`Error: ${e.name} : ${e.message}`, true);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
//# sourceMappingURL=sf-create-org-snapshot.js.map
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
-
export declare const createScratchOrgParams: z.ZodObject<{
|
|
4
|
-
directory: z.ZodEffects<z.ZodString, string, string>;
|
|
5
|
-
devHub: z.ZodString;
|
|
6
|
-
duration: z.ZodDefault<z.ZodNumber>;
|
|
7
|
-
edition: z.ZodOptional<z.ZodEnum<["developer", "enterprise", "group", "professional", "partner-developer", "partner-enterprise", "partner-group", "partner-professional"]>>;
|
|
8
|
-
definitionFile: z.ZodDefault<z.ZodString>;
|
|
9
|
-
alias: z.ZodOptional<z.ZodString>;
|
|
10
|
-
async: z.ZodDefault<z.ZodBoolean>;
|
|
11
|
-
setDefault: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
-
snapshot: z.ZodOptional<z.ZodString>;
|
|
13
|
-
sourceOrg: z.ZodOptional<z.ZodString>;
|
|
14
|
-
username: z.ZodOptional<z.ZodString>;
|
|
15
|
-
description: z.ZodOptional<z.ZodString>;
|
|
16
|
-
orgName: z.ZodOptional<z.ZodString>;
|
|
17
|
-
adminEmail: z.ZodOptional<z.ZodString>;
|
|
18
|
-
}, "strip", z.ZodTypeAny, {
|
|
19
|
-
directory: string;
|
|
20
|
-
devHub: string;
|
|
21
|
-
duration: number;
|
|
22
|
-
definitionFile: string;
|
|
23
|
-
async: boolean;
|
|
24
|
-
description?: string | undefined;
|
|
25
|
-
username?: string | undefined;
|
|
26
|
-
snapshot?: string | undefined;
|
|
27
|
-
alias?: string | undefined;
|
|
28
|
-
sourceOrg?: string | undefined;
|
|
29
|
-
edition?: "group" | "developer" | "enterprise" | "professional" | "partner-developer" | "partner-enterprise" | "partner-group" | "partner-professional" | undefined;
|
|
30
|
-
setDefault?: boolean | undefined;
|
|
31
|
-
orgName?: string | undefined;
|
|
32
|
-
adminEmail?: string | undefined;
|
|
33
|
-
}, {
|
|
34
|
-
directory: string;
|
|
35
|
-
devHub: string;
|
|
36
|
-
description?: string | undefined;
|
|
37
|
-
username?: string | undefined;
|
|
38
|
-
snapshot?: string | undefined;
|
|
39
|
-
alias?: string | undefined;
|
|
40
|
-
sourceOrg?: string | undefined;
|
|
41
|
-
duration?: number | undefined;
|
|
42
|
-
edition?: "group" | "developer" | "enterprise" | "professional" | "partner-developer" | "partner-enterprise" | "partner-group" | "partner-professional" | undefined;
|
|
43
|
-
definitionFile?: string | undefined;
|
|
44
|
-
async?: boolean | undefined;
|
|
45
|
-
setDefault?: boolean | undefined;
|
|
46
|
-
orgName?: string | undefined;
|
|
47
|
-
adminEmail?: string | undefined;
|
|
48
|
-
}>;
|
|
49
|
-
export type CreateScratchOrgOptions = z.infer<typeof createScratchOrgParams>;
|
|
50
|
-
export declare const createScratchOrg: (server: McpServer) => void;
|