@happyvertical/smrt-template-sveltekit 0.54.3 → 0.55.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/AGENTS.md +7 -5
- package/mcp-apps-template/package.dependencies.json +2 -2
- package/mcp-apps-template/src/routes/.well-known/oauth-protected-resource/api/mcp/+server.ts +1 -6
- package/mcp-apps-template/src/routes/api/mcp/+server.ts +10 -12
- package/package.json +19 -19
- package/template/README.md +5 -4
- package/template/package.json +11 -11
- package/template.config.js +11 -11
package/AGENTS.md
CHANGED
|
@@ -104,11 +104,13 @@ It is the ground-up alternative to `smrt-saas-starter`.
|
|
|
104
104
|
(`createRuntimeDiagnosticsHandler`) requires a direct active tenant membership
|
|
105
105
|
plus the owner role or `runtime_diagnostics.read` before any projection or
|
|
106
106
|
probe; it never calls principal-bound server tools.
|
|
107
|
-
- The opt-in `mcp-apps-template/` overlay is one
|
|
108
|
-
|
|
109
|
-
`
|
|
110
|
-
|
|
111
|
-
the
|
|
107
|
+
- The opt-in `mcp-apps-template/` overlay is one
|
|
108
|
+
`mountMcpAppRoute({ runtime })` route and
|
|
109
|
+
`mountMcpProtectedResourceMetadataRoute({ runtime })` (#3491): the
|
|
110
|
+
runtime supplies the request database, `runAsPrincipal` and, per request,
|
|
111
|
+
the profile's bearer adapter (local owner tokens, hosted membership-backed
|
|
112
|
+
principals). No `mcp.ts` helper or top-level `await`; `pnpm typecheck`
|
|
113
|
+
checks it against the template. `__tests__/localMcpToken.test.ts` proves mint → real
|
|
112
114
|
`smrt-mcp-bridge` stdio → route against the real runtime.
|
|
113
115
|
`__tests__/mcpConsumerBundle.test.ts` (why `@happyvertical/smrt-chat` is a
|
|
114
116
|
devDependency) Vite-SSR-builds `fixtures/mcp-chat-consumer/` with chat and
|
package/mcp-apps-template/src/routes/.well-known/oauth-protected-resource/api/mcp/+server.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { createHostedMcpResourceAuth } from '@happyvertical/smrt-app-mcp/auth';
|
|
2
1
|
import { mountMcpProtectedResourceMetadataRoute } from '@happyvertical/smrt-app-mcp/sveltekit';
|
|
3
2
|
|
|
4
3
|
import { runtime } from '$lib/server/smrt';
|
|
5
4
|
|
|
6
|
-
const { profile } = await runtime.resolvedRuntime();
|
|
7
|
-
|
|
8
5
|
/** RFC 9728 metadata at exactly the URL hosted bearer challenges advertise (404 locally). */
|
|
9
|
-
export const GET = mountMcpProtectedResourceMetadataRoute(
|
|
10
|
-
createHostedMcpResourceAuth({ profile, runtime }),
|
|
11
|
-
);
|
|
6
|
+
export const GET = mountMcpProtectedResourceMetadataRoute({ runtime });
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { McpWorkflowToolDefinition } from '@happyvertical/smrt-app-mcp';
|
|
2
|
-
import { createHostedMcpResourceAuth } from '@happyvertical/smrt-app-mcp/auth';
|
|
3
2
|
import { mountMcpAppRoute } from '@happyvertical/smrt-app-mcp/sveltekit';
|
|
4
3
|
import { openAiDisplayMetadata, withOpenAiEntrypoints } from '@happyvertical/smrt-mcp-openai';
|
|
5
4
|
|
|
@@ -35,28 +34,27 @@ const itemsOverview: McpWorkflowToolDefinition = withOpenAiEntrypoints(
|
|
|
35
34
|
['global'],
|
|
36
35
|
);
|
|
37
36
|
|
|
38
|
-
const { profile } = await runtime.resolvedRuntime();
|
|
39
|
-
|
|
40
37
|
/**
|
|
41
38
|
* Stateless SDK-v2 Streamable HTTP MCP endpoint for this app's own `Item`.
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
39
|
+
* `runtime` supplies the request database, the bearer adapter for the profile
|
|
40
|
+
* it resolves per request, and the principal binding. Locally the principal
|
|
41
|
+
* is the signed session (user, authorized tenant, and permission slugs), or
|
|
42
|
+
* an owner-minted bearer token from `smrt app token` for a local MCP client
|
|
43
|
+
* such as the `smrt-mcp-bridge` stdio bridge. Hosted profiles verify a bearer
|
|
44
|
+
* access token and map it through the runtime's membership-backed
|
|
45
|
+
* `resolveMcpPrincipal` (pass an explicit `auth` built with
|
|
46
|
+
* `createHostedMcpResourceAuth({ ..., resolvePrincipal })` to override it).
|
|
47
|
+
* A bearer principal is bound into the request permission
|
|
48
48
|
* context (under `database-rls`, its own RLS transaction) with its scopes
|
|
49
49
|
* capped to live permissions. Every principal needs `items.read`, so only
|
|
50
50
|
* read-only tools are published until per-operation authorization exists;
|
|
51
51
|
* browser requests from a foreign `Origin` are refused.
|
|
52
52
|
*/
|
|
53
53
|
export const POST = mountMcpAppRoute({
|
|
54
|
+
runtime,
|
|
54
55
|
models: [Item],
|
|
55
56
|
requiredScopes: ['items.read'],
|
|
56
57
|
effects: ['read'],
|
|
57
|
-
smrtOptions: () => ({ db: runtime.databaseConfig() }),
|
|
58
|
-
auth: createHostedMcpResourceAuth({ profile, runtime }),
|
|
59
|
-
bindPrincipal: runtime.runAsPrincipal,
|
|
60
58
|
workflowTools: [itemsOverview],
|
|
61
59
|
resources: [
|
|
62
60
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-template-sveltekit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.55.0",
|
|
4
4
|
"description": "Minimal SvelteKit project template with s-m-r-t framework integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -32,26 +32,26 @@
|
|
|
32
32
|
"directory": "packages/template-sveltekit"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@happyvertical/smrt-core": "0.
|
|
35
|
+
"@happyvertical/smrt-core": "0.55.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@happyvertical/smrt-app-cli": "0.
|
|
39
|
-
"@happyvertical/smrt-app-mcp": "0.
|
|
40
|
-
"@happyvertical/smrt-app-runtime": "0.
|
|
41
|
-
"@happyvertical/smrt-assets": "0.
|
|
42
|
-
"@happyvertical/smrt-chat": "0.
|
|
43
|
-
"@happyvertical/smrt-cli": "0.
|
|
44
|
-
"@happyvertical/smrt-config": "0.
|
|
45
|
-
"@happyvertical/smrt-jobs": "0.
|
|
46
|
-
"@happyvertical/smrt-mcp-openai": "0.
|
|
47
|
-
"@happyvertical/smrt-playbooks": "0.
|
|
48
|
-
"@happyvertical/smrt-profiles": "0.
|
|
49
|
-
"@happyvertical/smrt-scanner": "0.
|
|
50
|
-
"@happyvertical/smrt-svelte": "0.
|
|
51
|
-
"@happyvertical/smrt-tenancy": "0.
|
|
52
|
-
"@happyvertical/smrt-ui": "0.
|
|
53
|
-
"@happyvertical/smrt-users": "0.
|
|
54
|
-
"@happyvertical/smrt-web": "0.
|
|
38
|
+
"@happyvertical/smrt-app-cli": "0.55.0",
|
|
39
|
+
"@happyvertical/smrt-app-mcp": "0.55.0",
|
|
40
|
+
"@happyvertical/smrt-app-runtime": "0.55.0",
|
|
41
|
+
"@happyvertical/smrt-assets": "0.55.0",
|
|
42
|
+
"@happyvertical/smrt-chat": "0.55.0",
|
|
43
|
+
"@happyvertical/smrt-cli": "0.55.0",
|
|
44
|
+
"@happyvertical/smrt-config": "0.55.0",
|
|
45
|
+
"@happyvertical/smrt-jobs": "0.55.0",
|
|
46
|
+
"@happyvertical/smrt-mcp-openai": "0.55.0",
|
|
47
|
+
"@happyvertical/smrt-playbooks": "0.55.0",
|
|
48
|
+
"@happyvertical/smrt-profiles": "0.55.0",
|
|
49
|
+
"@happyvertical/smrt-scanner": "0.55.0",
|
|
50
|
+
"@happyvertical/smrt-svelte": "0.55.0",
|
|
51
|
+
"@happyvertical/smrt-tenancy": "0.55.0",
|
|
52
|
+
"@happyvertical/smrt-ui": "0.55.0",
|
|
53
|
+
"@happyvertical/smrt-users": "0.55.0",
|
|
54
|
+
"@happyvertical/smrt-web": "0.55.0",
|
|
55
55
|
"@happyvertical/sql": "^0.89.12",
|
|
56
56
|
"@modelcontextprotocol/client": "2.0.0",
|
|
57
57
|
"@modelcontextprotocol/server": "^2.0.0",
|
package/template/README.md
CHANGED
|
@@ -254,8 +254,9 @@ non-object or malformed manifests, credential-shaped JSON fields and credential
|
|
|
254
254
|
URL userinfo, non-portable schemas, and non-loopback HTTP server URLs. Diagnostics never
|
|
255
255
|
include malformed manifest content.
|
|
256
256
|
|
|
257
|
-
The option stages `src/routes/api/mcp/+server.ts`, one
|
|
258
|
-
|
|
257
|
+
The option stages `src/routes/api/mcp/+server.ts`, one
|
|
258
|
+
`mountMcpAppRoute({ runtime, ... })` call from
|
|
259
|
+
`@happyvertical/smrt-app-mcp/sveltekit` that publishes `Item` to
|
|
259
260
|
principals holding `items.read` (the signed session's permissions locally),
|
|
260
261
|
refuses browser requests from a foreign `Origin`, and serves a bounded static
|
|
261
262
|
resource with a restrictive CSP and the optional OpenAI display metadata. It
|
|
@@ -456,7 +457,7 @@ For `self-hosted` and `cloud`, configure HTTPS `SMRT_MCP_RESOURCE`,
|
|
|
456
457
|
`SMRT_MCP_SCOPES` values. On every request, the runtime maps the verified
|
|
457
458
|
issuer and subject to the user linked through OIDC login. That user must have
|
|
458
459
|
exactly one active tenant membership. Disabled, unmapped, or multi-tenant
|
|
459
|
-
identities are denied. To use a different lookup, pass
|
|
460
|
-
`createHostedMcpResourceAuth`. The route never derives tenant authority from
|
|
460
|
+
identities are denied. To use a different lookup, pass the route an explicit
|
|
461
|
+
`auth` built with `createHostedMcpResourceAuth({ ..., resolvePrincipal })`. The route never derives tenant authority from
|
|
461
462
|
JWT claims, request headers, or tool arguments. Missing configuration fails
|
|
462
463
|
closed before MCP dispatch.
|
package/template/package.json
CHANGED
|
@@ -39,19 +39,19 @@
|
|
|
39
39
|
"svelte-check": "^4.7.6",
|
|
40
40
|
"typescript": "6.0.3",
|
|
41
41
|
"vite": "8.3.0",
|
|
42
|
-
"@happyvertical/smrt-cli": "^0.
|
|
42
|
+
"@happyvertical/smrt-cli": "^0.55.0"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@happyvertical/smrt-app-runtime": "^0.
|
|
46
|
-
"@happyvertical/smrt-config": "^0.
|
|
47
|
-
"@happyvertical/smrt-core": "^0.
|
|
48
|
-
"@happyvertical/smrt-jobs": "^0.
|
|
49
|
-
"@happyvertical/smrt-profiles": "^0.
|
|
50
|
-
"@happyvertical/smrt-svelte": "^0.
|
|
51
|
-
"@happyvertical/smrt-tenancy": "^0.
|
|
52
|
-
"@happyvertical/smrt-ui": "^0.
|
|
53
|
-
"@happyvertical/smrt-users": "^0.
|
|
54
|
-
"@happyvertical/smrt-web": "^0.
|
|
45
|
+
"@happyvertical/smrt-app-runtime": "^0.55.0",
|
|
46
|
+
"@happyvertical/smrt-config": "^0.55.0",
|
|
47
|
+
"@happyvertical/smrt-core": "^0.55.0",
|
|
48
|
+
"@happyvertical/smrt-jobs": "^0.55.0",
|
|
49
|
+
"@happyvertical/smrt-profiles": "^0.55.0",
|
|
50
|
+
"@happyvertical/smrt-svelte": "^0.55.0",
|
|
51
|
+
"@happyvertical/smrt-tenancy": "^0.55.0",
|
|
52
|
+
"@happyvertical/smrt-ui": "^0.55.0",
|
|
53
|
+
"@happyvertical/smrt-users": "^0.55.0",
|
|
54
|
+
"@happyvertical/smrt-web": "^0.55.0",
|
|
55
55
|
"@happyvertical/sql": "^0.89.12",
|
|
56
56
|
"@modelcontextprotocol/server": "^2.0.0"
|
|
57
57
|
}
|
package/template.config.js
CHANGED
|
@@ -19,22 +19,22 @@ export default {
|
|
|
19
19
|
|
|
20
20
|
// Dependencies to add to generated project
|
|
21
21
|
dependencies: {
|
|
22
|
-
'@happyvertical/smrt-app-runtime': '^0.
|
|
23
|
-
'@happyvertical/smrt-config': '^0.
|
|
24
|
-
'@happyvertical/smrt-core': '^0.
|
|
25
|
-
'@happyvertical/smrt-jobs': '^0.
|
|
26
|
-
'@happyvertical/smrt-profiles': '^0.
|
|
27
|
-
'@happyvertical/smrt-svelte': '^0.
|
|
28
|
-
'@happyvertical/smrt-tenancy': '^0.
|
|
29
|
-
'@happyvertical/smrt-ui': '^0.
|
|
30
|
-
'@happyvertical/smrt-users': '^0.
|
|
31
|
-
'@happyvertical/smrt-web': '^0.
|
|
22
|
+
'@happyvertical/smrt-app-runtime': '^0.55.0',
|
|
23
|
+
'@happyvertical/smrt-config': '^0.55.0',
|
|
24
|
+
'@happyvertical/smrt-core': '^0.55.0',
|
|
25
|
+
'@happyvertical/smrt-jobs': '^0.55.0',
|
|
26
|
+
'@happyvertical/smrt-profiles': '^0.55.0',
|
|
27
|
+
'@happyvertical/smrt-svelte': '^0.55.0',
|
|
28
|
+
'@happyvertical/smrt-tenancy': '^0.55.0',
|
|
29
|
+
'@happyvertical/smrt-ui': '^0.55.0',
|
|
30
|
+
'@happyvertical/smrt-users': '^0.55.0',
|
|
31
|
+
'@happyvertical/smrt-web': '^0.55.0',
|
|
32
32
|
'@happyvertical/sql': '^0.89.12',
|
|
33
33
|
'@modelcontextprotocol/server': '^2.0.0',
|
|
34
34
|
},
|
|
35
35
|
|
|
36
36
|
devDependencies: {
|
|
37
|
-
'@happyvertical/smrt-cli': '^0.
|
|
37
|
+
'@happyvertical/smrt-cli': '^0.55.0',
|
|
38
38
|
'@sveltejs/adapter-node': '^5.5.7',
|
|
39
39
|
'@sveltejs/kit': '2.70.3',
|
|
40
40
|
'@sveltejs/vite-plugin-svelte': '^7.3.0',
|