@robosystems/core 0.8.3 → 0.8.4
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/components/console/ConsoleContent.js +47 -28
- package/lib/mcp-connector.d.ts +10 -14
- package/lib/mcp-connector.js +9 -12
- package/package.json +1 -1
|
@@ -90,7 +90,8 @@ export function ConsoleContent({ config }) {
|
|
|
90
90
|
(config.enableRecall
|
|
91
91
|
? ` /recall - Recall semantic memories\n`
|
|
92
92
|
: '') +
|
|
93
|
-
` /mcp -
|
|
93
|
+
` /mcp - Connect an MCP client (sign in — no key)\n` +
|
|
94
|
+
` /mcp key - Mint a graph-scoped API key for header-only clients\n` +
|
|
94
95
|
` /help - Show this help message\n` +
|
|
95
96
|
` /clear - Clear console history\n` +
|
|
96
97
|
` /examples - Show example queries`;
|
|
@@ -405,32 +406,54 @@ export function ConsoleContent({ config }) {
|
|
|
405
406
|
}
|
|
406
407
|
}
|
|
407
408
|
};
|
|
408
|
-
const showMcpSetup = async () => {
|
|
409
|
-
addSystemMessage('Creating graph-scoped connector key...', true);
|
|
409
|
+
const showMcpSetup = async (mode) => {
|
|
410
410
|
const apiUrl = process.env.NEXT_PUBLIC_ROBOSYSTEMS_API_URL ||
|
|
411
411
|
'https://api.robosystems.ai';
|
|
412
412
|
const { mcp } = config;
|
|
413
413
|
const contextId = graphId || mcp.contextIdFallback;
|
|
414
|
+
const endpoint = `${apiUrl}/v1/graphs/${contextId}/mcp`;
|
|
415
|
+
const connectorName = `${mcp.serverName}-${contextId}`;
|
|
416
|
+
const exampleLines = mcp.exampleQuestions
|
|
417
|
+
.map((q) => ` • "${q}"`)
|
|
418
|
+
.join('\n');
|
|
419
|
+
// The graph id lives in the URL path and never becomes a tool argument,
|
|
420
|
+
// so one connection is anchored to exactly one graph. OAuth on the
|
|
421
|
+
// per-graph URL shows this graph preselected on the consent screen; no
|
|
422
|
+
// key is minted unless asked for, so a sign-in user never leaves an
|
|
423
|
+
// unused credential behind in Settings → API Keys.
|
|
424
|
+
if (mode !== 'key') {
|
|
425
|
+
addSystemMessage(`MCP — connect ${contextId}\n` +
|
|
426
|
+
`═══════════════════════════════════════════════════════════════\n\n` +
|
|
427
|
+
`Sign in to connect (recommended). Paste the URL; the client sends\n` +
|
|
428
|
+
`you to sign in, and this graph is already selected on the consent\n` +
|
|
429
|
+
`screen. Nothing to copy, store, or rotate.\n\n` +
|
|
430
|
+
`Claude (claude.ai / Desktop)\n` +
|
|
431
|
+
` Settings → Connectors → Add custom connector\n` +
|
|
432
|
+
` ${endpoint}\n\n` +
|
|
433
|
+
`Claude Code (then /mcp to sign in)\n` +
|
|
434
|
+
` claude mcp add --transport http ${connectorName} ${endpoint}\n\n` +
|
|
435
|
+
`Cursor / VS Code (mcp.json)\n` +
|
|
436
|
+
` "${connectorName}": { "url": "${endpoint}" }\n\n` +
|
|
437
|
+
`Any graph from one address: ${apiUrl}/v1/mcp — pick the graph at\n` +
|
|
438
|
+
`sign-in.\n\n` +
|
|
439
|
+
`Scripts, CI, or a client that can't sign in? Type /mcp key to mint\n` +
|
|
440
|
+
`an API key scoped to this graph, with the header snippets filled in.\n\n` +
|
|
441
|
+
`Once connected, ask questions like:\n` +
|
|
442
|
+
`${exampleLines}\n\n` +
|
|
443
|
+
`Clients without HTTP transport support can use the stdio bridge\n` +
|
|
444
|
+
`in proxy mode: https://github.com/RoboFinSystems/robosystems-mcp-client`, true);
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
addSystemMessage('Creating graph-scoped API key...', true);
|
|
414
448
|
try {
|
|
415
449
|
const { createMcpConnectorUrl } = await import('../../lib/mcp-connector');
|
|
416
|
-
//
|
|
417
|
-
//
|
|
418
|
-
// add one connector per graph, which is why the name carries the id.
|
|
419
|
-
// The key is graph-scoped: valid only for this graph, revocable in
|
|
420
|
-
// Settings → API Keys, and rejected on every account-level surface.
|
|
450
|
+
// Graph-scoped: valid only for this graph and its subgraphs, rejected on
|
|
451
|
+
// every account-level surface, revocable in Settings → API Keys.
|
|
421
452
|
const connector = await createMcpConnectorUrl(contextId, { apiUrl });
|
|
422
|
-
|
|
423
|
-
const exampleLines = mcp.exampleQuestions
|
|
424
|
-
.map((q) => ` • "${q}"`)
|
|
425
|
-
.join('\n');
|
|
426
|
-
addSystemMessage(`MCP Setup Instructions:\n` +
|
|
453
|
+
addSystemMessage(`API key for ${contextId}\n` +
|
|
427
454
|
`═══════════════════════════════════════════════════════════════\n\n` +
|
|
428
|
-
`
|
|
429
|
-
`
|
|
430
|
-
`Claude (claude.ai / Desktop)\n` +
|
|
431
|
-
` Settings → Connectors → Add custom connector, then paste this\n` +
|
|
432
|
-
` URL (the key rides inside it — no header field needed):\n` +
|
|
433
|
-
` ${connector.url}\n\n` +
|
|
455
|
+
`Scoped to this graph only; revoke it anytime in Settings → API Keys.\n` +
|
|
456
|
+
`It goes in the X-API-Key header — never in the URL.\n\n` +
|
|
434
457
|
`Claude Code\n` +
|
|
435
458
|
` claude mcp add --transport http ${connectorName} \\\n` +
|
|
436
459
|
` ${connector.endpoint} \\\n` +
|
|
@@ -440,16 +463,12 @@ export function ConsoleContent({ config }) {
|
|
|
440
463
|
` "url": "${connector.endpoint}",\n` +
|
|
441
464
|
` "headers": { "X-API-Key": "${connector.apiKey}" }\n` +
|
|
442
465
|
` }\n\n` +
|
|
443
|
-
`
|
|
444
|
-
`${exampleLines}\n\n` +
|
|
445
|
-
`Clients without HTTP transport support can use the stdio bridge\n` +
|
|
446
|
-
`in proxy mode: https://github.com/RoboFinSystems/robosystems-mcp-client\n\n` +
|
|
447
|
-
`The connector URL contains the key — treat it like a password.`, true);
|
|
466
|
+
`Treat the key like a password. Shown once.`, true);
|
|
448
467
|
}
|
|
449
468
|
catch (error) {
|
|
450
|
-
addErrorMessage(`Failed to create
|
|
451
|
-
`You can create
|
|
452
|
-
` URL: ${
|
|
469
|
+
addErrorMessage(`Failed to create API key: ${error.message || 'Unknown error'}\n\n` +
|
|
470
|
+
`You can create a key in Settings and connect with:\n` +
|
|
471
|
+
` URL: ${endpoint}\n` +
|
|
453
472
|
` Header: X-API-Key: <your key>`);
|
|
454
473
|
}
|
|
455
474
|
};
|
|
@@ -602,7 +621,7 @@ export function ConsoleContent({ config }) {
|
|
|
602
621
|
return;
|
|
603
622
|
}
|
|
604
623
|
case '/mcp':
|
|
605
|
-
await showMcpSetup();
|
|
624
|
+
await showMcpSetup(command.slice(cmd.length).trim().toLowerCase());
|
|
606
625
|
return;
|
|
607
626
|
default:
|
|
608
627
|
addErrorMessage(`Unknown command: ${cmd}\n\nType /help for available commands.`);
|
package/lib/mcp-connector.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export interface McpConnectorUrl {
|
|
2
|
-
/**
|
|
3
|
-
url: string;
|
|
4
|
-
/** Bare MCP endpoint URL (no credential) — for header-capable clients */
|
|
2
|
+
/** Bare per-graph MCP endpoint URL (no credential) */
|
|
5
3
|
endpoint: string;
|
|
6
4
|
/** The plaintext graph-scoped API key (returned once at mint) */
|
|
7
5
|
apiKey: string;
|
|
@@ -10,18 +8,16 @@ export interface McpConnectorUrl {
|
|
|
10
8
|
graphId: string;
|
|
11
9
|
}
|
|
12
10
|
/**
|
|
13
|
-
* Mint a graph-scoped API key
|
|
11
|
+
* Mint a graph-scoped API key for the per-graph MCP endpoint.
|
|
14
12
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* Header-capable clients (Claude Code, Cursor, VS Code) should use the
|
|
24
|
-
* bare `endpoint` with the key in an `X-API-Key` header instead.
|
|
13
|
+
* For clients that cannot sign in (scripts, CI, editors without OAuth):
|
|
14
|
+
* the key goes in an `X-API-Key` header on `endpoint`. It works for
|
|
15
|
+
* exactly this graph (and its subgraphs), is rejected on every
|
|
16
|
+
* account-level surface, and can be revoked from Settings → API Keys like
|
|
17
|
+
* any other key. Credentials never travel in the URL — the `?token=`
|
|
18
|
+
* connector URL was the bridge to OAuth and the server no longer honors
|
|
19
|
+
* it. OAuth-capable clients need no key at all: they add `endpoint` (or
|
|
20
|
+
* the graph-agnostic `/v1/mcp`) and sign in.
|
|
25
21
|
*/
|
|
26
22
|
export declare function createMcpConnectorUrl(graphId: string, options?: {
|
|
27
23
|
apiUrl?: string;
|
package/lib/mcp-connector.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
const DEFAULT_API_URL = 'https://api.robosystems.ai';
|
|
2
2
|
/**
|
|
3
|
-
* Mint a graph-scoped API key
|
|
3
|
+
* Mint a graph-scoped API key for the per-graph MCP endpoint.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* Header-capable clients (Claude Code, Cursor, VS Code) should use the
|
|
14
|
-
* bare `endpoint` with the key in an `X-API-Key` header instead.
|
|
5
|
+
* For clients that cannot sign in (scripts, CI, editors without OAuth):
|
|
6
|
+
* the key goes in an `X-API-Key` header on `endpoint`. It works for
|
|
7
|
+
* exactly this graph (and its subgraphs), is rejected on every
|
|
8
|
+
* account-level surface, and can be revoked from Settings → API Keys like
|
|
9
|
+
* any other key. Credentials never travel in the URL — the `?token=`
|
|
10
|
+
* connector URL was the bridge to OAuth and the server no longer honors
|
|
11
|
+
* it. OAuth-capable clients need no key at all: they add `endpoint` (or
|
|
12
|
+
* the graph-agnostic `/v1/mcp`) and sign in.
|
|
15
13
|
*/
|
|
16
14
|
export async function createMcpConnectorUrl(graphId, options = {}) {
|
|
17
15
|
var _a, _b;
|
|
@@ -26,7 +24,6 @@ export async function createMcpConnectorUrl(graphId, options = {}) {
|
|
|
26
24
|
}
|
|
27
25
|
const endpoint = `${apiUrl}/v1/graphs/${graphId}/mcp`;
|
|
28
26
|
return {
|
|
29
|
-
url: `${endpoint}?token=${response.data.key}`,
|
|
30
27
|
endpoint,
|
|
31
28
|
apiKey: response.data.key,
|
|
32
29
|
keyName,
|
package/package.json
CHANGED