@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.
- package/ADOPTING.md +248 -0
- package/README.md +39 -12
- package/package.json +28 -9
- package/prisma/mcp.prisma +108 -0
- package/prisma/migrations/20260812150000_add_mcp_oauth_tables/migration.sql +152 -0
- package/scripts/sync-mcp-schema.mjs +61 -0
- package/src/auth/authorization-server-metadata.ts +27 -8
- package/src/coverage-gate/index.ts +243 -0
- package/src/coverage-gate/route-methods.ts +86 -0
- package/src/generate/index.ts +197 -0
- package/src/guide.ts +144 -98
- package/src/hono/index.ts +43 -0
- package/src/index.ts +4 -2
- package/src/oauth/access-token.ts +186 -0
- package/src/oauth/authorization-code.ts +215 -0
- package/src/oauth/authorize.ts +260 -0
- package/src/oauth/clients.ts +158 -0
- package/src/oauth/code-replay.ts +51 -0
- package/src/oauth/config.ts +142 -0
- package/src/oauth/context.ts +253 -0
- package/src/oauth/create-api-mcp-oauth.ts +205 -0
- package/src/oauth/index.ts +117 -0
- package/src/oauth/keys.ts +107 -0
- package/src/oauth/pkce.ts +93 -0
- package/src/oauth/prisma-stores.ts +306 -0
- package/src/oauth/refresh.ts +286 -0
- package/src/oauth/register.ts +282 -0
- package/src/oauth/stores.ts +157 -0
- package/src/oauth/token-grants.ts +326 -0
- package/src/oauth/token-response.ts +154 -0
- package/src/react/ai-onboarding.tsx +54 -13
- package/src/react/index.ts +3 -2
|
@@ -10,8 +10,7 @@ import {
|
|
|
10
10
|
|
|
11
11
|
import {
|
|
12
12
|
AI_CAPABILITIES,
|
|
13
|
-
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
54
|
-
|
|
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 =
|
|
121
|
+
const selectedHost =
|
|
122
|
+
hosts.find((h) => h.id === state.data.selectedHost) ?? hosts[0]!;
|
|
104
123
|
|
|
105
|
-
const steps = buildFlowSteps({
|
|
106
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
182
|
+
platformName,
|
|
183
|
+
hosts = aiHostGuides(platformName),
|
|
147
184
|
capabilities = AI_CAPABILITIES,
|
|
148
185
|
permissionModel = AI_PERMISSION_MODEL,
|
|
149
|
-
connectPrompt
|
|
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
|
|
193
|
+
<OnboardingProvider
|
|
194
|
+
featureKey={featureKey}
|
|
195
|
+
store={store}
|
|
196
|
+
initialState={initialState}
|
|
197
|
+
>
|
|
157
198
|
<AiOnboardingFlow
|
|
158
199
|
endpointUrl={endpointUrl}
|
|
159
200
|
connections={connections}
|
package/src/react/index.ts
CHANGED
|
@@ -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
|
-
|
|
32
|
+
aiHostGuides,
|
|
33
33
|
AI_CAPABILITIES,
|
|
34
34
|
AI_PERMISSION_MODEL,
|
|
35
|
-
|
|
35
|
+
aiConnectPrompt,
|
|
36
|
+
type AiConnectPromptSpec,
|
|
36
37
|
providerForHostId,
|
|
37
38
|
type AiHostBrand,
|
|
38
39
|
type AiHostLink,
|