@bevel-software/platform-core-frontend 0.13.3 → 0.13.6
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/THIRD-PARTY-NOTICES.md +4 -4
- package/package.json +3 -3
- package/src/modules/library/__tests__/ToolPage.test.tsx +148 -0
- package/src/modules/library/components/tool-page/ToolPage.tsx +84 -1
- package/src/modules/library/hooks/useToolSource.ts +77 -0
- package/src/modules/onboarding/__tests__/onboarding.test.tsx +760 -730
- package/src/modules/onboarding/agent-clients.ts +9 -3
- package/src/modules/onboarding/components/WelcomePage.tsx +9 -7
- package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +34 -12
- package/src/shared/mcp/ChatGptInstallLink.tsx +45 -0
- package/src/shared/mcp/ClaudeInstallLink.tsx +3 -3
- package/src/shared/mcp/ConnectionInstructions.tsx +17 -11
- package/src/shared/mcp/__tests__/ChatGptInstallLink.test.tsx +34 -0
- package/src/shared/mcp/__tests__/connect-snippets.test.ts +49 -13
- package/src/shared/mcp/connect-snippets.ts +41 -6
- package/src/shared/mcp/index.ts +4 -0
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
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
|
-
|
|
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
|
-
{/*
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
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">
|
|
@@ -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
|
|
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('
|
|
95
|
-
expect(JSON.parse(json!).mcpServers['knowledge
|
|
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('"
|
|
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
|
|
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
|
|
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('"
|
|
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’s public address is{' '}
|
|
68
|
-
<code className="font-mono">{withoutCredentials(mcpUrl)}</code>, which Claude
|
|
69
|
-
internet. Set <code className="font-mono">PUBLIC_BACKEND_URL</code> to the
|
|
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 {
|
|
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
|
|
8
|
-
* deployment is reachable enough for
|
|
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
|
|
28
|
-
{/* The
|
|
29
|
-
has to stay visible, because
|
|
30
|
-
deployment
|
|
31
|
-
thing that always works.
|
|
32
|
-
|
|
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
|
|
37
|
-
|
|
40
|
+
Or add it by hand and paste this URL — Claude: Settings → Connectors → Add custom
|
|
41
|
+
connector. ChatGPT: Settings → Apps & 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
|
+
});
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
2
2
|
import {
|
|
3
|
+
MCP_DISPLAY_NAME,
|
|
4
|
+
MCP_SERVER_KEY,
|
|
3
5
|
canDeepLink,
|
|
6
|
+
chatgptInstallUrl,
|
|
4
7
|
claudeCodeCommand,
|
|
5
8
|
claudeInstallUrl,
|
|
6
9
|
configureMcpUrl,
|
|
@@ -325,9 +328,42 @@ describe('claudeInstallUrl: the documented install link', () => {
|
|
|
325
328
|
});
|
|
326
329
|
});
|
|
327
330
|
|
|
331
|
+
describe('chatgptInstallUrl: the settings pane, since ChatGPT prefills nothing', () => {
|
|
332
|
+
it('opens ChatGPT’s connector settings over https', () => {
|
|
333
|
+
const link = chatgptInstallUrl();
|
|
334
|
+
expect(link.startsWith('https://chatgpt.com/')).toBe(true);
|
|
335
|
+
expect(link).toContain('settings');
|
|
336
|
+
});
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
describe('the two spellings of the name', () => {
|
|
340
|
+
// Humans read this one: it is what the connector list and the ChatGPT
|
|
341
|
+
// Create dialog show, so it is the product's words, not a slug.
|
|
342
|
+
it('shows people "Skills, Tools and Knowledge"', () => {
|
|
343
|
+
expect(MCP_DISPLAY_NAME).toBe('Skills, Tools and Knowledge');
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Config files read this one. Claude Code derives every tool name from it
|
|
348
|
+
* (`mcp__<server>__<tool>`), so a space or a comma here would surface in
|
|
349
|
+
* an identifier — and the same key must serve the hosted endpoint and the
|
|
350
|
+
* local server, so nothing drifts between the two families of snippets.
|
|
351
|
+
*/
|
|
352
|
+
it('gives config files a plain slug that every snippet shares', () => {
|
|
353
|
+
expect(MCP_SERVER_KEY).toMatch(/^[a-z0-9-]+$/);
|
|
354
|
+
const URL_UNDER_TEST = 'https://kb.acme.com/api/mcp';
|
|
355
|
+
expect(claudeCodeCommand(URL_UNDER_TEST)).toContain(` ${MCP_SERVER_KEY} `);
|
|
356
|
+
expect(Object.keys(JSON.parse(jsonConfigSnippet(URL_UNDER_TEST)).mcpServers)).toEqual([MCP_SERVER_KEY]);
|
|
357
|
+
expect(hexisMcpClaudeCommand('https://kb.acme.com')).toContain(`claude mcp add ${MCP_SERVER_KEY} `);
|
|
358
|
+
expect(Object.keys(JSON.parse(hexisMcpJsonSnippet('https://kb.acme.com')).mcpServers)).toEqual([
|
|
359
|
+
MCP_SERVER_KEY,
|
|
360
|
+
]);
|
|
361
|
+
});
|
|
362
|
+
});
|
|
363
|
+
|
|
328
364
|
describe('connectorName: what it is called in a connector list', () => {
|
|
329
365
|
it('names the product and the deployment', () => {
|
|
330
|
-
expect(connectorName('https://kb.acme.com/api/mcp')).toBe('Knowledge — kb.acme.com');
|
|
366
|
+
expect(connectorName('https://kb.acme.com/api/mcp')).toBe('Skills, Tools and Knowledge — kb.acme.com');
|
|
331
367
|
});
|
|
332
368
|
|
|
333
369
|
/**
|
|
@@ -343,11 +379,11 @@ describe('connectorName: what it is called in a connector list', () => {
|
|
|
343
379
|
|
|
344
380
|
// `host`, not `hostname` — two instances on one machine differ only by port.
|
|
345
381
|
it('keeps a non-default port', () => {
|
|
346
|
-
expect(connectorName('https://kb.acme.com:8443/api/mcp')).toBe('Knowledge — kb.acme.com:8443');
|
|
382
|
+
expect(connectorName('https://kb.acme.com:8443/api/mcp')).toBe('Skills, Tools and Knowledge — kb.acme.com:8443');
|
|
347
383
|
});
|
|
348
384
|
|
|
349
385
|
it('still names something when the URL is unparseable', () => {
|
|
350
|
-
expect(connectorName('not a url')).toBe('Knowledge');
|
|
386
|
+
expect(connectorName('not a url')).toBe('Skills, Tools and Knowledge');
|
|
351
387
|
});
|
|
352
388
|
});
|
|
353
389
|
|
|
@@ -357,13 +393,13 @@ describe('snippets: one builder per client, keyed or not', () => {
|
|
|
357
393
|
|
|
358
394
|
it('builds the Claude Code command without a key', () => {
|
|
359
395
|
expect(claudeCodeCommand(URL_UNDER_TEST)).toBe(
|
|
360
|
-
`claude mcp add --transport http knowledge
|
|
396
|
+
`claude mcp add --transport http skills-tools-knowledge ${URL_UNDER_TEST}`,
|
|
361
397
|
);
|
|
362
398
|
});
|
|
363
399
|
|
|
364
400
|
it('appends the Authorization header when there is a key', () => {
|
|
365
401
|
expect(claudeCodeCommand(URL_UNDER_TEST, KEY)).toBe(
|
|
366
|
-
`claude mcp add --transport http knowledge
|
|
402
|
+
`claude mcp add --transport http skills-tools-knowledge ${URL_UNDER_TEST} --header "Authorization: Bearer ${KEY}"`,
|
|
367
403
|
);
|
|
368
404
|
});
|
|
369
405
|
|
|
@@ -373,16 +409,16 @@ describe('snippets: one builder per client, keyed or not', () => {
|
|
|
373
409
|
*/
|
|
374
410
|
it('omits headers entirely from the keyless JSON config', () => {
|
|
375
411
|
const parsed = JSON.parse(jsonConfigSnippet(URL_UNDER_TEST));
|
|
376
|
-
expect(parsed.mcpServers['knowledge
|
|
412
|
+
expect(parsed.mcpServers['skills-tools-knowledge']).toEqual({
|
|
377
413
|
type: 'http',
|
|
378
414
|
url: URL_UNDER_TEST,
|
|
379
415
|
});
|
|
380
|
-
expect('headers' in parsed.mcpServers['knowledge
|
|
416
|
+
expect('headers' in parsed.mcpServers['skills-tools-knowledge']).toBe(false);
|
|
381
417
|
});
|
|
382
418
|
|
|
383
419
|
it('carries the key in the JSON config when there is one', () => {
|
|
384
420
|
const parsed = JSON.parse(jsonConfigSnippet(URL_UNDER_TEST, KEY));
|
|
385
|
-
expect(parsed.mcpServers['knowledge
|
|
421
|
+
expect(parsed.mcpServers['skills-tools-knowledge']).toEqual({
|
|
386
422
|
type: 'http',
|
|
387
423
|
url: URL_UNDER_TEST,
|
|
388
424
|
headers: { Authorization: `Bearer ${KEY}` },
|
|
@@ -396,7 +432,7 @@ describe('snippets: one builder per client, keyed or not', () => {
|
|
|
396
432
|
*/
|
|
397
433
|
it('escapes shell metacharacters in the key for the Claude Code command', () => {
|
|
398
434
|
expect(claudeCodeCommand(URL_UNDER_TEST, 'a"b$c`d\\e')).toBe(
|
|
399
|
-
`claude mcp add --transport http knowledge
|
|
435
|
+
`claude mcp add --transport http skills-tools-knowledge ${URL_UNDER_TEST} --header "Authorization: Bearer a\\"b\\$c\\\`d\\\\e"`,
|
|
400
436
|
);
|
|
401
437
|
});
|
|
402
438
|
|
|
@@ -404,7 +440,7 @@ describe('snippets: one builder per client, keyed or not', () => {
|
|
|
404
440
|
// the client reading the file gets the exact bytes back.
|
|
405
441
|
it('does not shell-escape the key in the JSON config', () => {
|
|
406
442
|
const parsed = JSON.parse(jsonConfigSnippet(URL_UNDER_TEST, 'a"b$c'));
|
|
407
|
-
expect(parsed.mcpServers['knowledge
|
|
443
|
+
expect(parsed.mcpServers['skills-tools-knowledge'].headers.Authorization).toBe('Bearer a"b$c');
|
|
408
444
|
});
|
|
409
445
|
|
|
410
446
|
it('spells the Langdock fields out separately', () => {
|
|
@@ -430,7 +466,7 @@ describe('snippets: one builder per client, keyed or not', () => {
|
|
|
430
466
|
|
|
431
467
|
it('builds a JSON config that spawns the package with the key', () => {
|
|
432
468
|
const parsed = JSON.parse(hexisMcpJsonSnippet(BASE, KEY));
|
|
433
|
-
expect(parsed.mcpServers['knowledge']).toEqual({
|
|
469
|
+
expect(parsed.mcpServers['skills-tools-knowledge']).toEqual({
|
|
434
470
|
command: 'npx',
|
|
435
471
|
args: ['-y', '@bevel-software/hexis-mcp'],
|
|
436
472
|
env: {
|
|
@@ -448,7 +484,7 @@ describe('snippets: one builder per client, keyed or not', () => {
|
|
|
448
484
|
*/
|
|
449
485
|
it('omits the key env entirely when no key was minted — keyless selects browser sign-in', () => {
|
|
450
486
|
const parsed = JSON.parse(hexisMcpJsonSnippet(BASE));
|
|
451
|
-
expect(parsed.mcpServers['knowledge'].env).toEqual({
|
|
487
|
+
expect(parsed.mcpServers['skills-tools-knowledge'].env).toEqual({
|
|
452
488
|
HEXIS_URL: BASE,
|
|
453
489
|
});
|
|
454
490
|
expect(hexisMcpJsonSnippet(BASE)).not.toContain(KEY);
|
|
@@ -456,7 +492,7 @@ describe('snippets: one builder per client, keyed or not', () => {
|
|
|
456
492
|
|
|
457
493
|
it('builds the Claude Code command as a stdio add with both env values', () => {
|
|
458
494
|
expect(hexisMcpClaudeCommand(BASE, KEY)).toBe(
|
|
459
|
-
`claude mcp add knowledge --env HEXIS_URL="${BASE}" --env HEXIS_CONNECTION_KEY="${KEY}" -- npx -y @bevel-software/hexis-mcp`,
|
|
495
|
+
`claude mcp add skills-tools-knowledge --env HEXIS_URL="${BASE}" --env HEXIS_CONNECTION_KEY="${KEY}" -- npx -y @bevel-software/hexis-mcp`,
|
|
460
496
|
);
|
|
461
497
|
});
|
|
462
498
|
|
|
@@ -28,6 +28,25 @@
|
|
|
28
28
|
/** Where `/api/mcp` hangs off a given origin. The one place that path is spelled. */
|
|
29
29
|
const MCP_PATH = '/api/mcp';
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* What this workspace is called when it shows up in an agent's server list.
|
|
33
|
+
* Two spellings of one name, because the two places it goes have different
|
|
34
|
+
* rules:
|
|
35
|
+
*
|
|
36
|
+
* - {@link MCP_DISPLAY_NAME} is for humans: the connector name claude.ai
|
|
37
|
+
* shows, and what someone types into ChatGPT's "Create" dialog. Spaces and
|
|
38
|
+
* punctuation are fine there.
|
|
39
|
+
* - {@link MCP_SERVER_KEY} is for config files: the `mcpServers` key and the
|
|
40
|
+
* `claude mcp add <name>` argument. Clients derive identifiers from it —
|
|
41
|
+
* Claude Code names every tool `mcp__<server>__<tool>` — so it has to be a
|
|
42
|
+
* plain slug. The same key serves the hosted endpoint and the local server:
|
|
43
|
+
* they are one workspace, and nobody adds both to one client.
|
|
44
|
+
*
|
|
45
|
+
* Everything below spells the name through these two; nothing re-types it.
|
|
46
|
+
*/
|
|
47
|
+
export const MCP_DISPLAY_NAME = 'Skills, Tools and Knowledge';
|
|
48
|
+
export const MCP_SERVER_KEY = 'skills-tools-knowledge';
|
|
49
|
+
|
|
31
50
|
/**
|
|
32
51
|
* The deployment's own answer, from `GET /api/config`. Module-global because
|
|
33
52
|
* it is a property of the deployment rather than of any component, and it is
|
|
@@ -279,9 +298,9 @@ function isPrivateIpv6(bracketed: string): boolean {
|
|
|
279
298
|
*/
|
|
280
299
|
export function connectorName(mcpUrl: string): string {
|
|
281
300
|
try {
|
|
282
|
-
return
|
|
301
|
+
return `${MCP_DISPLAY_NAME} — ${new URL(mcpUrl).host}`;
|
|
283
302
|
} catch {
|
|
284
|
-
return
|
|
303
|
+
return MCP_DISPLAY_NAME;
|
|
285
304
|
}
|
|
286
305
|
}
|
|
287
306
|
|
|
@@ -308,6 +327,22 @@ export function claudeInstallUrl(mcpUrl: string, name: string): string {
|
|
|
308
327
|
return `${CLAUDE_ADD_CONNECTOR}?${params}`;
|
|
309
328
|
}
|
|
310
329
|
|
|
330
|
+
/**
|
|
331
|
+
* Where ChatGPT keeps its connector settings — the pane whose "Advanced"
|
|
332
|
+
* section holds the Developer mode toggle and, once it is on, the "Create"
|
|
333
|
+
* button for a custom MCP server.
|
|
334
|
+
*
|
|
335
|
+
* Unlike Claude, ChatGPT publishes no install link: there is no query
|
|
336
|
+
* parameter that prefills a connector's name or URL. So this is a shortcut to
|
|
337
|
+
* the right settings pane and nothing more — the person still types the name
|
|
338
|
+
* and pastes the endpoint, which is why every surface that offers this link
|
|
339
|
+
* shows both right beside it. The settings pane is a hash route, so it takes
|
|
340
|
+
* no parameters and there is nothing to encode.
|
|
341
|
+
*/
|
|
342
|
+
export function chatgptInstallUrl(): string {
|
|
343
|
+
return 'https://chatgpt.com/#settings/Connectors';
|
|
344
|
+
}
|
|
345
|
+
|
|
311
346
|
/* ------------------------------------------------------------------ *
|
|
312
347
|
* The snippets themselves. One builder per client, each taking the URL
|
|
313
348
|
* so no caller ever re-derives it, and an optional bearer token for the
|
|
@@ -326,7 +361,7 @@ function escapeForDoubleQuotes(value: string): string {
|
|
|
326
361
|
|
|
327
362
|
/** The `claude mcp add` one-liner, with the key appended when there is one. */
|
|
328
363
|
export function claudeCodeCommand(mcpUrl: string, bearer?: string): string {
|
|
329
|
-
const base = `claude mcp add --transport http
|
|
364
|
+
const base = `claude mcp add --transport http ${MCP_SERVER_KEY} ${mcpUrl}`;
|
|
330
365
|
return bearer ? `${base} --header "Authorization: Bearer ${escapeForDoubleQuotes(bearer)}"` : base;
|
|
331
366
|
}
|
|
332
367
|
|
|
@@ -335,7 +370,7 @@ export function jsonConfigSnippet(mcpUrl: string, bearer?: string): string {
|
|
|
335
370
|
return JSON.stringify(
|
|
336
371
|
{
|
|
337
372
|
mcpServers: {
|
|
338
|
-
|
|
373
|
+
[MCP_SERVER_KEY]: {
|
|
339
374
|
type: 'http',
|
|
340
375
|
url: mcpUrl,
|
|
341
376
|
...(bearer ? { headers: { Authorization: `Bearer ${bearer}` } } : {}),
|
|
@@ -394,7 +429,7 @@ export function hexisMcpJsonSnippet(baseUrl: string, bearer?: string): string {
|
|
|
394
429
|
return JSON.stringify(
|
|
395
430
|
{
|
|
396
431
|
mcpServers: {
|
|
397
|
-
|
|
432
|
+
[MCP_SERVER_KEY]: {
|
|
398
433
|
command: 'npx',
|
|
399
434
|
args: ['-y', '@bevel-software/hexis-mcp'],
|
|
400
435
|
env: {
|
|
@@ -421,7 +456,7 @@ export function hexisMcpJsonSnippet(baseUrl: string, bearer?: string): string {
|
|
|
421
456
|
*/
|
|
422
457
|
export function hexisMcpClaudeCommand(baseUrl: string, bearer?: string): string {
|
|
423
458
|
return (
|
|
424
|
-
`claude mcp add
|
|
459
|
+
`claude mcp add ${MCP_SERVER_KEY}` +
|
|
425
460
|
` --env HEXIS_URL="${escapeForDoubleQuotes(baseUrl)}"` +
|
|
426
461
|
(bearer ? ` --env HEXIS_CONNECTION_KEY="${escapeForDoubleQuotes(bearer)}"` : '') +
|
|
427
462
|
` -- npx -y @bevel-software/hexis-mcp`
|
package/src/shared/mcp/index.ts
CHANGED
|
@@ -12,7 +12,10 @@
|
|
|
12
12
|
* Tests import it straight from `./connect-snippets`, as `test-setup.ts` does.
|
|
13
13
|
*/
|
|
14
14
|
export {
|
|
15
|
+
MCP_DISPLAY_NAME,
|
|
16
|
+
MCP_SERVER_KEY,
|
|
15
17
|
canDeepLink,
|
|
18
|
+
chatgptInstallUrl,
|
|
16
19
|
claudeCodeCommand,
|
|
17
20
|
claudeInstallUrl,
|
|
18
21
|
configureMcpUrl,
|
|
@@ -26,6 +29,7 @@ export {
|
|
|
26
29
|
} from './connect-snippets';
|
|
27
30
|
|
|
28
31
|
export { ClaudeInstallLink } from './ClaudeInstallLink';
|
|
32
|
+
export { ChatGptInstallLink } from './ChatGptInstallLink';
|
|
29
33
|
export { ConnectionInstructions } from './ConnectionInstructions';
|
|
30
34
|
export { CopyBlock } from './CopyBlock';
|
|
31
35
|
export { useCopyFeedback } from './useCopyFeedback';
|