@mcp-b/react-components 0.5.7 → 0.6.1

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.
@@ -1,3 +1,4 @@
1
+ import { McpServerCard, McpServerManualSetup } from "../utils/mcp-server-catalog.js";
1
2
  import * as React from "react";
2
3
 
3
4
  //#region src/components/AgentConnection.d.ts
@@ -24,14 +25,19 @@ type NanitesAgentConnectionOptions = {
24
25
  type AgentConnectionPanelProps = {
25
26
  readonly className?: string;
26
27
  readonly commands?: readonly AgentConnectionCommand[];
28
+ readonly dcrMcpServers?: readonly McpServerCard[];
27
29
  readonly defaultTarget?: AgentConnectionTarget;
28
30
  readonly headingLevel?: 2 | 3;
31
+ readonly manualMcpServers?: readonly McpServerCard[];
29
32
  readonly origin?: string;
30
33
  readonly section?: boolean;
31
34
  };
32
35
  type AgentConnectionPopoverProps = Omit<AgentConnectionPanelProps, "section"> & {
33
36
  readonly className?: string;
34
37
  };
38
+ type McpServerSetupProps = {
39
+ readonly setup: McpServerManualSetup;
40
+ };
35
41
  declare function Connection({
36
42
  fromX,
37
43
  fromY,
@@ -53,11 +59,16 @@ declare function buildNanitesAgentConnectionCommands(origin: string, {
53
59
  declare function AgentConnectionPanel({
54
60
  className,
55
61
  commands: commandsProp,
62
+ dcrMcpServers,
56
63
  defaultTarget,
57
64
  headingLevel,
65
+ manualMcpServers,
58
66
  origin,
59
67
  section
60
68
  }: AgentConnectionPanelProps): React.JSX.Element | null;
69
+ declare function McpServerSetup({
70
+ setup
71
+ }: McpServerSetupProps): React.JSX.Element;
61
72
  /**
62
73
  * Compact popover trigger for showing AgentConnectionPanel inline.
63
74
  */
@@ -66,4 +77,4 @@ declare function AgentConnectionPopover({
66
77
  ...props
67
78
  }: AgentConnectionPopoverProps): React.JSX.Element;
68
79
  //#endregion
69
- export { AgentConnectionCommand, AgentConnectionPanel, AgentConnectionPanelProps, AgentConnectionPopover, AgentConnectionPopoverProps, AgentConnectionTarget, Connection, ConnectionProps, NanitesAgentConnectionOptions, buildNanitesAgentConnectionCommands };
80
+ export { AgentConnectionCommand, AgentConnectionPanel, AgentConnectionPanelProps, AgentConnectionPopover, AgentConnectionPopoverProps, AgentConnectionTarget, Connection, ConnectionProps, McpServerSetup, McpServerSetupProps, NanitesAgentConnectionOptions, buildNanitesAgentConnectionCommands };
@@ -3,6 +3,7 @@ import { y as LinkIcon } from "../icons-BCNawx-T.js";
3
3
  import { Popover } from "./Popover.js";
4
4
  import { Button } from "./Button.js";
5
5
  import { a as CodeBlockCopyButton, i as CodeBlockContent, n as CodeBlockActions, p as CodeBlockTitle, r as CodeBlockContainer, s as CodeBlockHeader, t as CodeBlock } from "../CodeBlock-BK0sOAbV.js";
6
+ import { DCR_MCP_SERVER_CARDS, MANUAL_MCP_SERVER_CARDS } from "../utils/mcp-server-catalog.js";
6
7
  import * as React from "react";
7
8
  import { jsx, jsxs } from "react/jsx-runtime";
8
9
  //#region src/components/AgentConnection.tsx
@@ -95,7 +96,7 @@ function buildNanitesAgentConnectionCommands(origin, { mcpName = "nanites", plug
95
96
  * Use inside setup screens where users need Codex, Claude Code, skill-only,
96
97
  * or raw MCP JSON connection instructions.
97
98
  */
98
- function AgentConnectionPanel({ className, commands: commandsProp, defaultTarget = "codex", headingLevel = 2, origin, section = true }) {
99
+ function AgentConnectionPanel({ className, commands: commandsProp, dcrMcpServers = DCR_MCP_SERVER_CARDS, defaultTarget = "codex", headingLevel = 2, manualMcpServers = MANUAL_MCP_SERVER_CARDS, origin, section = true }) {
99
100
  const commands = React.useMemo(() => commandsProp ?? buildNanitesAgentConnectionCommands(origin ?? getBrowserOrigin()), [commandsProp, origin]);
100
101
  const [target, setTarget] = React.useState(defaultTarget);
101
102
  const selected = commands.find((command) => command.target === target) ?? commands[0];
@@ -141,10 +142,86 @@ function AgentConnectionPanel({ className, commands: commandsProp, defaultTarget
141
142
  code: selected.code,
142
143
  language: selected.language,
143
144
  children: [/* @__PURE__ */ jsxs(CodeBlockHeader, { children: [/* @__PURE__ */ jsx(CodeBlockTitle, { children: selected.label }), /* @__PURE__ */ jsx(CodeBlockActions, { children: /* @__PURE__ */ jsx(CodeBlockCopyButton, {}) })] }), /* @__PURE__ */ jsx(CodeBlockContainer, { children: /* @__PURE__ */ jsx(CodeBlockContent, {}) })]
144
- })
145
+ }),
146
+ dcrMcpServers.length > 0 ? /* @__PURE__ */ jsx(McpServerList, {
147
+ heading: "DCR-ready MCP servers",
148
+ servers: dcrMcpServers
149
+ }) : null,
150
+ manualMcpServers.length > 0 ? /* @__PURE__ */ jsx(McpServerList, {
151
+ heading: "Manual setup MCP servers",
152
+ servers: manualMcpServers
153
+ }) : null
145
154
  ]
146
155
  });
147
156
  }
157
+ function McpServerList({ heading, servers }) {
158
+ return /* @__PURE__ */ jsxs("div", {
159
+ className: "agent-connect__mcp",
160
+ children: [/* @__PURE__ */ jsx("p", {
161
+ className: "agent-connect__mcp-heading",
162
+ children: heading
163
+ }), /* @__PURE__ */ jsx("ul", {
164
+ className: "agent-connect__mcp-list",
165
+ role: "list",
166
+ children: servers.map((server) => /* @__PURE__ */ jsxs("li", {
167
+ className: "agent-connect__mcp-item",
168
+ children: [/* @__PURE__ */ jsx("span", {
169
+ className: "agent-connect__mcp-icon",
170
+ children: renderMcpServerIcon(server)
171
+ }), /* @__PURE__ */ jsxs("div", {
172
+ className: "agent-connect__mcp-copy",
173
+ children: [
174
+ /* @__PURE__ */ jsx("a", {
175
+ className: "agent-connect__mcp-name",
176
+ href: server.url,
177
+ target: "_blank",
178
+ rel: "noreferrer",
179
+ children: server.name
180
+ }),
181
+ server.description ? /* @__PURE__ */ jsx("span", {
182
+ className: "agent-connect__mcp-description",
183
+ children: server.description
184
+ }) : null,
185
+ server.manualSetup ? /* @__PURE__ */ jsx(McpServerSetup, { setup: server.manualSetup }) : null
186
+ ]
187
+ })]
188
+ }, server.id))
189
+ })]
190
+ });
191
+ }
192
+ function McpServerSetup({ setup }) {
193
+ return /* @__PURE__ */ jsxs("div", {
194
+ className: "agent-connect__mcp-setup",
195
+ children: [/* @__PURE__ */ jsx("p", { children: setup.description }), setup.links.length > 0 ? /* @__PURE__ */ jsx("ul", {
196
+ className: "agent-connect__mcp-setup-links",
197
+ role: "list",
198
+ children: setup.links.map((link) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", {
199
+ href: link.url,
200
+ target: "_blank",
201
+ rel: "noreferrer",
202
+ children: link.label
203
+ }) }, `${link.label}:${link.url}`))
204
+ }) : null]
205
+ });
206
+ }
207
+ function renderMcpServerIcon(server) {
208
+ const icon = server.icon;
209
+ if (typeof icon === "string") return /* @__PURE__ */ jsx("img", {
210
+ src: icon,
211
+ alt: "",
212
+ loading: "lazy",
213
+ decoding: "async",
214
+ referrerPolicy: "no-referrer"
215
+ });
216
+ if (icon) return /* @__PURE__ */ jsx("img", {
217
+ src: icon.src,
218
+ alt: "",
219
+ loading: "lazy",
220
+ decoding: "async",
221
+ referrerPolicy: "no-referrer"
222
+ });
223
+ return server.name.slice(0, 1);
224
+ }
148
225
  /**
149
226
  * Compact popover trigger for showing AgentConnectionPanel inline.
150
227
  */
@@ -173,4 +250,4 @@ function AgentConnectionPopover({ className, ...props }) {
173
250
  }) })] });
174
251
  }
175
252
  //#endregion
176
- export { AgentConnectionPanel, AgentConnectionPopover, Connection, buildNanitesAgentConnectionCommands };
253
+ export { AgentConnectionPanel, AgentConnectionPopover, Connection, McpServerSetup, buildNanitesAgentConnectionCommands };
@@ -1,20 +1,7 @@
1
+ import { McpServerCard } from "../utils/mcp-server-catalog.js";
1
2
  import * as React from "react";
2
3
 
3
4
  //#region src/components/McpServerPicker.d.ts
4
- type McpServerPickerStatus = "connecting" | "needs-auth" | "authenticating" | "ready" | "failed";
5
- interface McpServerCardIcon {
6
- src: string;
7
- }
8
- interface McpServerCard {
9
- id: string;
10
- name: string;
11
- url: string;
12
- description?: string;
13
- category?: string;
14
- icon?: string | McpServerCardIcon;
15
- status?: McpServerPickerStatus;
16
- statusLabel?: string;
17
- }
18
5
  interface McpServerPickerProps {
19
6
  /** MCP servers to show in the plus-menu picker. */
20
7
  servers: readonly McpServerCard[];
@@ -38,4 +25,4 @@ declare function McpServerPickerItems({
38
25
  onConnect
39
26
  }: McpServerPickerItemsProps): React.JSX.Element | React.JSX.Element[];
40
27
  //#endregion
41
- export { McpServerCard, McpServerCardIcon, McpServerPicker, McpServerPickerItems, McpServerPickerItemsProps, McpServerPickerProps, McpServerPickerStatus };
28
+ export { McpServerPicker, McpServerPickerItems, McpServerPickerItemsProps, McpServerPickerProps };
@@ -145,6 +145,146 @@
145
145
  line-height: 1.5;
146
146
  }
147
147
 
148
+ .agent-connect__mcp {
149
+ display: grid;
150
+ gap: 0.5rem;
151
+ min-inline-size: 0;
152
+ }
153
+
154
+ .agent-connect__mcp-heading {
155
+ margin: 0;
156
+ color: var(--sigvelo-color-text-muted);
157
+ font-size: 0.74rem;
158
+ font-weight: var(--sigvelo-font-weight-semibold);
159
+ line-height: 1.25;
160
+ }
161
+
162
+ .agent-connect__mcp-list {
163
+ display: grid;
164
+ grid-template-columns: repeat(2, minmax(0, 1fr));
165
+ gap: 0.35rem;
166
+ max-block-size: 24rem;
167
+ margin: 0;
168
+ padding: 0;
169
+ overflow-y: auto;
170
+ overscroll-behavior: contain;
171
+ list-style: none;
172
+ }
173
+
174
+ .agent-connect__mcp-item {
175
+ display: grid;
176
+ grid-template-columns: 1.625rem minmax(0, 1fr);
177
+ gap: 0.5rem;
178
+ align-items: start;
179
+ min-inline-size: 0;
180
+ padding: 0.5rem;
181
+ border: var(--sigvelo-border-style) var(--sigvelo-border-width)
182
+ var(--sigvelo-color-neutral-border-subtle);
183
+ border-radius: var(--sigvelo-radius-md);
184
+ background: var(--sigvelo-color-surface);
185
+ }
186
+
187
+ .agent-connect__mcp-icon {
188
+ display: grid;
189
+ place-items: center;
190
+ inline-size: 1.625rem;
191
+ block-size: 1.625rem;
192
+ border-radius: var(--sigvelo-radius-sm);
193
+ background: var(--sigvelo-color-neutral-bg-subtle);
194
+ color: var(--sigvelo-color-text-muted);
195
+ font-size: 0.72rem;
196
+ font-weight: var(--sigvelo-font-weight-bold);
197
+ line-height: 1;
198
+ }
199
+
200
+ .agent-connect__mcp-icon img {
201
+ display: block;
202
+ max-inline-size: 1rem;
203
+ max-block-size: 1rem;
204
+ }
205
+
206
+ .agent-connect__mcp-copy {
207
+ display: grid;
208
+ gap: 0.08rem;
209
+ min-inline-size: 0;
210
+ }
211
+
212
+ .agent-connect__mcp-name {
213
+ color: var(--sigvelo-color-text);
214
+ font-size: 0.78rem;
215
+ font-weight: var(--sigvelo-font-weight-semibold);
216
+ line-height: 1.2;
217
+ overflow-wrap: anywhere;
218
+ text-decoration: none;
219
+ }
220
+
221
+ .agent-connect__mcp-name:hover {
222
+ color: var(--sigvelo-color-primary-text);
223
+ text-decoration: underline;
224
+ text-underline-offset: 0.16em;
225
+ }
226
+
227
+ .agent-connect__mcp-name:focus-visible {
228
+ outline: 2px solid var(--sigvelo-color-focus);
229
+ outline-offset: 2px;
230
+ }
231
+
232
+ .agent-connect__mcp-description {
233
+ color: var(--sigvelo-color-text-muted);
234
+ font-size: 0.7rem;
235
+ line-height: 1.25;
236
+ overflow-wrap: anywhere;
237
+ }
238
+
239
+ .agent-connect__mcp-setup {
240
+ display: grid;
241
+ gap: 0.3rem;
242
+ margin-block-start: 0.2rem;
243
+ min-inline-size: 0;
244
+ }
245
+
246
+ .agent-connect__mcp-setup p {
247
+ margin: 0;
248
+ color: var(--sigvelo-color-text-muted);
249
+ font-size: 0.68rem;
250
+ line-height: 1.3;
251
+ overflow-wrap: anywhere;
252
+ }
253
+
254
+ .agent-connect__mcp-setup-links {
255
+ display: flex;
256
+ flex-wrap: wrap;
257
+ gap: 0.25rem;
258
+ margin: 0;
259
+ padding: 0;
260
+ list-style: none;
261
+ }
262
+
263
+ .agent-connect__mcp-setup-links a {
264
+ display: inline-flex;
265
+ align-items: center;
266
+ min-block-size: 1.35rem;
267
+ padding: 0 0.35rem;
268
+ border: var(--sigvelo-border-style) var(--sigvelo-border-width)
269
+ var(--sigvelo-color-neutral-border-subtle);
270
+ border-radius: var(--sigvelo-radius-sm);
271
+ color: var(--sigvelo-color-text-muted);
272
+ font-size: 0.65rem;
273
+ font-weight: var(--sigvelo-font-weight-semibold);
274
+ line-height: 1.1;
275
+ text-decoration: none;
276
+ }
277
+
278
+ .agent-connect__mcp-setup-links a:hover {
279
+ border-color: var(--sigvelo-color-primary-border-muted);
280
+ color: var(--sigvelo-color-primary-text);
281
+ }
282
+
283
+ .agent-connect__mcp-setup-links a:focus-visible {
284
+ outline: 2px solid var(--sigvelo-color-focus);
285
+ outline-offset: 2px;
286
+ }
287
+
148
288
  .agent-connect-trigger {
149
289
  inline-size: 100%;
150
290
  }
@@ -160,6 +300,10 @@
160
300
  grid-template-columns: repeat(2, minmax(0, 1fr));
161
301
  }
162
302
 
303
+ .agent-connect__mcp-list {
304
+ grid-template-columns: 1fr;
305
+ }
306
+
163
307
  .agent-connect-popover {
164
308
  inline-size: min(24rem, calc(100dvi - 1.5rem));
165
309
  }