@12-apps/mcp 1.19.0 → 2.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.
@@ -10,8 +10,7 @@ import {
10
10
 
11
11
  import {
12
12
  AI_CAPABILITIES,
13
- AI_CONNECT_PROMPT,
14
- AI_HOST_GUIDES,
13
+ aiHostGuides,
15
14
  AI_PERMISSION_MODEL,
16
15
  type AiCapability,
17
16
  type AiHostGuide,
@@ -44,14 +43,33 @@ export interface AiIntegrationOnboardingProps {
44
43
  featureKey?: string;
45
44
  /** Show the dev-only "reset onboarding" button. @default false */
46
45
  devReset?: boolean;
47
- /** Assistants offered in the flow. @default the shared AI_HOST_GUIDES */
46
+ /**
47
+ * The platform operating this MCP server, as its OAuth consent button names
48
+ * it. REQUIRED, and it is the reason `hosts` can have a default at all: one
49
+ * ChatGPT step tells the owner which "Sign in with …" button to click, and
50
+ * that button carries whoever runs the server. It used to be a hard-coded
51
+ * name — of a single STORE on one deployment, not even the product — so every
52
+ * other adopter pointed its owners at a button that does not exist.
53
+ */
54
+ platformName: string;
55
+ /** Assistants offered in the flow. @default aiHostGuides(platformName) */
48
56
  hosts?: readonly AiHostGuide[];
49
57
  /** Capability cards on the landing. @default the shared AI_CAPABILITIES */
50
58
  capabilities?: readonly AiCapability[];
51
59
  /** Permission reassurance copy on the landing. @default AI_PERMISSION_MODEL */
52
60
  permissionModel?: string;
53
- /** Message pasted into the assistant on the Conectar step. @default AI_CONNECT_PROMPT */
54
- connectPrompt?: string;
61
+ /**
62
+ * Message the owner pastes into the assistant on the Conectar step.
63
+ *
64
+ * REQUIRED, with no default, because the useful version of it names TOOLS —
65
+ * one to register the connection, one to read something real — and this
66
+ * package neither defines nor serves any. It shipped a constant naming two
67
+ * tools from one adopter's surface, so another host handed its owner a prompt
68
+ * that called two things that did not exist, and the confirm step then waited
69
+ * forever for a registration that could never happen. Build it with
70
+ * `aiConnectPrompt({ … })`.
71
+ */
72
+ connectPrompt: string;
55
73
  /**
56
74
  * Re-check the live connection on the verify step's "Testar conexão" button —
57
75
  * apps pass a router refresh (e.g. Next's `router.refresh`). @default a full
@@ -100,10 +118,19 @@ function AiOnboardingFlow(props: FlowProps): React.JSX.Element {
100
118
  devReset,
101
119
  } = props;
102
120
  const { state } = useOnboarding();
103
- const selectedHost = hosts.find((h) => h.id === state.data.selectedHost) ?? hosts[0]!;
121
+ const selectedHost =
122
+ hosts.find((h) => h.id === state.data.selectedHost) ?? hosts[0]!;
104
123
 
105
- const steps = buildFlowSteps({ host: selectedHost, hosts, endpointUrl, connectPrompt, connections, onRetest });
106
- const connectedHostId = (state.data.connectedHost ?? state.data.selectedHost) as string | undefined;
124
+ const steps = buildFlowSteps({
125
+ host: selectedHost,
126
+ hosts,
127
+ endpointUrl,
128
+ connectPrompt,
129
+ connections,
130
+ onRetest,
131
+ });
132
+ const connectedHostId = (state.data.connectedHost ??
133
+ state.data.selectedHost) as string | undefined;
107
134
 
108
135
  return (
109
136
  <GuidedSection
@@ -111,13 +138,22 @@ function AiOnboardingFlow(props: FlowProps): React.JSX.Element {
111
138
  title="Conecte assistentes de IA à sua loja"
112
139
  startLabel="Ver como conectar"
113
140
  renderLanding={(start) => (
114
- <AiLanding onStart={start} permissionModel={permissionModel} capabilities={capabilities} />
141
+ <AiLanding
142
+ onStart={start}
143
+ permissionModel={permissionModel}
144
+ capabilities={capabilities}
145
+ />
115
146
  )}
116
147
  configuredTitle={connectedTitle(connections, hosts, connectedHostId)}
117
148
  configuredSummary={connectedSummary(connections)}
118
149
  editLabel="Conectar IA"
119
150
  completedContent={(nav) => (
120
- <StatusBoard nav={nav} connections={connections} hosts={hosts} onDisconnect={onDisconnect} />
151
+ <StatusBoard
152
+ nav={nav}
153
+ connections={connections}
154
+ hosts={hosts}
155
+ onDisconnect={onDisconnect}
156
+ />
121
157
  )}
122
158
  devReset={devReset}
123
159
  dataTestId="ai-onboarding"
@@ -143,17 +179,22 @@ export function AiIntegrationOnboarding({
143
179
  connections,
144
180
  featureKey = DEFAULT_FEATURE_KEY,
145
181
  devReset = false,
146
- hosts = AI_HOST_GUIDES,
182
+ platformName,
183
+ hosts = aiHostGuides(platformName),
147
184
  capabilities = AI_CAPABILITIES,
148
185
  permissionModel = AI_PERMISSION_MODEL,
149
- connectPrompt = AI_CONNECT_PROMPT,
186
+ connectPrompt,
150
187
  onRetest = () => {
151
188
  if (typeof window !== "undefined") window.location.reload();
152
189
  },
153
190
  onDisconnect,
154
191
  }: AiIntegrationOnboardingProps): React.JSX.Element {
155
192
  return (
156
- <OnboardingProvider featureKey={featureKey} store={store} initialState={initialState}>
193
+ <OnboardingProvider
194
+ featureKey={featureKey}
195
+ store={store}
196
+ initialState={initialState}
197
+ >
157
198
  <AiOnboardingFlow
158
199
  endpointUrl={endpointUrl}
159
200
  connections={connections}
@@ -29,10 +29,11 @@ export { McpEndpointUrl } from "./mcp-endpoint-url";
29
29
  export { HostBrandAvatar, CapabilityIcon } from "./ai-icons";
30
30
  export { FeatureBadge, type FeatureBadgeItem } from "./feature-badge";
31
31
  export {
32
- AI_HOST_GUIDES,
32
+ aiHostGuides,
33
33
  AI_CAPABILITIES,
34
34
  AI_PERMISSION_MODEL,
35
- AI_CONNECT_PROMPT,
35
+ aiConnectPrompt,
36
+ type AiConnectPromptSpec,
36
37
  providerForHostId,
37
38
  type AiHostBrand,
38
39
  type AiHostLink,