@aotter/mantle 0.1.2-alpha.6 → 0.1.2
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/README.md +15 -10
- package/dist/cli/generate.d.ts +9 -0
- package/dist/cli/generate.d.ts.map +1 -1
- package/dist/cli/generate.js +40 -1
- package/dist/cli/generate.js.map +1 -1
- package/dist/cli/main.d.ts +1 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +37 -9
- package/dist/cli/main.js.map +1 -1
- package/docs/adapter-guide.md +6 -1
- package/docs/adr/adr-lite-845-frontend-client.md +38 -0
- package/docs/agent-prompts.md +91 -0
- package/docs/api-mcp-authorization.md +1 -1
- package/docs/auth-hosting-model.md +1 -1
- package/docs/examples/README.md +22 -0
- package/docs/examples/builtin-commerce.md +269 -0
- package/docs/examples/builtin-intake.md +143 -0
- package/docs/examples/builtin-legal-documents.md +189 -0
- package/docs/examples/builtin-procurement.md +241 -0
- package/docs/examples/builtin-publication.md +241 -0
- package/docs/examples/builtin-reservation.md +149 -0
- package/docs/examples/cf-primitives-commerce-inventory.md +809 -0
- package/docs/examples/cf-primitives-guarded-api.md +429 -0
- package/docs/examples/cf-primitives-intake-hooks.md +319 -0
- package/docs/examples/host-chatgpt-sites/.openai/hosting.json +1 -0
- package/docs/examples/host-chatgpt-sites/README.md +53 -0
- package/docs/examples/host-chatgpt-sites/drizzle/0000_sites_users.sql +8 -0
- package/docs/examples/host-chatgpt-sites/drizzle/0001_mantle.sql +294 -0
- package/docs/examples/host-chatgpt-sites/drizzle/0002_article_cover.sql +5 -0
- package/docs/examples/host-chatgpt-sites/drizzle/meta/_journal.json +1 -0
- package/docs/examples/host-chatgpt-sites/manifests/site.yaml +27 -0
- package/docs/examples/host-chatgpt-sites/package.json +1 -0
- package/docs/examples/host-chatgpt-sites/public/site.css +1 -0
- package/docs/examples/host-chatgpt-sites/scripts/build.mjs +12 -0
- package/docs/examples/host-chatgpt-sites/scripts/check.mjs +99 -0
- package/docs/examples/host-chatgpt-sites/scripts/migration.mjs +9 -0
- package/docs/examples/host-chatgpt-sites/src/chatgpt-auth.ts +63 -0
- package/docs/examples/host-chatgpt-sites/src/index.ts +46 -0
- package/docs/examples/host-chatgpt-sites/src/mcp.ts +49 -0
- package/docs/examples/host-chatgpt-sites/src/media.ts +109 -0
- package/docs/examples/host-chatgpt-sites/src/r2-lab.ts +38 -0
- package/docs/examples/host-chatgpt-sites/src/storage-fingerprint.json +1 -0
- package/docs/examples/host-chatgpt-sites/src/web.ts +35 -0
- package/docs/examples/host-chatgpt-sites/tsconfig.json +1 -0
- package/docs/examples/host-chatgpt-sites/wrangler.jsonc +10 -0
- package/docs/examples/host-local-admin-otp/.dev.vars.example +3 -0
- package/docs/examples/host-local-admin-otp/README.md +70 -0
- package/docs/examples/host-local-admin-otp/ensure-dev-vars.mjs +5 -0
- package/docs/examples/host-local-admin-otp/package.json +29 -0
- package/docs/examples/host-local-admin-otp/public/.gitkeep +1 -0
- package/docs/examples/host-local-admin-otp/smoke.mjs +141 -0
- package/docs/examples/host-local-admin-otp/src/index.ts +54 -0
- package/docs/examples/host-local-admin-otp/wrangler.jsonc +23 -0
- package/docs/examples/{minimal-worker → host-minimal-worker}/README.md +9 -5
- package/docs/examples/host-minimal-worker/manifests/site.yaml +25 -0
- package/docs/examples/{minimal-worker → host-minimal-worker}/package.json +3 -3
- package/docs/examples/host-minimal-worker/tsconfig.json +17 -0
- package/docs/handbook/cloudflare/authentication.md +17 -2
- package/docs/handbook/cloudflare/bindings.md +9 -7
- package/docs/handbook/cloudflare/chatgpt-sites.md +29 -0
- package/docs/handbook/cloudflare/conventional-worker.md +3 -3
- package/docs/handbook/cloudflare/deferred-hooks-queues.md +0 -1
- package/docs/handbook/cloudflare/deploy-and-operate.md +14 -20
- package/docs/handbook/cloudflare/media-r2.md +2 -2
- package/docs/handbook/cloudflare/public-web.md +1 -1
- package/docs/handbook/cloudflare/site-chrome.md +75 -0
- package/docs/handbook/concepts/authorization.md +2 -2
- package/docs/handbook/concepts/four-atoms.md +2 -2
- package/docs/handbook/concepts/lifecycle-and-locales.md +1 -1
- package/docs/handbook/concepts/mcp-and-agents.md +1 -1
- package/docs/handbook/concepts/procedures-and-triggers.md +1 -1
- package/docs/handbook/concepts/runtime-and-adapters.md +2 -2
- package/docs/handbook/concepts/views.md +2 -2
- package/docs/handbook/examples/commerce-transaction.md +4 -806
- package/docs/handbook/examples/commerce.md +11 -0
- package/docs/handbook/examples/guarded-api.md +3 -420
- package/docs/handbook/examples/hub.md +10 -0
- package/docs/handbook/examples/intake-form.md +6 -313
- package/docs/handbook/examples/intake-hooks.md +11 -0
- package/docs/handbook/examples/legal-documents.md +3 -211
- package/docs/handbook/examples/procurement-approvals.md +3 -233
- package/docs/handbook/examples/publication.md +3 -233
- package/docs/handbook/examples/reservation.md +3 -213
- package/docs/handbook/navigation.json +17 -2
- package/docs/handbook/reference/authorization.md +1 -1
- package/docs/handbook/reference/procedure.md +2 -2
- package/docs/handbook/reference/schema.md +3 -3
- package/docs/handbook/reference/site-config.md +5 -16
- package/docs/handbook/reference/surface.md +3 -7
- package/docs/handbook/sites/equipment-checkout.md +231 -0
- package/docs/handbook/sites/host-reference.md +113 -0
- package/docs/handbook/sites/index.md +111 -0
- package/docs/handbook/start/project-and-cli.md +22 -14
- package/docs/handbook/start/quickstart-admin.md +239 -0
- package/docs/handbook/start/quickstart-worker.md +22 -23
- package/docs/migration-0.1.2.md +26 -0
- package/docs/release-process.md +92 -7
- package/docs/sealed-pipeline-ownership.md +2 -2
- package/docs/spec-only-host-adoption.md +3 -4
- package/docs/transaction-patterns.md +2 -2
- package/package.json +15 -15
- package/skills/README.md +18 -2
- package/skills/develop/SKILL.md +32 -23
- package/skills/install/SKILL.md +50 -11
- package/skills/provision/SKILL.md +21 -5
- /package/docs/examples/{minimal-worker → host-local-admin-otp}/manifests/site.yaml +0 -0
- /package/docs/examples/{minimal-worker → host-local-admin-otp}/tsconfig.json +0 -0
- /package/docs/examples/{minimal-worker → host-minimal-worker}/smoke.mjs +0 -0
- /package/docs/examples/{minimal-worker → host-minimal-worker}/src/index.ts +0 -0
- /package/docs/examples/{minimal-worker → host-minimal-worker}/wrangler.jsonc +0 -0
package/README.md
CHANGED
|
@@ -4,15 +4,15 @@ Umbrella entry for the embeddable Mantle SDK — a manifest-driven application
|
|
|
4
4
|
engine built around a 4-atom YAML model (Schema / View / Procedure / Trigger)
|
|
5
5
|
where agents write config and the runtime carries the complexity.
|
|
6
6
|
|
|
7
|
-
> Mantle is
|
|
8
|
-
>
|
|
7
|
+
> Mantle's first stable release is `0.1.2`. Use this package's `package.json`
|
|
8
|
+
> as the exact installed version.
|
|
9
9
|
|
|
10
10
|
## Install
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
npm install @aotter/mantle
|
|
13
|
+
npm install @aotter/mantle
|
|
14
14
|
# or
|
|
15
|
-
pnpm add @aotter/mantle
|
|
15
|
+
pnpm add @aotter/mantle
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
## What's inside
|
|
@@ -87,6 +87,8 @@ use generated `bindMantle(runtime)`, or skip code generation and call
|
|
|
87
87
|
`runtime.executeView({ view: "published-notes" })` directly.
|
|
88
88
|
|
|
89
89
|
Author the application directly using [the installed guide](docs/handbook/start/project-and-cli.md).
|
|
90
|
+
Admin is opt-in; use [local Admin OTP](docs/handbook/start/quickstart-admin.md)
|
|
91
|
+
only when humans need a console.
|
|
90
92
|
The CLI has no scaffold/type picker; missing manifests fail without creating
|
|
91
93
|
an application or a visitor home page.
|
|
92
94
|
|
|
@@ -185,9 +187,10 @@ internals or rebuilding Mantle's adapters.
|
|
|
185
187
|
Use the installed install skill and [direct-authoring guide](docs/handbook/start/project-and-cli.md).
|
|
186
188
|
The owner or agent writes the application's manifests, entry and configuration;
|
|
187
189
|
`generate` compiles them and `skills` projects the version-matched instructions.
|
|
188
|
-
The [minimal Worker reference](docs/examples/minimal-worker/README.md) is
|
|
189
|
-
|
|
190
|
-
|
|
190
|
+
The [minimal Worker reference](docs/examples/host-minimal-worker/README.md) is
|
|
191
|
+
the embed / adapter path without Admin. The
|
|
192
|
+
[local Admin OTP reference](docs/examples/host-local-admin-otp/README.md) is the
|
|
193
|
+
opt-in Dev UI path. Neither is a scaffold command. Admin is optional.
|
|
191
194
|
|
|
192
195
|
## Agent marketplace install
|
|
193
196
|
|
|
@@ -242,12 +245,14 @@ adapter is a port-implementation exercise, not a runtime refactor.
|
|
|
242
245
|
|
|
243
246
|
- The handbook is the user documentation and ships inside this npm package:
|
|
244
247
|
`node_modules/@aotter/mantle/docs/handbook/` (start, concepts, Cloudflare
|
|
245
|
-
guides,
|
|
248
|
+
guides, example redirects, reference; `navigation.json` lists every page in order).
|
|
249
|
+
Worked Manifests live in `node_modules/@aotter/mantle/docs/examples/`
|
|
250
|
+
([index](docs/examples/README.md)).
|
|
246
251
|
The copy in `node_modules` describes the installed release.
|
|
247
252
|
- Embedded docs and agent skills ship inside this npm package for
|
|
248
253
|
generated-site agents:
|
|
249
254
|
- `node_modules/@aotter/mantle/docs/handbook/reference/manifest.md`
|
|
250
|
-
- `node_modules/@aotter/mantle/docs/
|
|
255
|
+
- `node_modules/@aotter/mantle/docs/examples/cf-primitives-guarded-api.md` (anonymous,
|
|
251
256
|
API-key, paid guard, personal-token, OAuth, REST, and MCP examples)
|
|
252
257
|
- `node_modules/@aotter/mantle/docs/handbook/cloudflare/media-r2.md` (Cloudflare R2 adapter recipe)
|
|
253
258
|
- `node_modules/@aotter/mantle/docs/handbook/cloudflare/deferred-hooks-queues.md` (versioned
|
|
@@ -264,7 +269,7 @@ adapter is a port-implementation exercise, not a runtime refactor.
|
|
|
264
269
|
- `node_modules/@aotter/mantle/skills/install/SKILL.md`
|
|
265
270
|
- `node_modules/@aotter/mantle/skills/provision/SKILL.md`
|
|
266
271
|
- [4-atom manifest model (ADR-0001)](docs/adr/0001-four-atom-manifest-model.md)
|
|
267
|
-
- [API and MCP authorization](docs/
|
|
272
|
+
- [API and MCP authorization](docs/examples/cf-primitives-guarded-api.md)
|
|
268
273
|
- [Deferred lifecycle Queues](docs/handbook/cloudflare/deferred-hooks-queues.md)
|
|
269
274
|
- [Schema indexes on D1](docs/handbook/reference/schema.md)
|
|
270
275
|
- [Release process](docs/release-process.md)
|
package/dist/cli/generate.d.ts
CHANGED
|
@@ -8,4 +8,13 @@ export interface GenerateDeps {
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function resolveAdminUiIndexHtml(): string | null;
|
|
10
10
|
export declare function runGenerate(rawArgs: readonly string[], deps?: GenerateDeps): Promise<number>;
|
|
11
|
+
export declare function printGenerateNextSteps(adminUiInstalled: boolean, write?: {
|
|
12
|
+
(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
|
|
13
|
+
(str: Uint8Array | string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
|
|
14
|
+
}): void;
|
|
15
|
+
/** Cheap hint: Admin SPA was synced but wrangler has no ASSETS binding. */
|
|
16
|
+
export declare function warnMissingWranglerAssets(root: string, write?: {
|
|
17
|
+
(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
|
|
18
|
+
(str: Uint8Array | string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
|
|
19
|
+
}): void;
|
|
11
20
|
//# sourceMappingURL=generate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/cli/generate.ts"],"names":[],"mappings":"AAiBA,yDAAyD;AACzD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,uBAAuB,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;CACxD;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,IAAI,CAOvD;AAED,wBAAsB,WAAW,CAC/B,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,IAAI,GAAE,YAAiB,GACtB,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/cli/generate.ts"],"names":[],"mappings":"AAiBA,yDAAyD;AACzD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,uBAAuB,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;CACxD;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,IAAI,CAOvD;AAED,wBAAsB,WAAW,CAC/B,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,IAAI,GAAE,YAAiB,GACtB,OAAO,CAAC,MAAM,CAAC,CAiDjB;AA0CD,wBAAgB,sBAAsB,CAAC,gBAAgB,EAAE,OAAO,EAAE,KAAK;2CAIxC,CAAC;mEAK0B,CAAC;CATwC,GAAG,IAAI,CAmBzG;AAiBD,2EAA2E;AAC3E,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK;2CAjC9B,CAAC;mEAK0B,CAAC;CA4B8B,GAAG,IAAI,CAa/F"}
|
package/dist/cli/generate.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { mkdir, readFile, readdir, rm, writeFile } from "node:fs/promises";
|
|
3
3
|
import { dirname, join, resolve } from "node:path";
|
|
4
4
|
import { cwd, stderr, stdout } from "node:process";
|
|
@@ -59,11 +59,15 @@ export async function runGenerate(rawArgs, deps = {}) {
|
|
|
59
59
|
const adminSource = dirname(adminIndex);
|
|
60
60
|
const adminTarget = resolve(cwd(), "public/_mantle/admin");
|
|
61
61
|
stale = !(await syncAdminAssets(adminSource, adminTarget, options.check)) || stale;
|
|
62
|
+
if (!options.check)
|
|
63
|
+
warnMissingWranglerAssets(cwd());
|
|
62
64
|
}
|
|
63
65
|
if (stale && options.check) {
|
|
64
66
|
stderr.write("Mantle generated files are stale; run `mantle generate`.\n");
|
|
65
67
|
return 1;
|
|
66
68
|
}
|
|
69
|
+
if (!options.check)
|
|
70
|
+
printGenerateNextSteps(adminIndex !== null);
|
|
67
71
|
return 0;
|
|
68
72
|
}
|
|
69
73
|
function parseGenerateArgs(rawArgs) {
|
|
@@ -93,6 +97,10 @@ function printHelp() {
|
|
|
93
97
|
|
|
94
98
|
Usage: mantle generate [options]
|
|
95
99
|
|
|
100
|
+
This is the Minimal compile path (Spec + generate). It writes .mantle/generated/mantle.ts.
|
|
101
|
+
Admin is opt-in: when @aotter/mantle-admin-ui is installed, generate also syncs
|
|
102
|
+
the prebuilt Admin SPA. See \`mantle --help\` for optional surfaces.
|
|
103
|
+
|
|
96
104
|
Options:
|
|
97
105
|
--manifests <dir> Manifest directory (default: ./manifests)
|
|
98
106
|
-o, --output <dir> Generated root (default: .mantle/generated)
|
|
@@ -101,6 +109,22 @@ Options:
|
|
|
101
109
|
-h, --help This help
|
|
102
110
|
`);
|
|
103
111
|
}
|
|
112
|
+
export function printGenerateNextSteps(adminUiInstalled, write = stdout.write.bind(stdout)) {
|
|
113
|
+
if (adminUiInstalled) {
|
|
114
|
+
write("Synced public/_mantle/admin/ from @aotter/mantle-admin-ui (opt-in, prebuilt; do not vite-build).\n" +
|
|
115
|
+
"Admin / Dev UI next steps:\n" +
|
|
116
|
+
" 1. wrangler assets.directory=./public and binding=ASSETS\n" +
|
|
117
|
+
" 2. pnpm dev → open /admin/sign-in\n" +
|
|
118
|
+
" 3. email OTP via ConsoleEmailSender (code in wrangler logs)\n" +
|
|
119
|
+
"PUBLIC_ORIGIN must equal the origin wrangler prints; a mismatch is INVALID_ORIGIN.\n" +
|
|
120
|
+
"See docs/examples/host-local-admin-otp or node_modules/@aotter/mantle/docs/examples/host-local-admin-otp.\n");
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
write("API-only (Admin is opt-in). A complete service does not require a Dev UI. " +
|
|
124
|
+
"To add Admin later: install @aotter/mantle-admin and @aotter/mantle-admin-ui, " +
|
|
125
|
+
"re-run generate, configure wrangler ASSETS, and wire local email-otp " +
|
|
126
|
+
"(docs/examples/host-local-admin-otp or node_modules/@aotter/mantle/docs/examples/host-local-admin-otp).\n");
|
|
127
|
+
}
|
|
104
128
|
function printDiagnostics(diagnostics) {
|
|
105
129
|
for (const diagnostic of diagnostics) {
|
|
106
130
|
stderr.write(`${diagnostic.code} ${diagnostic.path}: ${diagnostic.message}\n`);
|
|
@@ -116,6 +140,21 @@ async function syncText(path, expected, check) {
|
|
|
116
140
|
await writeFile(path, expected, "utf8");
|
|
117
141
|
return true;
|
|
118
142
|
}
|
|
143
|
+
/** Cheap hint: Admin SPA was synced but wrangler has no ASSETS binding. */
|
|
144
|
+
export function warnMissingWranglerAssets(root, write = stderr.write.bind(stderr)) {
|
|
145
|
+
const wrangler = ["wrangler.jsonc", "wrangler.json", "wrangler.toml"]
|
|
146
|
+
.map((name) => join(root, name))
|
|
147
|
+
.find((path) => existsSync(path));
|
|
148
|
+
if (!wrangler)
|
|
149
|
+
return;
|
|
150
|
+
const text = readFileSync(wrangler, "utf8");
|
|
151
|
+
if (/["']?binding["']?\s*[:=]\s*["']ASSETS["']/.test(text))
|
|
152
|
+
return;
|
|
153
|
+
write("warning: @aotter/mantle-admin-ui synced public/_mantle/admin, but wrangler has no ASSETS binding. " +
|
|
154
|
+
"/admin can return HTML 200 while /_mantle/admin/assets/* 404s (white screen). " +
|
|
155
|
+
'Add "assets": { "directory": "./public", "binding": "ASSETS" }. ' +
|
|
156
|
+
"Do not put /_mantle in run_worker_first.\n");
|
|
157
|
+
}
|
|
119
158
|
async function syncAdminAssets(source, target, check) {
|
|
120
159
|
const sourceFiles = (await listFiles(source)).filter((path) => !path.startsWith("server."));
|
|
121
160
|
const targetFiles = await listFiles(target).catch(() => []);
|
package/dist/cli/generate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/cli/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAA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AE;IAChD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3E,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QACtC,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC,CAAC;IACJ,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC;AAC7B,CAAC;AAED,SAAS,OAAO,CAAC,KAAc;IAC7B,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
|
package/dist/cli/main.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export
|
|
2
|
+
export declare const MANTLE_OVERVIEW = "mantle \u2014 compile manifests into a RuntimePlan and typed binding\n\nOverview\n Optional surfaces \u2014 take only what you need. Admin is opt-in. You can ship a\n complete service with no Dev UI, no visitor frontend, and no extra packages.\n\n Minimal \u2014 Spec + generate\n validate + generate compile manifests into a sealed plan and typed binding.\n Embed that binding in an existing host. No Admin, no visitor UI.\n\n Runtime / adapter\n Bind Runtime through an adapter (Cloudflare Worker, Bun, Vercel, or yours).\n HTTP Views, MCP, and Auth work without Admin.\n See docs/examples/host-minimal-worker or\n node_modules/@aotter/mantle/docs/examples/host-minimal-worker.\n\n Opt-in \u2014 Admin / Dev UI\n Add @aotter/mantle-admin and @aotter/mantle-admin-ui only when humans need\n a console. Then re-run generate, bind wrangler ASSETS, and open\n /admin/sign-in (local email OTP via ConsoleEmailSender).\n See docs/examples/host-local-admin-otp or\n node_modules/@aotter/mantle/docs/examples/host-local-admin-otp.\n\n Further (ask the subcommand for details)\n skills project version-matched agent instructions\n emit-openapi OpenAPI 3.1 from HTTP Triggers and Views\n mantle-harness measure indexes and live HTTP (separate binary)\n\nUsage: mantle <subcommand> [options]\n\nSubcommands:\n generate Compile manifests into a typed runtime binding\n validate Static manifest and handler-source validation\n skills Project version-matched Core skills\n emit-openapi Emit OpenAPI 3.1 from Triggers and Views\n";
|
|
3
3
|
//# sourceMappingURL=main.d.ts.map
|
package/dist/cli/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AAgCA,eAAO,MAAM,eAAe,wkDAmC3B,CAAC"}
|
package/dist/cli/main.js
CHANGED
|
@@ -6,15 +6,7 @@ import { runSkills } from "./skills.js";
|
|
|
6
6
|
async function main() {
|
|
7
7
|
const command = argv[2];
|
|
8
8
|
if (!command || command === "--help" || command === "-h") {
|
|
9
|
-
stdout.write(
|
|
10
|
-
|
|
11
|
-
Usage: mantle <subcommand> [options]
|
|
12
|
-
|
|
13
|
-
Subcommands:
|
|
14
|
-
generate Compile manifests and handler types
|
|
15
|
-
skills Project version-matched Core skills
|
|
16
|
-
validate Static manifest + handler-source validation
|
|
17
|
-
emit-openapi Emit OpenAPI 3.1 from Triggers + Views
|
|
9
|
+
stdout.write(`${MANTLE_OVERVIEW}
|
|
18
10
|
`);
|
|
19
11
|
return command ? 0 : 2;
|
|
20
12
|
}
|
|
@@ -33,6 +25,42 @@ Subcommands:
|
|
|
33
25
|
return 2;
|
|
34
26
|
}
|
|
35
27
|
}
|
|
28
|
+
export const MANTLE_OVERVIEW = `mantle — compile manifests into a RuntimePlan and typed binding
|
|
29
|
+
|
|
30
|
+
Overview
|
|
31
|
+
Optional surfaces — take only what you need. Admin is opt-in. You can ship a
|
|
32
|
+
complete service with no Dev UI, no visitor frontend, and no extra packages.
|
|
33
|
+
|
|
34
|
+
Minimal — Spec + generate
|
|
35
|
+
validate + generate compile manifests into a sealed plan and typed binding.
|
|
36
|
+
Embed that binding in an existing host. No Admin, no visitor UI.
|
|
37
|
+
|
|
38
|
+
Runtime / adapter
|
|
39
|
+
Bind Runtime through an adapter (Cloudflare Worker, Bun, Vercel, or yours).
|
|
40
|
+
HTTP Views, MCP, and Auth work without Admin.
|
|
41
|
+
See docs/examples/host-minimal-worker or
|
|
42
|
+
node_modules/@aotter/mantle/docs/examples/host-minimal-worker.
|
|
43
|
+
|
|
44
|
+
Opt-in — Admin / Dev UI
|
|
45
|
+
Add @aotter/mantle-admin and @aotter/mantle-admin-ui only when humans need
|
|
46
|
+
a console. Then re-run generate, bind wrangler ASSETS, and open
|
|
47
|
+
/admin/sign-in (local email OTP via ConsoleEmailSender).
|
|
48
|
+
See docs/examples/host-local-admin-otp or
|
|
49
|
+
node_modules/@aotter/mantle/docs/examples/host-local-admin-otp.
|
|
50
|
+
|
|
51
|
+
Further (ask the subcommand for details)
|
|
52
|
+
skills project version-matched agent instructions
|
|
53
|
+
emit-openapi OpenAPI 3.1 from HTTP Triggers and Views
|
|
54
|
+
mantle-harness measure indexes and live HTTP (separate binary)
|
|
55
|
+
|
|
56
|
+
Usage: mantle <subcommand> [options]
|
|
57
|
+
|
|
58
|
+
Subcommands:
|
|
59
|
+
generate Compile manifests into a typed runtime binding
|
|
60
|
+
validate Static manifest and handler-source validation
|
|
61
|
+
skills Project version-matched Core skills
|
|
62
|
+
emit-openapi Emit OpenAPI 3.1 from Triggers and Views
|
|
63
|
+
`;
|
|
36
64
|
main().then((code) => {
|
|
37
65
|
process.exitCode = code;
|
|
38
66
|
}, (error) => {
|
package/dist/cli/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EACL,cAAc,EACd,WAAW,GACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,KAAK,UAAU,IAAI;IACjB,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACxB,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACzD,MAAM,CAAC,KAAK,CAAC
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EACL,cAAc,EACd,WAAW,GACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,KAAK,UAAU,IAAI;IACjB,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACxB,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACzD,MAAM,CAAC,KAAK,CAAC,GAAG,eAAe;CAClC,CAAC,CAAC;QACC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3B,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,UAAU;YACb,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;QAC3B,KAAK,QAAQ;YACX,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;QACzB,KAAK,UAAU;YACb,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;QAC3B,KAAK,cAAc;YACjB,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC;QAC9B;YACE,MAAM,CAAC,KAAK,CAAC,uBAAuB,OAAO,IAAI,CAAC,CAAC;YACjD,OAAO,CAAC,CAAC;IACb,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmC9B,CAAC;AAEF,IAAI,EAAE,CAAC,IAAI,CACT,CAAC,IAAI,EAAE,EAAE;IACP,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;AAC1B,CAAC,EACD,CAAC,KAAK,EAAE,EAAE;IACR,MAAM,CAAC,KAAK,CAAC,mBAAmB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3G,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CACF,CAAC"}
|
package/docs/adapter-guide.md
CHANGED
|
@@ -90,6 +90,11 @@ ports. Unsupported native View dialects fail before the adapter mutates state.
|
|
|
90
90
|
|
|
91
91
|
### Bun embedding
|
|
92
92
|
|
|
93
|
+
> **Experimental.** The Bun and Vercel adapters may change in a minor
|
|
94
|
+
> release. They cover public Views and HTTP Triggers; the host owns
|
|
95
|
+
> authentication and CSRF, and Auth, Admin and MCP are Cloudflare-only today.
|
|
96
|
+
> Cloudflare is the supported host.
|
|
97
|
+
|
|
93
98
|
`@aotter/mantle-bun` is the minimal SQLite reference: pass an application-owned
|
|
94
99
|
`bun:sqlite` `Database` and a compiled `RuntimePlan` to `createBunMantle()`.
|
|
95
100
|
Its `handle()` returns `null` for sibling routes and a Web-standard `Response`
|
|
@@ -136,7 +141,7 @@ adapter. A narrow adapter extension seam may let consumer code verify its own
|
|
|
136
141
|
API-key or personal-token formats, but credential storage/issuance must not
|
|
137
142
|
become a runtime port. The Cloudflare reference is
|
|
138
143
|
`mount/resolveCaller.ts`; consumer usage is documented in
|
|
139
|
-
[API and MCP authorization](
|
|
144
|
+
[API and MCP authorization](examples/cf-primitives-guarded-api.md).
|
|
140
145
|
|
|
141
146
|
Minimum HTTP behavior for a full adapter:
|
|
142
147
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# ADR-lite #845: frontend calls use the existing HTTP Trigger contract
|
|
2
|
+
|
|
3
|
+
Status: Accepted for implementation under #845 and mantle-home #86.
|
|
4
|
+
|
|
5
|
+
`mantle-web/client` is a browser-safe fetch client for declared public Views and
|
|
6
|
+
HTTP Triggers. `mantle-web/client-runtime` projects that contract from the sealed
|
|
7
|
+
RuntimePlan and binds the same client to `createMantleRequestHandler`, with a
|
|
8
|
+
request-local principal. Local SSR makes no network call and invokes no internal
|
|
9
|
+
EntryReader. Calls retain Trigger identity. No manifest grammar changes.
|
|
10
|
+
|
|
11
|
+
The public contract uses wire names, input/output schemas and the plan fingerprint.
|
|
12
|
+
View rows remain records: the existing View API does not promise a generated row
|
|
13
|
+
schema. The generic response shape includes rows/page/show/hasMore. This is not a
|
|
14
|
+
new generator or validation engine; Runtime still validates and authorizes.
|
|
15
|
+
|
|
16
|
+
Remote callers inject fetch and a request-local token resolver. Clients never
|
|
17
|
+
retry a mutation or follow redirects with credentials. Business diagnostics and
|
|
18
|
+
OAuth challenge remain available in MantleClientError; network and abort errors
|
|
19
|
+
remain native errors. The browser export imports no runtime or storage module.
|
|
20
|
+
|
|
21
|
+
Cloudflare's opt-in frontendOrigins accepts exact origins for API CORS, exposes
|
|
22
|
+
WWW-Authenticate and permits Authorization/Content-Type preflights. Cross-origin
|
|
23
|
+
responses use no-store and do not enable cookie credentials. Cookie CSRF checks
|
|
24
|
+
and configured bearer issuer/audience/scope checks remain the same. Host-owned
|
|
25
|
+
OAuth/connection policy is independent of application revision. Existing Better
|
|
26
|
+
Auth PKCE registration, consent and revocation remain the authority.
|
|
27
|
+
|
|
28
|
+
In a provider composed with MCP, user grants for additional configured resources
|
|
29
|
+
carry the same consent lineage and session binding as MCP grants. Verification
|
|
30
|
+
reuses the current-consent/session check for those resources too; API JWTs cannot
|
|
31
|
+
outlive revocation or become valid again on reconnect. OAuth discovery responses
|
|
32
|
+
also receive the configured exact-origin CORS policy for public browser clients.
|
|
33
|
+
|
|
34
|
+
Existing native public cache tags and purge handle same-Worker invalidation.
|
|
35
|
+
External consumers start with private/no-store, or explicitly bound TTL; durable
|
|
36
|
+
remote invalidation delivery remains the parent #792 contract and must be proven
|
|
37
|
+
before advertising a stronger freshness guarantee. Cloud's integration includes
|
|
38
|
+
the actual external consumer and browser evidence, not only this package change.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Task-specific agent prompts
|
|
2
|
+
|
|
3
|
+
Copy one block into a coding agent. Paths below are relative to the Mantle
|
|
4
|
+
docs root: `node_modules/@aotter/mantle/docs/` after `@aotter/mantle` is
|
|
5
|
+
installed, or `docs/` in the installed agent plugin. Pin `@aotter/mantle`
|
|
6
|
+
first if neither exists. `npx --no-install mantle --help` is the layered
|
|
7
|
+
overview. There is no `mantle create`. Admin is opt-in.
|
|
8
|
+
|
|
9
|
+
### Embed Runtime with typed APIs
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
Read handbook/start/project-and-cli.md and npx --no-install mantle --help.
|
|
13
|
+
Pin @aotter/mantle at the exact version we agree, author manifests for
|
|
14
|
+
this existing host, then run mantle generate. Embed
|
|
15
|
+
the typed binding from .mantle/generated/mantle.ts into the current
|
|
16
|
+
system. Do not add Admin, mantle-admin-ui, a visitor frontend, or a
|
|
17
|
+
Cloudflare adapter unless I ask. Do not invent a default Schema.
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Minimal API service locally
|
|
21
|
+
|
|
22
|
+
```text
|
|
23
|
+
Read handbook/start/quickstart-worker.md and examples/host-minimal-worker/.
|
|
24
|
+
Author a Cloudflare Worker from that official example or from scratch:
|
|
25
|
+
one Schema, one public View (copy the contract, not the tree wholesale).
|
|
26
|
+
Pin every @aotter/mantle* package to the same exact version. Run
|
|
27
|
+
pnpm install && pnpm generate && pnpm dev (or wrangler dev --local).
|
|
28
|
+
Probe GET /api/views/<name> with curl. GET / may 404. Do not install
|
|
29
|
+
Admin or wrangler ASSETS unless I ask.
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Full local Dev UI (opt-in)
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
I want the optional Admin / Dev UI. Read handbook/start/quickstart-admin.md
|
|
36
|
+
and examples/host-local-admin-otp/. Interview me for a bootstrap owner email.
|
|
37
|
+
Install @aotter/mantle-admin and @aotter/mantle-admin-ui, run
|
|
38
|
+
mantle generate (it syncs the prebuilt SPA — do not vite-build), and set
|
|
39
|
+
wrangler assets.directory=./public with binding ASSETS (required when
|
|
40
|
+
Admin is installed). Wire createAuth email-otp + ConsoleEmailSender.
|
|
41
|
+
Then pnpm install && pnpm generate && pnpm dev, open /admin/sign-in, and
|
|
42
|
+
read the OTP from wrangler logs. If /admin is a white screen, fetch
|
|
43
|
+
/_mantle/admin/assets/* — 404 means ASSETS is missing, not a missing
|
|
44
|
+
frontend build.
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Interview then build
|
|
48
|
+
|
|
49
|
+
```text
|
|
50
|
+
Interview me about the service: host, who uses it, whether humans need a
|
|
51
|
+
Dev UI, and whether we only embed Spec/Runtime. Read mantle --help, then
|
|
52
|
+
handbook/start/project-and-cli.md. Use examples/README.md as the
|
|
53
|
+
examples index; copy builtin-* Manifests only (not cf-primitives-*).
|
|
54
|
+
Implement locally first. Take only the surfaces we chose.
|
|
55
|
+
For Spec-only use, skip Runtime and code generation. For a Worker without
|
|
56
|
+
Admin, follow examples/host-minimal-worker/. For a Worker with Dev UI,
|
|
57
|
+
follow examples/host-local-admin-otp/. No mantle create. Pin all
|
|
58
|
+
@aotter/mantle* packages to one exact version.
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Later layer: MCP or public web (opt-in)
|
|
62
|
+
|
|
63
|
+
```text
|
|
64
|
+
Do not add Admin unless it is already in this project. Read
|
|
65
|
+
handbook/concepts/mcp-and-agents.md and/or
|
|
66
|
+
handbook/cloudflare/public-web.md. Add only the surface I name: MCP
|
|
67
|
+
Triggers at /mcp or /mcp/staff, or optional @aotter/mantle-web
|
|
68
|
+
composition. Keep Core adapter-neutral. Probe the new route; do not
|
|
69
|
+
claim Auth or Admin works from a public 200.
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Mantle on ChatGPT Sites, including media
|
|
73
|
+
|
|
74
|
+
```text
|
|
75
|
+
Build with ChatGPT Sites; use Mantle for content management and publishing.
|
|
76
|
+
Read handbook/sites/index.md and examples/host-chatgpt-sites/README.md.
|
|
77
|
+
Use that runnable host as a reference and install its pinned
|
|
78
|
+
dependencies from the registry. Derive Schema, View,
|
|
79
|
+
Procedure and Trigger from my requirements and check the Admin editor/picker and public
|
|
80
|
+
projections against them. Request both Sites D1 and R2 when my workflow
|
|
81
|
+
includes uploads. Bind the R2 media port, declare media.purposes, and keep
|
|
82
|
+
the same-origin PUT and committed-only public GET checks. Pin every
|
|
83
|
+
@aotter/mantle* dependency to one exact version. Run the local smoke,
|
|
84
|
+
show a draft-to-publish walkthrough, then save and deploy through Sites when
|
|
85
|
+
requested. Verify the deployed owner/member role, R2 upload, published page, and anonymous draft 404. Treat public read-only
|
|
86
|
+
MCP, Admin WebMCP, and staff OAuth MCP as separate acceptance gates; never
|
|
87
|
+
claim staff MCP from a working browser session or connector URL alone.
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
[Back to the Core README](../README.md#for-engineers-and-agents).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# API and MCP authorization
|
|
2
2
|
|
|
3
3
|
See [Authorization](handbook/reference/authorization.md),
|
|
4
|
-
[Guarded API access](
|
|
4
|
+
[Guarded API access](examples/cf-primitives-guarded-api.md), and
|
|
5
5
|
[OAuth resource primitives](handbook/cloudflare/authentication.md#oauth-resource-primitives).
|
|
@@ -138,7 +138,7 @@ handler that checks current business state.
|
|
|
138
138
|
Mantle Platform may be the identity or OAuth token authority for a hosted
|
|
139
139
|
flow. That does not make token claims the generated site's live membership or
|
|
140
140
|
entitlement authority. The target site's guard reads its authoritative state
|
|
141
|
-
on every call. See [API and MCP authorization](
|
|
141
|
+
on every call. See [API and MCP authorization](examples/cf-primitives-guarded-api.md) for
|
|
142
142
|
the exact public API and four consumer examples.
|
|
143
143
|
|
|
144
144
|
## SDK Surface Rule
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Examples hub
|
|
2
|
+
|
|
3
|
+
This folder is the only official examples tree. Filenames carry the handler class. There is no second Manifest body under `docs/handbook/examples/` — those pages redirect here.
|
|
4
|
+
|
|
5
|
+
**Builder** may ingest a Manifest only when every Procedure is `handler.kind: builtin` (or the example has no Procedures). That is the `builtin-*` prefix. `cf-primitives-*` documents Durable Objects, Queues, cron, R2, and/or `handler.kind: ref`. `host-*` directories are runnable consumer projects, not business presets.
|
|
6
|
+
|
|
7
|
+
Drop a `builtin-*` YAML block into `host-local-admin-otp/manifests/` (or `host-minimal-worker/manifests/`) and run `mantle validate`.
|
|
8
|
+
|
|
9
|
+
| Id / filename | Meaning | Class | Builder | Admin | Related host |
|
|
10
|
+
|---|---|---|---|---|---|
|
|
11
|
+
| [`builtin-intake.md`](./builtin-intake.md) | Public request form; builtin create; staff list | builtin | yes | optional (staff View / Staff MCP) | `host-minimal-worker` or `host-local-admin-otp` |
|
|
12
|
+
| [`builtin-reservation.md`](./builtin-reservation.md) | Public reservation queue; builtin create; staff list | builtin | yes | optional | `host-minimal-worker` or `host-local-admin-otp` |
|
|
13
|
+
| [`builtin-publication.md`](./builtin-publication.md) | Localized posts, public list, reader suggestions | builtin | yes | optional (Admin or Staff MCP to draft/publish) | `host-local-admin-otp` |
|
|
14
|
+
| [`builtin-procurement.md`](./builtin-procurement.md) | Member requisitions and staff approve/reject with OCC | builtin | yes | optional (Admin or Staff MCP) | `host-local-admin-otp` |
|
|
15
|
+
| [`builtin-legal-documents.md`](./builtin-legal-documents.md) | Localized Terms/Privacy revisions and signed-in acceptances | builtin | yes | optional (staff create via MCP; Admin for review) | `host-local-admin-otp` |
|
|
16
|
+
| [`builtin-commerce.md`](./builtin-commerce.md) | Product catalog, guest orders, staff fulfill/cancel; builtin create/update only | builtin | yes | optional (Admin or Staff MCP to publish products) | `host-local-admin-otp` |
|
|
17
|
+
| [`cf-primitives-intake-hooks.md`](./cf-primitives-intake-hooks.md) | Same intake Schema with Turnstile `before_create` and email `after_create` `ref` hooks | cf-primitives | no | optional | `host-minimal-worker` plus handlers |
|
|
18
|
+
| [`cf-primitives-commerce-inventory.md`](./cf-primitives-commerce-inventory.md) | Catalog plus Durable Object stock authority, Queue expiry, payment callback, `ref` handlers | cf-primitives | no | optional | `host-minimal-worker` plus DO/Queue/cron |
|
|
19
|
+
| [`cf-primitives-guarded-api.md`](./cf-primitives-guarded-api.md) | API keys, scopes, live entitlement `ref` guards over REST and MCP | cf-primitives | no | none | `host-minimal-worker` plus credential resolver |
|
|
20
|
+
| [`host-minimal-worker/`](./host-minimal-worker/README.md) | Executable Spec + adapter without Admin | host | no | none | itself |
|
|
21
|
+
| [`host-local-admin-otp/`](./host-local-admin-otp/README.md) | Executable opt-in Admin / Dev UI with email OTP | host | no | required | itself |
|
|
22
|
+
| [Mantle on ChatGPT Sites](../handbook/sites/index.md) · [runnable reference](./host-chatgpt-sites/README.md) | Runnable Sites D1/R2, ChatGPT identity, Admin media, published web and public read-only MCP | host | no | required | itself |
|