@bevel-software/platform-core-frontend 0.13.5 → 0.14.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.
Files changed (35) hide show
  1. package/THIRD-PARTY-NOTICES.md +416 -418
  2. package/package.json +2 -2
  3. package/src/lib/__tests__/utils.test.ts +43 -0
  4. package/src/lib/utils.ts +15 -7
  5. package/src/modules/library/__tests__/LibraryRoutes.test.tsx +1 -0
  6. package/src/modules/library/__tests__/McpServerSection.test.tsx +7 -1
  7. package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +216 -8
  8. package/src/modules/library/__tests__/ToolPage.test.tsx +164 -3
  9. package/src/modules/library/__tests__/ToolVarRow.test.tsx +7 -7
  10. package/src/modules/library/__tests__/status.test.ts +84 -0
  11. package/src/modules/library/components/LibraryCard.tsx +7 -1
  12. package/src/modules/library/components/skill-page/SkillPage.tsx +5 -1
  13. package/src/modules/library/components/tool-page/McpServerSection.tsx +9 -1
  14. package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +223 -8
  15. package/src/modules/library/components/tool-page/ToolPage.tsx +103 -1
  16. package/src/modules/library/components/tool-page/ToolVarRow.tsx +30 -8
  17. package/src/modules/library/hooks/useToolPage.ts +28 -11
  18. package/src/modules/library/hooks/useToolSource.ts +77 -0
  19. package/src/modules/library/utils/status.ts +99 -10
  20. package/src/modules/onboarding/__tests__/onboarding.test.tsx +760 -730
  21. package/src/modules/onboarding/agent-clients.ts +9 -3
  22. package/src/modules/onboarding/components/WelcomePage.tsx +9 -7
  23. package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +29 -14
  24. package/src/modules/secrets-vault/components/SecretsPage.tsx +4 -1
  25. package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +4 -1
  26. package/src/modules/secrets-vault/services/tool-secrets.api.ts +36 -0
  27. package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +6 -10
  28. package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +34 -12
  29. package/src/shared/mcp/ChatGptInstallLink.tsx +45 -0
  30. package/src/shared/mcp/ClaudeInstallLink.tsx +3 -3
  31. package/src/shared/mcp/ConnectionInstructions.tsx +17 -11
  32. package/src/shared/mcp/__tests__/ChatGptInstallLink.test.tsx +34 -0
  33. package/src/shared/mcp/__tests__/connect-snippets.test.ts +49 -13
  34. package/src/shared/mcp/connect-snippets.ts +41 -6
  35. package/src/shared/mcp/index.ts +4 -0
@@ -1,4 +1,9 @@
1
- import { hexisMcpJsonSnippet, jsonConfigSnippet, workspaceBaseUrl } from '../../shared/mcp';
1
+ import {
2
+ MCP_DISPLAY_NAME,
3
+ hexisMcpJsonSnippet,
4
+ jsonConfigSnippet,
5
+ workspaceBaseUrl,
6
+ } from '../../shared/mcp';
2
7
 
3
8
  /**
4
9
  * The ways an agent connects, named by PRODUCT rather than surface —
@@ -53,8 +58,9 @@ export const AGENT_CLIENTS: AgentClient[] = [
53
58
  id: 'chatgpt',
54
59
  label: 'ChatGPT',
55
60
  // Developer mode first: it is off by default, and every "Create" button
56
- // someone hunts for is behind it.
57
- hint: 'Settings → Apps & Connectors → Advanced → turn on Developer mode, then Create and paste this.',
61
+ // someone hunts for is behind it. The name is spelled out because, unlike
62
+ // Claude, ChatGPT has no link that prefills it.
63
+ hint: `Settings → Apps & Connectors → Advanced → turn on Developer mode, then Create: name it “${MCP_DISPLAY_NAME}” and paste this.`,
58
64
  snip: (url) => url,
59
65
  },
60
66
  {
@@ -10,7 +10,7 @@ import { pathForLibraryFilter } from '../../library/routes/library-paths';
10
10
  import { useAppRegistry } from '../../../core/registry';
11
11
  import { displayFirstName } from '../../library/utils/personal-plugin';
12
12
  import { setSidebarCollapsed } from '../../layout/state/sidebar';
13
- import { ClaudeInstallLink, mcpEndpointUrl } from '../../../shared/mcp';
13
+ import { ChatGptInstallLink, ClaudeInstallLink, mcpEndpointUrl } from '../../../shared/mcp';
14
14
  import { AGENT_CLIENTS, type AgentClient } from '../agent-clients';
15
15
  import { useOnboarding } from '../state/onboarding';
16
16
  import { useWelcomeRouteState } from '../welcome-state';
@@ -314,13 +314,15 @@ export function WelcomePage() {
314
314
 
315
315
  <p className="mt-2.5 text-meta leading-normal text-ink-faint">{client.hint}</p>
316
316
 
317
- {/* Claude only, because Claude is the only client with an install
318
- link — and it renders nothing at all when this deployment is one
319
- Anthropic could not reach, rather than offering a shortcut that
320
- dead-ends. No `showHint`: the reader here is a new employee, and
321
- naming an env var they cannot change is noise. The copy block
322
- below is the route that always works. */}
317
+ {/* The web assistants only: Claude's link prefills the connector,
318
+ ChatGPT's opens the settings pane it is created in. Both render
319
+ nothing at all when this deployment is one their vendor could not
320
+ reach, rather than offering a shortcut that dead-ends. No
321
+ `showHint`: the reader here is a new employee, and naming an env
322
+ var they cannot change is noise. The copy block below is the route
323
+ that always works. */}
323
324
  {client.id === 'claude' && <ClaudeInstallLink mcpUrl={mcpUrl} className="mt-3.5" />}
325
+ {client.id === 'chatgpt' && <ChatGptInstallLink mcpUrl={mcpUrl} className="mt-3.5" />}
324
326
 
325
327
  {/* The copy rides the block it copies. */}
326
328
  <div className="relative mt-3.5">
@@ -40,8 +40,10 @@ const MCP_OAUTH_STATE_KEY = 'mcp-oauth-state';
40
40
  * sends the browser back to the agent.
41
41
  *
42
42
  * DESIGN: this page speaks the Library's vocabulary, because it is the other
43
- * half of the same job. Every state reads `Connected` or `Needs …` (never a
44
- * third phrasing), nothing that needs a person is grey, and a tool is
43
+ * half of the same job. Every state reads what is STORED — `Signed in`,
44
+ * `Key saved` — or `Needs …` (never a third phrasing; `Connected` is
45
+ * reserved for the tool page, whose probe actually earns the word), nothing
46
+ * that needs a person is grey, and a tool is
45
47
  * identified by its mark before its name — the same `ToolLogo` the gallery
46
48
  * cards use. It went through the design system wholesale: no raw palette, no
47
49
  * off-scale type, no ad-hoc bordered `div`s pretending to be Surfaces.
@@ -118,7 +120,9 @@ export function ConnectToolsPage() {
118
120
  const hash = window.location.hash.replace(/^#/, '');
119
121
  if (!hash) return;
120
122
  const params = new URLSearchParams(hash);
121
- if (params.has('authorized')) setNotice('Connected. You can go back to your agent and try again.');
123
+ // "Signed in", not "Connected": the sign-in landing here proves a token was
124
+ // issued, not that a call with it will succeed.
125
+ if (params.has('authorized')) setNotice('Signed in. You can go back to your agent and try again.');
122
126
  else if (params.has('error')) setError(params.get('error') || 'Authorization failed.');
123
127
  if (params.has('authorized') || params.has('error')) {
124
128
  window.history.replaceState(null, '', window.location.pathname + window.location.search);
@@ -301,7 +305,10 @@ export function ConnectToolsPage() {
301
305
  <>
302
306
  {outstanding === 0 && (
303
307
  <Banner role="status" tone="ok" className="mb-5">
304
- Everything is connected. You can use your tools in your agent.
308
+ {/* Not "everything is connected": nothing on this page has
309
+ called a provider, so every row above is stored-but-untested.
310
+ The banner has to make the same claim its rows do. */}
311
+ Everything is set up. You can use your tools in your agent.
305
312
  </Banner>
306
313
  )}
307
314
 
@@ -325,7 +332,7 @@ export function ConnectToolsPage() {
325
332
  : o.needsReauth
326
333
  ? 'needs-reauth'
327
334
  : o.authorized
328
- ? 'connected'
335
+ ? 'signed-in'
329
336
  : 'needs-signin'
330
337
  }
331
338
  onToggle={() =>
@@ -354,7 +361,7 @@ export function ConnectToolsPage() {
354
361
  label={o.label || o.key}
355
362
  on
356
363
  busy={false}
357
- state={o.authorized ? 'connected' : 'needs-signin'}
364
+ state={o.authorized ? 'signed-in' : 'needs-signin'}
358
365
  action={
359
366
  <Button
360
367
  variant="outline"
@@ -391,7 +398,7 @@ export function ConnectToolsPage() {
391
398
  label={tool.name}
392
399
  on={on}
393
400
  busy={wiping.has(id)}
394
- state={!on ? 'skipped' : unset > 0 ? 'needs-key' : 'connected'}
401
+ state={!on ? 'skipped' : unset > 0 ? 'needs-key' : 'key-saved'}
395
402
  onToggle={() =>
396
403
  void onToggle(id, configured, async () => {
397
404
  for (const v of tool.variables.filter((x) => x.configured)) {
@@ -438,18 +445,26 @@ function Section({ title, children }: { title: string; children: React.ReactNode
438
445
  }
439
446
 
440
447
  /**
441
- * The five things a row can be — and the words for each.
448
+ * The things a row can be — and the words for each.
442
449
  *
443
- * `Connected` or `Needs …`, exactly as the Library says it, because this is the
444
- * page you land on to FIX what the Library told you was broken and the two must
445
- * not disagree about what is wrong. "skipped" is the one non-status here: it is
446
- * a choice you made, not a state of the tool, so it stays grey.
450
+ * The same vocabulary the Library uses, because this is the page you land on to
451
+ * FIX what the Library told you was broken and the two must not disagree about
452
+ * what is wrong. "skipped" is the one non-status here: it is a choice you made,
453
+ * not a state of the tool, so it stays grey.
454
+ *
455
+ * Note what is NOT here: `Connected`. This page knows only what is STORED, and
456
+ * the one word that asserts a working connection is reserved for a probe that
457
+ * actually called the provider — which only the tool page does. Two states
458
+ * rather than one, because "signed in" and "key saved" describe two different
459
+ * things the reader did, and telling someone a key was saved when they signed
460
+ * in is a small lie of exactly the kind this vocabulary exists to stop.
447
461
  */
448
462
  const ROW_STATE: Record<
449
- 'connected' | 'needs-signin' | 'needs-reauth' | 'needs-key' | 'skipped',
463
+ 'signed-in' | 'key-saved' | 'needs-signin' | 'needs-reauth' | 'needs-key' | 'skipped',
450
464
  { text: string; tone: 'ok' | 'wait' | 'outline' }
451
465
  > = {
452
- connected: { text: 'Connected', tone: 'ok' },
466
+ 'signed-in': { text: 'Signed in', tone: 'ok' },
467
+ 'key-saved': { text: 'Key saved', tone: 'ok' },
453
468
  'needs-signin': { text: 'Needs your sign-in', tone: 'wait' },
454
469
  'needs-reauth': { text: 'Needs signing in again', tone: 'wait' },
455
470
  'needs-key': { text: 'Needs a key from you', tone: 'wait' },
@@ -193,7 +193,10 @@ export function SecretsPage() {
193
193
  {`\${${s.key}}`}
194
194
  </code>
195
195
  <Badge tone={s.authorized ? 'ok' : 'wait'} size="xs" className="shrink-0">
196
- {s.authorized ? 'Connected' : 'Needs your sign-in'}
196
+ {/* "Signed in", not "Connected": a stored token is the whole
197
+ of what this page knows, and only a probe that called the
198
+ provider may claim the connection works. */}
199
+ {s.authorized ? 'Signed in' : 'Needs your sign-in'}
197
200
  </Badge>
198
201
  <span className="ml-auto flex shrink-0 items-center gap-1.5">
199
202
  <Button variant="outline" size="tiny" onClick={() => void onAuthorize(s.id)}>
@@ -320,10 +320,13 @@ function OAuthVarRow({
320
320
  size="xs"
321
321
  className="shrink-0"
322
322
  >
323
+ {/* "Signed in", not "Connected": at variable level all we know is that
324
+ a token is stored. Only the tool page runs a probe, and only a
325
+ probe may claim the connection works. */}
323
326
  {v.needsReauth
324
327
  ? 'Needs signing in again'
325
328
  : v.authorized
326
- ? 'Connected'
329
+ ? 'Signed in'
327
330
  : 'Needs your sign-in'}
328
331
  </Badge>
329
332
  <Button
@@ -45,6 +45,27 @@ export interface ToolSetup {
45
45
  reason?: string;
46
46
  }
47
47
 
48
+ /**
49
+ * The verdict of the last credential PROBE — a different question from every
50
+ * `ToolVarStatus` field, which say only what is STORED.
51
+ *
52
+ * - `ok` — the provider was called and accepted the credential.
53
+ * - `failed` — the provider rejected it; `detail` is what it said.
54
+ * - `unverifiable` — we don't know: either the tool offers no way to test it,
55
+ * or the attempt couldn't reach a verdict. `detail` says which.
56
+ *
57
+ * NOT stored anywhere. A verdict is returned to the page that asked for it and
58
+ * lives in that page's state until it is closed or reloaded — because a saved
59
+ * verdict is evidence with a date on it, and a credential can be revoked or
60
+ * expire between the check and the render. "Connected" therefore means "a call
61
+ * succeeded moments ago", which is the only claim a badge can honestly make.
62
+ */
63
+ export interface ProbeVerdict {
64
+ status: 'ok' | 'failed' | 'unverifiable';
65
+ detail: string | null;
66
+ checkedAt: string;
67
+ }
68
+
48
69
  export interface ToolSecrets {
49
70
  slug: string;
50
71
  name: string;
@@ -111,6 +132,21 @@ export async function setOAuthClientSecret(slug: string, varName: string, client
111
132
  if (!res.ok) await unwrap(res, "Couldn't save the client secret.");
112
133
  }
113
134
 
135
+ /**
136
+ * Probe this tool's credential NOW and return the verdict.
137
+ *
138
+ * Called after saving a key so the user learns immediately whether it works,
139
+ * while they still have it to hand — the moment a wrong key is cheapest to fix.
140
+ * A rejected credential is a SUCCESSFUL check, so it resolves with
141
+ * `status: 'failed'` rather than throwing; only a transport or access failure
142
+ * rejects.
143
+ */
144
+ export async function checkToolConnection(slug: string): Promise<ProbeVerdict> {
145
+ const res = await authFetch(`/api/secrets/tools/${encodeURIComponent(slug)}/check`, { method: 'POST' });
146
+ if (!res.ok) await unwrap(res, "Couldn't test this connection.");
147
+ return ((await res.json()) as { verdict: ProbeVerdict }).verdict;
148
+ }
149
+
114
150
  export const setAdminVar = (slug: string, varName: string, value: string, label?: string | null) =>
115
151
  putVar(slug, varName, 'admin', value, label);
116
152
  export const setUserVar = (slug: string, varName: string, value: string, label?: string | null) =>
@@ -4,6 +4,7 @@ import { Check, Copy, Wrench, ExternalLink } from 'lucide-react';
4
4
  import { Dialog } from '../../../shared/components/Dialog';
5
5
  import { PageShell } from '../../../shared/components/PageShell';
6
6
  import { buttonClasses } from '../../../shared/components';
7
+ import { formatRelativeTime } from '../../../lib/utils';
7
8
  import {
8
9
  ConnectionInstructions,
9
10
  CopyBlock,
@@ -27,17 +28,12 @@ import {
27
28
 
28
29
  const MAX_LABEL_LEN = 200;
29
30
 
31
+ /**
32
+ * The shared formatter, plus the one word it deliberately leaves to the caller:
33
+ * a key that has never been used has no instant to describe.
34
+ */
30
35
  function formatRelative(ts: number | null): string {
31
- if (ts === null) return 'never';
32
- const diff = Date.now() - ts;
33
- const minutes = Math.round(diff / 60_000);
34
- if (minutes < 1) return 'just now';
35
- if (minutes < 60) return `${minutes} min ago`;
36
- const hours = Math.round(minutes / 60);
37
- if (hours < 24) return `${hours} hr ago`;
38
- const days = Math.round(hours / 24);
39
- if (days < 30) return `${days} day${days === 1 ? '' : 's'} ago`;
40
- return new Date(ts).toLocaleDateString();
36
+ return formatRelativeTime(ts) || 'never';
41
37
  }
42
38
 
43
39
  /**
@@ -85,14 +85,14 @@ describe('the interactive tab: local first, hosted second, each with its own add
85
85
 
86
86
  // 1. the Claude Code one-liner
87
87
  expect(values).toContain(
88
- `claude mcp add --transport http knowledge-base ${PUBLIC_URL}`,
88
+ `claude mcp add --transport http skills-tools-knowledge ${PUBLIC_URL}`,
89
89
  );
90
90
  // 2. the bare URL for claude.ai / Claude Desktop
91
91
  expect(values).toContain(PUBLIC_URL);
92
92
  // 3. the JSON config for everything else — the LOCAL section renders a
93
93
  // `mcpServers` block too, so pick the hosted one by its server name.
94
- const json = values.find((v) => v.includes('knowledge-base') && v.includes('mcpServers'));
95
- expect(JSON.parse(json!).mcpServers['knowledge-base'].url).toBe(PUBLIC_URL);
94
+ const json = values.find((v) => v.includes('"type": "http"') && v.includes('mcpServers'));
95
+ expect(JSON.parse(json!).mcpServers['skills-tools-knowledge'].url).toBe(PUBLIC_URL);
96
96
  });
97
97
 
98
98
  /**
@@ -118,10 +118,10 @@ describe('the interactive tab: local first, hosted second, each with its own add
118
118
 
119
119
  const values = snippets();
120
120
  expect(values).toContain(
121
- `claude mcp add knowledge --env HEXIS_URL="${window.location.origin}" -- npx -y @bevel-software/hexis-mcp`,
121
+ `claude mcp add skills-tools-knowledge --env HEXIS_URL="${window.location.origin}" -- npx -y @bevel-software/hexis-mcp`,
122
122
  );
123
- const json = values.find((v) => v.includes('mcpServers') && v.includes('"knowledge"'));
124
- const parsed = JSON.parse(json!).mcpServers['knowledge'];
123
+ const json = values.find((v) => v.includes('mcpServers') && v.includes('"command"'));
124
+ const parsed = JSON.parse(json!).mcpServers['skills-tools-knowledge'];
125
125
  expect(parsed.args).toEqual(['-y', '@bevel-software/hexis-mcp']);
126
126
  expect(parsed.env.HEXIS_URL).toBe(window.location.origin);
127
127
  // Keyless = interactive: the browser-sign-in mode carries no key env.
@@ -175,7 +175,7 @@ describe('the key-bearing snippets quote the deployment too', () => {
175
175
 
176
176
  // 4. the Claude Code one-liner, with the key
177
177
  expect(values).toContain(
178
- `claude mcp add --transport http knowledge-base ${PUBLIC_URL} --header "Authorization: Bearer ${KEY}"`,
178
+ `claude mcp add --transport http skills-tools-knowledge ${PUBLIC_URL} --header "Authorization: Bearer ${KEY}"`,
179
179
  );
180
180
  // 5. the Langdock field list
181
181
  expect(values).toContain(
@@ -183,7 +183,7 @@ describe('the key-bearing snippets quote the deployment too', () => {
183
183
  );
184
184
  // 6. the JSON config, with the key
185
185
  const json = values.find((v) => v.includes('mcpServers') && v.includes('headers'));
186
- const parsed = JSON.parse(json!).mcpServers['knowledge-base'];
186
+ const parsed = JSON.parse(json!).mcpServers['skills-tools-knowledge'];
187
187
  expect(parsed.url).toBe(PUBLIC_URL);
188
188
  expect(parsed.headers.Authorization).toBe(`Bearer ${KEY}`);
189
189
  });
@@ -209,11 +209,11 @@ describe('the key-bearing snippets quote the deployment too', () => {
209
209
 
210
210
  // 7. the Claude Code stdio one-liner
211
211
  expect(values).toContain(
212
- `claude mcp add knowledge --env HEXIS_URL="${window.location.origin}" --env HEXIS_CONNECTION_KEY="${KEY}" -- npx -y @bevel-software/hexis-mcp`,
212
+ `claude mcp add skills-tools-knowledge --env HEXIS_URL="${window.location.origin}" --env HEXIS_CONNECTION_KEY="${KEY}" -- npx -y @bevel-software/hexis-mcp`,
213
213
  );
214
214
  // 8. the JSON config that spawns the package
215
- const json = values.find((v) => v.includes('mcpServers') && v.includes('"knowledge"'));
216
- const parsed = JSON.parse(json!).mcpServers['knowledge'];
215
+ const json = values.find((v) => v.includes('mcpServers') && v.includes('"command"'));
216
+ const parsed = JSON.parse(json!).mcpServers['skills-tools-knowledge'];
217
217
  expect(parsed.args).toEqual(['-y', '@bevel-software/hexis-mcp']);
218
218
  expect(parsed.env.HEXIS_URL).toBe(window.location.origin);
219
219
  expect(parsed.env.HEXIS_CONNECTION_KEY).toBe(KEY);
@@ -246,7 +246,7 @@ describe('the one-click install link', () => {
246
246
  expect(href.origin + href.pathname).toBe('https://claude.ai/customize/connectors');
247
247
  expect(href.searchParams.get('modal')).toBe('add-custom-connector');
248
248
  expect(href.searchParams.get('connectorUrl')).toBe(PUBLIC_URL);
249
- expect(href.searchParams.get('connectorName')).toBe('Knowledge — kb.acme.com');
249
+ expect(href.searchParams.get('connectorName')).toBe('Skills, Tools and Knowledge — kb.acme.com');
250
250
  });
251
251
 
252
252
  it('opens in a new tab without handing Claude a window reference', () => {
@@ -256,6 +256,28 @@ describe('the one-click install link', () => {
256
256
  expect(link).toHaveAttribute('rel', 'noopener noreferrer');
257
257
  });
258
258
 
259
+ /**
260
+ * ChatGPT sits beside Claude, with the honest difference: no prefill
261
+ * exists, so the button opens the settings pane and the copy under it
262
+ * names the connector to type. Same gate — an endpoint Anthropic cannot
263
+ * reach is one OpenAI cannot reach.
264
+ */
265
+ it('offers Add to ChatGPT beside it, naming what to call the connector', () => {
266
+ mount(PUBLIC_URL);
267
+ const link = screen.getByRole('link', { name: 'Add to ChatGPT' });
268
+ // The whole href, not just the origin: the settings-pane anchor is the
269
+ // only part that makes the link worth clicking.
270
+ expect(link).toHaveAttribute('href', 'https://chatgpt.com/#settings/Connectors');
271
+ expect(link).toHaveAttribute('target', '_blank');
272
+ expect(link).toHaveAttribute('rel', 'noopener noreferrer');
273
+ expect(screen.getByText('Skills, Tools and Knowledge')).toBeInTheDocument();
274
+ });
275
+
276
+ it('offers no ChatGPT button on a localhost deployment', () => {
277
+ mount(LOCALHOST_URL);
278
+ expect(screen.queryByRole('link', { name: 'Add to ChatGPT' })).toBeNull();
279
+ });
280
+
259
281
  /**
260
282
  * The default install. claude.ai fetches the server from Anthropic's
261
283
  * infrastructure and cannot reach a laptop, so the button would be dead —
@@ -0,0 +1,45 @@
1
+ import { ExternalLink } from 'lucide-react';
2
+ import { buttonClasses } from '../components';
3
+ import { canDeepLink, chatgptInstallUrl } from './connect-snippets';
4
+
5
+ /**
6
+ * The ChatGPT counterpart of {@link ClaudeInstallLink} — with one honest
7
+ * difference. Claude's link PREFILLS the connector; ChatGPT publishes no
8
+ * such link, so this one only opens the settings pane where a custom MCP
9
+ * server is created. The person still turns on Developer mode, presses
10
+ * Create, types the name and pastes the URL. It is a shortcut through a menu
11
+ * nobody finds on the first try, not a grant of anything — which is why it
12
+ * carries no warning, and why every surface that shows it also shows the
13
+ * name and the URL to paste.
14
+ *
15
+ * Same gate as the Claude link: ChatGPT fetches the server from OpenAI's
16
+ * infrastructure, so an endpoint Anthropic could not reach (plain http,
17
+ * localhost, private ranges — see `canDeepLink`) is one OpenAI cannot reach
18
+ * either, and a button that opens a dialog you cannot complete is worse than
19
+ * none. No `showHint` variant: on the one surface that wants the operator
20
+ * hint, this renders next to the Claude link, whose hint already names both
21
+ * products and the variable that fixes them.
22
+ */
23
+ export function ChatGptInstallLink({
24
+ mcpUrl,
25
+ className,
26
+ }: {
27
+ mcpUrl: string;
28
+ /** Spacing belongs to the caller, ON the element — see `ClaudeInstallLink`. */
29
+ className?: string;
30
+ }) {
31
+ if (!canDeepLink(mcpUrl)) return null;
32
+
33
+ return (
34
+ <a
35
+ href={chatgptInstallUrl()}
36
+ target="_blank"
37
+ rel="noopener noreferrer"
38
+ className={buttonClasses({ variant: 'outline', size: 'sm', className })}
39
+ >
40
+ Add to ChatGPT
41
+ {/* Decoration: the link's own text is its accessible name. */}
42
+ <ExternalLink size={12} className="opacity-70" aria-hidden="true" />
43
+ </a>
44
+ );
45
+ }
@@ -65,9 +65,9 @@ export function ClaudeInstallLink({
65
65
  new copy goes on-scale even when it sits beside copy that is not. */
66
66
  <p className={cn('text-meta text-ink-muted leading-snug', className)}>
67
67
  One-click connect is off because this deployment&rsquo;s public address is{' '}
68
- <code className="font-mono">{withoutCredentials(mcpUrl)}</code>, which Claude cannot reach from the
69
- internet. Set <code className="font-mono">PUBLIC_BACKEND_URL</code> to the https
70
- address people actually use to turn it on. The URL below works either way.
68
+ <code className="font-mono">{withoutCredentials(mcpUrl)}</code>, which Claude and ChatGPT cannot
69
+ reach from the internet. Set <code className="font-mono">PUBLIC_BACKEND_URL</code> to the
70
+ https address people actually use to turn it on. The URL below works either way.
71
71
  </p>
72
72
  );
73
73
  }
@@ -1,11 +1,12 @@
1
1
  import { CopyBlock } from './CopyBlock';
2
2
  import { ClaudeInstallLink } from './ClaudeInstallLink';
3
- import { claudeCodeCommand, jsonConfigSnippet } from './connect-snippets';
3
+ import { ChatGptInstallLink } from './ChatGptInstallLink';
4
+ import { MCP_DISPLAY_NAME, claudeCodeCommand, jsonConfigSnippet } from './connect-snippets';
4
5
 
5
6
  /**
6
7
  * How to point an interactive agent at this workspace: the three
7
- * no-key connection configs, plus the one-click Claude install link when the
8
- * deployment is reachable enough for it to work.
8
+ * no-key connection configs, plus the Claude and ChatGPT install links when
9
+ * the deployment is reachable enough for them to work.
9
10
  *
10
11
  * Its own component rather than a block inside `ExternalAgentAccessPage`
11
12
  * because that page fetches external API keys on mount. Testing "does the
@@ -24,17 +25,22 @@ export function ConnectionInstructions({ mcpUrl }: { mcpUrl: string }) {
24
25
  <>
25
26
  <CopyBlock label="Connect Claude Code" value={claudeCodeCommand(mcpUrl)} rows={2} />
26
27
  <div>
27
- <div className="text-xs font-medium text-ink mb-1">claude.ai / Claude Desktop</div>
28
- {/* The button first, then the manual route underneath — the fallback
29
- has to stay visible, because one-click is unavailable on any
30
- deployment Claude cannot reach and the copy-paste URL is the only
31
- thing that always works. */}
32
- <div className="mb-1.5">
28
+ <div className="text-xs font-medium text-ink mb-1">claude.ai, Claude Desktop and ChatGPT</div>
29
+ {/* The buttons first, then the manual routes underneath — the fallback
30
+ has to stay visible, because the buttons are unavailable on any
31
+ deployment the assistants cannot reach, and the copy-paste URL is
32
+ the only thing that always works. ChatGPT's button only opens the
33
+ settings pane (no prefill exists), so the name and URL to type sit
34
+ right below it. */}
35
+ <div className="mb-1.5 flex flex-wrap items-center gap-2">
33
36
  <ClaudeInstallLink mcpUrl={mcpUrl} showHint />
37
+ <ChatGptInstallLink mcpUrl={mcpUrl} />
34
38
  </div>
35
39
  <p className="text-[11px] text-ink-muted mb-1 leading-snug">
36
- Or add it by hand: Settings → Connectors → Add custom connector, then paste this
37
- URL. When asked to authorize, your browser opens this app to finish connecting.
40
+ Or add it by hand and paste this URL — Claude: Settings → Connectors → Add custom
41
+ connector. ChatGPT: Settings → Apps &amp; Connectors → Advanced → turn on Developer
42
+ mode, then Create, and name it <span className="font-medium">{MCP_DISPLAY_NAME}</span>.
43
+ When asked to authorize, your browser opens this app to finish connecting.
38
44
  </p>
39
45
  <CopyBlock label={null} value={mcpUrl} rows={1} />
40
46
  </div>
@@ -0,0 +1,34 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { render, screen } from '@testing-library/react';
3
+ import { ChatGptInstallLink } from '../ChatGptInstallLink';
4
+
5
+ /**
6
+ * Two states, not three: a live button on a reachable address and nothing on
7
+ * a dead one. There is no hint variant — the Claude link next to it on the
8
+ * settings page carries the operator hint for both.
9
+ */
10
+ describe('ChatGptInstallLink', () => {
11
+ it('opens ChatGPT’s connector settings for a reachable https address', () => {
12
+ render(<ChatGptInstallLink mcpUrl="https://kb.acme.com/api/mcp" />);
13
+ const link = screen.getByRole('link', { name: 'Add to ChatGPT' });
14
+ expect(link).toHaveAttribute('href', expect.stringContaining('chatgpt.com'));
15
+ expect(link).toHaveAttribute('target', '_blank');
16
+ expect(link).toHaveAttribute('rel', 'noopener noreferrer');
17
+ });
18
+
19
+ /**
20
+ * ChatGPT has no prefill link, so the endpoint must NOT be smuggled into
21
+ * the href on the hope that some parameter picks it up — an address in a
22
+ * URL ChatGPT does not read is a leak with no upside.
23
+ */
24
+ it('does not put the endpoint in the href', () => {
25
+ render(<ChatGptInstallLink mcpUrl="https://kb.acme.com/api/mcp" />);
26
+ const href = screen.getByRole('link', { name: 'Add to ChatGPT' }).getAttribute('href')!;
27
+ expect(href).not.toContain('kb.acme.com');
28
+ });
29
+
30
+ it('renders nothing for an address OpenAI could not reach', () => {
31
+ const { container } = render(<ChatGptInstallLink mcpUrl="http://localhost:3001/api/mcp" />);
32
+ expect(container).toBeEmptyDOMElement();
33
+ });
34
+ });