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/AGENTFORCE.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Agentforce Guide
|
|
2
|
+
|
|
3
|
+
Complete guide for creating Agentforce agents with `salesforce-metadata-mcp`.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
Agentforce (Einstein Copilot) agents consist of three components:
|
|
10
|
+
|
|
11
|
+
1. **Agent** — The top-level AI assistant with a persona and instructions
|
|
12
|
+
2. **Topics** — Areas of expertise (what types of requests the agent handles)
|
|
13
|
+
3. **Actions** — Concrete steps the agent takes (powered by Flows, Apex, or Prompt Templates)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Step 1: Create the Agent
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
Create an Agentforce agent called SalesAssistant:
|
|
21
|
+
- Label: Sales Assistant
|
|
22
|
+
- Persona: A knowledgeable sales expert who helps reps close more deals
|
|
23
|
+
- Tone: Professional
|
|
24
|
+
- Instructions: Always check opportunity stage before recommending next steps. Be concise.
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This calls `sf_create_agent` with:
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"agentName": "SalesAssistant",
|
|
31
|
+
"label": "Sales Assistant",
|
|
32
|
+
"type": "EinsteinCopilot",
|
|
33
|
+
"persona": "A knowledgeable sales expert who helps reps close more deals",
|
|
34
|
+
"tone": "Neutral",
|
|
35
|
+
"instructions": "Always check opportunity stage before recommending next steps. Be concise."
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Step 2: Create Topics
|
|
42
|
+
|
|
43
|
+
Topics tell the agent what kinds of user requests it can handle.
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
Add a topic called OrderManagement to the SalesAssistant agent:
|
|
47
|
+
- Label: Order Management
|
|
48
|
+
- Description: Handles all questions about customer orders, quotes, and order status
|
|
49
|
+
- Scope: User questions about creating orders, checking order status, updating order quantities
|
|
50
|
+
- Instructions: 1. Identify the order or account. 2. Check current status. 3. Take appropriate action.
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Step 3: Create a Flow for the Action
|
|
56
|
+
|
|
57
|
+
First, create the Flow that the agent will invoke:
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
Create an AutoLaunchedFlow called Get_Account_Orders that:
|
|
61
|
+
- Takes an input variable accountId (String, isInput: true)
|
|
62
|
+
- Queries related Order__c records using GetRecords
|
|
63
|
+
- Returns them in an output variable orders (SObject collection, isOutput: true)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Step 4: Link the Flow as an Agent Action
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
Create an agent action called GetOrders for the SalesAssistant agent's OrderManagement topic:
|
|
72
|
+
- Type: Flow
|
|
73
|
+
- Reference: Get_Account_Orders
|
|
74
|
+
- Description: Retrieves all orders for a given account
|
|
75
|
+
- Map input: accountId → {!Agent.Topic.Entities.accountId}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## End-to-End Example
|
|
81
|
+
|
|
82
|
+
Full conversation to create a support agent:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
1. Create an Agentforce agent called SupportAgent with:
|
|
86
|
+
- Persona: "A friendly and efficient customer support representative"
|
|
87
|
+
- Tone: Formal
|
|
88
|
+
- Company: Acme Corp
|
|
89
|
+
|
|
90
|
+
2. Add a topic CaseManagement to SupportAgent:
|
|
91
|
+
- Description: Handles customer support cases, status inquiries, and escalations
|
|
92
|
+
- Scope: Questions about case status, creating new cases, escalating urgent issues
|
|
93
|
+
|
|
94
|
+
3. Create an AutoLaunchedFlow called Create_Support_Case with:
|
|
95
|
+
- Input variables: subject (String), description (String), contactId (String)
|
|
96
|
+
- A CreateRecords element creating a Case with these fields
|
|
97
|
+
- Output variable: caseId (String)
|
|
98
|
+
|
|
99
|
+
4. Create an agent action CreateCase for SupportAgent.CaseManagement:
|
|
100
|
+
- Type: Flow
|
|
101
|
+
- Reference: Create_Support_Case
|
|
102
|
+
- Description: Creates a new support case for the customer
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Testing Your Agent
|
|
108
|
+
|
|
109
|
+
After creating all components:
|
|
110
|
+
|
|
111
|
+
1. **Activate the agent** in Setup → Einstein Copilot → Your Agent → Activate
|
|
112
|
+
2. **Open Copilot** in any Salesforce page (the lightning bolt icon)
|
|
113
|
+
3. **Test a prompt:** "Show me all orders for Acme Corp"
|
|
114
|
+
|
|
115
|
+
The agent should route to the OrderManagement topic and invoke the GetOrders action.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Tips
|
|
120
|
+
|
|
121
|
+
- **Be specific in topic descriptions** — the AI uses them to route requests
|
|
122
|
+
- **Use clear action descriptions** — help the agent know when to invoke each action
|
|
123
|
+
- **Start with Flows** — they're easiest to create and debug
|
|
124
|
+
- **Test with narrow prompts first** — gradually expand scope
|
|
125
|
+
- **Use variables consistently** — name them meaningfully for better AI reasoning
|
package/APEX_LWC.md
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
# Apex & LWC Development Guide
|
|
2
|
+
|
|
3
|
+
Guide for writing Apex classes, triggers, test classes, and Lightning Web Components via Claude.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Apex Classes
|
|
8
|
+
|
|
9
|
+
### Creating Any Apex Class
|
|
10
|
+
|
|
11
|
+
Use `sf_create_apex_class` with the full class body:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
Create an Apex class called AccountService with:
|
|
15
|
+
- A static method getActiveAccounts() that returns List<Account>
|
|
16
|
+
- A static method updateAccountStatus(Id accountId, String status)
|
|
17
|
+
- Proper error handling with custom exceptions
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Claude will write the complete class and deploy it:
|
|
21
|
+
|
|
22
|
+
```apex
|
|
23
|
+
public class AccountService {
|
|
24
|
+
public class AccountServiceException extends Exception {}
|
|
25
|
+
|
|
26
|
+
public static List<Account> getActiveAccounts() {
|
|
27
|
+
return [SELECT Id, Name, Status__c FROM Account WHERE IsActive__c = true];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public static void updateAccountStatus(Id accountId, String status) {
|
|
31
|
+
Account acc = [SELECT Id FROM Account WHERE Id = :accountId];
|
|
32
|
+
acc.Status__c = status;
|
|
33
|
+
update acc;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Batch Apex
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
Create a Batch Apex class called LeadCleanupBatch that:
|
|
42
|
+
- Queries leads older than 2 years with status Closed
|
|
43
|
+
- Deletes them in batches of 200
|
|
44
|
+
- Sends an email report when complete
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Schedulable Apex
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
Create a Schedulable class called WeeklyReportScheduler that
|
|
51
|
+
runs the WeeklyReportBatch every Monday at 6 AM
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Invocable Methods (for Flows)
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
Create an Apex class called OpportunityHelper with an @InvocableMethod
|
|
58
|
+
called calculateScore that accepts a List<Id> of opportunity IDs
|
|
59
|
+
and returns a List<Decimal> of scores
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Apex Triggers
|
|
65
|
+
|
|
66
|
+
### Creating a Trigger
|
|
67
|
+
|
|
68
|
+
Use `sf_create_apex_trigger`:
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
Create an Apex trigger called ContactTrigger on Contact that fires
|
|
72
|
+
before insert and before update. It should:
|
|
73
|
+
- Capitalize the first letter of FirstName and LastName
|
|
74
|
+
- Set Description to 'Created by trigger' on insert if empty
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The trigger declaration is auto-generated. Just provide the body logic:
|
|
78
|
+
|
|
79
|
+
```apex
|
|
80
|
+
// Trigger body (goes inside the trigger { })
|
|
81
|
+
List<Contact> contacts = Trigger.new;
|
|
82
|
+
for (Contact c : contacts) {
|
|
83
|
+
if (c.FirstName != null) {
|
|
84
|
+
c.FirstName = c.FirstName.substring(0,1).toUpperCase() + c.FirstName.substring(1).toLowerCase();
|
|
85
|
+
}
|
|
86
|
+
if (Trigger.isInsert && String.isBlank(c.Description)) {
|
|
87
|
+
c.Description = 'Created by trigger';
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Apex Test Classes
|
|
95
|
+
|
|
96
|
+
### Creating a Test Class
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
Create a test class for AccountService called AccountServiceTest with:
|
|
100
|
+
- Test method for getActiveAccounts returning correct results
|
|
101
|
+
- Test method for updateAccountStatus with valid and invalid IDs
|
|
102
|
+
- At least 90% code coverage
|
|
103
|
+
- @TestSetup method for test data
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Running Tests After Deployment
|
|
107
|
+
|
|
108
|
+
Set `runAfterDeploy: true` in `sf_create_apex_test_class` to automatically run tests:
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
Create a test class AccountServiceTest and run it immediately after deployment
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Running Existing Tests
|
|
115
|
+
|
|
116
|
+
Use `sf_run_apex_tests`:
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
Run the test classes AccountServiceTest and ContactTriggerTest and show me the results
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Execute Anonymous Apex
|
|
125
|
+
|
|
126
|
+
Use `sf_execute_anonymous_apex` for one-off scripts:
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
Execute this Apex to backfill the Description field for all Accounts
|
|
130
|
+
that are missing it: set it to "Auto-populated"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
Run anonymous Apex: query all Opportunities where StageName is 'Closed Won'
|
|
135
|
+
and Amount > 100000, then print their names to the debug log
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Lightning Web Components
|
|
141
|
+
|
|
142
|
+
### Creating an LWC
|
|
143
|
+
|
|
144
|
+
Use `sf_create_lwc` with all three files:
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
Create an LWC called accountDashboard:
|
|
148
|
+
- HTML: Show a card with account name, phone, industry, and annual revenue
|
|
149
|
+
- JS: Import from LDS using @wire(getRecord) with the record ID
|
|
150
|
+
- Make it available on Record Pages
|
|
151
|
+
- Use SLDS styling
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Claude will generate:
|
|
155
|
+
|
|
156
|
+
**HTML (accountDashboard.html):**
|
|
157
|
+
```html
|
|
158
|
+
<template>
|
|
159
|
+
<lightning-card title="Account Dashboard" icon-name="standard:account">
|
|
160
|
+
<div class="slds-p-horizontal_small">
|
|
161
|
+
<template if:true={account.data}>
|
|
162
|
+
<p><strong>Name:</strong> {accountName}</p>
|
|
163
|
+
<p><strong>Phone:</strong> {accountPhone}</p>
|
|
164
|
+
</template>
|
|
165
|
+
</div>
|
|
166
|
+
</lightning-card>
|
|
167
|
+
</template>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**JS (accountDashboard.js):**
|
|
171
|
+
```javascript
|
|
172
|
+
import { LightningElement, api, wire } from 'lwc';
|
|
173
|
+
import { getRecord, getFieldValue } from 'lightning/uiRecordApi';
|
|
174
|
+
import NAME_FIELD from '@salesforce/schema/Account.Name';
|
|
175
|
+
import PHONE_FIELD from '@salesforce/schema/Account.Phone';
|
|
176
|
+
|
|
177
|
+
export default class AccountDashboard extends LightningElement {
|
|
178
|
+
@api recordId;
|
|
179
|
+
|
|
180
|
+
@wire(getRecord, { recordId: '$recordId', fields: [NAME_FIELD, PHONE_FIELD] })
|
|
181
|
+
account;
|
|
182
|
+
|
|
183
|
+
get accountName() { return getFieldValue(this.account.data, NAME_FIELD); }
|
|
184
|
+
get accountPhone() { return getFieldValue(this.account.data, PHONE_FIELD); }
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### LWC for Flow Screens
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
Create an LWC called addressInput for use in Flow Screens:
|
|
192
|
+
- Inputs: street, city, state, zipCode (all @api properties)
|
|
193
|
+
- Outputs: the same fields after user input
|
|
194
|
+
- Use lightning-input components
|
|
195
|
+
- Target: lightning__FlowScreen
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Updating an LWC
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
Update the accountDashboard LWC to also show Annual Revenue and
|
|
202
|
+
add a button that opens a modal when clicked
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Best Practices
|
|
208
|
+
|
|
209
|
+
1. **Always write test classes** — Salesforce requires 75% coverage for production deploys
|
|
210
|
+
2. **Use `@TestSetup`** — Create shared test data once, reuse across all test methods
|
|
211
|
+
3. **Bulk-safe triggers** — Always write triggers that handle collections, not single records
|
|
212
|
+
4. **Use LDS in LWC** — Lightning Data Service (`@wire(getRecord)`) is more efficient than Apex calls
|
|
213
|
+
5. **Separate concerns** — Put business logic in service classes, keep triggers thin
|
|
214
|
+
6. **Handle exceptions** — Always use try-catch in Apex methods that do DML or callouts
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [2.0.0] - 2026-05-22
|
|
4
|
+
|
|
5
|
+
### Major Release — 60+ Tools
|
|
6
|
+
|
|
7
|
+
This release transforms the server from a basic metadata tool into the most comprehensive Salesforce MCP server available.
|
|
8
|
+
|
|
9
|
+
### New Tools (53 additions)
|
|
10
|
+
|
|
11
|
+
#### Objects & Fields
|
|
12
|
+
- `sf_create_custom_metadata_type` — Create Custom Metadata Types (__mdt)
|
|
13
|
+
- `sf_create_custom_metadata_record` — Create records for Custom Metadata Types
|
|
14
|
+
- `sf_create_custom_label` — Create or update Custom Labels
|
|
15
|
+
- `sf_create_custom_setting` — Create Hierarchy or List Custom Settings
|
|
16
|
+
- `sf_create_global_value_set` — Create shared picklists (Global Value Sets)
|
|
17
|
+
- `sf_create_record_type` — Create Record Types with picklist mappings
|
|
18
|
+
- `sf_create_business_process` — Create Business Processes for Opp/Lead/Case
|
|
19
|
+
- `sf_create_page_layout` — Create Page Layouts with sections and related lists
|
|
20
|
+
- `sf_create_sharing_rule` — Create criteria and ownership sharing rules
|
|
21
|
+
- `sf_create_field_dependency` — Create controlling/dependent picklist relationships
|
|
22
|
+
|
|
23
|
+
#### Automation
|
|
24
|
+
- `sf_create_email_alert` — Create Workflow Email Alert actions
|
|
25
|
+
- `sf_create_platform_event` — Create Platform Event objects (__e)
|
|
26
|
+
- `sf_create_assignment_rule` — Create Lead/Case assignment rules
|
|
27
|
+
- `sf_create_escalation_rule` — Create Case escalation rules
|
|
28
|
+
- `sf_create_auto_response_rule` — Create auto-response rules for Web-to-Lead/Case
|
|
29
|
+
- `sf_create_matching_rule` — Create matching rules for duplicate detection
|
|
30
|
+
- `sf_create_duplicate_rule` — Create duplicate detection rules
|
|
31
|
+
- `sf_create_apex_email_service` — Create inbound email services
|
|
32
|
+
- `sf_create_scheduled_job` — Schedule Apex classes via cron expressions
|
|
33
|
+
|
|
34
|
+
#### Security & Access
|
|
35
|
+
- `sf_create_permission_set` — Create Permission Sets with full permissions config
|
|
36
|
+
- `sf_create_role` — Create roles in the role hierarchy
|
|
37
|
+
- `sf_create_queue` — Create queues with members and supported objects
|
|
38
|
+
- `sf_create_named_credential` — Create Named Credentials for callouts
|
|
39
|
+
|
|
40
|
+
#### UI & Experience
|
|
41
|
+
- `sf_create_lightning_app` — Create Lightning Apps with nav/utility bars
|
|
42
|
+
- `sf_create_tab` — Create Custom Tabs for objects
|
|
43
|
+
- `sf_create_compact_layout` — Create Compact Layouts
|
|
44
|
+
- `sf_create_list_view` — Create List Views with filters and columns
|
|
45
|
+
- `sf_create_email_template` — Create HTML/text email templates
|
|
46
|
+
- `sf_create_static_resource` — Deploy Static Resources from text content
|
|
47
|
+
- `sf_create_custom_notification_type` — Create Custom Notification Types
|
|
48
|
+
- `sf_create_report_type` — Create Custom Report Types
|
|
49
|
+
- `sf_create_dashboard` — Create Dashboards with components
|
|
50
|
+
|
|
51
|
+
#### Apex Development
|
|
52
|
+
- `sf_create_apex_class` — Deploy any Apex class via zip-based Metadata API
|
|
53
|
+
- `sf_create_apex_trigger` — Deploy Apex triggers
|
|
54
|
+
- `sf_create_apex_test_class` — Deploy test classes with optional auto-run
|
|
55
|
+
- `sf_run_apex_tests` — Run test classes and get pass/fail results
|
|
56
|
+
- `sf_execute_anonymous_apex` — Execute anonymous Apex via Tooling API
|
|
57
|
+
|
|
58
|
+
#### LWC Development
|
|
59
|
+
- `sf_create_lwc` — Deploy Lightning Web Components (HTML + JS + CSS)
|
|
60
|
+
- `sf_update_lwc` — Update existing LWC components
|
|
61
|
+
|
|
62
|
+
#### Experience Cloud
|
|
63
|
+
- `sf_create_experience_site` — Create Experience Cloud sites
|
|
64
|
+
- `sf_create_experience_page` — Create pages within Experience sites
|
|
65
|
+
|
|
66
|
+
#### Agentforce
|
|
67
|
+
- `sf_create_agent` — Create Agentforce Einstein Copilot agents
|
|
68
|
+
- `sf_create_agent_topic` — Create Agent Topics with instructions
|
|
69
|
+
- `sf_create_agent_action` — Create Agent Actions linked to Flows/Apex
|
|
70
|
+
|
|
71
|
+
#### External Integrations
|
|
72
|
+
- `sf_create_connected_app` — Create OAuth Connected Apps
|
|
73
|
+
- `sf_create_external_data_source` — Create External Data Sources
|
|
74
|
+
- `sf_create_external_object` — Create External Objects (__x)
|
|
75
|
+
- `sf_create_remote_site_setting` — Whitelist external URLs for callouts
|
|
76
|
+
- `sf_create_csp_setting` — Create CSP trusted sites
|
|
77
|
+
|
|
78
|
+
#### Change Sets & Deployment
|
|
79
|
+
- `sf_create_outbound_change_set` — Create Outbound Change Sets
|
|
80
|
+
- `sf_add_to_change_set` — Add components to change sets
|
|
81
|
+
- `sf_deploy_metadata` — Deploy metadata via SOAP Metadata API
|
|
82
|
+
- `sf_check_deploy_status` — Check deployment job status
|
|
83
|
+
- `sf_retrieve_metadata` — Retrieve metadata from the org
|
|
84
|
+
|
|
85
|
+
#### MCP Server Management
|
|
86
|
+
- `sf_create_mcp_server` — Generate new MCP server projects on disk
|
|
87
|
+
- `sf_create_mcp_tool` — Add tools to existing MCP servers
|
|
88
|
+
- `sf_list_mcp_tools` — List tools in an MCP server project
|
|
89
|
+
|
|
90
|
+
### Enhanced Tools
|
|
91
|
+
- `sf_create_flow` — Now supports advanced elements: Decision, GetRecords, CreateRecords, DeleteRecords, SendEmailAlert, ApexAction, Subflow, Loop, Assignment, Screen, Wait, Platform Event via `elements` array
|
|
92
|
+
|
|
93
|
+
### Infrastructure Changes
|
|
94
|
+
- Added `jszip` dependency for zip-based deployment (Apex, LWC, Static Resources)
|
|
95
|
+
- Split tools into category files: `objects.ts`, `automation.ts`, `security.ts`, `ui.ts`, `apex.ts`, `lwc.ts`, `experience.ts`, `agentforce.ts`, `deployment.ts`, `mcp.ts`, `integrations.ts`
|
|
96
|
+
- Added service modules: `deployment.ts` (zip/SOAP deploy), `tooling.ts` (Tooling API), `mcpgen.ts` (file generation)
|
|
97
|
+
- Updated server name to `salesforce-metadata-mcp`
|
|
98
|
+
- Updated API version to `62.0`
|
|
99
|
+
- Added HTTP transport health check endpoint
|
|
100
|
+
|
|
101
|
+
### Documentation
|
|
102
|
+
- Added `README.md` with all 60+ tools and example prompts
|
|
103
|
+
- Added `SETUP.md` with complete authentication setup guide
|
|
104
|
+
- Added `TOOLS.md` with full parameter documentation
|
|
105
|
+
- Added `AGENTFORCE.md` with end-to-end Agentforce guide
|
|
106
|
+
- Added `APEX_LWC.md` with Apex and LWC development guide
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## [1.0.0] - 2025-01-01
|
|
111
|
+
|
|
112
|
+
### Initial Release
|
|
113
|
+
|
|
114
|
+
- `sf_create_custom_object` — Create custom objects
|
|
115
|
+
- `sf_create_custom_field` — Create custom fields (all types)
|
|
116
|
+
- `sf_add_picklist_values` — Add picklist values
|
|
117
|
+
- `sf_create_flow` — Create Flows (basic)
|
|
118
|
+
- `sf_create_approval_process` — Create Approval Processes
|
|
119
|
+
- `sf_create_validation_rule` — Create Validation Rules
|
|
120
|
+
- `sf_create_workflow_field_update` — Create Workflow Field Updates
|
package/README.md
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# salesforce-metadata-mcp
|
|
2
|
+
|
|
3
|
+
[](https://npmjs.com/package/salesforce-metadata-mcp)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](https://modelcontextprotocol.io)
|
|
6
|
+
|
|
7
|
+
**The most comprehensive Salesforce metadata and development MCP server.** 60+ tools for building, configuring, and automating Salesforce orgs directly from Claude or any MCP client.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx salesforce-metadata-mcp
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or install globally:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install -g salesforce-metadata-mcp
|
|
21
|
+
salesforce-metadata-mcp
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Configuration (Claude Desktop / Claude Code)
|
|
27
|
+
|
|
28
|
+
Add to your MCP configuration (`claude_desktop_config.json` or `.claude/settings.json`):
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"mcpServers": {
|
|
33
|
+
"salesforce": {
|
|
34
|
+
"command": "npx",
|
|
35
|
+
"args": ["salesforce-metadata-mcp"],
|
|
36
|
+
"env": {
|
|
37
|
+
"SF_INSTANCE_URL": "https://your-org.salesforce.com",
|
|
38
|
+
"SF_ACCESS_TOKEN": "your_access_token"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
See [SETUP.md](SETUP.md) for all authentication methods and detailed setup instructions.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Tools (60+)
|
|
50
|
+
|
|
51
|
+
### Objects & Fields
|
|
52
|
+
| Tool | Description |
|
|
53
|
+
|------|-------------|
|
|
54
|
+
| `sf_create_custom_object` | Create a custom object with all settings |
|
|
55
|
+
| `sf_create_custom_field` | Create a field on any object (all types) |
|
|
56
|
+
| `sf_add_picklist_values` | Add values to existing picklist fields |
|
|
57
|
+
| `sf_create_custom_metadata_type` | Create a Custom Metadata Type (__mdt) |
|
|
58
|
+
| `sf_create_custom_metadata_record` | Create records for a Custom Metadata Type |
|
|
59
|
+
| `sf_create_custom_label` | Create or update Custom Labels |
|
|
60
|
+
| `sf_create_custom_setting` | Create Hierarchy or List Custom Settings |
|
|
61
|
+
| `sf_create_global_value_set` | Create shared picklist usable across objects |
|
|
62
|
+
| `sf_create_record_type` | Create Record Types with picklist overrides |
|
|
63
|
+
| `sf_create_business_process` | Create Business Processes for Opp/Lead/Case |
|
|
64
|
+
| `sf_create_page_layout` | Create Page Layouts with sections and fields |
|
|
65
|
+
| `sf_create_sharing_rule` | Create criteria or ownership sharing rules |
|
|
66
|
+
| `sf_create_field_dependency` | Create controlling/dependent picklist dependency |
|
|
67
|
+
|
|
68
|
+
### Automation
|
|
69
|
+
| Tool | Description |
|
|
70
|
+
|------|-------------|
|
|
71
|
+
| `sf_create_flow` | Create any Flow type with advanced elements |
|
|
72
|
+
| `sf_create_approval_process` | Create multi-step approval processes |
|
|
73
|
+
| `sf_create_validation_rule` | Create data validation rules |
|
|
74
|
+
| `sf_create_workflow_field_update` | Create workflow field update actions |
|
|
75
|
+
| `sf_create_email_alert` | Create workflow email alert actions |
|
|
76
|
+
| `sf_create_platform_event` | Create Platform Event objects |
|
|
77
|
+
| `sf_create_assignment_rule` | Create Lead/Case assignment rules |
|
|
78
|
+
| `sf_create_escalation_rule` | Create Case escalation rules |
|
|
79
|
+
| `sf_create_auto_response_rule` | Create Web-to-Lead/Case auto-response rules |
|
|
80
|
+
| `sf_create_matching_rule` | Create duplicate matching rules |
|
|
81
|
+
| `sf_create_duplicate_rule` | Create duplicate detection rules |
|
|
82
|
+
| `sf_create_apex_email_service` | Create inbound Apex email services |
|
|
83
|
+
| `sf_create_scheduled_job` | Schedule an Apex class via cron |
|
|
84
|
+
|
|
85
|
+
### Security & Access
|
|
86
|
+
| Tool | Description |
|
|
87
|
+
|------|-------------|
|
|
88
|
+
| `sf_create_permission_set` | Create Permission Sets with all permissions |
|
|
89
|
+
| `sf_create_role` | Create roles in the role hierarchy |
|
|
90
|
+
| `sf_create_queue` | Create queues with members and objects |
|
|
91
|
+
| `sf_create_named_credential` | Create Named Credentials for callouts |
|
|
92
|
+
|
|
93
|
+
### UI & Experience
|
|
94
|
+
| Tool | Description |
|
|
95
|
+
|------|-------------|
|
|
96
|
+
| `sf_create_lightning_app` | Create Lightning Apps with nav/utility bars |
|
|
97
|
+
| `sf_create_tab` | Create Custom Tabs for objects |
|
|
98
|
+
| `sf_create_compact_layout` | Create Compact Layouts (highlights panel) |
|
|
99
|
+
| `sf_create_list_view` | Create List Views with filters and columns |
|
|
100
|
+
| `sf_create_email_template` | Create HTML/text email templates |
|
|
101
|
+
| `sf_create_static_resource` | Create Static Resources from text content |
|
|
102
|
+
| `sf_create_custom_notification_type` | Create Custom Notification Types |
|
|
103
|
+
| `sf_create_report_type` | Create Custom Report Types |
|
|
104
|
+
| `sf_create_dashboard` | Create Dashboards with components |
|
|
105
|
+
|
|
106
|
+
### Apex Development
|
|
107
|
+
| Tool | Description |
|
|
108
|
+
|------|-------------|
|
|
109
|
+
| `sf_create_apex_class` | Deploy any Apex class to the org |
|
|
110
|
+
| `sf_create_apex_trigger` | Deploy an Apex trigger on any object |
|
|
111
|
+
| `sf_create_apex_test_class` | Deploy test classes, optionally run tests |
|
|
112
|
+
| `sf_run_apex_tests` | Run test classes and get pass/fail results |
|
|
113
|
+
| `sf_execute_anonymous_apex` | Execute anonymous Apex and see output |
|
|
114
|
+
|
|
115
|
+
### LWC Development
|
|
116
|
+
| Tool | Description |
|
|
117
|
+
|------|-------------|
|
|
118
|
+
| `sf_create_lwc` | Deploy a full LWC with HTML, JS, CSS |
|
|
119
|
+
| `sf_update_lwc` | Update an existing LWC component |
|
|
120
|
+
|
|
121
|
+
### Experience Cloud
|
|
122
|
+
| Tool | Description |
|
|
123
|
+
|------|-------------|
|
|
124
|
+
| `sf_create_experience_site` | Create Experience Cloud sites |
|
|
125
|
+
| `sf_create_experience_page` | Create pages within Experience sites |
|
|
126
|
+
|
|
127
|
+
### Agentforce
|
|
128
|
+
| Tool | Description |
|
|
129
|
+
|------|-------------|
|
|
130
|
+
| `sf_create_agent` | Create Agentforce Agents |
|
|
131
|
+
| `sf_create_agent_topic` | Create Agent Topics with instructions |
|
|
132
|
+
| `sf_create_agent_action` | Create Agent Actions linked to Flows/Apex |
|
|
133
|
+
|
|
134
|
+
### External Integrations
|
|
135
|
+
| Tool | Description |
|
|
136
|
+
|------|-------------|
|
|
137
|
+
| `sf_create_connected_app` | Create OAuth Connected Apps |
|
|
138
|
+
| `sf_create_external_data_source` | Create External Data Sources for Connect |
|
|
139
|
+
| `sf_create_external_object` | Create External Objects (__x) |
|
|
140
|
+
| `sf_create_remote_site_setting` | Whitelist external URLs for callouts |
|
|
141
|
+
| `sf_create_csp_setting` | Create CSP trusted sites for LWC |
|
|
142
|
+
|
|
143
|
+
### Change Sets & Deployment
|
|
144
|
+
| Tool | Description |
|
|
145
|
+
|------|-------------|
|
|
146
|
+
| `sf_create_outbound_change_set` | Create Outbound Change Sets |
|
|
147
|
+
| `sf_add_to_change_set` | Add components to a change set |
|
|
148
|
+
| `sf_deploy_metadata` | Deploy metadata via Metadata API |
|
|
149
|
+
| `sf_check_deploy_status` | Check deployment job status |
|
|
150
|
+
| `sf_retrieve_metadata` | Retrieve metadata from the org |
|
|
151
|
+
|
|
152
|
+
### MCP Server Management
|
|
153
|
+
| Tool | Description |
|
|
154
|
+
|------|-------------|
|
|
155
|
+
| `sf_create_mcp_server` | Generate a new MCP server project on disk |
|
|
156
|
+
| `sf_create_mcp_tool` | Add a new tool to an existing MCP server |
|
|
157
|
+
| `sf_list_mcp_tools` | List all tools in an MCP server project |
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Example Prompts
|
|
162
|
+
|
|
163
|
+
**Build a complete object:**
|
|
164
|
+
> "Create a custom object called Project__c with fields: Name (text), Status__c (picklist: Planning/Active/Complete), Budget__c (currency), then add a validation rule requiring Budget when Status is Active."
|
|
165
|
+
|
|
166
|
+
**Deploy Apex:**
|
|
167
|
+
> "Create an Apex class called OpportunityService that queries all Opps with Amount > 100000. Then create a test class for it."
|
|
168
|
+
|
|
169
|
+
**Create a flow:**
|
|
170
|
+
> "Create a record-triggered flow on Opportunity that fires after save when Stage = Closed Won. Send an email alert to the owner and create a follow-up Task due in 30 days."
|
|
171
|
+
|
|
172
|
+
**Set up an LWC:**
|
|
173
|
+
> "Create a Lightning Web Component called accountSummary that displays account name, industry, and annual revenue. Make it available on Record Pages."
|
|
174
|
+
|
|
175
|
+
**Agentforce setup:**
|
|
176
|
+
> "Create an Agentforce agent called SalesAssistant with a topic for Order Management."
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Environment Variables
|
|
181
|
+
|
|
182
|
+
| Variable | Description | Required |
|
|
183
|
+
|----------|-------------|----------|
|
|
184
|
+
| `SF_INSTANCE_URL` | Your org URL (e.g. https://org.salesforce.com) | Always |
|
|
185
|
+
| `SF_CLIENT_ID` | Connected App client ID | For OAuth |
|
|
186
|
+
| `SF_CLIENT_SECRET` | Connected App client secret | For OAuth |
|
|
187
|
+
| `SF_REFRESH_TOKEN` | OAuth refresh token | For OAuth |
|
|
188
|
+
| `SF_ALIAS` | Salesforce CLI org alias | For CLI |
|
|
189
|
+
| `SF_ACCESS_TOKEN` | Static access token (expires ~1hr) | For static |
|
|
190
|
+
| `PORT` | HTTP server port (default: 3000) | For HTTP mode |
|
|
191
|
+
| `TRANSPORT` | `stdio` or `http` (default: stdio) | Optional |
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Documentation
|
|
196
|
+
|
|
197
|
+
- [SETUP.md](SETUP.md) — Prerequisites, authentication, Claude configuration
|
|
198
|
+
- [TOOLS.md](TOOLS.md) — All 60+ tools with full parameter documentation
|
|
199
|
+
- [AGENTFORCE.md](AGENTFORCE.md) — Agentforce agent creation guide
|
|
200
|
+
- [APEX_LWC.md](APEX_LWC.md) — Apex and LWC development guide
|
|
201
|
+
- [CHANGELOG.md](CHANGELOG.md) — Version history
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## License
|
|
206
|
+
|
|
207
|
+
MIT
|