@cyanheads/mcp-ts-core 0.13.9 → 0.13.11
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 +41 -15
- package/CLAUDE.md +41 -15
- package/README.md +37 -11
- package/biome.json +1 -1
- package/changelog/0.13.x/0.13.10.md +118 -0
- package/changelog/0.13.x/0.13.11.md +113 -0
- package/dist/cli/app-render.d.ts +11 -0
- package/dist/cli/app-render.d.ts.map +1 -0
- package/dist/cli/app-render.js +150 -0
- package/dist/cli/app-render.js.map +1 -0
- package/dist/cli/init.d.ts +2 -1
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +10 -2
- package/dist/cli/init.js.map +1 -1
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +11 -0
- package/dist/config/index.js.map +1 -1
- package/dist/core/app.d.ts.map +1 -1
- package/dist/core/app.js +15 -1
- package/dist/core/app.js.map +1 -1
- package/dist/core/context.d.ts +92 -22
- package/dist/core/context.d.ts.map +1 -1
- package/dist/core/context.js +65 -16
- package/dist/core/context.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/worker.d.ts +6 -0
- package/dist/core/worker.d.ts.map +1 -1
- package/dist/core/worker.js +1 -0
- package/dist/core/worker.js.map +1 -1
- package/dist/linter/rules/error-contract-rules.d.ts +3 -44
- package/dist/linter/rules/error-contract-rules.d.ts.map +1 -1
- package/dist/linter/rules/error-contract-rules.js +8 -144
- package/dist/linter/rules/error-contract-rules.js.map +1 -1
- package/dist/linter/rules/index.d.ts +1 -1
- package/dist/linter/rules/index.d.ts.map +1 -1
- package/dist/linter/rules/index.js +1 -1
- package/dist/linter/rules/index.js.map +1 -1
- package/dist/linter/rules/resource-rules.d.ts.map +1 -1
- package/dist/linter/rules/resource-rules.js +1 -2
- package/dist/linter/rules/resource-rules.js.map +1 -1
- package/dist/linter/rules/tool-rules.d.ts.map +1 -1
- package/dist/linter/rules/tool-rules.js +1 -2
- package/dist/linter/rules/tool-rules.js.map +1 -1
- package/dist/mcp-server/handlerContext.d.ts +26 -13
- package/dist/mcp-server/handlerContext.d.ts.map +1 -1
- package/dist/mcp-server/handlerContext.js +32 -17
- package/dist/mcp-server/handlerContext.js.map +1 -1
- package/dist/mcp-server/inputRequired.d.ts +120 -8
- package/dist/mcp-server/inputRequired.d.ts.map +1 -1
- package/dist/mcp-server/inputRequired.js +177 -12
- package/dist/mcp-server/inputRequired.js.map +1 -1
- package/dist/mcp-server/prompts/prompt-registration.d.ts +10 -2
- package/dist/mcp-server/prompts/prompt-registration.d.ts.map +1 -1
- package/dist/mcp-server/prompts/prompt-registration.js +49 -11
- package/dist/mcp-server/prompts/prompt-registration.js.map +1 -1
- package/dist/mcp-server/resources/resource-registration.d.ts +4 -2
- package/dist/mcp-server/resources/resource-registration.d.ts.map +1 -1
- package/dist/mcp-server/resources/resource-registration.js +6 -4
- package/dist/mcp-server/resources/resource-registration.js.map +1 -1
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts +4 -3
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts.map +1 -1
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.js +60 -21
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.js.map +1 -1
- package/dist/mcp-server/server.d.ts +9 -0
- package/dist/mcp-server/server.d.ts.map +1 -1
- package/dist/mcp-server/server.js +14 -13
- package/dist/mcp-server/server.js.map +1 -1
- package/dist/mcp-server/tools/tool-registration.d.ts +7 -3
- package/dist/mcp-server/tools/tool-registration.d.ts.map +1 -1
- package/dist/mcp-server/tools/tool-registration.js +9 -5
- package/dist/mcp-server/tools/tool-registration.js.map +1 -1
- package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts +17 -9
- package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts.map +1 -1
- package/dist/mcp-server/tools/utils/toolHandlerFactory.js +91 -50
- package/dist/mcp-server/tools/utils/toolHandlerFactory.js.map +1 -1
- package/dist/mcp-server/transports/http/httpErrorHandler.d.ts.map +1 -1
- package/dist/mcp-server/transports/http/httpErrorHandler.js +7 -1
- package/dist/mcp-server/transports/http/httpErrorHandler.js.map +1 -1
- package/dist/services/mirror/sqlite/handle.d.ts +11 -5
- package/dist/services/mirror/sqlite/handle.d.ts.map +1 -1
- package/dist/services/mirror/sqlite/handle.js +46 -8
- package/dist/services/mirror/sqlite/handle.js.map +1 -1
- package/dist/services/mirror/sqlite/sqliteMirrorStore.d.ts +6 -1
- package/dist/services/mirror/sqlite/sqliteMirrorStore.d.ts.map +1 -1
- package/dist/services/mirror/sqlite/sqliteMirrorStore.js.map +1 -1
- package/dist/testing/apps/browser.d.ts +27 -0
- package/dist/testing/apps/browser.d.ts.map +1 -0
- package/dist/testing/apps/browser.js +162 -0
- package/dist/testing/apps/browser.js.map +1 -0
- package/dist/testing/apps/cdp-pipe.d.ts +79 -0
- package/dist/testing/apps/cdp-pipe.d.ts.map +1 -0
- package/dist/testing/apps/cdp-pipe.js +200 -0
- package/dist/testing/apps/cdp-pipe.js.map +1 -0
- package/dist/testing/apps/csp.d.ts +17 -0
- package/dist/testing/apps/csp.d.ts.map +1 -0
- package/dist/testing/apps/csp.js +50 -0
- package/dist/testing/apps/csp.js.map +1 -0
- package/dist/testing/apps/host-pages.d.ts +47 -0
- package/dist/testing/apps/host-pages.d.ts.map +1 -0
- package/dist/testing/apps/host-pages.js +138 -0
- package/dist/testing/apps/host-pages.js.map +1 -0
- package/dist/testing/apps/index.d.ts +167 -0
- package/dist/testing/apps/index.d.ts.map +1 -0
- package/dist/testing/apps/index.js +36 -0
- package/dist/testing/apps/index.js.map +1 -0
- package/dist/testing/apps/partial-json.d.ts +14 -0
- package/dist/testing/apps/partial-json.d.ts.map +1 -0
- package/dist/testing/apps/partial-json.js +71 -0
- package/dist/testing/apps/partial-json.js.map +1 -0
- package/dist/testing/apps/run.d.ts +13 -0
- package/dist/testing/apps/run.d.ts.map +1 -0
- package/dist/testing/apps/run.js +659 -0
- package/dist/testing/apps/run.js.map +1 -0
- package/dist/testing/index.d.ts +17 -2
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +21 -7
- package/dist/testing/index.js.map +1 -1
- package/dist/types-global/errors.d.ts +18 -15
- package/dist/types-global/errors.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/internal/error-handler/errorHandler.d.ts +5 -4
- package/dist/utils/internal/error-handler/errorHandler.d.ts.map +1 -1
- package/dist/utils/internal/error-handler/errorHandler.js +9 -7
- package/dist/utils/internal/error-handler/errorHandler.js.map +1 -1
- package/dist/utils/internal/error-handler/types.d.ts +3 -1
- package/dist/utils/internal/error-handler/types.d.ts.map +1 -1
- package/dist/utils/internal/logger.d.ts +21 -1
- package/dist/utils/internal/logger.d.ts.map +1 -1
- package/dist/utils/internal/logger.js +31 -14
- package/dist/utils/internal/logger.js.map +1 -1
- package/dist/utils/internal/performance.d.ts +7 -3
- package/dist/utils/internal/performance.d.ts.map +1 -1
- package/dist/utils/internal/performance.js +16 -9
- package/dist/utils/internal/performance.js.map +1 -1
- package/dist/utils/internal/telemetryMessages.d.ts +0 -1
- package/dist/utils/internal/telemetryMessages.d.ts.map +1 -1
- package/dist/utils/internal/telemetryMessages.js +0 -1
- package/dist/utils/internal/telemetryMessages.js.map +1 -1
- package/dist/utils/security/sanitization.d.ts +16 -13
- package/dist/utils/security/sanitization.d.ts.map +1 -1
- package/dist/utils/security/sanitization.js +74 -33
- package/dist/utils/security/sanitization.js.map +1 -1
- package/dist/utils/telemetry/attributes.d.ts +12 -5
- package/dist/utils/telemetry/attributes.d.ts.map +1 -1
- package/dist/utils/telemetry/attributes.js +12 -5
- package/dist/utils/telemetry/attributes.js.map +1 -1
- package/framework-skills/add-app-tool/SKILL.md +2 -1
- package/framework-skills/add-service/SKILL.md +3 -12
- package/framework-skills/add-test/SKILL.md +20 -17
- package/framework-skills/add-tool/SKILL.md +30 -34
- package/framework-skills/api-config/SKILL.md +12 -2
- package/framework-skills/api-context/SKILL.md +156 -41
- package/framework-skills/api-errors/SKILL.md +43 -47
- package/framework-skills/api-linter/SKILL.md +5 -29
- package/framework-skills/api-mirror/SKILL.md +4 -3
- package/framework-skills/api-telemetry/SKILL.md +16 -10
- package/framework-skills/api-testing/SKILL.md +47 -11
- package/framework-skills/api-utils/SKILL.md +3 -3
- package/framework-skills/api-workers/SKILL.md +3 -1
- package/framework-skills/code-simplifier/SKILL.md +2 -2
- package/framework-skills/design-mcp-server/SKILL.md +5 -5
- package/framework-skills/field-test/SKILL.md +53 -8
- package/framework-skills/git-wrapup/SKILL.md +2 -2
- package/framework-skills/orchestrations/SKILL.md +1 -1
- package/framework-skills/orchestrations/workflows/greenfield-build.md +2 -2
- package/framework-skills/polish-docs-meta/SKILL.md +4 -3
- package/framework-skills/polish-docs-meta/references/server-json.md +24 -26
- package/framework-skills/release-and-publish/SKILL.md +3 -3
- package/framework-skills/release-pr-review/SKILL.md +6 -6
- package/framework-skills/security-pass/SKILL.md +8 -7
- package/framework-skills/setup/SKILL.md +2 -2
- package/package.json +38 -22
- package/scripts/devcheck.ts +43 -21
- package/scripts/install-otel.ts +84 -0
- package/scripts/lint-packaging.ts +279 -28
- package/scripts/prune-musl-packages.ts +146 -0
- package/templates/.env.example +2 -0
- package/templates/.github/workflows/codeql.yml +10 -1
- package/templates/AGENTS.md +5 -4
- package/templates/CLAUDE.md +5 -4
- package/templates/Dockerfile +76 -50
- package/templates/_.dockerignore +3 -5
- package/templates/_.gitignore +4 -4
- package/templates/package.json +4 -4
- package/templates/server.json +7 -21
- package/templates/src/mcp-server/tools/definitions/echo.tool.ts +3 -8
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "A client can no longer pre-answer a consent gate with a response its declared capabilities do not cover, framework-built errors carry their request ID and fill a declared recovery hint, and multi-arch Docker builds stop running Bun under QEMU."
|
|
3
|
+
breaking: false
|
|
4
|
+
security: true
|
|
5
|
+
agent-notes: |
|
|
6
|
+
Adoption steps for a consumer upgrading from 0.13.9.
|
|
7
|
+
|
|
8
|
+
1. Dockerfile — move every install into a `deps` stage. These steps
|
|
9
|
+
replace 0.13.8's agent-notes step 7. A production stage that copies
|
|
10
|
+
`bunfig.toml` (the 0.13.8 / 0.13.9 scaffold) fails `lint:packaging`
|
|
11
|
+
check 15 once `scripts/lint-packaging.ts` is resynced, and its
|
|
12
|
+
multi-arch build aborts on the non-native leg. `init` never overwrites
|
|
13
|
+
`Dockerfile`, so port by hand:
|
|
14
|
+
a. Resync the framework scripts (maintenance Phase C, or `init` in
|
|
15
|
+
place) so `scripts/install-otel.ts` exists. Commit it, and keep
|
|
16
|
+
`scripts/` out of `.dockerignore`: the image build copies it.
|
|
17
|
+
b. Copy the scaffold `Dockerfile`'s `deps` stage — its
|
|
18
|
+
`FROM --platform=$BUILDPLATFORM` on the build stage's `oven/bun` tag,
|
|
19
|
+
manifest copy, scanner seed, `TARGETARCH` → `.bun-cpu` mapping,
|
|
20
|
+
cross-install, `install-otel.ts` step, and scanner removal — in
|
|
21
|
+
between the build and production stages.
|
|
22
|
+
c. In the production stage, delete the `package.json`/`bun.lock`/
|
|
23
|
+
`bunfig.toml` copy, the scanner seed, the `bun install`,
|
|
24
|
+
`ARG OTEL_ENABLED`, and the OTel `RUN` (the `bun -e` range lookup
|
|
25
|
+
plus `bun add`, or an older plain `bun add` list). Before the `dist`
|
|
26
|
+
copy, add `COPY package.json ./` and
|
|
27
|
+
`COPY --from=deps /usr/src/app/node_modules ./node_modules`. Keep
|
|
28
|
+
everything else.
|
|
29
|
+
d. Move any other build-time `bun` / `bunx` call out of a stage not
|
|
30
|
+
pinned to `$BUILDPLATFORM`; check 15 names each line. Verify with
|
|
31
|
+
`bun run lint:packaging`.
|
|
32
|
+
A server still on the pre-0.13.8 production stage lints clean, but its
|
|
33
|
+
image installs skip the release-age gate and scanner; port it too.
|
|
34
|
+
2. Drop redundant recovery forwards. `ctx.fail('x', msg, ctx.recoveryFor('x'))`
|
|
35
|
+
becomes `ctx.fail('x', msg)`, and a service throw keeps only
|
|
36
|
+
`{ reason: 'x', … }` (a service that took `ctx` only for the spread can
|
|
37
|
+
drop it). Keep explicit `recovery: { hint }` overrides, deliberate
|
|
38
|
+
cross-reason forwards, and forwards a test asserts on a direct
|
|
39
|
+
`definition.handler(...)` throw — or move that assertion to
|
|
40
|
+
`runToolContract`, which applies the fill. The lint rule
|
|
41
|
+
`error-contract-recovery-unforwarded` is gone: swap its mentions in
|
|
42
|
+
`CLAUDE.md` / `AGENTS.md` for the template's Errors wording, and drop it
|
|
43
|
+
from any script that greps lint output.
|
|
44
|
+
3. Tests pinning exact error text or `data`: a tool error's `content[]`
|
|
45
|
+
now closes with `request <id>`, and tool, resource, and prompt error
|
|
46
|
+
`data` gain `requestId` (a classified plain `Error` returns
|
|
47
|
+
`data: { requestId }`). Assert with the envelope's own value or
|
|
48
|
+
`expect.any(String)`. `runToolContract` adds no request id but now
|
|
49
|
+
fills a declared hint, adding a `Recovery:` line. A server that put an
|
|
50
|
+
upstream id in `data.requestId` renames it (`upstreamRequestId`); one
|
|
51
|
+
that copied `ctx.requestId` there drops it.
|
|
52
|
+
4. Alerts: `invalid_arguments` and `client_capability_missing` records
|
|
53
|
+
now log at `notice`, tagged `mcp.error.severity: "notice"`. The
|
|
54
|
+
`Prompt generation failed.` record is gone — key prompt alerts on
|
|
55
|
+
`Error in prompt:<name>`.
|
|
56
|
+
5. Consent gates: a destructive handler that acts on `ctx.inputs` alone,
|
|
57
|
+
compares a target carried in `requestState`, or stores a record without
|
|
58
|
+
the operation and caller moves to the `api-context` § Consent gates
|
|
59
|
+
pattern: redeem a `ctx.state` record
|
|
60
|
+
`{ operation, clientId, subject, target, contentHash }` first and ask
|
|
61
|
+
again on any mismatch. Keep the record where every instance a retry
|
|
62
|
+
reaches can read it (`filesystem`, `supabase`, or `cloudflare-d1`,
|
|
63
|
+
never `cloudflare-kv`), and make an action that must not repeat
|
|
64
|
+
idempotent per record until an atomic `ctx.state.take` exists (#593).
|
|
65
|
+
Tests copy the round-one record into the round-two mock context
|
|
66
|
+
(`api-testing` § Mock inputs).
|
|
67
|
+
6. Set `MCP_REQUEST_STATE_KEY` (≥ 32 bytes, e.g. `openssl rand -base64 32`,
|
|
68
|
+
the same on every instance and Worker isolate) on any server whose
|
|
69
|
+
`requestState` drives a mutation or carries ids across rounds. A
|
|
70
|
+
startup `info` record naming the variable confirms it took. A client
|
|
71
|
+
or test that builds `requestState` by hand then gets `-32602`
|
|
72
|
+
`invalid_request_state`.
|
|
73
|
+
7. Replace a catch of `client_capability_missing` used to fall through to
|
|
74
|
+
another source with a `ctx.clientCapabilities` check before
|
|
75
|
+
`ctx.requestInput`, after reading `ctx.inputs`. Treat `undefined` as
|
|
76
|
+
cannot-ask, and never use it to skip a consent prompt.
|
|
77
|
+
8. `Context` gains a required `clientCapabilities` key, so a hand-built
|
|
78
|
+
`Context` literal (a custom mock typed `Context`) needs it.
|
|
79
|
+
`createMockContext` tests change only when they seed
|
|
80
|
+
`clientCapabilities`, which applies the production filter.
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
# 0.13.10 — 2026-09-26
|
|
84
|
+
|
|
85
|
+
## Added
|
|
86
|
+
|
|
87
|
+
- **`ctx.clientCapabilities`** ([#580](https://github.com/cyanheads/mcp-ts-core/issues/580)) — what the client declared for this request (`undefined` for a 2025-era request under stateless HTTP), for deciding whether to ask for optional context, never whether to skip a consent prompt. `ClientCapabilities` is exported from the main entry, and `createMockContext({ clientCapabilities })` seeds it.
|
|
88
|
+
- **`MCP_REQUEST_STATE_KEY`** ([#496](https://github.com/cyanheads/mcp-ts-core/issues/496)) — opt-in key (≥ 32 bytes, the same on every instance) that seals the `requestState` a handler returns, bound to the caller for 900 s. Any other state is rejected as `-32602` `invalid_request_state` before the handler runs; also a Worker core binding.
|
|
89
|
+
- **`scripts/install-otel.ts`** ([#578](https://github.com/cyanheads/mcp-ts-core/issues/578)) — ships in the package and the scaffold, installing every `@opentelemetry/*` peer plus `@hono/otel` at the framework's declared ranges and passing extra arguments (`--os`, `--cpu`) to its `bun install`. The Dockerfiles run it in place of a hand-kept list.
|
|
90
|
+
|
|
91
|
+
## Changed
|
|
92
|
+
|
|
93
|
+
- **A declared `recovery` reaches the wire without `ctx.recoveryFor`** ([#579](https://github.com/cyanheads/mcp-ts-core/issues/579)) — a tool or resource failure whose `data.reason` names an `errors[]` entry and carries no `data.recovery` gets that entry's hint, service throws included, and `runToolContract` does the same. A throw-site hint still wins.
|
|
94
|
+
- **Error envelopes carry `data.requestId`** ([#576](https://github.com/cyanheads/mcp-ts-core/issues/576)) — tool, resource, prompt, and `httpErrorHandler` errors return the `requestId` their log records carry, and a tool's `content[]` closes with `request <id>`. A resource `-32602` whose `data` is exactly `{ uri }` and `runToolContract` results go without.
|
|
95
|
+
- **Framework refusals log at `notice`** ([#567](https://github.com/cyanheads/mcp-ts-core/issues/567)) — `Error in tool:<name>` for `invalid_arguments` and `client_capability_missing` drops from `error` to `notice`, and `mcp.errors.classified` tags them `mcp.error.severity: "notice"`. A declared `severity` naming either reason still wins.
|
|
96
|
+
- **`lint:packaging` check 15 flags JavaScript in any target-platform stage** ([#575](https://github.com/cyanheads/mcp-ts-core/issues/575)) — a Dockerfile stage not starting `FROM --platform=$BUILDPLATFORM` fails when a `RUN` invokes `bun` for anything but `install`/`add`, or installs once `bunfig.toml` is in the stage, naming each line.
|
|
97
|
+
- **The release review pass may ship caller-handed work** — `release-pr-review` commits uncommitted work the caller explicitly hands over on top of the stack and adds it to the changelog entry; `release-and-publish` admits those commits above the release commit.
|
|
98
|
+
- Skill versions: `add-service` 1.11 → 1.12, `add-test` 1.7 → 1.8, `add-tool` 2.31 → 2.32, `api-config` 1.22 → 1.23, `api-context` 2.8 → 2.9, `api-errors` 1.18 → 1.19, `api-linter` 1.20 → 1.21, `api-telemetry` 1.15 → 1.16, `api-testing` 1.12 → 1.13, `api-workers` 1.8 → 1.9, `design-mcp-server` 2.30 → 2.31, `field-test` 2.17 → 2.18, `polish-docs-meta` 2.20 → 2.21, `release-and-publish` 2.22 → 2.23, `release-pr-review` 1.6 → 1.7, `security-pass` 1.11 → 1.12.
|
|
99
|
+
|
|
100
|
+
## Removed
|
|
101
|
+
|
|
102
|
+
- **`error-contract-recovery-unforwarded`** ([#579](https://github.com/cyanheads/mcp-ts-core/issues/579)) — the lint rule is gone; with the recovery fill, a bare `ctx.fail('<reason>')` reaches the client with its hint.
|
|
103
|
+
|
|
104
|
+
## Fixed
|
|
105
|
+
|
|
106
|
+
- **Multi-arch Docker builds no longer run Bun under QEMU** ([#575](https://github.com/cyanheads/mcp-ts-core/issues/575)) — the framework and scaffold Dockerfiles install production dependencies in a `deps` stage on `$BUILDPLATFORM`, cross-installing with `--os`/`--cpu`, so the production stage's only Bun calls are `HEALTHCHECK` and `CMD`. Existing servers port by hand.
|
|
107
|
+
- **An argless prompt's `generate` receives `{}`** ([#581](https://github.com/cyanheads/mcp-ts-core/issues/581)) — not the SDK's request context, and its input measures 0 bytes.
|
|
108
|
+
- **A failed prompt writes one error record, under its own request id** ([#582](https://github.com/cyanheads/mcp-ts-core/issues/582)) — `Error in prompt:<name>` at `error`, and a completion record of `Prompt generation finished.` at `info` with `metrics.isSuccess: false` in place of `Prompt generation failed.` at `error`. Each `prompts/get` logs under its own `requestId`.
|
|
109
|
+
|
|
110
|
+
## Security
|
|
111
|
+
|
|
112
|
+
- **`ctx.inputs` keeps only responses the client declared** ([#496](https://github.com/cyanheads/mcp-ts-core/issues/496)) — a client that did not declare `elicitation`, or declared only its URL mode, could pre-answer a consent gate on its first call. A response now reaches `ctx.inputs` only when the client's declared capabilities and modes cover it, on both protocol eras.
|
|
113
|
+
- **Consent gates redeem a server record** — a client that declared `elicitation` can still pre-answer, so `api-context` § *Consent gates* documents storing `{ operation, clientId, subject, target, contentHash }` in `ctx.state` under a random id and redeeming it before acting. That stops a sequential replay, not concurrent retries, until an atomic `ctx.state.take` exists ([#593](https://github.com/cyanheads/mcp-ts-core/issues/593)).
|
|
114
|
+
|
|
115
|
+
## Dependencies
|
|
116
|
+
|
|
117
|
+
- `hono` ^4.13.8 → ^4.13.9.
|
|
118
|
+
- Dev: `@cloudflare/workers-types` 5.20260922.1 → 5.20260924.1.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "A headless MCP Apps host renders app tool views in tests and from the CLI, ctx.log's mirror to the client honors MCP_LOG_LEVEL and masks sensitive fields, and devcheck's git scans and the scaffold server.json HTTP entry are fixed."
|
|
3
|
+
breaking: false
|
|
4
|
+
security: true
|
|
5
|
+
agent-notes: |
|
|
6
|
+
Adoption steps for a consumer upgrading from 0.13.10.
|
|
7
|
+
|
|
8
|
+
1. Re-sync the framework scripts (maintenance Phase C). devcheck's
|
|
9
|
+
`TODOs/FIXMEs` step now matches: resolve each tracked uppercase `TODO` or
|
|
10
|
+
`FIXME` it reports. `Tracked Secrets` now also catches root-level files
|
|
11
|
+
(`.npmrc`, `credentials.json`, `*.pem`, `.env`, …): `git rm --cached`
|
|
12
|
+
each one and ignore it. A tracked `.github/secret_scanning.yml` now
|
|
13
|
+
passes. `lint-packaging` gains check 16 (step 2), and
|
|
14
|
+
`scripts/prune-musl-packages.ts` arrives (step 5).
|
|
15
|
+
2. Edit `server.json` — upgrading never rewrites it, and the re-synced
|
|
16
|
+
`lint:packaging` fails the old shape. Remove the `run` + `start:*`
|
|
17
|
+
`packageArguments` from each npm entry, set `"runtimeHint": "npx"` (not
|
|
18
|
+
lint-enforced), and add
|
|
19
|
+
`{ "name": "MCP_TRANSPORT_TYPE", "description": "Selects the HTTP transport.", "format": "string", "value": "http" }`
|
|
20
|
+
to the `streamable-http` entry's `environmentVariables` — `value`, not
|
|
21
|
+
`default`.
|
|
22
|
+
3. `.gitignore`: replace the `.env`, `.env.local`, and `.env.*.local` lines
|
|
23
|
+
with `.env*`, `!.env.example`, `!.env.template`, `!.env.sample`.
|
|
24
|
+
`.dockerignore`: replace the enumerated `.env` lines with `.env*`, and add
|
|
25
|
+
`.mcpregistry_github_token` and `.mcpregistry_registry_token`. Then run
|
|
26
|
+
`git ls-files '*.env*'` and `git rm --cached` anything but the three
|
|
27
|
+
templates.
|
|
28
|
+
4. Replace `.github/workflows/codeql.yml` with the scaffold copy. Once the
|
|
29
|
+
default branch has analyses under `/language:actions` and
|
|
30
|
+
`/language:javascript-typescript`, delete the
|
|
31
|
+
`.github/workflows/codeql.yml:analyze` analyses on `refs/heads/main`,
|
|
32
|
+
newest first (`DELETE .../code-scanning/analyses/<id>?confirm_delete=true`);
|
|
33
|
+
a repo that never ran the old workflow has none. A required status check
|
|
34
|
+
named `Analyze` becomes `Analyze (actions)` and
|
|
35
|
+
`Analyze (javascript-typescript)`.
|
|
36
|
+
5. `Dockerfile` `deps` stage: after the OTel step and before the scanner
|
|
37
|
+
`rm`, add `COPY scripts/prune-musl-packages.ts ./scripts/` and
|
|
38
|
+
`RUN bun scripts/prune-musl-packages.ts`. Skip both on a musl (Alpine)
|
|
39
|
+
runtime image.
|
|
40
|
+
6. Mirror servers: remove any `SQLITE_BUSY` retry wrapped around
|
|
41
|
+
`openSqliteHandle`. A failed open now rejects as `DatabaseError` with the
|
|
42
|
+
driver error on `cause` (`err.cause.code`); match on that, not on the raw
|
|
43
|
+
driver error.
|
|
44
|
+
7. Run the skill sync (maintenance Phase A) for the skills listed under
|
|
45
|
+
Changed.
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
# 0.13.11 — 2026-10-03
|
|
49
|
+
|
|
50
|
+
## Added
|
|
51
|
+
|
|
52
|
+
- **`@cyanheads/mcp-ts-core/testing/apps`** ([#623](https://github.com/cyanheads/mcp-ts-core/issues/623)) — `renderAppTool` calls an app tool as an MCP Apps client and renders its `ui://` view in headless `chrome-headless-shell` inside the spec's sandbox and CSP, reporting `initialized`, `errors`, `cspViolations`, `messages`, `text`, and `screenshots`. It throws only on setup failures and needs the optional peers `@modelcontextprotocol/client` and `@modelcontextprotocol/ext-apps`.
|
|
53
|
+
- **`mcp-ts-core app-render`** — the same run from the CLI, writing `report.json` and screenshots under `--out`; it exits 1 only on bad arguments or a setup failure. The `field-test` skill renders every app tool with it (Step 6).
|
|
54
|
+
- **`Logger.isLevelEnabled(level)`** — the level check every sink and the `ctx.log` mirror share, on the RFC 5424 order; `true` before `initialize()`.
|
|
55
|
+
- **`ATTR_MCP_RESOURCE_URI_LENGTH`** — `mcp.resource.uri_length`, exported from `/utils`.
|
|
56
|
+
- **`scripts/prune-musl-packages.ts`** — ships in the package and the scaffold, deleting every installed package whose own `libc` lists `musl` and not `glibc`.
|
|
57
|
+
- **`lint:packaging` check 16** — fails a `server.json` npm entry carrying the `run` + `start:*` arguments, or a `streamable-http` npm entry whose `MCP_TRANSPORT_TYPE` is not `"value": "http"`. devcheck's Packaging step now runs on `server.json` alone.
|
|
58
|
+
|
|
59
|
+
## Changed
|
|
60
|
+
|
|
61
|
+
- **The log level filter compares RFC 5424 severity** — a `notice` floor now drops `info`, `crit` drops `error`, and `emerg` drops `alert` from every sink, where the pino-level comparison let them through.
|
|
62
|
+
- **Skill guidance** — `api-config`: call `getServerConfig()` in `setup()` so a bad value fails startup; `api-mirror`: run a long scheduled sync in a child process; `api-testing`: assert a resource's declared hints through `createWorkerHandler`; `field-test`: start the server with `MCP_LOG_RATE_LIMIT_THRESHOLD=0` to count upstream requests from its log.
|
|
63
|
+
- **Skill corrections** — `add-test`: a cancellation test asserts the work stopped; `add-tool`: keep a tolerated blank out of `.describe()`; `api-mirror`: the lifecycle scripts resolve `@/` only through a `tsconfig.json`, so an npm-installed server cannot run them; `code-simplifier`: `InvalidParams` covers schema rejections and upstream 400s; `git-wrapup`: the npm tarball carries `changelog/`, not the `CHANGELOG.md` rollup; `greenfield-build`: cancel the first private CodeQL run, never delete it.
|
|
64
|
+
- **`release-pr-review` settles a stranded alert by category** — an alert that will not close after its fix is cleared by deleting the retired category's analyses on its ref.
|
|
65
|
+
- Skill versions: `add-app-tool` 1.7 → 1.8, `add-test` 1.8 → 1.9, `add-tool` 2.32 → 2.33, `api-config` 1.23 → 1.24, `api-context` 2.9 → 2.10, `api-mirror` 1.3 → 1.4, `api-telemetry` 1.16 → 1.17, `api-testing` 1.13 → 1.14, `api-utils` 2.14 → 2.15, `code-simplifier` 1.6 → 1.7, `field-test` 2.18 → 2.19, `git-wrapup` 1.27 → 1.28, `orchestrations` 1.12 → 1.13 (workflow `greenfield-build` 1.3 → 1.4), `polish-docs-meta` 2.21 → 2.22, `release-and-publish` 2.23 → 2.24, `release-pr-review` 1.7 → 1.8, `setup` 1.11 → 1.12.
|
|
66
|
+
|
|
67
|
+
## Fixed
|
|
68
|
+
|
|
69
|
+
- **devcheck's `TODOs/FIXMEs` step matches** ([#588](https://github.com/cyanheads/mcp-ts-core/issues/588)) — `git grep -nwE '(TODO|FIXME)'` replaces a `\b` pattern macOS git read as a literal `b`. It is case-sensitive and skips `framework-skills/` and the `.claude`, `.agents`, `.codex`, `.cursor`, and `.windsurf` skill directories.
|
|
70
|
+
- **`Tracked Secrets` catches root-level files** ([#629](https://github.com/cyanheads/mcp-ts-core/issues/629)) — every pattern carries `:(glob)`, so a root `.npmrc`, `credentials.json`, `*.pem`, or `.env` fails the step.
|
|
71
|
+
- **`Tracked Secrets` passes `.github/secret_scanning.yml`** ([#594](https://github.com/cyanheads/mcp-ts-core/issues/594)) — at that exact path only.
|
|
72
|
+
- **The scaffold `server.json` HTTP entry starts HTTP** ([#622](https://github.com/cyanheads/mcp-ts-core/issues/622)) — npm entries drop the `run start:*` arguments a registry client hands the bin, and set `"runtimeHint": "npx"`. The `streamable-http` entry also fixes `MCP_TRANSPORT_TYPE` as `"value": "http"`, and this repo's `server.json` matches.
|
|
73
|
+
- **Scaffold ignore rules cover every env file** ([#589](https://github.com/cyanheads/mcp-ts-core/issues/589)) — `.gitignore` ignores `.env*` except `.env.example`, `.env.template`, and `.env.sample`; `.dockerignore` excludes `.env*` and the MCP registry token files. This repo's own files match.
|
|
74
|
+
- **CodeQL alerts close once fixed** ([#470](https://github.com/cyanheads/mcp-ts-core/issues/470)) — the scaffold and repo workflows run one job per language, uploading under `/language:<language>`, default setup's category. A required `Analyze` check becomes `Analyze (actions)` and `Analyze (javascript-typescript)`.
|
|
75
|
+
- **Docker images drop musl bindings** ([#608](https://github.com/cyanheads/mcp-ts-core/issues/608)) — both Dockerfiles' `deps` stage runs `scripts/prune-musl-packages.ts` after the OTel step, removing musl variants (DuckDB's ~70 MB binding among them) the glibc runtime never loads.
|
|
76
|
+
- **`ctx.log` reaches the client only at or above `MCP_LOG_LEVEL`** ([#621](https://github.com/cyanheads/mcp-ts-core/issues/621)) — `notifications/message` honors the floor on every transport, `silent` included; a client's own level can only narrow it.
|
|
77
|
+
- **`openSqliteHandle` waits out a lock and fails cleanly** ([#607](https://github.com/cyanheads/mcp-ts-core/issues/607)) — `busy_timeout` is set before the first read, and the switch to WAL retries a busy result until `busyTimeoutMs`. A failed open closes the connection and rejects as `DatabaseError`, driver error on `cause` (a missing `better-sqlite3` still throws `ConfigurationError`).
|
|
78
|
+
- **`mcp-ts-core -h` exits 0** — as `--help` does, where it printed the usage and exited 1.
|
|
79
|
+
|
|
80
|
+
## Security
|
|
81
|
+
|
|
82
|
+
- **`ctx.log` masks sensitive fields on the wire** ([#630](https://github.com/cyanheads/mcp-ts-core/issues/630)) — the `notifications/message` payload carries `[REDACTED]` for every sensitive field at any depth, matched as `sanitizeForLogging` matches, fields added through `setSensitiveFields` included. The caller's object is not modified.
|
|
83
|
+
- **A resource read's records and span cap the client's URI** ([#617](https://github.com/cyanheads/mcp-ts-core/issues/617)) — `resourceUri`, `metrics.uri`, and `mcp.resource.uri` carry at most the first 1,024 characters, with `resourceUriLength` / `mcp.resource.uri_length` holding the uncut length when cut. `ctx.uri` and the response keep the full URI.
|
|
84
|
+
|
|
85
|
+
## Dependencies
|
|
86
|
+
|
|
87
|
+
- `@modelcontextprotocol/server` ^2.1.0 → ^2.2.0 (`initialize` and the tool, resource, resource-template, and prompt lists are unchanged on the example server).
|
|
88
|
+
- `@hono/node-server` ^2.1.1 → ^2.1.3.
|
|
89
|
+
- `hono` ^4.13.9 → ^4.13.12.
|
|
90
|
+
- Peer: `@duckdb/node-api` ^1.5.5-r.1 → ^1.5.5-r.1 || ^1.5.6-r.1.
|
|
91
|
+
- Peer (new, optional): `@modelcontextprotocol/client` ^2.1.0, `@modelcontextprotocol/ext-apps` ^2.0.0.
|
|
92
|
+
- Overrides: `brace-expansion` ^2.1.3 → ^2.1.7.
|
|
93
|
+
- Overrides: `fast-uri` ^3.1.6 → ^3.1.8.
|
|
94
|
+
- Overrides: `ip-address` ^10.3.1 → ^10.7.1.
|
|
95
|
+
- Dev (new): `@modelcontextprotocol/ext-apps` ^2.0.3.
|
|
96
|
+
- Dev: `@biomejs/biome` 2.5.14 → 2.5.15.
|
|
97
|
+
- Dev: `@cloudflare/workers-types` 5.20260924.1 → 5.20260930.2.
|
|
98
|
+
- Dev: `@duckdb/node-api` ^1.5.5-r.5 → ^1.5.6-r.1.
|
|
99
|
+
- Dev: `@hono/otel` ^1.1.2 → ^1.2.0.
|
|
100
|
+
- Dev: `@modelcontextprotocol/client` ^2.1.0 → ^2.2.0.
|
|
101
|
+
- Dev: `@supabase/supabase-js` ^2.117.1 → ^2.117.2.
|
|
102
|
+
- Dev: `@types/node` 26.6.2 → 26.6.3.
|
|
103
|
+
- Dev: `@types/sanitize-html` ^2.16.1 → ^2.16.2.
|
|
104
|
+
- Dev: `fast-xml-parser` ^5.11.1 → ^5.11.2.
|
|
105
|
+
- Dev: `ignore` ^7.0.10 → ^7.0.11.
|
|
106
|
+
- Dev: `openai` ^7.23.0 → ^7.25.0.
|
|
107
|
+
- Dev: `sanitize-html` ^2.17.7 → ^2.18.0.
|
|
108
|
+
- Dev: `tsc-alias` ^1.9.5 → ^1.9.7.
|
|
109
|
+
- Dev: `vite` 8.3.0 → 8.3.1.
|
|
110
|
+
- Scaffold dev: `@biomejs/biome` 2.5.14 → 2.5.15.
|
|
111
|
+
- Scaffold dev: `@types/node` 26.6.2 → 26.6.3.
|
|
112
|
+
- Scaffold dev: `ignore` ^7.0.9 → ^7.0.11.
|
|
113
|
+
- Scaffold dev: `tsc-alias` ^1.9.5 → ^1.9.7.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The `app-render` subcommand of the `mcp-ts-core` bin: renders an app
|
|
3
|
+
* tool's view in the headless MCP Apps host, writes `report.json` and screenshots under
|
|
4
|
+
* `--out`, and prints the report. Exits non-zero only on bad arguments or a setup failure
|
|
5
|
+
* (see `renderAppTool`). Loaded on demand from `src/cli/init.ts`.
|
|
6
|
+
* @module src/cli/app-render
|
|
7
|
+
*/
|
|
8
|
+
export declare const APP_RENDER_USAGE = "\n Usage:\n mcp-ts-core app-render --tool <name> [--args '<json>'] [--click <selector>]...\n [--out <dir>] [--browser <path>] [--theme light|dark]\n [--width <px>] [--height <px>] [--stream-input] [--timeout <ms>]\n (--url <url> | -- <command> [args...])\n\n Renders the tool's ui:// view in headless chrome-headless-shell inside the MCP Apps\n sandbox, clicks each --click selector in order (a screenshot after each), and prints\n the report. With --out, writes report.json and the screenshots there.\n\n Browser: --browser, else MCP_APPS_BROWSER_PATH, else the newest chrome-headless-shell\n in Puppeteer's cache. To install one there:\n npx @puppeteer/browsers install chrome-headless-shell@stable --path ~/.cache/puppeteer\n\n Example:\n mcp-ts-core app-render --tool my_app_tool --args '{\"query\":\"probe\"}' \\\n --click '#action-btn' --out ./app-run -- bun run dist/index.js\n";
|
|
9
|
+
/** Run the subcommand with the arguments after `app-render`. Returns the exit code. */
|
|
10
|
+
export declare function appRender(argv: string[]): Promise<number>;
|
|
11
|
+
//# sourceMappingURL=app-render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-render.d.ts","sourceRoot":"","sources":["../../src/cli/app-render.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAYH,eAAO,MAAM,gBAAgB,w+BAkB5B,CAAC;AAEF,uFAAuF;AACvF,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA4B/D"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The `app-render` subcommand of the `mcp-ts-core` bin: renders an app
|
|
3
|
+
* tool's view in the headless MCP Apps host, writes `report.json` and screenshots under
|
|
4
|
+
* `--out`, and prints the report. Exits non-zero only on bad arguments or a setup failure
|
|
5
|
+
* (see `renderAppTool`). Loaded on demand from `src/cli/init.ts`.
|
|
6
|
+
* @module src/cli/app-render
|
|
7
|
+
*/
|
|
8
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
9
|
+
import path from 'node:path';
|
|
10
|
+
import { parseArgs } from 'node:util';
|
|
11
|
+
export const APP_RENDER_USAGE = `
|
|
12
|
+
Usage:
|
|
13
|
+
mcp-ts-core app-render --tool <name> [--args '<json>'] [--click <selector>]...
|
|
14
|
+
[--out <dir>] [--browser <path>] [--theme light|dark]
|
|
15
|
+
[--width <px>] [--height <px>] [--stream-input] [--timeout <ms>]
|
|
16
|
+
(--url <url> | -- <command> [args...])
|
|
17
|
+
|
|
18
|
+
Renders the tool's ui:// view in headless chrome-headless-shell inside the MCP Apps
|
|
19
|
+
sandbox, clicks each --click selector in order (a screenshot after each), and prints
|
|
20
|
+
the report. With --out, writes report.json and the screenshots there.
|
|
21
|
+
|
|
22
|
+
Browser: --browser, else MCP_APPS_BROWSER_PATH, else the newest chrome-headless-shell
|
|
23
|
+
in Puppeteer's cache. To install one there:
|
|
24
|
+
npx @puppeteer/browsers install chrome-headless-shell@stable --path ~/.cache/puppeteer
|
|
25
|
+
|
|
26
|
+
Example:
|
|
27
|
+
mcp-ts-core app-render --tool my_app_tool --args '{"query":"probe"}' \\
|
|
28
|
+
--click '#action-btn' --out ./app-run -- bun run dist/index.js
|
|
29
|
+
`;
|
|
30
|
+
/** Run the subcommand with the arguments after `app-render`. Returns the exit code. */
|
|
31
|
+
export async function appRender(argv) {
|
|
32
|
+
let options;
|
|
33
|
+
try {
|
|
34
|
+
const parsed = parseCli(argv);
|
|
35
|
+
if (!parsed) {
|
|
36
|
+
console.log(APP_RENDER_USAGE);
|
|
37
|
+
return 0;
|
|
38
|
+
}
|
|
39
|
+
options = parsed;
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
console.error(`app-render: ${errorMessage(err)}\n${APP_RENDER_USAGE}`);
|
|
43
|
+
return 1;
|
|
44
|
+
}
|
|
45
|
+
const { renderAppTool } = await import('../testing/apps/index.js');
|
|
46
|
+
try {
|
|
47
|
+
const report = await renderAppTool(options);
|
|
48
|
+
const json = JSON.stringify(report, null, 2);
|
|
49
|
+
if (options.outDir) {
|
|
50
|
+
await mkdir(options.outDir, { recursive: true });
|
|
51
|
+
await writeFile(path.join(options.outDir, 'report.json'), `${json}\n`);
|
|
52
|
+
}
|
|
53
|
+
console.log(json);
|
|
54
|
+
return 0;
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
console.error(`app-render: ${errorMessage(err)}`);
|
|
58
|
+
return 1;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/** Options from the command line, or undefined for `--help`. */
|
|
62
|
+
function parseCli(argv) {
|
|
63
|
+
const { values, positionals } = parseArgs({
|
|
64
|
+
args: argv,
|
|
65
|
+
allowPositionals: true,
|
|
66
|
+
options: {
|
|
67
|
+
tool: { type: 'string' },
|
|
68
|
+
args: { type: 'string' },
|
|
69
|
+
click: { type: 'string', multiple: true },
|
|
70
|
+
out: { type: 'string' },
|
|
71
|
+
browser: { type: 'string' },
|
|
72
|
+
url: { type: 'string' },
|
|
73
|
+
theme: { type: 'string' },
|
|
74
|
+
width: { type: 'string' },
|
|
75
|
+
height: { type: 'string' },
|
|
76
|
+
'stream-input': { type: 'boolean' },
|
|
77
|
+
timeout: { type: 'string' },
|
|
78
|
+
help: { type: 'boolean', short: 'h' },
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
if (values.help)
|
|
82
|
+
return;
|
|
83
|
+
if (!values.tool)
|
|
84
|
+
throw new Error('--tool is required.');
|
|
85
|
+
let server;
|
|
86
|
+
if (values.url) {
|
|
87
|
+
if (positionals.length > 0)
|
|
88
|
+
throw new Error('Pass either --url or a command after --, not both.');
|
|
89
|
+
server = { url: values.url };
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
const [command, ...args] = positionals;
|
|
93
|
+
if (!command)
|
|
94
|
+
throw new Error('Pass the server as --url <url> or as a command after --.');
|
|
95
|
+
server = { command, args, env: inheritedEnv() };
|
|
96
|
+
}
|
|
97
|
+
let args = {};
|
|
98
|
+
if (values.args !== undefined) {
|
|
99
|
+
try {
|
|
100
|
+
args = JSON.parse(values.args);
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
throw new Error(`--args is not valid JSON: ${errorMessage(err)}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (args === null || typeof args !== 'object' || Array.isArray(args)) {
|
|
107
|
+
throw new Error('--args must be a JSON object.');
|
|
108
|
+
}
|
|
109
|
+
if (values.theme !== undefined && values.theme !== 'light' && values.theme !== 'dark') {
|
|
110
|
+
throw new Error('--theme must be light or dark.');
|
|
111
|
+
}
|
|
112
|
+
const steps = (values.click ?? []).flatMap((selector, i) => [
|
|
113
|
+
{ click: selector },
|
|
114
|
+
{ screenshot: `click-${i + 1}` },
|
|
115
|
+
]);
|
|
116
|
+
const width = optionalNumber(values.width, '--width');
|
|
117
|
+
const height = optionalNumber(values.height, '--height');
|
|
118
|
+
const timeoutMs = optionalNumber(values.timeout, '--timeout');
|
|
119
|
+
return {
|
|
120
|
+
server,
|
|
121
|
+
tool: values.tool,
|
|
122
|
+
arguments: args,
|
|
123
|
+
steps,
|
|
124
|
+
host: {
|
|
125
|
+
...(values.theme && { theme: values.theme }),
|
|
126
|
+
...(width !== undefined && { width }),
|
|
127
|
+
...(height !== undefined && { height }),
|
|
128
|
+
...(values['stream-input'] && { streamInput: true }),
|
|
129
|
+
},
|
|
130
|
+
...(values.out && { outDir: path.resolve(values.out) }),
|
|
131
|
+
...(values.browser && { browserPath: values.browser }),
|
|
132
|
+
...(timeoutMs !== undefined && { timeoutMs }),
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function optionalNumber(value, flag) {
|
|
136
|
+
if (value === undefined)
|
|
137
|
+
return;
|
|
138
|
+
const parsed = Number(value);
|
|
139
|
+
if (!Number.isFinite(parsed) || parsed <= 0)
|
|
140
|
+
throw new Error(`${flag} must be a positive number.`);
|
|
141
|
+
return parsed;
|
|
142
|
+
}
|
|
143
|
+
/** This process's environment, passed to a stdio server so its configuration reaches it. */
|
|
144
|
+
function inheritedEnv() {
|
|
145
|
+
return Object.fromEntries(Object.entries(process.env).filter((entry) => entry[1] !== undefined));
|
|
146
|
+
}
|
|
147
|
+
function errorMessage(err) {
|
|
148
|
+
return err instanceof Error ? err.message : String(err);
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=app-render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-render.js","sourceRoot":"","sources":["../../src/cli/app-render.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAQtC,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;CAkB/B,CAAC;AAEF,uFAAuF;AACvF,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,IAAc;IAC5C,IAAI,OAA6B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CAAC,MAAM,CAChC,CAAC,KAAK,EAA6B,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,CAC7D,CACF,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,GAAY;IAChC,OAAO,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC1D,CAAC"}
|
package/dist/cli/init.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* @fileoverview CLI entry point for `@cyanheads/mcp-ts-core`. Dispatches subcommands.
|
|
4
|
-
*
|
|
4
|
+
* Supports `init` for scaffolding new consumer projects and `app-render` (loaded on
|
|
5
|
+
* demand) for rendering an app tool's view in the headless MCP Apps host.
|
|
5
6
|
* @module src/cli/init
|
|
6
7
|
*/
|
|
7
8
|
export {};
|
package/dist/cli/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":";AACA;;;;;GAKG"}
|
package/dist/cli/init.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* @fileoverview CLI entry point for `@cyanheads/mcp-ts-core`. Dispatches subcommands.
|
|
4
|
-
*
|
|
4
|
+
* Supports `init` for scaffolding new consumer projects and `app-render` (loaded on
|
|
5
|
+
* demand) for rendering an app tool's view in the headless MCP Apps host.
|
|
5
6
|
* @module src/cli/init
|
|
6
7
|
*/
|
|
7
8
|
import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
@@ -37,9 +38,13 @@ const [subcommand] = process.argv.slice(2);
|
|
|
37
38
|
if (subcommand === 'init') {
|
|
38
39
|
init();
|
|
39
40
|
}
|
|
41
|
+
else if (subcommand === 'app-render') {
|
|
42
|
+
const { appRender } = await import('./app-render.js');
|
|
43
|
+
process.exitCode = await appRender(process.argv.slice(3));
|
|
44
|
+
}
|
|
40
45
|
else {
|
|
41
46
|
printUsage();
|
|
42
|
-
process.exit(subcommand === undefined || subcommand === '--help' ? 0 : 1);
|
|
47
|
+
process.exit(subcommand === undefined || subcommand === '--help' || subcommand === '-h' ? 0 : 1);
|
|
43
48
|
}
|
|
44
49
|
function printUsage() {
|
|
45
50
|
console.log(`
|
|
@@ -48,11 +53,14 @@ function printUsage() {
|
|
|
48
53
|
Usage:
|
|
49
54
|
mcp-ts-core init [name] Scaffold a new MCP server project
|
|
50
55
|
Without [name], scaffolds in place (upgrade flow)
|
|
56
|
+
mcp-ts-core app-render ... Render an app tool's view in a headless MCP Apps host
|
|
57
|
+
and print the report (app-render --help for options)
|
|
51
58
|
mcp-ts-core --help, -h Show this help message
|
|
52
59
|
mcp-ts-core init --help Show init help (same output)
|
|
53
60
|
|
|
54
61
|
Examples:
|
|
55
62
|
bunx @cyanheads/mcp-ts-core init my-mcp-server
|
|
63
|
+
bunx @cyanheads/mcp-ts-core app-render --tool my_app_tool -- bun run dist/index.js
|
|
56
64
|
`);
|
|
57
65
|
}
|
|
58
66
|
// ── Init command ──────────────────────────────────────────────────────
|
package/dist/cli/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":";AACA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClG,OAAO,EAAE,QAAQ,E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OAAO,CAAC,GAAG,CAAC,oEAAoE,CAAC,CAAC;QAClF,OAAO,CAAC,GAAG,EAAE,CAAC;IAChB,CAAC;AACH,CAAC"}
|
package/dist/config/index.d.ts
CHANGED
|
@@ -60,6 +60,7 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
60
60
|
mcpGcPressureIntervalMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
61
61
|
mcpAllowedOrigins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
62
62
|
mcpAuthSecretKey: z.ZodOptional<z.ZodString>;
|
|
63
|
+
mcpRequestStateKey: z.ZodOptional<z.ZodString>;
|
|
63
64
|
mcpJwtExpectedIssuer: z.ZodOptional<z.ZodString>;
|
|
64
65
|
mcpJwtExpectedAudience: z.ZodOptional<z.ZodString>;
|
|
65
66
|
mcpAuthMode: z.ZodPreprocess<z.ZodDefault<z.ZodEnum<{
|
|
@@ -197,6 +198,7 @@ declare const parseConfig: (envOverrides?: Record<string, string | undefined>) =
|
|
|
197
198
|
mcpGcPressureIntervalMs: number;
|
|
198
199
|
mcpAllowedOrigins?: string[] | undefined;
|
|
199
200
|
mcpAuthSecretKey?: string | undefined;
|
|
201
|
+
mcpRequestStateKey?: string | undefined;
|
|
200
202
|
mcpJwtExpectedIssuer?: string | undefined;
|
|
201
203
|
mcpJwtExpectedAudience?: string | undefined;
|
|
202
204
|
mcpAuthMode: "jwt" | "none" | "oauth";
|
|
@@ -325,6 +327,7 @@ declare const config: {
|
|
|
325
327
|
mcpGcPressureIntervalMs: number;
|
|
326
328
|
mcpAllowedOrigins?: string[] | undefined;
|
|
327
329
|
mcpAuthSecretKey?: string | undefined;
|
|
330
|
+
mcpRequestStateKey?: string | undefined;
|
|
328
331
|
mcpJwtExpectedIssuer?: string | undefined;
|
|
329
332
|
mcpJwtExpectedAudience?: string | undefined;
|
|
330
333
|
mcpAuthMode: "jwt" | "none" | "oauth";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,wEAAwE;AACxE,eAAO,MAAM,cAAc,2BAA2B,CAAC;AACvD,eAAO,MAAM,iBAAiB,QAAkC,CAAC;AA6DjE,QAAA,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,wEAAwE;AACxE,eAAO,MAAM,cAAc,2BAA2B,CAAC;AACvD,eAAO,MAAM,iBAAiB,QAAkC,CAAC;AA6DjE,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2Yd,CAAC;AAGL,QAAA,MAAM,WAAW,kBAAmB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+MrE,CAAC;AAIF;;;;;;;;GAQG;AACH,QAAA,MAAM,WAAW,kBAAmB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,KAAG,IAExE,CAAC;AAEF;;;;;;GAMG;AACH,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuBV,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAErD;;;;;;GAMG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC"}
|
package/dist/config/index.js
CHANGED
|
@@ -204,6 +204,16 @@ const ConfigSchema = z
|
|
|
204
204
|
mcpGcPressureIntervalMs: z.coerce.number().min(0).default(0),
|
|
205
205
|
mcpAllowedOrigins: z.array(z.string()).optional(),
|
|
206
206
|
mcpAuthSecretKey: z.string().optional(),
|
|
207
|
+
/**
|
|
208
|
+
* Opt-in HMAC key for multi-round-trip `requestState`. When set, the
|
|
209
|
+
* framework seals the state a handler returns with `ctx.requestInput` and
|
|
210
|
+
* the SDK verifies every echoed state before the handler runs, so a retry
|
|
211
|
+
* can only carry state this server minted, for the same principal, within
|
|
212
|
+
* 900 s. Every instance a retry can reach needs the same key. Unset, state
|
|
213
|
+
* round-trips raw. At least 32 bytes; the length is checked where the
|
|
214
|
+
* codec is built, so the startup error names this variable.
|
|
215
|
+
*/
|
|
216
|
+
mcpRequestStateKey: z.string().optional(),
|
|
207
217
|
mcpJwtExpectedIssuer: z.string().optional(),
|
|
208
218
|
mcpJwtExpectedAudience: z.string().optional(),
|
|
209
219
|
mcpAuthMode: z.preprocess(emptyStringAsUndefined, z.enum(['jwt', 'oauth', 'none']).default('none')),
|
|
@@ -481,6 +491,7 @@ const parseConfig = (envOverrides) => {
|
|
|
481
491
|
.map((o) => o.trim())
|
|
482
492
|
.filter(Boolean),
|
|
483
493
|
mcpAuthSecretKey: env.MCP_AUTH_SECRET_KEY,
|
|
494
|
+
mcpRequestStateKey: env.MCP_REQUEST_STATE_KEY,
|
|
484
495
|
mcpJwtExpectedIssuer: env.MCP_JWT_EXPECTED_ISSUER,
|
|
485
496
|
mcpJwtExpectedAudience: env.MCP_JWT_EXPECTED_AUDIENCE,
|
|
486
497
|
mcpAuthMode: env.MCP_AUTH_MODE,
|