@salesforce/vite-plugin-lwc-ui-bundle 2.2.0 → 3.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/docs/consumer-guide.md +12 -0
- package/package.json +4 -4
- package/skills/test-mcp-server/README.md +93 -0
- package/skills/test-mcp-server/SKILL.md +491 -0
- package/skills/test-mcp-server/default-test-server-config.sh +45 -0
- package/skills/test-mcp-server/references/eca-setup.md +58 -0
- package/skills/test-mcp-server/references/testing-methods.md +313 -0
- package/skills/test-mcp-server/references/troubleshooting.md +124 -0
package/docs/consumer-guide.md
CHANGED
|
@@ -290,6 +290,18 @@ npm run preview
|
|
|
290
290
|
# Open http://localhost:4173
|
|
291
291
|
```
|
|
292
292
|
|
|
293
|
+
### Step 6: Validate via MCP Server (optional)
|
|
294
|
+
|
|
295
|
+
Once `dist/index.html` builds clean, you can validate the compiled bundle end-to-end by serving it through agentic-api-service and exercising it from MCP Inspector / MCP Jam / ChatGPT — closer to production than the local mock path. The `test-mcp-server` skill bundled with this plugin walks through the setup interactively (sfdc-bazel checkout, OrgFarm or Falcon test org, OAuth token generation, swapping your bundle into a UI-resource path, and connecting a test client).
|
|
296
|
+
|
|
297
|
+
The skill lives at [`packages/vite-plugin-lwc-ui-bundle/skills/test-mcp-server/`](https://github.com/salesforce-experience-platform-emu/webapps/tree/main/packages/vite-plugin-lwc-ui-bundle/skills/test-mcp-server) in this repo. Install it the same way you'd install `setup-lwc-vite-plugin`:
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
cp -r node_modules/@salesforce/vite-plugin-lwc-ui-bundle/skills/test-mcp-server ~/.claude/skills/
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
Then run `/test-mcp-server` from Claude Code and answer the prompts. The skill is opinionated about the agentic-api-service path; teams using a different MCP host should treat it as a reference rather than a turnkey solution.
|
|
304
|
+
|
|
293
305
|
---
|
|
294
306
|
|
|
295
307
|
## Common Errors
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/vite-plugin-lwc-ui-bundle",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Vite plugin for compiling LWC components into static bundles for off-platform and MCP use",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "Salesforce",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@lwc/rollup-plugin": "^9.0.0",
|
|
57
|
-
"@salesforce/platform-sdk-chat": "^
|
|
58
|
-
"@salesforce/ui-bundle": "^
|
|
57
|
+
"@salesforce/platform-sdk-chat": "^3.0.0",
|
|
58
|
+
"@salesforce/ui-bundle": "^3.0.0",
|
|
59
59
|
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0",
|
|
60
60
|
"zod": "^3.23.8"
|
|
61
61
|
},
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@conduit-client/bindings-utils": "3.19.3",
|
|
77
77
|
"@conduit-client/command-base": "3.19.3",
|
|
78
|
-
"@salesforce/platform-sdk-chat": "^
|
|
78
|
+
"@salesforce/platform-sdk-chat": "^3.0.0",
|
|
79
79
|
"typescript": "^5.9.3",
|
|
80
80
|
"vite": "^7.0.0",
|
|
81
81
|
"vite-plugin-dts": "^4.5.4",
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Test MCP Server Skill
|
|
2
|
+
|
|
3
|
+
An interactive skill for testing MCP servers accessed through the agentic-api-service, including both Core-hosted servers and off-core file-based servers defined in sfdc-bazel.
|
|
4
|
+
|
|
5
|
+
> **Maturity note:** This skill is checked in here so the `vite-plugin-lwc-ui-bundle` workflow has a documented path for validating compiled bundles end-to-end through agentic-api-service. It has been used by the original author against `agentforce-sales` and the default test1 org, but it is **not fully exercised** across every scenario it claims to cover. Treat it as a working starting point; ideally the MCP team owns and maintains a canonical version going forward.
|
|
6
|
+
|
|
7
|
+
## What This Skill Does
|
|
8
|
+
|
|
9
|
+
This skill provides step-by-step guidance through the complete workflow for testing MCP servers. It covers:
|
|
10
|
+
|
|
11
|
+
- Environment detection (Core-hosted vs off-core file-based)
|
|
12
|
+
- Repository setup (sfdc-bazel clone and initialization)
|
|
13
|
+
- Org setup (OrgFarm, External Client App, org perms)
|
|
14
|
+
- MCP server activation (Core-hosted) or server definition discovery (off-core)
|
|
15
|
+
- OAuth token generation
|
|
16
|
+
- Service building and startup with Bazel
|
|
17
|
+
- Testing with curl, MCP Inspector, and ChatGPT
|
|
18
|
+
|
|
19
|
+
## When to Use This Skill
|
|
20
|
+
|
|
21
|
+
Use this skill when you need to:
|
|
22
|
+
|
|
23
|
+
- Test changes to MCP server code, tools, or resources
|
|
24
|
+
- Set up a testing environment for Core-hosted or off-core MCP servers
|
|
25
|
+
- Debug MCP server behavior with access to server logs
|
|
26
|
+
- Validate end-to-end integration with MCP Inspector or ChatGPT
|
|
27
|
+
|
|
28
|
+
**Supported workflows:**
|
|
29
|
+
|
|
30
|
+
- ✅ Core-hosted MCP server — local Core/workspace development (testing code changes in Core)
|
|
31
|
+
- ✅ Core-hosted MCP server — Falcon test org (testing already-deployed servers via MCP Inspector)
|
|
32
|
+
- ✅ Off-core file-based servers/tools in sfdc-bazel (e.g., agentforce-sales)
|
|
33
|
+
|
|
34
|
+
## Skill Structure
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
test-mcp-server/
|
|
38
|
+
├── SKILL.md — Main skill (interactive workflow)
|
|
39
|
+
├── default-test-server-config.sh — Template for OAuth credentials (placeholder values; fill in your own ECA's Client ID/Secret before sourcing)
|
|
40
|
+
├── README.md
|
|
41
|
+
└── references/
|
|
42
|
+
├── eca-setup.md — External Client App setup + genoauth.sh template
|
|
43
|
+
├── testing-methods.md — Detailed curl, MCP Inspector, ChatGPT guides
|
|
44
|
+
└── troubleshooting.md — Troubleshooting, checklists, key points
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## How to Install
|
|
48
|
+
|
|
49
|
+
The skill ships with `@salesforce/vite-plugin-lwc-ui-bundle`. After
|
|
50
|
+
`npm install @salesforce/vite-plugin-lwc-ui-bundle` in your project,
|
|
51
|
+
copy the skill into Claude Code's skills directory:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
cp -r node_modules/@salesforce/vite-plugin-lwc-ui-bundle/skills/test-mcp-server ~/.claude/skills/
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Re-run this whenever you upgrade the plugin so the skill stays current.
|
|
58
|
+
|
|
59
|
+
Then fill in your own org's credentials in
|
|
60
|
+
`~/.claude/skills/test-mcp-server/default-test-server-config.sh`
|
|
61
|
+
(see `references/eca-setup.md` for how to set up an External Client
|
|
62
|
+
App and where to find the Consumer Key + Secret). Do **not** commit
|
|
63
|
+
filled-in credentials back to a public repo.
|
|
64
|
+
|
|
65
|
+
## How to Use
|
|
66
|
+
|
|
67
|
+
Once installed, the skill triggers automatically when you mention:
|
|
68
|
+
|
|
69
|
+
- "test mcp server"
|
|
70
|
+
- "test mcp tool"
|
|
71
|
+
- "sfdc-bazel mcp"
|
|
72
|
+
- "agentic-api-service"
|
|
73
|
+
- Or explicitly invoke it: `/skill test-mcp-server`
|
|
74
|
+
|
|
75
|
+
The skill uses the `AskUserQuestion` tool to guide you through each step interactively, waiting for your input before proceeding.
|
|
76
|
+
|
|
77
|
+
## Prerequisites
|
|
78
|
+
|
|
79
|
+
- Access to sfdc-bazel repository (for local Core/workspace and off-core development)
|
|
80
|
+
- OrgFarm access for org creation (local Core development)
|
|
81
|
+
- An org with External Client App for OAuth (all scenarios)
|
|
82
|
+
- ChatGPT Enterprise license (for ChatGPT testing method)
|
|
83
|
+
- ngrok installed (for ChatGPT testing method)
|
|
84
|
+
|
|
85
|
+
## Testing Methods Supported
|
|
86
|
+
|
|
87
|
+
1. **curl** — Quick command-line verification (recommended for initial testing)
|
|
88
|
+
2. **MCP Inspector** — Interactive GUI testing with tool/resource exploration
|
|
89
|
+
3. **ChatGPT** — Production validation with natural language interaction (requires ngrok)
|
|
90
|
+
|
|
91
|
+
## Feedback
|
|
92
|
+
|
|
93
|
+
If you encounter issues or have suggestions for improvement, please share feedback with the skill creator.
|
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-mcp-server
|
|
3
|
+
description: Use this skill for testing MCP servers via the agentic-api-service. Supports (1) Core-hosted MCP servers — both local Core/workspace development and Falcon test orgs via MCP Inspector, and (2) off-core file-based MCP servers and tools defined in sfdc-bazel (e.g., agentforce-sales with server/tool/resource JSON definitions). Covers org setup, OAuth configuration, and testing with curl/MCP Inspector/ChatGPT. Always use when user mentions MCP server testing, MCP tool testing, sfdc-bazel setup, agentic-api-service, or MCP Inspector setup.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Test MCP Server
|
|
7
|
+
|
|
8
|
+
This skill guides you through testing MCP servers accessed through the agentic-api-service, including both Core-hosted servers and off-core file-based servers defined in sfdc-bazel.
|
|
9
|
+
|
|
10
|
+
## How to Use This Skill
|
|
11
|
+
|
|
12
|
+
Use the **AskUserQuestion tool** at decision points, then actively help the user execute each step by running commands and creating files together.
|
|
13
|
+
|
|
14
|
+
**Key principles:**
|
|
15
|
+
|
|
16
|
+
- Present one question at a time using AskUserQuestion
|
|
17
|
+
- After receiving the answer, actively execute that step (run commands via Bash tool, create files, etc.)
|
|
18
|
+
- Only proceed to the next question after completing the current step
|
|
19
|
+
|
|
20
|
+
## When to Use This Workflow
|
|
21
|
+
|
|
22
|
+
**✅ Fully Supported — two scenarios:**
|
|
23
|
+
|
|
24
|
+
1. **Core-hosted MCP Server:** For testing MCP servers or tools defined in Core.
|
|
25
|
+
- **Local Core/workspace:** Developing or modifying servers/tools with code changes in Core. **Requires:** sfdc-bazel project + local Core/workspace running.
|
|
26
|
+
- **Falcon test org:** Testing already-deployed Core-hosted servers without code changes. **Does NOT require:** sfdc-bazel project.
|
|
27
|
+
- The workflow will ask which environment you're using after you select this option.
|
|
28
|
+
|
|
29
|
+
2. **Off-Core File-Based Servers/Tools:** For testing **existing MCP servers and tools defined in sfdc-bazel** (not in Core).
|
|
30
|
+
- Modifying existing off-core MCP servers (`*.server.json`), tools (`*.tool.json`), or resources (`*.resource.json`)
|
|
31
|
+
- Working with servers like `agentforce-sales`, `education-cloud`, `manufacturing-cloud`, etc.
|
|
32
|
+
- Definitions live in `agentic-api-service-shared/src/main/resources/mcp/`
|
|
33
|
+
- **Requires:** sfdc-bazel project + an org for OAuth (but NOT local Core/workspace)
|
|
34
|
+
- **Does NOT require:** MCP server activation in Setup (file-based servers load automatically)
|
|
35
|
+
- ⚠️ Off-core file-based is NOT the recommended approach for new MCP servers/tools. For new development, use the Core-hosted approach instead.
|
|
36
|
+
|
|
37
|
+
## Interactive Workflow
|
|
38
|
+
|
|
39
|
+
### Step 1: Determine Testing Environment
|
|
40
|
+
|
|
41
|
+
Use AskUserQuestion:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
Question: "What type of MCP server/tool are you testing?"
|
|
45
|
+
Options:
|
|
46
|
+
- "Core-hosted MCP server (server/tool defined in Core)"
|
|
47
|
+
- "Off-core file-based MCP server/tool (defined in sfdc-bazel, e.g., agentforce-sales)"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**If "Off-core file-based":**
|
|
51
|
+
|
|
52
|
+
Explain: "You're testing an off-core MCP server or tool defined in sfdc-bazel. You'll need the sfdc-bazel project to build and run the agentic-api-service, plus an org for OAuth authentication. You do NOT need a local Core server running."
|
|
53
|
+
|
|
54
|
+
⚠️ For new MCP servers/tools, the recommended approach is Core-hosted. Off-core file-based is for existing servers already defined in sfdc-bazel.
|
|
55
|
+
|
|
56
|
+
Proceed to **Step 2-OffCore**.
|
|
57
|
+
|
|
58
|
+
**If "Core-hosted":**
|
|
59
|
+
|
|
60
|
+
Use AskUserQuestion:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
Question: "Where is your Core server running?"
|
|
64
|
+
Options:
|
|
65
|
+
- "Local Core or workspace (testing code changes in Core)"
|
|
66
|
+
- "Falcon test org (testing already-deployed Core-hosted server)"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
- **If "Falcon test org":** Proceed to **Step 2-Falcon**.
|
|
70
|
+
- **If "Local Core or workspace":**
|
|
71
|
+
- Explain: "You'll need the sfdc-bazel project to build and run the agentic-api-service locally."
|
|
72
|
+
- ⚠️ Make sure your **Core server is running** before creating an org.
|
|
73
|
+
- Proceed to **Step 2-Local**.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
### Step 2-Local: Repository Setup
|
|
78
|
+
|
|
79
|
+
Use AskUserQuestion:
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
Question: "Do you already have the sfdc-bazel repo cloned?"
|
|
83
|
+
Options:
|
|
84
|
+
- "Yes, I have it cloned"
|
|
85
|
+
- "No, I need to clone it"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**If "Yes":** Ask for the path, verify it exists, and set working directory.
|
|
89
|
+
|
|
90
|
+
**If "No":**
|
|
91
|
+
|
|
92
|
+
1. Ask where to clone (suggest `~/git/sfdc-bazel`)
|
|
93
|
+
2. Guide: `git clone https://git.soma.salesforce.com/services/sfdc-bazel`
|
|
94
|
+
|
|
95
|
+
**Then check if Bazel build environment is set up:**
|
|
96
|
+
|
|
97
|
+
Use AskUserQuestion:
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
Question: "Have you run ./monorepo_setup.sh -i in the sfdc-bazel repo? This sets up the Bazel build environment, downloads dependencies, and configures toolchains."
|
|
101
|
+
Options:
|
|
102
|
+
- "Yes, already done"
|
|
103
|
+
- "No, not yet"
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**If "No":** Explain they need to run `./monorepo_setup.sh -i` in the sfdc-bazel root. It may take several minutes.
|
|
107
|
+
|
|
108
|
+
After initialization, proceed to **Step 3-Local**.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
### Step 2-Falcon: Falcon Test Org Setup
|
|
113
|
+
|
|
114
|
+
#### 2-Falcon.1: Enable MCP Service in Org
|
|
115
|
+
|
|
116
|
+
Guide them:
|
|
117
|
+
|
|
118
|
+
1. Navigate to **Setup → Einstein Setup** and verify Einstein is turned on
|
|
119
|
+
2. Enable **"MCPService"** org perm
|
|
120
|
+
3. Enable **"MContentInternalApi"** org perm
|
|
121
|
+
|
|
122
|
+
💡 If "MCP Servers" page is not visible after enabling the org perm, also enable `AgentforceMcpSupportPilot` and `ApiCatalogMcpPilot`.
|
|
123
|
+
|
|
124
|
+
Use AskUserQuestion:
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
Question: "Can you see 'MCP Servers' in Setup after enabling MCPService org perm?"
|
|
128
|
+
Options:
|
|
129
|
+
- "Yes, I can see it"
|
|
130
|
+
- "No, it's not showing"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**If "No":** Guide them to enable the additional org perms listed above.
|
|
134
|
+
|
|
135
|
+
#### 2-Falcon.2: Activate MCP Server
|
|
136
|
+
|
|
137
|
+
Guide them:
|
|
138
|
+
|
|
139
|
+
1. Navigate to **Setup → MCP Servers**
|
|
140
|
+
2. Find and click on their server
|
|
141
|
+
3. Click **Activate**
|
|
142
|
+
|
|
143
|
+
Ask: "Which MCP server are you testing?"
|
|
144
|
+
|
|
145
|
+
Ask: "What is the Server URL shown on the MCP server details page?"
|
|
146
|
+
|
|
147
|
+
💡 Example: `https://test.api.salesforce.com/platform/mcp/v1/platform/records`
|
|
148
|
+
|
|
149
|
+
Extract apiDomainName and serverName from the URL format: `https://[domain]/platform/mcp/v1/<apiDomainName>/<serverName>`
|
|
150
|
+
|
|
151
|
+
⚠️ **Troubleshooting:** If `v1` doesn't work when testing, try replacing with `v1-beta.2`.
|
|
152
|
+
|
|
153
|
+
#### 2-Falcon.3: Enable Required Org Perms (If Needed)
|
|
154
|
+
|
|
155
|
+
Use AskUserQuestion:
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
Question: "Does your MCP server require any specific org perms?"
|
|
159
|
+
Options:
|
|
160
|
+
- "Yes, I know which perms are needed"
|
|
161
|
+
- "No, or I'm not sure"
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Guide accordingly (e.g., `LightningTypesMcpIntegration` for `lightning-type-sample-server`).
|
|
165
|
+
|
|
166
|
+
#### 2-Falcon.4: Setup OAuth for Token Generation
|
|
167
|
+
|
|
168
|
+
Use AskUserQuestion:
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
Question: "Do you already have an External Client App (ECA) set up for OAuth?"
|
|
172
|
+
Options:
|
|
173
|
+
- "Yes, I have an ECA"
|
|
174
|
+
- "No, I need to create one"
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**If "Yes":**
|
|
178
|
+
|
|
179
|
+
Load the default test server config and show it to the user for confirmation. Use Bash tool to run:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
source ~/.claude/skills/test-mcp-server/default-test-server-config.sh
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Show the loaded credentials (Client ID, Client Secret, Username, Org URL) and ask: "Are these the correct credentials, or do you want to use different ones?"
|
|
186
|
+
|
|
187
|
+
If the user wants different credentials, ask for:
|
|
188
|
+
|
|
189
|
+
1. Consumer Key (Client ID)
|
|
190
|
+
2. Consumer Secret
|
|
191
|
+
3. Org domain URL (the base URL for OAuth token generation, e.g., `https://your-org.my.salesforce.com`)
|
|
192
|
+
|
|
193
|
+
**If "No":**
|
|
194
|
+
|
|
195
|
+
Read the ECA setup guide at `references/eca-setup.md` and walk the user through creating one. After completion, ask for:
|
|
196
|
+
|
|
197
|
+
1. Consumer Key (Client ID)
|
|
198
|
+
2. Consumer Secret
|
|
199
|
+
3. Org domain URL (the base URL for OAuth token generation, e.g., `https://your-org.my.salesforce.com`)
|
|
200
|
+
|
|
201
|
+
After completing Falcon setup, proceed to **Step 3-Falcon**.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
### Step 2-OffCore: Off-Core File-Based Server Setup
|
|
206
|
+
|
|
207
|
+
#### Understanding Off-Core Server Structure
|
|
208
|
+
|
|
209
|
+
Off-core MCP servers are defined by JSON files in sfdc-bazel at:
|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
projects/services/agentic-api-access/agentic-api-service-shared/src/main/resources/mcp/
|
|
213
|
+
├── servers/ ← *.server.json (server definitions)
|
|
214
|
+
├── tools/ ← *.tool.json (tool definitions)
|
|
215
|
+
└── resources/ ← *.resource.json (UI resource definitions)
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
**Example:** The `agentforce-sales` server is defined in `salescloud.server.json` and references tools like `agentforce-sales.get_record_details`.
|
|
219
|
+
|
|
220
|
+
#### 2-OffCore.1: Repository Setup
|
|
221
|
+
|
|
222
|
+
Follow the same steps as **Step 2-Local** (clone sfdc-bazel and run `./monorepo_setup.sh -i`).
|
|
223
|
+
|
|
224
|
+
#### 2-OffCore.2: Identify the Server and Definitions
|
|
225
|
+
|
|
226
|
+
Ask: "Which off-core MCP server are you testing?"
|
|
227
|
+
|
|
228
|
+
Use Glob tool to search for server definitions:
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
projects/services/agentic-api-access/agentic-api-service-shared/src/main/resources/mcp/servers/*.server.json
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Read the server definition to list its tools and resources. If the user is modifying a tool or resource, help locate the specific file:
|
|
235
|
+
|
|
236
|
+
- Tools: `mcp/tools/<toolName>.tool.json`
|
|
237
|
+
- Resources: `mcp/resources/<resourceName>.resource.json`
|
|
238
|
+
|
|
239
|
+
#### 2-OffCore.3: Org Setup for OAuth
|
|
240
|
+
|
|
241
|
+
Explain: "Off-core servers still need an org for OAuth authentication. You do NOT need a local Core server running."
|
|
242
|
+
|
|
243
|
+
Use AskUserQuestion:
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
Question: "Do you have an org with an External Client App set up for OAuth?"
|
|
247
|
+
Options:
|
|
248
|
+
- "Yes, I have an org and OAuth ready"
|
|
249
|
+
- "No, I need to set up an org"
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**If "Yes":** Ask for org domain URL (the base URL for OAuth token generation), Consumer Key, and Consumer Secret.
|
|
253
|
+
|
|
254
|
+
**If "No":** Read the ECA setup guide at `references/eca-setup.md` and walk the user through it.
|
|
255
|
+
|
|
256
|
+
#### 2-OffCore.4: OAuth Token Generation
|
|
257
|
+
|
|
258
|
+
Check if `genoauth.sh` exists in the sfdc-bazel root.
|
|
259
|
+
|
|
260
|
+
**If it exists:** Read the file and confirm with the user that the org domain URL, Client ID, and Client Secret are correct for the org they want to test against. Update if needed.
|
|
261
|
+
|
|
262
|
+
**If it doesn't exist:** Create it using the template from `references/eca-setup.md` with the user's credentials. Make executable with `chmod +x genoauth.sh`.
|
|
263
|
+
|
|
264
|
+
After confirming credentials, generate and verify the token.
|
|
265
|
+
|
|
266
|
+
#### 2-OffCore.5: Build, Start, and Test
|
|
267
|
+
|
|
268
|
+
Follow the same build/start/test steps as the Local workflow:
|
|
269
|
+
|
|
270
|
+
1. **Build:** Follow **Step 5-Local**
|
|
271
|
+
2. **Start:** Follow **Step 6-Local**
|
|
272
|
+
3. **Test:** Follow **Step 7-Local** and **Detailed Testing Methods** in `references/testing-methods.md`
|
|
273
|
+
|
|
274
|
+
The MCP server URL for off-core servers: `http://localhost:7442/mcp/<apiDomainName>/<serverName>`
|
|
275
|
+
Example: `http://localhost:7442/mcp/salescloud/agentforce-sales`
|
|
276
|
+
|
|
277
|
+
💡 The `apiDomainName` comes from the server definition file name prefix (e.g., `salescloud` from `salescloud.server.json`).
|
|
278
|
+
|
|
279
|
+
**Key differences from Core-hosted:**
|
|
280
|
+
|
|
281
|
+
- Off-core servers load automatically — **no need to activate in Setup → MCP Servers**
|
|
282
|
+
- **No local Core server required** — you only need an org for OAuth
|
|
283
|
+
- If a server doesn't appear: verify `*.server.json` is in the correct directory, rebuild after changes, check service logs
|
|
284
|
+
- For **ChatGPT testing**, ngrok is still required (see `references/testing-methods.md` Method 3)
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
### Step 3-Falcon: Testing Falcon Test Org
|
|
289
|
+
|
|
290
|
+
⚠️ **ChatGPT testing for Falcon test orgs is not yet verified.** Use MCP Inspector for now.
|
|
291
|
+
|
|
292
|
+
Explain: "We'll test your MCP server using MCP Inspector. You don't need agentic-api-service — you'll connect directly to the Salesforce-hosted MCP server."
|
|
293
|
+
|
|
294
|
+
**Generate OAuth Token:**
|
|
295
|
+
|
|
296
|
+
**If using default test server config:**
|
|
297
|
+
|
|
298
|
+
Use Bash tool to run:
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
source ~/.claude/skills/test-mcp-server/default-test-server-config.sh && TOKEN=$(generate_default_token) && echo "$TOKEN" | tr -d '\n' | pbcopy && echo "Token copied to clipboard! First 20 chars: ${TOKEN:0:20}..."
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
**If using custom External Client App:**
|
|
305
|
+
|
|
306
|
+
Check if `genoauth.sh` exists. If not, create it at `~/genoauth.sh` (Falcon users don't have sfdc-bazel) using the template from `references/eca-setup.md` with their credentials. Make executable.
|
|
307
|
+
|
|
308
|
+
Use Bash tool to generate and copy token:
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
TOKEN=$(~/genoauth.sh) && echo "$TOKEN" | tr -d '\n' | pbcopy && echo "Token copied to clipboard! First 20 chars: ${TOKEN:0:20}..."
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
**Launch and configure MCP Inspector:**
|
|
315
|
+
|
|
316
|
+
Follow the Falcon-specific instructions in `references/testing-methods.md` Method 2 (MCP Inspector for Falcon Test Org).
|
|
317
|
+
|
|
318
|
+
After connection, verify tools and resources appear.
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
### Step 3-Local: Org Setup
|
|
323
|
+
|
|
324
|
+
Use AskUserQuestion:
|
|
325
|
+
|
|
326
|
+
```
|
|
327
|
+
Question: "Do you have an org with your MCP server already deployed and activated?"
|
|
328
|
+
Options:
|
|
329
|
+
- "Yes, I have an org ready"
|
|
330
|
+
- "No, I need to set up an org"
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
**If "Yes":**
|
|
334
|
+
|
|
335
|
+
- Ask for org's domain URL (this is the base URL used for OAuth token generation, e.g., `https://orgfarm-[hash].my.salesforce-com.[domain].wc.crm.dev:[port]`)
|
|
336
|
+
- **Validate:** If user provides a `lightning.force.com` URL, explain that's the Lightning UI URL. They need the org's domain URL instead — this is the base URL used to call `/services/oauth2/token` for generating OAuth tokens. They can find it in OrgFarm details or workspace configuration.
|
|
337
|
+
- Verify MCPService org perm is enabled and server is activated
|
|
338
|
+
- Proceed to **Step 4-Local**
|
|
339
|
+
|
|
340
|
+
**If "No":**
|
|
341
|
+
|
|
342
|
+
**3.1: Create Org with OrgFarm**
|
|
343
|
+
|
|
344
|
+
Guide them:
|
|
345
|
+
|
|
346
|
+
1. Start the app server in workspace
|
|
347
|
+
2. Use OrgFarm plugin: Environment=LOCAL_CORE, Cloud=Einstein Generative AI, Farm=AppDevV2, OrgPerm=EinsteinGPTEnabled
|
|
348
|
+
3. Navigate to **Setup → Einstein Setup** and verify Einstein is turned on
|
|
349
|
+
4. Enable **"MCPService"** org perm
|
|
350
|
+
5. Enable **"MContentInternalApi"** org perm
|
|
351
|
+
|
|
352
|
+
When user provides URL, validate it's not a Lightning UI URL.
|
|
353
|
+
|
|
354
|
+
**3.2: Setup External Client App**
|
|
355
|
+
|
|
356
|
+
Read the ECA setup guide at `references/eca-setup.md` and walk the user through it.
|
|
357
|
+
|
|
358
|
+
Ask for the Consumer Key and Consumer Secret when done.
|
|
359
|
+
|
|
360
|
+
**3.3: Activate MCP Server**
|
|
361
|
+
|
|
362
|
+
Guide them:
|
|
363
|
+
|
|
364
|
+
1. Navigate to **Setup → MCP Servers**
|
|
365
|
+
2. Find their server and **Activate** it
|
|
366
|
+
|
|
367
|
+
⚠️ Inactive servers won't appear in the `/mcp/servers` API endpoint. This is the #1 cause of "server not found" errors.
|
|
368
|
+
|
|
369
|
+
Use AskUserQuestion:
|
|
370
|
+
|
|
371
|
+
```
|
|
372
|
+
Question: "Can you see your MCP server in Setup → MCP Servers?"
|
|
373
|
+
Options:
|
|
374
|
+
- "Yes, I can see it"
|
|
375
|
+
- "No, it's not showing up"
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
**If "No":** Check MCPService org perm, verify server is deployed to Core.
|
|
379
|
+
|
|
380
|
+
**If "Yes":** Ask for server name (format: `apiDomainName/serverName`) and confirm it's activated.
|
|
381
|
+
|
|
382
|
+
Proceed to **Step 4-Local**.
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
### Step 4-Local: OAuth Setup and Token Generation
|
|
387
|
+
|
|
388
|
+
Use AskUserQuestion:
|
|
389
|
+
|
|
390
|
+
```
|
|
391
|
+
Question: "Do you already have a genoauth.sh file with your OAuth credentials?"
|
|
392
|
+
Options:
|
|
393
|
+
- "Yes, I have it"
|
|
394
|
+
- "No, I need to create it"
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
**If "Yes":** Read the file, show the org domain URL, Client ID, and Client Secret to the user, and confirm they're correct for the target org. Update if needed.
|
|
398
|
+
|
|
399
|
+
**If "No":** Ask for Consumer Key, Consumer Secret, and org domain URL (the base URL for OAuth token generation). Create the script using the template from `references/eca-setup.md`. Make executable.
|
|
400
|
+
|
|
401
|
+
**Generate and verify token:** Run `./genoauth.sh`. Expected: JWT starting with `eyJ0...`
|
|
402
|
+
|
|
403
|
+
💡 Save to variable: `export TOKEN=$(./genoauth.sh)`
|
|
404
|
+
|
|
405
|
+
Proceed to **Step 5-Local**.
|
|
406
|
+
|
|
407
|
+
---
|
|
408
|
+
|
|
409
|
+
### Step 5-Local: Build the Service
|
|
410
|
+
|
|
411
|
+
Use Bash tool to run:
|
|
412
|
+
|
|
413
|
+
```bash
|
|
414
|
+
bazel build projects/services/agentic-api-access/agentic-api-service
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
Expected: Build succeeds, JAR at `bazel-bin/projects/services/agentic-api-access/agentic-api-service/agentic-api-service.jar`
|
|
418
|
+
|
|
419
|
+
**Common Issues:**
|
|
420
|
+
|
|
421
|
+
- "Unable to locate a Java Runtime" → See `docs/java-setup-mac-troubleshooting.md` in sfdc-bazel
|
|
422
|
+
|
|
423
|
+
Proceed to **Step 6-Local**.
|
|
424
|
+
|
|
425
|
+
---
|
|
426
|
+
|
|
427
|
+
### Step 6-Local: Start the Service
|
|
428
|
+
|
|
429
|
+
Use AskUserQuestion:
|
|
430
|
+
|
|
431
|
+
```
|
|
432
|
+
Question: "How would you like to start the agentic-api-service?"
|
|
433
|
+
Options:
|
|
434
|
+
- "With OAUTH_SERVER_TOKEN exported (Recommended)"
|
|
435
|
+
- "Without OAUTH_SERVER_TOKEN"
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
**With OAUTH_SERVER_TOKEN (Recommended):** Clients can connect with "No auth" — simpler setup, best for development.
|
|
439
|
+
|
|
440
|
+
**Without OAUTH_SERVER_TOKEN:** Each client must provide authentication individually — more complex, closer to production.
|
|
441
|
+
|
|
442
|
+
**Start the service** (use Bash tool):
|
|
443
|
+
|
|
444
|
+
```bash
|
|
445
|
+
export OAUTH_SERVER_BASE_URL="<org-url>"
|
|
446
|
+
# Include next line only if "With OAUTH_SERVER_TOKEN":
|
|
447
|
+
export OAUTH_SERVER_TOKEN=$(./genoauth.sh)
|
|
448
|
+
|
|
449
|
+
bazel run projects/services/agentic-api-access/agentic-api-service
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
Expected output: `Started AgenticApiService`, ports 7442 and 15372.
|
|
453
|
+
|
|
454
|
+
**Verify health:** `curl localhost:15372/manage/info | jq`
|
|
455
|
+
|
|
456
|
+
Proceed to **Step 7-Local**.
|
|
457
|
+
|
|
458
|
+
---
|
|
459
|
+
|
|
460
|
+
### Step 7-Local: Test the MCP Server
|
|
461
|
+
|
|
462
|
+
MCP server URL: `http://localhost:7442/mcp/<apiDomainName>/<serverName>`
|
|
463
|
+
|
|
464
|
+
Use AskUserQuestion:
|
|
465
|
+
|
|
466
|
+
```
|
|
467
|
+
Question: "Which testing method would you like to use?"
|
|
468
|
+
Options:
|
|
469
|
+
- "curl - Quick command-line test (Recommended)"
|
|
470
|
+
- "MCP Inspector - Interactive GUI testing"
|
|
471
|
+
- "ChatGPT - Production validation (requires ngrok)"
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
Based on selection, read `references/testing-methods.md` and guide the user through the appropriate method.
|
|
475
|
+
|
|
476
|
+
---
|
|
477
|
+
|
|
478
|
+
## Troubleshooting, Checklists, and Key Points
|
|
479
|
+
|
|
480
|
+
For troubleshooting issues, verifying setup with checklists, or reviewing key points, read `references/troubleshooting.md`. It covers:
|
|
481
|
+
|
|
482
|
+
- Common issues organized by scenario (All, Local, Off-Core, Falcon)
|
|
483
|
+
- Testing checklists for each scenario
|
|
484
|
+
- Key points to remember (URL formats, token expiry, activation requirements, etc.)
|
|
485
|
+
|
|
486
|
+
## Additional Resources
|
|
487
|
+
|
|
488
|
+
- `references/eca-setup.md` — External Client App setup and genoauth.sh template
|
|
489
|
+
- `references/testing-methods.md` — Detailed curl, MCP Inspector, and ChatGPT testing guides
|
|
490
|
+
- Java setup: `docs/java-setup-mac-troubleshooting.md` in sfdc-bazel repo
|
|
491
|
+
- MCP Protocol Spec: https://spec.modelcontextprotocol.io
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Default Test Server Configuration template for Falcon Test Org Testing.
|
|
3
|
+
#
|
|
4
|
+
# This file is a starting point — fill in your own org's values before
|
|
5
|
+
# sourcing it. The skill's setup flow can also create this for you
|
|
6
|
+
# interactively; see references/eca-setup.md for how to set up an
|
|
7
|
+
# External Client App (ECA) in your org and where to find the Consumer
|
|
8
|
+
# Key + Secret.
|
|
9
|
+
#
|
|
10
|
+
# Workflow:
|
|
11
|
+
# 1. Set up an ECA in your test org (references/eca-setup.md)
|
|
12
|
+
# 2. Replace the placeholders below with your ECA's credentials
|
|
13
|
+
# 3. Source this file: `source default-test-server-config.sh`
|
|
14
|
+
# 4. Generate a token: `generate_default_token`
|
|
15
|
+
#
|
|
16
|
+
# Do NOT commit real Client Secrets back to a public repo. Keep filled-in
|
|
17
|
+
# copies of this file local-only or in a private dotfiles repo.
|
|
18
|
+
|
|
19
|
+
# OAuth Credentials — replace with your ECA's values
|
|
20
|
+
export DEFAULT_CLIENT_ID="<YOUR_CONSUMER_KEY>"
|
|
21
|
+
export DEFAULT_CLIENT_SECRET="<YOUR_CONSUMER_SECRET>"
|
|
22
|
+
export DEFAULT_USERNAME="<your-username@example.com>"
|
|
23
|
+
export DEFAULT_ORG_URL="https://<your-org-domain>.my.salesforce.com"
|
|
24
|
+
|
|
25
|
+
# Helper function to generate OAuth token
|
|
26
|
+
generate_default_token() {
|
|
27
|
+
response=$(curl -s -X POST "${DEFAULT_ORG_URL}/services/oauth2/token" \
|
|
28
|
+
-H "Content-Type: application/x-www-form-urlencoded" \
|
|
29
|
+
-d "grant_type=client_credentials&client_id=${DEFAULT_CLIENT_ID}&client_secret=${DEFAULT_CLIENT_SECRET}")
|
|
30
|
+
|
|
31
|
+
if command -v jq &> /dev/null; then
|
|
32
|
+
access_token=$(echo "$response" | jq -r '.access_token')
|
|
33
|
+
else
|
|
34
|
+
access_token=$(echo "$response" | grep -o '"access_token":"[^"]*"' | cut -d'"' -f4)
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
echo "$access_token"
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
# Print configuration info
|
|
41
|
+
echo "Default Test Server Configuration Loaded:"
|
|
42
|
+
echo " Username: ${DEFAULT_USERNAME}"
|
|
43
|
+
echo " Org URL: ${DEFAULT_ORG_URL}"
|
|
44
|
+
echo ""
|
|
45
|
+
echo "To generate a token, run: generate_default_token"
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# External Client App (ECA) Setup
|
|
2
|
+
|
|
3
|
+
This is the shared setup guide for creating an External Client App for OAuth authentication. Referenced from the main skill when any scenario needs ECA configuration.
|
|
4
|
+
|
|
5
|
+
## Steps
|
|
6
|
+
|
|
7
|
+
1. Navigate to **Setup → External Client App Manager → New External Client App**
|
|
8
|
+
2. Enter Basic Information:
|
|
9
|
+
- External Client App Name: (e.g., "MCP Testing App")
|
|
10
|
+
- API Name: (e.g., "MCP_Testing_App")
|
|
11
|
+
- Contact Email: (your email)
|
|
12
|
+
3. Under **API (Enable OAuth Settings)**, check "Enable OAuth"
|
|
13
|
+
4. Set **Callback URL:** `http://localhost:8080/oauth/callback`
|
|
14
|
+
5. Select **OAuth Scopes:** `api`, `sfap_api`, `refresh_token`, `einstein_gpt_api`
|
|
15
|
+
- Why these scopes? `sfap_api` and `einstein_gpt_api` provide access to AI/MCP features, `api` gives general Salesforce API access, and `refresh_token` allows long-lived sessions
|
|
16
|
+
6. Under **Flow Enablement**, check "Enable Client Credentials Flow"
|
|
17
|
+
7. Under **Security:**
|
|
18
|
+
- ✅ Check "Issue JSON Web Token based access tokens for named users"
|
|
19
|
+
- ❌ Uncheck "Require secret for Web Server Flow"
|
|
20
|
+
- ❌ Uncheck "Require secret for Refresh Token Flow"
|
|
21
|
+
8. Click **Create**
|
|
22
|
+
9. After creation, go to **Policies** Tab → **Edit** → **OAuth Policies**:
|
|
23
|
+
- Check "Enable Client Credentials Flow"
|
|
24
|
+
- "Run As" → Enter your username
|
|
25
|
+
- Save
|
|
26
|
+
|
|
27
|
+
After completion, note the **Consumer Key** and **Consumer Secret** — these are needed for OAuth token generation. You'll also need your **org domain URL** (the base URL used to call `/services/oauth2/token` for generating OAuth tokens, e.g., `https://orgfarm-xxx.my.salesforce-com.xxx.wc.crm.dev:6101`). This is NOT the Lightning UI URL (`lightning.force.com`) — find it in OrgFarm details or workspace configuration.
|
|
28
|
+
|
|
29
|
+
## genoauth.sh Script Template
|
|
30
|
+
|
|
31
|
+
Create this script to generate OAuth tokens. Replace the placeholder values with your actual credentials.
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
#!/bin/bash
|
|
35
|
+
|
|
36
|
+
CLIENT_ID=<consumer-key>
|
|
37
|
+
CLIENT_SECRET=<consumer-secret>
|
|
38
|
+
ORG_URL=<org-domain-url>
|
|
39
|
+
|
|
40
|
+
response=$(curl -s -X POST "${ORG_URL}/services/oauth2/token" \
|
|
41
|
+
-H "Content-Type: application/x-www-form-urlencoded" \
|
|
42
|
+
-d "grant_type=client_credentials&client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}")
|
|
43
|
+
|
|
44
|
+
if command -v jq &> /dev/null; then
|
|
45
|
+
access_token=$(echo "$response" | jq -r '.access_token')
|
|
46
|
+
else
|
|
47
|
+
access_token=$(echo "$response" | grep -o '"access_token":"[^"]*"' | cut -d'"' -f4)
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
export OAUTH_SERVER_TOKEN="$access_token"
|
|
51
|
+
echo "$access_token"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
After creating, make executable: `chmod +x genoauth.sh`
|
|
55
|
+
|
|
56
|
+
Expected output: Long JWT token starting with `eyJ0...`
|
|
57
|
+
|
|
58
|
+
Tokens expire after ~2 hours. Regenerate by running `./genoauth.sh` again.
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
# Detailed Testing Methods
|
|
2
|
+
|
|
3
|
+
After completing environment setup and starting the agentic-api-service (Local/Off-Core) or generating an OAuth token (Falcon), use one of these methods to test your MCP server.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Method 1: curl](#method-1-using-curl)
|
|
8
|
+
- [Method 2: MCP Inspector](#method-2-using-mcp-inspector)
|
|
9
|
+
- [Method 3: ChatGPT](#method-3-using-chatgpt)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Method 1: Using curl
|
|
14
|
+
|
|
15
|
+
curl is the most reliable way to test MCP servers. Use it for quick verification, scripting, and CI/CD integration.
|
|
16
|
+
|
|
17
|
+
**Run the initialize request:**
|
|
18
|
+
|
|
19
|
+
Build the server URL using the apiDomainName/serverName (e.g., `platform/lightning-type-sample-server`):
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
TOKEN=$(./genoauth.sh)
|
|
23
|
+
|
|
24
|
+
curl -s -H "Authorization: Bearer $TOKEN" \
|
|
25
|
+
-H "Content-Type: application/json" \
|
|
26
|
+
-H "Accept: application/json, text/event-stream" \
|
|
27
|
+
http://localhost:7442/mcp/<apiDomainName>/<serverName> \
|
|
28
|
+
-d '{
|
|
29
|
+
"jsonrpc":"2.0",
|
|
30
|
+
"id":1,
|
|
31
|
+
"method":"initialize",
|
|
32
|
+
"params":{
|
|
33
|
+
"protocolVersion":"2024-11-05",
|
|
34
|
+
"capabilities":{},
|
|
35
|
+
"clientInfo":{"name":"test","version":"1.0"}
|
|
36
|
+
}
|
|
37
|
+
}' | jq
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Expected response:
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"jsonrpc": "2.0",
|
|
45
|
+
"id": 1,
|
|
46
|
+
"result": {
|
|
47
|
+
"protocolVersion": "2024-11-05",
|
|
48
|
+
"capabilities": {
|
|
49
|
+
"tools": {},
|
|
50
|
+
"prompts": {},
|
|
51
|
+
"resources": {}
|
|
52
|
+
},
|
|
53
|
+
"serverInfo": {
|
|
54
|
+
"name": "<server-name>",
|
|
55
|
+
"version": "1.0.0"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
If this succeeds, the server is working! The initialize response confirms the server is reachable and responding to MCP protocol requests. Testing is complete — do not proceed to list tools or resources via curl. If the user wants to explore tools and resources interactively, they can use MCP Inspector separately.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Method 2: Using MCP Inspector
|
|
66
|
+
|
|
67
|
+
MCP Inspector (`npx @mcpjam/inspector@latest`) provides an interactive GUI for testing MCP servers.
|
|
68
|
+
|
|
69
|
+
### For Local/Off-Core (agentic-api-service running locally)
|
|
70
|
+
|
|
71
|
+
**Check if service was started with OAUTH_SERVER_TOKEN:**
|
|
72
|
+
|
|
73
|
+
Use AskUserQuestion:
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
Question: "Did you start the service with OAUTH_SERVER_TOKEN exported?"
|
|
77
|
+
Options:
|
|
78
|
+
- "Yes, token was exported before starting"
|
|
79
|
+
- "No, or service has been running for >2 hours"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**If "Yes" - use No Auth:**
|
|
83
|
+
|
|
84
|
+
Use Bash tool to run:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
npx @mcpjam/inspector@latest
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
This opens MCP Inspector in your browser. Configure:
|
|
91
|
+
|
|
92
|
+
1. Server URL: `http://localhost:7442/mcp/<apiDomainName>/<serverName>`
|
|
93
|
+
2. Authentication: Select **"No auth"**
|
|
94
|
+
3. Click **Connect**
|
|
95
|
+
|
|
96
|
+
This works because the service handles authentication internally using the token it was started with.
|
|
97
|
+
|
|
98
|
+
**If "No" - use Bearer Token:**
|
|
99
|
+
|
|
100
|
+
First, get a fresh token to clipboard. Use Bash tool to run:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
./genoauth.sh | tr -d '\n' | pbcopy
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Then launch MCP Inspector:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
npx @mcpjam/inspector@latest
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Configure:
|
|
113
|
+
|
|
114
|
+
1. Server URL: `http://localhost:7442/mcp/<apiDomainName>/<serverName>`
|
|
115
|
+
2. Authentication: Select **"Bearer token"**
|
|
116
|
+
3. Paste the token (just the token, without "Bearer " prefix - it should start with `eyJ0...`)
|
|
117
|
+
4. Click **Connect**
|
|
118
|
+
|
|
119
|
+
### For Falcon Test Org (connecting directly to Salesforce)
|
|
120
|
+
|
|
121
|
+
Use Bash tool to launch MCP Inspector:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
npx @mcpjam/inspector@latest
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Configure:
|
|
128
|
+
|
|
129
|
+
1. Server URL: The Server URL from the MCP server details page (e.g., `https://test.api.salesforce.com/platform/mcp/v1/platform/records`)
|
|
130
|
+
- ⚠️ **If connection fails:** Try changing `v1` to `v1-beta.2` in the URL
|
|
131
|
+
2. Authentication: Select **"Bearer token"**
|
|
132
|
+
3. Paste the OAuth token (without "Bearer " prefix)
|
|
133
|
+
4. Click **Connect**
|
|
134
|
+
|
|
135
|
+
### After Connection (All scenarios)
|
|
136
|
+
|
|
137
|
+
- Connection should show "Connected" (green)
|
|
138
|
+
- Tools tab should show available tools
|
|
139
|
+
- Resources tab should show UI resources (if any)
|
|
140
|
+
- Test tool invocation by selecting a tool and providing inputs
|
|
141
|
+
|
|
142
|
+
**Common Issue:** If you get 401 errors and MCP Inspector worked previously, the token has expired. For Local/Off-Core: restart the service with a fresh token, then reconnect with "No auth". For Falcon: regenerate the token and paste the new one.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Method 3: Using ChatGPT (Production Testing)
|
|
147
|
+
|
|
148
|
+
ChatGPT provides end-to-end testing with natural language interaction. Requires ChatGPT Enterprise license and ngrok for local services.
|
|
149
|
+
|
|
150
|
+
⚠️ **ChatGPT testing for Falcon test orgs is not yet verified.** Use MCP Inspector for Falcon instead.
|
|
151
|
+
|
|
152
|
+
**Prerequisites check:**
|
|
153
|
+
|
|
154
|
+
Use AskUserQuestion:
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
Question: "Do you have ChatGPT Enterprise license?"
|
|
158
|
+
Options:
|
|
159
|
+
- "Yes, I have access"
|
|
160
|
+
- "No, I don't have Enterprise"
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**If "No":** Explain that ChatGPT Enterprise is required for custom app integration. Suggest using MCP Inspector for testing instead.
|
|
164
|
+
|
|
165
|
+
**If "Yes", proceed with setup:**
|
|
166
|
+
|
|
167
|
+
### Step 1: Set up ngrok
|
|
168
|
+
|
|
169
|
+
Explain: "ChatGPT needs to access your local service via a public URL. We'll use ngrok to create a secure tunnel."
|
|
170
|
+
|
|
171
|
+
Check if ngrok is installed:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
which ngrok
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**If not installed:**
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
brew install ngrok
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
**Start ngrok:**
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
ngrok http 7442
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
This creates a public URL like `https://abc123.ngrok-free.dev`. Get the URL from ngrok output or:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
curl -s http://localhost:4040/api/tunnels | jq -r '.tunnels[0].public_url'
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Store the ngrok URL and explain: "This is your public URL that ChatGPT will use to reach your local service. Keep ngrok running throughout your testing session."
|
|
196
|
+
|
|
197
|
+
Use AskUserQuestion:
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
Question: "Is ngrok running and showing a public URL?"
|
|
201
|
+
Options:
|
|
202
|
+
- "Yes, I have the ngrok URL"
|
|
203
|
+
- "No, having issues with ngrok"
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
**If "No":** Help troubleshoot ngrok setup.
|
|
207
|
+
**If "Yes":** Ask: "What is your ngrok public URL?" Store it for the next step.
|
|
208
|
+
|
|
209
|
+
### Step 2: Create ChatGPT App
|
|
210
|
+
|
|
211
|
+
Use AskUserQuestion:
|
|
212
|
+
|
|
213
|
+
```
|
|
214
|
+
Question: "Did you start the service with OAUTH_SERVER_TOKEN exported?"
|
|
215
|
+
Options:
|
|
216
|
+
- "Yes, token was exported before starting"
|
|
217
|
+
- "No, or service has been running for >2 hours"
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
**If "Yes" - guide No Auth setup:**
|
|
221
|
+
|
|
222
|
+
Explain: "Since the service has the token, we can use 'No auth' - the service handles authentication internally."
|
|
223
|
+
|
|
224
|
+
Guide them step by step:
|
|
225
|
+
|
|
226
|
+
1. Open ChatGPT and go to bottom left **"Salesforce Dev Sandbox"**
|
|
227
|
+
2. Click **Sandbox → Settings → Apps**
|
|
228
|
+
3. Click **Create App**
|
|
229
|
+
4. Enter configuration:
|
|
230
|
+
- **External facing URL:** `<ngrok-url>/mcp/<apiDomainName>/<serverName>`
|
|
231
|
+
- Core-hosted example: `https://abc123.ngrok-free.dev/mcp/platform/records`
|
|
232
|
+
- Off-core example: `https://abc123.ngrok-free.dev/mcp/salescloud/agentforce-sales`
|
|
233
|
+
- **Authentication:** Select **"No auth"**
|
|
234
|
+
5. Click **Create**
|
|
235
|
+
|
|
236
|
+
Explain: "ChatGPT is now calling your server's `tools/list` and `resources/list` endpoints. This may take a few seconds."
|
|
237
|
+
|
|
238
|
+
Use AskUserQuestion:
|
|
239
|
+
|
|
240
|
+
```
|
|
241
|
+
Question: "After ChatGPT finishes loading, do you see Actions and Templates populated?"
|
|
242
|
+
Options:
|
|
243
|
+
- "Yes, I see them"
|
|
244
|
+
- "No, they're not showing"
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
**If "No" - guide OAuth setup:**
|
|
248
|
+
|
|
249
|
+
Explain: "We'll configure full OAuth authentication. You'll need the Client ID and Secret from your External Client App."
|
|
250
|
+
|
|
251
|
+
Guide them step by step:
|
|
252
|
+
|
|
253
|
+
1. Go to **"Salesforce Dev Sandbox" → Settings → Apps**
|
|
254
|
+
2. Click **Create App**
|
|
255
|
+
3. Enter configuration:
|
|
256
|
+
- **External facing URL:** `<ngrok-url>/mcp/<apiDomainName>/<serverName>`
|
|
257
|
+
- **Authentication:** Select **"OAuth"**
|
|
258
|
+
- **Client ID:** Their External Client App's Consumer Key
|
|
259
|
+
- **Client Secret:** Their External Client App's Consumer Secret
|
|
260
|
+
- **Authorization URL:** `<org-url>/services/oauth2/authorize`
|
|
261
|
+
- **Token URL:** `<org-url>/services/oauth2/token`
|
|
262
|
+
- **Scopes:** `api sfap_api einstein_gpt_api refresh_token`
|
|
263
|
+
4. Click **Create** and complete OAuth flow
|
|
264
|
+
|
|
265
|
+
Use AskUserQuestion:
|
|
266
|
+
|
|
267
|
+
```
|
|
268
|
+
Question: "After ChatGPT finishes loading and OAuth completes, do you see Actions and Templates populated?"
|
|
269
|
+
Options:
|
|
270
|
+
- "Yes, I see them"
|
|
271
|
+
- "No, they're not showing"
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Step 3: Test in ChatGPT
|
|
275
|
+
|
|
276
|
+
Explain: "Now let's test your MCP server with natural language."
|
|
277
|
+
|
|
278
|
+
Guide them:
|
|
279
|
+
|
|
280
|
+
1. In the Chat window, click **+ → More → [Your App Name]** (or type **@[Your App Name]**)
|
|
281
|
+
2. Ask: "What tools does your server provide? I'll help you craft a test utterance."
|
|
282
|
+
3. Based on their tools, suggest a test utterance
|
|
283
|
+
- Example: "Show me recent accounts" or "Get record details for ID 001..."
|
|
284
|
+
4. When they send the utterance, explain: "The first tool call will require approval. Click 'Allow'."
|
|
285
|
+
5. After execution, ask: "Did the tool execute successfully? Are UI resources rendering correctly?"
|
|
286
|
+
|
|
287
|
+
### ChatGPT Troubleshooting
|
|
288
|
+
|
|
289
|
+
Use AskUserQuestion:
|
|
290
|
+
|
|
291
|
+
```
|
|
292
|
+
Question: "What issue are you experiencing?"
|
|
293
|
+
Options:
|
|
294
|
+
- "Template changes not appearing"
|
|
295
|
+
- "Getting 401 errors"
|
|
296
|
+
- "Tools not showing up"
|
|
297
|
+
- "Other issue"
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
**If "Template changes not appearing":**
|
|
301
|
+
|
|
302
|
+
1. Refresh the app in ChatGPT
|
|
303
|
+
2. Hard refresh browser (Cmd+Shift+R or Ctrl+Shift+R)
|
|
304
|
+
3. If still not working, disconnect and recreate app
|
|
305
|
+
|
|
306
|
+
**If "Getting 401 errors":**
|
|
307
|
+
|
|
308
|
+
- Token expired → restart service with fresh token (No auth) or refresh OAuth (OAuth auth)
|
|
309
|
+
|
|
310
|
+
**If "Tools not showing up":**
|
|
311
|
+
|
|
312
|
+
- Check server is activated in Setup → MCP Servers (Core-hosted only)
|
|
313
|
+
- Verify service logs show "Loaded server definition: <name>"
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Troubleshooting, Checklists, and Key Points
|
|
2
|
+
|
|
3
|
+
Reference this file when users encounter issues during testing, or to verify their setup is complete.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Common Troubleshooting](#common-troubleshooting)
|
|
8
|
+
- [Testing Checklist](#testing-checklist)
|
|
9
|
+
- [Key Points to Remember](#key-points-to-remember)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Common Troubleshooting
|
|
14
|
+
|
|
15
|
+
### All Scenarios
|
|
16
|
+
|
|
17
|
+
1. **Token expired (401 errors):** Tokens expire after ~2 hours. Regenerate with `./genoauth.sh` or `generate_default_token` (for default config).
|
|
18
|
+
|
|
19
|
+
2. **Tools/resources not appearing:** Check service logs for "Loaded server definition: <name>". Confirm OAuth token has correct scopes (`api`, `sfap_api`, `einstein_gpt_api`).
|
|
20
|
+
|
|
21
|
+
### Local Core/Workspace
|
|
22
|
+
|
|
23
|
+
3. **Wrong resource renderer loaded (`acc-renderer-component.html` instead of Core's `renderer.html`):**
|
|
24
|
+
|
|
25
|
+
If your Core MCP resource defines a custom `renderer.html` but the service renders `acc-renderer-component.html` (the generic ACC Renderer Component) instead, the issue is in [`LightningTypeResourceLoader.java` (line 85-90)](https://git.soma.salesforce.com/services/sfdc-bazel/blob/main/projects/services/agentic-api-access/agentic-api-service-shared/src/main/java/com/salesforce/mcp/lightningtype/LightningTypeResourceLoader.java#L85). The `loadContent()` method checks `getUiMeta()` and short-circuits to the generic ACC renderer when it's not null:
|
|
26
|
+
|
|
27
|
+
```java
|
|
28
|
+
if (mcpResourceDefinition.getUiMeta() != null) {
|
|
29
|
+
logger.info("Retrieving ACC Renderer Component for fqn: {}", fqn);
|
|
30
|
+
return getGenericACCRenderer(mcpRequestContext);
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**First check:** Ensure org perm `MContentInternalApi` is enabled (should be done during org setup).
|
|
35
|
+
|
|
36
|
+
**Workaround:** In your local sfdc-bazel copy, comment out or remove this `if` block (lines 85-90), then rebuild and restart the service. This forces the loader to use the Core-defined `renderer.html` instead of the generic ACC renderer.
|
|
37
|
+
|
|
38
|
+
See [GUS W-18345458](https://gus.lightning.force.com/lightning/r/ADM_Work__c/a07EE00002XeNOkYAN/view) for tracking.
|
|
39
|
+
|
|
40
|
+
4. **Server not found / 500 error:** Verify server is **activated** in Setup → MCP Servers. Verify org has MCPService enabled.
|
|
41
|
+
|
|
42
|
+
5. **MCP Inspector worked yesterday but returns 401 today:** Service's token expired. Restart with fresh token:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
lsof -ti:7442,15372 | xargs kill
|
|
46
|
+
export OAUTH_SERVER_BASE_URL="<org-url>"
|
|
47
|
+
export OAUTH_SERVER_TOKEN=$(./genoauth.sh)
|
|
48
|
+
bazel run projects/services/agentic-api-access/agentic-api-service
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
6. **Service won't start (port already in use):**
|
|
52
|
+
```bash
|
|
53
|
+
lsof -ti:7442,15372 | xargs kill
|
|
54
|
+
```
|
|
55
|
+
Wait 2-3 seconds, then retry. Check Java is in PATH (see `docs/java-setup-mac-troubleshooting.md` in sfdc-bazel).
|
|
56
|
+
|
|
57
|
+
### Off-Core File-Based
|
|
58
|
+
|
|
59
|
+
7. **Off-core server not loading:** Verify `*.server.json` is in `agentic-api-service-shared/src/main/resources/mcp/servers/`. Ensure rebuilt after changes. Check service logs.
|
|
60
|
+
|
|
61
|
+
8. **Off-core tool returning errors:** Check `*.tool.json` has valid `inputSchema`. Verify `metadata.httpMethod` and `metadata.path` are correct.
|
|
62
|
+
|
|
63
|
+
### Falcon Test Org
|
|
64
|
+
|
|
65
|
+
9. **MCP Servers page not visible in Setup:** Enable `MCPService` org perm. If still not visible, also enable `AgentforceMcpSupportPilot` and `ApiCatalogMcpPilot`.
|
|
66
|
+
|
|
67
|
+
10. **MCP Inspector connection fails:** Try changing `v1` to `v1-beta.2` in the Server URL. Verify token is valid and server is activated.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Testing Checklist
|
|
72
|
+
|
|
73
|
+
**Local Core/Workspace & Off-Core (agentic-api-service):**
|
|
74
|
+
|
|
75
|
+
- [ ] Service builds successfully (`bazel build`)
|
|
76
|
+
- [ ] OAuth token generated
|
|
77
|
+
- [ ] Service starts on ports 7442 and 15372
|
|
78
|
+
- [ ] Health endpoint responds: `curl localhost:15372/manage/info`
|
|
79
|
+
- [ ] Initialize method returns valid response via curl
|
|
80
|
+
- [ ] Tools/list returns expected tools
|
|
81
|
+
- [ ] Resources/list returns UI resources (if applicable)
|
|
82
|
+
- [ ] (Core-hosted only) MCP server activated in Setup → MCP Servers
|
|
83
|
+
- [ ] (Off-core only) Service logs show "Loaded server definition: <name>"
|
|
84
|
+
|
|
85
|
+
**Falcon Test Org:**
|
|
86
|
+
|
|
87
|
+
- [ ] MCPService org perm enabled
|
|
88
|
+
- [ ] MCP server visible and activated in Setup → MCP Servers
|
|
89
|
+
- [ ] Required org perms enabled (if any)
|
|
90
|
+
- [ ] OAuth token generated
|
|
91
|
+
- [ ] MCP Inspector connects with Bearer token
|
|
92
|
+
- [ ] If `v1` URL doesn't work, tried `v1-beta.2`
|
|
93
|
+
- [ ] Tools and resources appear after connection
|
|
94
|
+
|
|
95
|
+
**MCP Inspector (Optional):**
|
|
96
|
+
|
|
97
|
+
- [ ] Connects with "No auth" (service has fresh token) or "Bearer token" (fresh token pasted)
|
|
98
|
+
- [ ] Tools and resources appear after connection
|
|
99
|
+
|
|
100
|
+
**ChatGPT (Optional - Local/Off-Core only, requires ngrok):**
|
|
101
|
+
|
|
102
|
+
- [ ] ngrok tunnel running and URL obtained
|
|
103
|
+
- [ ] App created with public URL and "No auth"
|
|
104
|
+
- [ ] Actions and Templates appear after creation
|
|
105
|
+
- [ ] Can invoke tools via natural language
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Key Points to Remember
|
|
110
|
+
|
|
111
|
+
**Local/Off-Core (agentic-api-service):**
|
|
112
|
+
|
|
113
|
+
1. **MCP server URL format** is `http://localhost:7442/mcp/<apiDomainName>/<serverName>`
|
|
114
|
+
2. **Tokens expire after ~2 hours** — regenerate if you get 401 errors
|
|
115
|
+
3. Export `OAUTH_SERVER_TOKEN` before starting service to use "No auth" in MCP Inspector and ChatGPT
|
|
116
|
+
4. If token expired, use MCP Inspector's "Bearer token" option with a fresh token (without "Bearer " prefix)
|
|
117
|
+
|
|
118
|
+
**Core-hosted (Local):** 5. **Always activate the server** in Setup → MCP Servers — this is the most common issue
|
|
119
|
+
|
|
120
|
+
**Off-core file-based:** 6. **No activation needed** — off-core servers load automatically from classpath files 7. **Rebuild after changes** — modify JSON definitions, then rebuild and restart the service
|
|
121
|
+
|
|
122
|
+
**Falcon test org:** 8. **URL versioning** — if `v1` doesn't work, try `v1-beta.2` 9. **ChatGPT testing** — not yet verified; use MCP Inspector for now
|
|
123
|
+
|
|
124
|
+
**ChatGPT (Local/Off-Core):** 10. **ngrok required** to expose `localhost:7442` for ChatGPT 11. **Template caching** is aggressive — hard refresh browser or recreate app if changes don't appear
|