salesforce-metadata-mcp 2.0.0
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/AGENTFORCE.md +125 -0
- package/APEX_LWC.md +214 -0
- package/CHANGELOG.md +120 -0
- package/README.md +207 -0
- package/SETUP.md +208 -0
- package/TOOLS.md +193 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/index.d.ts +3406 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +992 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/services/deployment.d.ts +36 -0
- package/dist/services/deployment.d.ts.map +1 -0
- package/dist/services/deployment.js +215 -0
- package/dist/services/deployment.js.map +1 -0
- package/dist/services/mcpgen.d.ts +16 -0
- package/dist/services/mcpgen.d.ts.map +1 -0
- package/dist/services/mcpgen.js +229 -0
- package/dist/services/mcpgen.js.map +1 -0
- package/dist/services/salesforce.d.ts +598 -0
- package/dist/services/salesforce.d.ts.map +1 -0
- package/dist/services/salesforce.js +1317 -0
- package/dist/services/salesforce.js.map +1 -0
- package/dist/services/tooling.d.ts +23 -0
- package/dist/services/tooling.d.ts.map +1 -0
- package/dist/services/tooling.js +173 -0
- package/dist/services/tooling.js.map +1 -0
- package/dist/tools/agentforce.d.ts +3 -0
- package/dist/tools/agentforce.d.ts.map +1 -0
- package/dist/tools/agentforce.js +73 -0
- package/dist/tools/agentforce.js.map +1 -0
- package/dist/tools/apex.d.ts +3 -0
- package/dist/tools/apex.d.ts.map +1 -0
- package/dist/tools/apex.js +95 -0
- package/dist/tools/apex.js.map +1 -0
- package/dist/tools/automation.d.ts +3 -0
- package/dist/tools/automation.d.ts.map +1 -0
- package/dist/tools/automation.js +186 -0
- package/dist/tools/automation.js.map +1 -0
- package/dist/tools/deployment.d.ts +3 -0
- package/dist/tools/deployment.d.ts.map +1 -0
- package/dist/tools/deployment.js +89 -0
- package/dist/tools/deployment.js.map +1 -0
- package/dist/tools/experience.d.ts +3 -0
- package/dist/tools/experience.d.ts.map +1 -0
- package/dist/tools/experience.js +53 -0
- package/dist/tools/experience.js.map +1 -0
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +27 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/integrations.d.ts +3 -0
- package/dist/tools/integrations.d.ts.map +1 -0
- package/dist/tools/integrations.js +96 -0
- package/dist/tools/integrations.js.map +1 -0
- package/dist/tools/lwc.d.ts +3 -0
- package/dist/tools/lwc.d.ts.map +1 -0
- package/dist/tools/lwc.js +73 -0
- package/dist/tools/lwc.js.map +1 -0
- package/dist/tools/mcp.d.ts +3 -0
- package/dist/tools/mcp.d.ts.map +1 -0
- package/dist/tools/mcp.js +44 -0
- package/dist/tools/mcp.js.map +1 -0
- package/dist/tools/metadata.d.ts +3 -0
- package/dist/tools/metadata.d.ts.map +1 -0
- package/dist/tools/metadata.js +168 -0
- package/dist/tools/metadata.js.map +1 -0
- package/dist/tools/objects.d.ts +3 -0
- package/dist/tools/objects.d.ts.map +1 -0
- package/dist/tools/objects.js +172 -0
- package/dist/tools/objects.js.map +1 -0
- package/dist/tools/security.d.ts +3 -0
- package/dist/tools/security.d.ts.map +1 -0
- package/dist/tools/security.js +82 -0
- package/dist/tools/security.js.map +1 -0
- package/dist/tools/ui.d.ts +3 -0
- package/dist/tools/ui.d.ts.map +1 -0
- package/dist/tools/ui.js +195 -0
- package/dist/tools/ui.js.map +1 -0
- package/dist/tools/utils.d.ts +15 -0
- package/dist/tools/utils.d.ts.map +1 -0
- package/dist/tools/utils.js +7 -0
- package/dist/tools/utils.js.map +1 -0
- package/dist/types.d.ts +85 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +46 -0
package/SETUP.md
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
# Setup Guide
|
|
2
|
+
|
|
3
|
+
Complete prerequisites and configuration for `salesforce-metadata-mcp`.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
### 1. Node.js 18+
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
node --version # must be 18.0.0 or higher
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Download from [nodejs.org](https://nodejs.org) if needed.
|
|
16
|
+
|
|
17
|
+
### 2. Salesforce Org
|
|
18
|
+
|
|
19
|
+
You need a Salesforce org (Developer Edition, Sandbox, or Production). Free Developer Edition orgs: [developer.salesforce.com/signup](https://developer.salesforce.com/signup).
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Authentication Methods
|
|
24
|
+
|
|
25
|
+
The server tries these in order:
|
|
26
|
+
|
|
27
|
+
### Method 1: OAuth Refresh Token (Recommended for Production)
|
|
28
|
+
|
|
29
|
+
**Step 1: Create a Connected App in Salesforce**
|
|
30
|
+
|
|
31
|
+
1. Go to **Setup → App Manager → New Connected App**
|
|
32
|
+
2. Fill in: Connected App Name, API Name, Contact Email
|
|
33
|
+
3. Under **OAuth Settings**, check **Enable OAuth Settings**
|
|
34
|
+
4. Set Callback URL: `https://login.salesforce.com/services/oauth2/success`
|
|
35
|
+
5. Add scopes: `Full Access (full)`, `Perform requests at any time (refresh_token, offline_access)`
|
|
36
|
+
6. Save. Wait 2-10 minutes for the app to activate.
|
|
37
|
+
7. Click **Manage Consumer Details** to get your **Consumer Key** (client_id) and **Consumer Secret**
|
|
38
|
+
|
|
39
|
+
**Step 2: Get your Refresh Token**
|
|
40
|
+
|
|
41
|
+
Using the Salesforce CLI:
|
|
42
|
+
```bash
|
|
43
|
+
sf org login web --client-id YOUR_CONSUMER_KEY --instance-url https://login.salesforce.com
|
|
44
|
+
sf org display --target-org YOUR_USERNAME --json
|
|
45
|
+
# Copy the refreshToken value
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Step 3: Configure environment variables**
|
|
49
|
+
```env
|
|
50
|
+
SF_INSTANCE_URL=https://yourorg.my.salesforce.com
|
|
51
|
+
SF_CLIENT_ID=3MVG9...your_consumer_key...
|
|
52
|
+
SF_CLIENT_SECRET=your_consumer_secret
|
|
53
|
+
SF_REFRESH_TOKEN=5Aep...your_refresh_token...
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Method 2: Salesforce CLI Alias
|
|
57
|
+
|
|
58
|
+
**Step 1: Install Salesforce CLI**
|
|
59
|
+
```bash
|
|
60
|
+
npm install -g @salesforce/cli
|
|
61
|
+
sf --version
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Step 2: Authenticate**
|
|
65
|
+
```bash
|
|
66
|
+
sf org login web --instance-url https://login.salesforce.com --alias myOrg
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Step 3: Configure**
|
|
70
|
+
```env
|
|
71
|
+
SF_INSTANCE_URL=https://yourorg.my.salesforce.com
|
|
72
|
+
SF_ALIAS=myOrg
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Method 3: Static Access Token (Dev/Testing Only)
|
|
76
|
+
|
|
77
|
+
Access tokens expire after ~1 hour. Only use for quick testing.
|
|
78
|
+
|
|
79
|
+
**Get an access token:**
|
|
80
|
+
```bash
|
|
81
|
+
sf org display --target-org myOrg --json
|
|
82
|
+
# Look for "accessToken" in the output
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Configure:**
|
|
86
|
+
```env
|
|
87
|
+
SF_INSTANCE_URL=https://yourorg.my.salesforce.com
|
|
88
|
+
SF_ACCESS_TOKEN=00D...your_access_token...
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Claude Desktop Configuration
|
|
94
|
+
|
|
95
|
+
Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
96
|
+
|
|
97
|
+
### Using OAuth (recommended)
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"mcpServers": {
|
|
101
|
+
"salesforce": {
|
|
102
|
+
"command": "npx",
|
|
103
|
+
"args": ["-y", "salesforce-metadata-mcp"],
|
|
104
|
+
"env": {
|
|
105
|
+
"SF_INSTANCE_URL": "https://yourorg.my.salesforce.com",
|
|
106
|
+
"SF_CLIENT_ID": "your_consumer_key",
|
|
107
|
+
"SF_CLIENT_SECRET": "your_consumer_secret",
|
|
108
|
+
"SF_REFRESH_TOKEN": "your_refresh_token"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Using CLI alias
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"mcpServers": {
|
|
119
|
+
"salesforce": {
|
|
120
|
+
"command": "npx",
|
|
121
|
+
"args": ["-y", "salesforce-metadata-mcp"],
|
|
122
|
+
"env": {
|
|
123
|
+
"SF_INSTANCE_URL": "https://yourorg.my.salesforce.com",
|
|
124
|
+
"SF_ALIAS": "myOrg"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Using a local build
|
|
132
|
+
```json
|
|
133
|
+
{
|
|
134
|
+
"mcpServers": {
|
|
135
|
+
"salesforce": {
|
|
136
|
+
"command": "node",
|
|
137
|
+
"args": ["/path/to/salesforce-metadata-mcp-server/dist/index.js"],
|
|
138
|
+
"env": {
|
|
139
|
+
"SF_INSTANCE_URL": "https://yourorg.my.salesforce.com",
|
|
140
|
+
"SF_ACCESS_TOKEN": "your_token"
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Claude Code Configuration
|
|
150
|
+
|
|
151
|
+
Add to `.claude/settings.json` in your project, or `~/.claude/settings.json` for global:
|
|
152
|
+
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"mcpServers": {
|
|
156
|
+
"salesforce": {
|
|
157
|
+
"command": "npx",
|
|
158
|
+
"args": ["-y", "salesforce-metadata-mcp"],
|
|
159
|
+
"env": {
|
|
160
|
+
"SF_INSTANCE_URL": "https://yourorg.my.salesforce.com",
|
|
161
|
+
"SF_CLIENT_ID": "your_consumer_key",
|
|
162
|
+
"SF_CLIENT_SECRET": "your_consumer_secret",
|
|
163
|
+
"SF_REFRESH_TOKEN": "your_refresh_token"
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## HTTP Transport Mode
|
|
173
|
+
|
|
174
|
+
For server deployments or multi-user scenarios:
|
|
175
|
+
|
|
176
|
+
```env
|
|
177
|
+
TRANSPORT=http
|
|
178
|
+
PORT=3000
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Start the server:
|
|
182
|
+
```bash
|
|
183
|
+
node dist/index.js
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
The server will listen at `http://localhost:3000/mcp`.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Troubleshooting
|
|
191
|
+
|
|
192
|
+
**"Missing SF_INSTANCE_URL environment variable"**
|
|
193
|
+
→ Make sure `SF_INSTANCE_URL` is set in your MCP configuration env block.
|
|
194
|
+
|
|
195
|
+
**"No access token returned from SF CLI"**
|
|
196
|
+
→ Run `sf org login web` and verify the alias is correct.
|
|
197
|
+
|
|
198
|
+
**"INVALID_SESSION_ID"**
|
|
199
|
+
→ Your access token has expired. Use OAuth refresh token method for automatic renewal.
|
|
200
|
+
|
|
201
|
+
**"INSUFFICIENT_ACCESS"**
|
|
202
|
+
→ The authenticated user needs sufficient permissions. Try a System Administrator profile.
|
|
203
|
+
|
|
204
|
+
**Metadata API errors**
|
|
205
|
+
→ The org must have Metadata API enabled (all Developer/Enterprise/Unlimited editions have it).
|
|
206
|
+
|
|
207
|
+
**"Cannot deploy Apex to production without test coverage"**
|
|
208
|
+
→ Run `sf_run_apex_tests` first to verify coverage, then deploy with `runTests` specified.
|
package/TOOLS.md
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# Tools Reference
|
|
2
|
+
|
|
3
|
+
Complete documentation for all 60+ tools in `salesforce-metadata-mcp`.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Objects & Fields
|
|
8
|
+
|
|
9
|
+
### sf_create_custom_object
|
|
10
|
+
Creates a new Salesforce Custom Object using the Metadata API.
|
|
11
|
+
|
|
12
|
+
**Parameters:**
|
|
13
|
+
| Parameter | Type | Default | Description |
|
|
14
|
+
|-----------|------|---------|-------------|
|
|
15
|
+
| `fullName` | string | required | API name ending in `__c`, e.g. `Invoice__c` |
|
|
16
|
+
| `label` | string | required | Singular display label |
|
|
17
|
+
| `pluralLabel` | string | required | Plural display label |
|
|
18
|
+
| `description` | string | — | Optional description |
|
|
19
|
+
| `nameFieldLabel` | string | `"Name"` | Label for the standard Name field |
|
|
20
|
+
| `nameFieldType` | `Text\|AutoNumber` | `"Text"` | Name field type |
|
|
21
|
+
| `autoNumberFormat` | string | — | Format for AutoNumber, e.g. `INV-{0000}` |
|
|
22
|
+
| `deploymentStatus` | `Deployed\|InDevelopment` | `"Deployed"` | Deployment status |
|
|
23
|
+
| `sharingModel` | `ReadWrite\|Read\|Private\|...` | `"ReadWrite"` | OWD sharing model |
|
|
24
|
+
| `enableActivities` | boolean | `true` | Allow Tasks/Events |
|
|
25
|
+
| `enableHistory` | boolean | `false` | Enable field history tracking |
|
|
26
|
+
| `enableReports` | boolean | `true` | Available in Reports |
|
|
27
|
+
| `enableSearch` | boolean | `true` | Searchable |
|
|
28
|
+
|
|
29
|
+
**Example prompts:**
|
|
30
|
+
- "Create a custom object called Project__c with plural label Projects"
|
|
31
|
+
- "Create a Job Application object with AutoNumber name format JOB-{0000}"
|
|
32
|
+
- "Create a custom object called Feedback__c with Private sharing and no activities"
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
### sf_create_custom_field
|
|
37
|
+
Creates a new field on an existing object.
|
|
38
|
+
|
|
39
|
+
**Parameters:**
|
|
40
|
+
| Parameter | Type | Description |
|
|
41
|
+
|-----------|------|-------------|
|
|
42
|
+
| `objectName` | string | Parent object API name |
|
|
43
|
+
| `fieldName` | string | Field API name ending in `__c` |
|
|
44
|
+
| `label` | string | Display label |
|
|
45
|
+
| `type` | FieldType | Text, Number, Picklist, Lookup, etc. |
|
|
46
|
+
| `required` | boolean | Is field required |
|
|
47
|
+
| `unique` | boolean | Must values be unique |
|
|
48
|
+
| `length` | number | For Text fields (1-255) |
|
|
49
|
+
| `precision` / `scale` | number | For Number/Currency fields |
|
|
50
|
+
| `picklistValues` | object | Required for Picklist/MultiselectPicklist |
|
|
51
|
+
| `referenceTo` | string | For Lookup/MasterDetail |
|
|
52
|
+
| `deleteConstraint` | string | For Lookup: Cascade/Restrict/SetNull |
|
|
53
|
+
|
|
54
|
+
**Example prompts:**
|
|
55
|
+
- "Add a Status__c picklist field to Invoice__c with values: Draft, Pending, Approved, Rejected"
|
|
56
|
+
- "Add an Amount__c currency field to Opportunity with 2 decimal places"
|
|
57
|
+
- "Add a lookup from Project__c to Account"
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
### sf_create_custom_metadata_type
|
|
62
|
+
Creates a Custom Metadata Type (__mdt) for storing configuration.
|
|
63
|
+
|
|
64
|
+
**Parameters:**
|
|
65
|
+
| Parameter | Type | Description |
|
|
66
|
+
|-----------|------|-------------|
|
|
67
|
+
| `fullName` | string | API name ending in `__mdt` |
|
|
68
|
+
| `label` | string | Singular label |
|
|
69
|
+
| `pluralLabel` | string | Plural label |
|
|
70
|
+
| `description` | string | Optional description |
|
|
71
|
+
| `fields` | array | Custom fields to add |
|
|
72
|
+
|
|
73
|
+
**Example prompts:**
|
|
74
|
+
- "Create a Feature_Flag__mdt Custom Metadata Type with a Boolean field IsEnabled__c"
|
|
75
|
+
- "Create an Integration_Config__mdt type with fields for endpoint URL and API key"
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
### sf_create_apex_class
|
|
80
|
+
Deploys an Apex class to the org via Metadata API zip deploy.
|
|
81
|
+
|
|
82
|
+
**Parameters:**
|
|
83
|
+
| Parameter | Type | Description |
|
|
84
|
+
|-----------|------|-------------|
|
|
85
|
+
| `className` | string | Class name (no __c) |
|
|
86
|
+
| `classBody` | string | Full Apex source code |
|
|
87
|
+
| `apiVersion` | string | API version, default `62.0` |
|
|
88
|
+
|
|
89
|
+
**Example prompts:**
|
|
90
|
+
- "Create an Apex class called AccountService with a method to get all active accounts"
|
|
91
|
+
- "Create a Batch Apex class called DataCleanupBatch that deletes records older than 2 years"
|
|
92
|
+
- "Create a Schedulable class called NightlyReport that generates a report email"
|
|
93
|
+
|
|
94
|
+
**Expected output:** Deploy job ID and success/failure message with any compile errors.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
### sf_execute_anonymous_apex
|
|
99
|
+
Executes Apex code immediately via Tooling API.
|
|
100
|
+
|
|
101
|
+
**Parameters:**
|
|
102
|
+
| Parameter | Type | Description |
|
|
103
|
+
|-----------|------|-------------|
|
|
104
|
+
| `apexCode` | string | Apex code to execute |
|
|
105
|
+
|
|
106
|
+
**Example prompts:**
|
|
107
|
+
- "Run this Apex to update all Contact email addresses to lowercase"
|
|
108
|
+
- "Execute: System.debug(UserInfo.getUserName());"
|
|
109
|
+
- "Run anonymous Apex to backfill the missing CreatedDate__c field on all Account records"
|
|
110
|
+
|
|
111
|
+
**Expected output:** Success/failure, compile errors if any, and debug log if present.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
### sf_create_lwc
|
|
116
|
+
Deploys a Lightning Web Component via Metadata API.
|
|
117
|
+
|
|
118
|
+
**Parameters:**
|
|
119
|
+
| Parameter | Type | Description |
|
|
120
|
+
|-----------|------|-------------|
|
|
121
|
+
| `componentName` | string | camelCase name, e.g. `accountCard` |
|
|
122
|
+
| `html` | string | Full HTML template content |
|
|
123
|
+
| `javascript` | string | Full JS controller content |
|
|
124
|
+
| `css` | string | Optional CSS |
|
|
125
|
+
| `targets` | array | Where to place the component |
|
|
126
|
+
| `isExposed` | boolean | Available in App Builder |
|
|
127
|
+
| `apiVersion` | string | Default `62.0` |
|
|
128
|
+
|
|
129
|
+
**Example prompts:**
|
|
130
|
+
- "Create an LWC called opportunityList that shows a table of open opportunities"
|
|
131
|
+
- "Create a contact card LWC with name, email, phone and make it available on Record Pages"
|
|
132
|
+
- "Create an LWC Flow Screen component for collecting address information"
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
### sf_create_agent (Agentforce)
|
|
137
|
+
Creates an Agentforce Einstein Copilot agent.
|
|
138
|
+
|
|
139
|
+
**Parameters:**
|
|
140
|
+
| Parameter | Type | Description |
|
|
141
|
+
|-----------|------|-------------|
|
|
142
|
+
| `agentName` | string | Agent API name |
|
|
143
|
+
| `label` | string | Display name |
|
|
144
|
+
| `description` | string | Agent description |
|
|
145
|
+
| `type` | string | `EinsteinCopilot` |
|
|
146
|
+
| `company` | string | Company context |
|
|
147
|
+
| `persona` | string | Agent persona description |
|
|
148
|
+
| `tone` | `Formal\|Neutral\|Casual` | Communication tone |
|
|
149
|
+
| `instructions` | string | System-level instructions |
|
|
150
|
+
|
|
151
|
+
**Example prompts:**
|
|
152
|
+
- "Create an Agentforce agent called SalesBot for helping sales reps close deals"
|
|
153
|
+
- "Create a customer service agent with a formal tone for handling support cases"
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
### sf_deploy_metadata
|
|
158
|
+
Deploys metadata components via SOAP deploy.
|
|
159
|
+
|
|
160
|
+
**Parameters:**
|
|
161
|
+
| Parameter | Type | Description |
|
|
162
|
+
|-----------|------|-------------|
|
|
163
|
+
| `components` | array | `[{type, name}]` to deploy |
|
|
164
|
+
| `checkOnly` | boolean | Validate without deploying |
|
|
165
|
+
| `runTests` | array | Test classes to run |
|
|
166
|
+
| `rollbackOnError` | boolean | Rollback on any failure |
|
|
167
|
+
| `waitMinutes` | number | Timeout (default 10 min) |
|
|
168
|
+
|
|
169
|
+
**Example prompts:**
|
|
170
|
+
- "Deploy the AccountService Apex class and AccountTrigger to the org"
|
|
171
|
+
- "Validate the deployment of these components without making changes"
|
|
172
|
+
- "Deploy MyFlow and MyClass, running MyClassTest during deployment"
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
### sf_create_mcp_server
|
|
177
|
+
Generates a complete MCP server project on disk.
|
|
178
|
+
|
|
179
|
+
**Parameters:**
|
|
180
|
+
| Parameter | Type | Description |
|
|
181
|
+
|-----------|------|-------------|
|
|
182
|
+
| `serverName` | string | Server package name |
|
|
183
|
+
| `outputDirectory` | string | Absolute path to output directory |
|
|
184
|
+
| `description` | string | Server description |
|
|
185
|
+
| `salesforceInstanceUrl` | string | Pre-configure org URL |
|
|
186
|
+
|
|
187
|
+
**Example prompts:**
|
|
188
|
+
- "Create a new MCP server called my-sf-integration in C:/projects/my-server"
|
|
189
|
+
- "Generate a Salesforce MCP server project targeting https://myorg.salesforce.com"
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
*For the complete list of all 60+ tools, see [README.md](README.md).*
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
4
|
+
import express from "express";
|
|
5
|
+
import { registerTools } from "./tools/index.js";
|
|
6
|
+
// ─── Server init ──────────────────────────────────────────────────────────────
|
|
7
|
+
const server = new McpServer({
|
|
8
|
+
name: "salesforce-metadata-mcp",
|
|
9
|
+
version: "2.0.0",
|
|
10
|
+
});
|
|
11
|
+
registerTools(server);
|
|
12
|
+
// ─── Transport: stdio ─────────────────────────────────────────────────────────
|
|
13
|
+
async function runStdio() {
|
|
14
|
+
const transport = new StdioServerTransport();
|
|
15
|
+
await server.connect(transport);
|
|
16
|
+
console.error("Salesforce Metadata MCP server v2.0.0 running on stdio");
|
|
17
|
+
}
|
|
18
|
+
// ─── Transport: HTTP ──────────────────────────────────────────────────────────
|
|
19
|
+
async function runHTTP() {
|
|
20
|
+
const app = express();
|
|
21
|
+
app.use(express.json());
|
|
22
|
+
app.post("/mcp", async (req, res) => {
|
|
23
|
+
const transport = new StreamableHTTPServerTransport({
|
|
24
|
+
sessionIdGenerator: undefined,
|
|
25
|
+
enableJsonResponse: true,
|
|
26
|
+
});
|
|
27
|
+
res.on("close", () => transport.close());
|
|
28
|
+
await server.connect(transport);
|
|
29
|
+
await transport.handleRequest(req, res, req.body);
|
|
30
|
+
});
|
|
31
|
+
app.get("/health", (_req, res) => {
|
|
32
|
+
res.json({ status: "ok", server: "salesforce-metadata-mcp", version: "2.0.0" });
|
|
33
|
+
});
|
|
34
|
+
const port = parseInt(process.env.PORT ?? "3000", 10);
|
|
35
|
+
app.listen(port, () => {
|
|
36
|
+
console.error(`Salesforce Metadata MCP server v2.0.0 running on http://localhost:${port}/mcp`);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
// ─── Entry point ──────────────────────────────────────────────────────────────
|
|
40
|
+
const transport = process.env.TRANSPORT ?? "stdio";
|
|
41
|
+
if (transport === "http") {
|
|
42
|
+
runHTTP().catch((err) => {
|
|
43
|
+
console.error("Server error:", err);
|
|
44
|
+
process.exit(1);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
runStdio().catch((err) => {
|
|
49
|
+
console.error("Server error:", err);
|
|
50
|
+
process.exit(1);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,iFAAiF;AAEjF,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IAC3B,IAAI,EAAE,yBAAyB;IAC/B,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC;AAEH,aAAa,CAAC,MAAM,CAAC,CAAC;AAEtB,iFAAiF;AAEjF,KAAK,UAAU,QAAQ;IACrB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;AAC1E,CAAC;AAED,iFAAiF;AAEjF,KAAK,UAAU,OAAO;IACpB,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;IACtB,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAExB,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;QAClC,MAAM,SAAS,GAAG,IAAI,6BAA6B,CAAC;YAClD,kBAAkB,EAAE,SAAS;YAC7B,kBAAkB,EAAE,IAAI;SACzB,CAAC,CAAC;QACH,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC;QACzC,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAChC,MAAM,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;QAC/B,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,yBAAyB,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAClF,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,MAAM,EAAE,EAAE,CAAC,CAAC;IACtD,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE;QACpB,OAAO,CAAC,KAAK,CAAC,qEAAqE,IAAI,MAAM,CAAC,CAAC;IACjG,CAAC,CAAC,CAAC;AACL,CAAC;AAED,iFAAiF;AAEjF,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,OAAO,CAAC;AACnD,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;IACzB,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;QAC/B,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;QACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;KAAM,CAAC;IACN,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;QAChC,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;QACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|