@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.
Files changed (192) hide show
  1. package/AGENTS.md +41 -15
  2. package/CLAUDE.md +41 -15
  3. package/README.md +37 -11
  4. package/biome.json +1 -1
  5. package/changelog/0.13.x/0.13.10.md +118 -0
  6. package/changelog/0.13.x/0.13.11.md +113 -0
  7. package/dist/cli/app-render.d.ts +11 -0
  8. package/dist/cli/app-render.d.ts.map +1 -0
  9. package/dist/cli/app-render.js +150 -0
  10. package/dist/cli/app-render.js.map +1 -0
  11. package/dist/cli/init.d.ts +2 -1
  12. package/dist/cli/init.d.ts.map +1 -1
  13. package/dist/cli/init.js +10 -2
  14. package/dist/cli/init.js.map +1 -1
  15. package/dist/config/index.d.ts +3 -0
  16. package/dist/config/index.d.ts.map +1 -1
  17. package/dist/config/index.js +11 -0
  18. package/dist/config/index.js.map +1 -1
  19. package/dist/core/app.d.ts.map +1 -1
  20. package/dist/core/app.js +15 -1
  21. package/dist/core/app.js.map +1 -1
  22. package/dist/core/context.d.ts +92 -22
  23. package/dist/core/context.d.ts.map +1 -1
  24. package/dist/core/context.js +65 -16
  25. package/dist/core/context.js.map +1 -1
  26. package/dist/core/index.d.ts +1 -1
  27. package/dist/core/index.d.ts.map +1 -1
  28. package/dist/core/index.js.map +1 -1
  29. package/dist/core/worker.d.ts +6 -0
  30. package/dist/core/worker.d.ts.map +1 -1
  31. package/dist/core/worker.js +1 -0
  32. package/dist/core/worker.js.map +1 -1
  33. package/dist/linter/rules/error-contract-rules.d.ts +3 -44
  34. package/dist/linter/rules/error-contract-rules.d.ts.map +1 -1
  35. package/dist/linter/rules/error-contract-rules.js +8 -144
  36. package/dist/linter/rules/error-contract-rules.js.map +1 -1
  37. package/dist/linter/rules/index.d.ts +1 -1
  38. package/dist/linter/rules/index.d.ts.map +1 -1
  39. package/dist/linter/rules/index.js +1 -1
  40. package/dist/linter/rules/index.js.map +1 -1
  41. package/dist/linter/rules/resource-rules.d.ts.map +1 -1
  42. package/dist/linter/rules/resource-rules.js +1 -2
  43. package/dist/linter/rules/resource-rules.js.map +1 -1
  44. package/dist/linter/rules/tool-rules.d.ts.map +1 -1
  45. package/dist/linter/rules/tool-rules.js +1 -2
  46. package/dist/linter/rules/tool-rules.js.map +1 -1
  47. package/dist/mcp-server/handlerContext.d.ts +26 -13
  48. package/dist/mcp-server/handlerContext.d.ts.map +1 -1
  49. package/dist/mcp-server/handlerContext.js +32 -17
  50. package/dist/mcp-server/handlerContext.js.map +1 -1
  51. package/dist/mcp-server/inputRequired.d.ts +120 -8
  52. package/dist/mcp-server/inputRequired.d.ts.map +1 -1
  53. package/dist/mcp-server/inputRequired.js +177 -12
  54. package/dist/mcp-server/inputRequired.js.map +1 -1
  55. package/dist/mcp-server/prompts/prompt-registration.d.ts +10 -2
  56. package/dist/mcp-server/prompts/prompt-registration.d.ts.map +1 -1
  57. package/dist/mcp-server/prompts/prompt-registration.js +49 -11
  58. package/dist/mcp-server/prompts/prompt-registration.js.map +1 -1
  59. package/dist/mcp-server/resources/resource-registration.d.ts +4 -2
  60. package/dist/mcp-server/resources/resource-registration.d.ts.map +1 -1
  61. package/dist/mcp-server/resources/resource-registration.js +6 -4
  62. package/dist/mcp-server/resources/resource-registration.js.map +1 -1
  63. package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts +4 -3
  64. package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts.map +1 -1
  65. package/dist/mcp-server/resources/utils/resourceHandlerFactory.js +60 -21
  66. package/dist/mcp-server/resources/utils/resourceHandlerFactory.js.map +1 -1
  67. package/dist/mcp-server/server.d.ts +9 -0
  68. package/dist/mcp-server/server.d.ts.map +1 -1
  69. package/dist/mcp-server/server.js +14 -13
  70. package/dist/mcp-server/server.js.map +1 -1
  71. package/dist/mcp-server/tools/tool-registration.d.ts +7 -3
  72. package/dist/mcp-server/tools/tool-registration.d.ts.map +1 -1
  73. package/dist/mcp-server/tools/tool-registration.js +9 -5
  74. package/dist/mcp-server/tools/tool-registration.js.map +1 -1
  75. package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts +17 -9
  76. package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts.map +1 -1
  77. package/dist/mcp-server/tools/utils/toolHandlerFactory.js +91 -50
  78. package/dist/mcp-server/tools/utils/toolHandlerFactory.js.map +1 -1
  79. package/dist/mcp-server/transports/http/httpErrorHandler.d.ts.map +1 -1
  80. package/dist/mcp-server/transports/http/httpErrorHandler.js +7 -1
  81. package/dist/mcp-server/transports/http/httpErrorHandler.js.map +1 -1
  82. package/dist/services/mirror/sqlite/handle.d.ts +11 -5
  83. package/dist/services/mirror/sqlite/handle.d.ts.map +1 -1
  84. package/dist/services/mirror/sqlite/handle.js +46 -8
  85. package/dist/services/mirror/sqlite/handle.js.map +1 -1
  86. package/dist/services/mirror/sqlite/sqliteMirrorStore.d.ts +6 -1
  87. package/dist/services/mirror/sqlite/sqliteMirrorStore.d.ts.map +1 -1
  88. package/dist/services/mirror/sqlite/sqliteMirrorStore.js.map +1 -1
  89. package/dist/testing/apps/browser.d.ts +27 -0
  90. package/dist/testing/apps/browser.d.ts.map +1 -0
  91. package/dist/testing/apps/browser.js +162 -0
  92. package/dist/testing/apps/browser.js.map +1 -0
  93. package/dist/testing/apps/cdp-pipe.d.ts +79 -0
  94. package/dist/testing/apps/cdp-pipe.d.ts.map +1 -0
  95. package/dist/testing/apps/cdp-pipe.js +200 -0
  96. package/dist/testing/apps/cdp-pipe.js.map +1 -0
  97. package/dist/testing/apps/csp.d.ts +17 -0
  98. package/dist/testing/apps/csp.d.ts.map +1 -0
  99. package/dist/testing/apps/csp.js +50 -0
  100. package/dist/testing/apps/csp.js.map +1 -0
  101. package/dist/testing/apps/host-pages.d.ts +47 -0
  102. package/dist/testing/apps/host-pages.d.ts.map +1 -0
  103. package/dist/testing/apps/host-pages.js +138 -0
  104. package/dist/testing/apps/host-pages.js.map +1 -0
  105. package/dist/testing/apps/index.d.ts +167 -0
  106. package/dist/testing/apps/index.d.ts.map +1 -0
  107. package/dist/testing/apps/index.js +36 -0
  108. package/dist/testing/apps/index.js.map +1 -0
  109. package/dist/testing/apps/partial-json.d.ts +14 -0
  110. package/dist/testing/apps/partial-json.d.ts.map +1 -0
  111. package/dist/testing/apps/partial-json.js +71 -0
  112. package/dist/testing/apps/partial-json.js.map +1 -0
  113. package/dist/testing/apps/run.d.ts +13 -0
  114. package/dist/testing/apps/run.d.ts.map +1 -0
  115. package/dist/testing/apps/run.js +659 -0
  116. package/dist/testing/apps/run.js.map +1 -0
  117. package/dist/testing/index.d.ts +17 -2
  118. package/dist/testing/index.d.ts.map +1 -1
  119. package/dist/testing/index.js +21 -7
  120. package/dist/testing/index.js.map +1 -1
  121. package/dist/types-global/errors.d.ts +18 -15
  122. package/dist/types-global/errors.d.ts.map +1 -1
  123. package/dist/utils/index.d.ts +1 -1
  124. package/dist/utils/index.d.ts.map +1 -1
  125. package/dist/utils/index.js +1 -1
  126. package/dist/utils/index.js.map +1 -1
  127. package/dist/utils/internal/error-handler/errorHandler.d.ts +5 -4
  128. package/dist/utils/internal/error-handler/errorHandler.d.ts.map +1 -1
  129. package/dist/utils/internal/error-handler/errorHandler.js +9 -7
  130. package/dist/utils/internal/error-handler/errorHandler.js.map +1 -1
  131. package/dist/utils/internal/error-handler/types.d.ts +3 -1
  132. package/dist/utils/internal/error-handler/types.d.ts.map +1 -1
  133. package/dist/utils/internal/logger.d.ts +21 -1
  134. package/dist/utils/internal/logger.d.ts.map +1 -1
  135. package/dist/utils/internal/logger.js +31 -14
  136. package/dist/utils/internal/logger.js.map +1 -1
  137. package/dist/utils/internal/performance.d.ts +7 -3
  138. package/dist/utils/internal/performance.d.ts.map +1 -1
  139. package/dist/utils/internal/performance.js +16 -9
  140. package/dist/utils/internal/performance.js.map +1 -1
  141. package/dist/utils/internal/telemetryMessages.d.ts +0 -1
  142. package/dist/utils/internal/telemetryMessages.d.ts.map +1 -1
  143. package/dist/utils/internal/telemetryMessages.js +0 -1
  144. package/dist/utils/internal/telemetryMessages.js.map +1 -1
  145. package/dist/utils/security/sanitization.d.ts +16 -13
  146. package/dist/utils/security/sanitization.d.ts.map +1 -1
  147. package/dist/utils/security/sanitization.js +74 -33
  148. package/dist/utils/security/sanitization.js.map +1 -1
  149. package/dist/utils/telemetry/attributes.d.ts +12 -5
  150. package/dist/utils/telemetry/attributes.d.ts.map +1 -1
  151. package/dist/utils/telemetry/attributes.js +12 -5
  152. package/dist/utils/telemetry/attributes.js.map +1 -1
  153. package/framework-skills/add-app-tool/SKILL.md +2 -1
  154. package/framework-skills/add-service/SKILL.md +3 -12
  155. package/framework-skills/add-test/SKILL.md +20 -17
  156. package/framework-skills/add-tool/SKILL.md +30 -34
  157. package/framework-skills/api-config/SKILL.md +12 -2
  158. package/framework-skills/api-context/SKILL.md +156 -41
  159. package/framework-skills/api-errors/SKILL.md +43 -47
  160. package/framework-skills/api-linter/SKILL.md +5 -29
  161. package/framework-skills/api-mirror/SKILL.md +4 -3
  162. package/framework-skills/api-telemetry/SKILL.md +16 -10
  163. package/framework-skills/api-testing/SKILL.md +47 -11
  164. package/framework-skills/api-utils/SKILL.md +3 -3
  165. package/framework-skills/api-workers/SKILL.md +3 -1
  166. package/framework-skills/code-simplifier/SKILL.md +2 -2
  167. package/framework-skills/design-mcp-server/SKILL.md +5 -5
  168. package/framework-skills/field-test/SKILL.md +53 -8
  169. package/framework-skills/git-wrapup/SKILL.md +2 -2
  170. package/framework-skills/orchestrations/SKILL.md +1 -1
  171. package/framework-skills/orchestrations/workflows/greenfield-build.md +2 -2
  172. package/framework-skills/polish-docs-meta/SKILL.md +4 -3
  173. package/framework-skills/polish-docs-meta/references/server-json.md +24 -26
  174. package/framework-skills/release-and-publish/SKILL.md +3 -3
  175. package/framework-skills/release-pr-review/SKILL.md +6 -6
  176. package/framework-skills/security-pass/SKILL.md +8 -7
  177. package/framework-skills/setup/SKILL.md +2 -2
  178. package/package.json +38 -22
  179. package/scripts/devcheck.ts +43 -21
  180. package/scripts/install-otel.ts +84 -0
  181. package/scripts/lint-packaging.ts +279 -28
  182. package/scripts/prune-musl-packages.ts +146 -0
  183. package/templates/.env.example +2 -0
  184. package/templates/.github/workflows/codeql.yml +10 -1
  185. package/templates/AGENTS.md +5 -4
  186. package/templates/CLAUDE.md +5 -4
  187. package/templates/Dockerfile +76 -50
  188. package/templates/_.dockerignore +3 -5
  189. package/templates/_.gitignore +4 -4
  190. package/templates/package.json +4 -4
  191. package/templates/server.json +7 -21
  192. package/templates/src/mcp-server/tools/definitions/echo.tool.ts +3 -8
@@ -5,10 +5,10 @@
5
5
  # source code into JavaScript, and prepares the production assets.
6
6
  #
7
7
  # Pinned to $BUILDPLATFORM rather than the target platform: `bun run build` emits
8
- # JavaScript, and only `dist/` crosses into the production stage, which runs its
9
- # own target-arch install. Built for the target instead, the non-native leg of a
10
- # `--platform linux/amd64,linux/arm64` build runs under QEMU, where bun >= 1.4
11
- # aborts with a JavaScriptCore allocator assertion and fails the multi-arch push.
8
+ # JavaScript, and only `dist/` crosses into the production stage. Built for the
9
+ # target instead, the non-native leg of a `--platform linux/amd64,linux/arm64`
10
+ # build runs under QEMU, where bun >= 1.4 aborts with a JavaScriptCore allocator
11
+ # assertion and fails the multi-arch push.
12
12
  #
13
13
  # The constraint this assumes: the build stage produces platform-independent
14
14
  # output. A stage that compiles a native addon needs the target-arch toolchain
@@ -34,80 +34,106 @@ RUN bun run build
34
34
 
35
35
 
36
36
  # ==============================================================================
37
- # Production Stage
37
+ # Production Dependencies Stage
38
38
  #
39
- # This stage creates a minimal, optimized, and secure image for running the
40
- # application. It uses a slim base image and only includes production
41
- # dependencies and build artifacts.
39
+ # Installs the production dependency tree for the target platform. Every step
40
+ # here can run JavaScript — bunfig.toml's security scanner runs as a Bun
41
+ # program, and so do the OTel and musl-prune scripts — so the stage runs on
42
+ # $BUILDPLATFORM and cross-installs with `--os`/`--cpu`, which pick each
43
+ # platform-specific optional dependency (native bindings such as DuckDB's) for
44
+ # the target. Only `node_modules` leaves this stage.
45
+ #
46
+ # A clean image rather than `FROM build`: the build stage's node_modules holds
47
+ # devDependencies.
42
48
  # ==============================================================================
43
- FROM oven/bun:1.4.2-slim AS production
49
+ FROM --platform=$BUILDPLATFORM oven/bun:1.4.2 AS deps
44
50
 
45
51
  WORKDIR /usr/src/app
46
52
 
47
- # Set the environment to production for performance and to ensure only
48
- # production dependencies are installed.
49
- ENV NODE_ENV=production
50
-
51
- # OCI image metadata (https://github.com/opencontainers/image-spec/blob/main/annotations.md)
52
- ARG APP_VERSION
53
- LABEL org.opencontainers.image.title="{{PACKAGE_NAME}}"
54
- LABEL org.opencontainers.image.description=""
55
- LABEL org.opencontainers.image.licenses="Apache-2.0"
56
- LABEL org.opencontainers.image.version="${APP_VERSION}"
57
- LABEL org.opencontainers.image.source=""
58
-
59
53
  # Copy dependency manifests. `bunfig.toml` rides along so every install below
60
54
  # passes its release-age gate and security scanner, as a local install does.
61
55
  COPY package.json bun.lock bunfig.toml ./
62
56
 
63
57
  # The scanner bunfig.toml names is a devDependency, and Bun installs a missing
64
58
  # scanner through the same production-filtered install, which omits it and
65
- # aborts. Seed it from the build stage's full install instead. Remove this line
66
- # together with the scanner if bunfig.toml stops naming one.
59
+ # aborts. Seed it from the build stage's full install instead. Remove this line,
60
+ # and the `rm` at the end of this stage, if bunfig.toml stops naming a scanner.
67
61
  COPY --from=build /usr/src/app/node_modules/@socketsecurity/bun-security-scanner ./node_modules/@socketsecurity/bun-security-scanner
68
62
 
63
+ # Docker names the target architecture `amd64`/`arm64`; Bun's `--cpu` takes
64
+ # `x64`/`arm64`. Mapped once here, read by both installs below. `oven/bun`
65
+ # publishes only these two architectures, so any other target fails here.
66
+ ARG TARGETOS
67
+ ARG TARGETARCH
68
+ RUN case "$TARGETARCH" in \
69
+ amd64) echo x64 ;; \
70
+ arm64) echo arm64 ;; \
71
+ *) echo "Unsupported TARGETARCH '$TARGETARCH': expected amd64 or arm64" >&2; exit 1 ;; \
72
+ esac > .bun-cpu
73
+
69
74
  # Install only production dependencies, ignoring any lifecycle scripts (like 'prepare')
70
75
  # that are not needed in the final production image.
71
76
  # `--omit=peer` drops the framework's optional peer tiers (test runner, service
72
77
  # SDKs, parsers) that Bun would otherwise auto-install. Anything this server
73
78
  # actually imports belongs in its own `dependencies`, so nothing needed at
74
- # runtime is lost. The OTEL step below carries the same flag — without it, that
75
- # install re-resolves the graph and pulls every optional peer back in.
79
+ # runtime is lost.
76
80
  RUN --mount=type=cache,target=/root/.bun/install/cache \
77
- bun install --production --omit=peer --frozen-lockfile --ignore-scripts
81
+ bun install --production --omit=peer --frozen-lockfile --ignore-scripts \
82
+ --os="$TARGETOS" --cpu="$(cat .bun-cpu)"
78
83
 
79
84
  # Conditionally install OpenTelemetry optional peer dependencies (Tier 3).
80
85
  # Installed by default. Omit them for a leaner image at build time
81
86
  # with: docker build --build-arg OTEL_ENABLED=false
82
- # Each package is requested at the range the installed framework declares in
83
- # `peerDependencies`, so the resolution stays inside the framework's tested
84
- # peer range; a name with no declared range fails the build.
87
+ # The script reads the list and each range from the installed framework's
88
+ # `peerDependencies` and passes the target flags on to its `bun install`.
89
+ COPY scripts/install-otel.ts ./scripts/
85
90
  ARG OTEL_ENABLED=true
86
91
  RUN --mount=type=cache,target=/root/.bun/install/cache \
87
92
  if [ "$OTEL_ENABLED" = "true" ]; then \
88
- specs=$(bun -e ' \
89
- const { peerDependencies: peers } = await Bun.file("node_modules/@cyanheads/mcp-ts-core/package.json").json(); \
90
- const names = process.argv.slice(1); \
91
- const missing = names.filter((name) => !peers?.[name]); \
92
- if (missing.length > 0) throw new Error(`no peerDependencies range for ${missing.join(", ")}`); \
93
- console.log(names.map((name) => `${name}@${peers[name]}`).join(" ")); \
94
- ' \
95
- @hono/otel \
96
- @opentelemetry/api-logs \
97
- @opentelemetry/exporter-logs-otlp-http \
98
- @opentelemetry/exporter-metrics-otlp-http \
99
- @opentelemetry/exporter-trace-otlp-http \
100
- @opentelemetry/instrumentation-http \
101
- @opentelemetry/instrumentation-pino \
102
- @opentelemetry/resources \
103
- @opentelemetry/sdk-logs \
104
- @opentelemetry/sdk-metrics \
105
- @opentelemetry/sdk-node \
106
- @opentelemetry/sdk-trace-node \
107
- @opentelemetry/semantic-conventions) \
108
- && bun add --omit=dev --omit=peer --ignore-scripts $specs; \
93
+ bun scripts/install-otel.ts --os="$TARGETOS" --cpu="$(cat .bun-cpu)"; \
109
94
  fi
110
95
 
96
+ # `--os`/`--cpu` have no libc counterpart, so a native dependency published in
97
+ # glibc and musl variants (DuckDB's bindings, for one) installs both. The
98
+ # runtime image is Debian (glibc) and never loads the musl copy; the script
99
+ # deletes every package whose own `libc` admits only musl. It follows every
100
+ # install, since a later `bun install` restores what it removes. A server on a
101
+ # musl (Alpine) runtime image drops these two lines.
102
+ COPY scripts/prune-musl-packages.ts ./scripts/
103
+ RUN bun scripts/prune-musl-packages.ts
104
+
105
+ # The seeded scanner served only the installs above; keep it out of the image.
106
+ RUN rm -rf node_modules/@socketsecurity/bun-security-scanner
107
+
108
+
109
+ # ==============================================================================
110
+ # Production Stage
111
+ #
112
+ # This stage creates a minimal, optimized, and secure image for running the
113
+ # application. It uses a slim base image and only includes production
114
+ # dependencies and build artifacts. Its only Bun invocations are HEALTHCHECK
115
+ # and CMD, which run on the real target at container start.
116
+ # ==============================================================================
117
+ FROM oven/bun:1.4.2-slim AS production
118
+
119
+ WORKDIR /usr/src/app
120
+
121
+ # Set the environment to production for performance.
122
+ ENV NODE_ENV=production
123
+
124
+ # OCI image metadata (https://github.com/opencontainers/image-spec/blob/main/annotations.md)
125
+ ARG APP_VERSION
126
+ LABEL org.opencontainers.image.title="{{PACKAGE_NAME}}"
127
+ LABEL org.opencontainers.image.description=""
128
+ LABEL org.opencontainers.image.licenses="Apache-2.0"
129
+ LABEL org.opencontainers.image.version="${APP_VERSION}"
130
+ LABEL org.opencontainers.image.source=""
131
+
132
+ # The manifest comes from the build context: the deps stage's copy was rewritten
133
+ # by the OTel install, and the runtime reads only its name, version, and type.
134
+ COPY package.json ./
135
+ COPY --from=deps /usr/src/app/node_modules ./node_modules
136
+
111
137
  # Copy the compiled application code from the build stage
112
138
  COPY --from=build /usr/src/app/dist ./dist
113
139
 
@@ -164,11 +164,9 @@ coverage/
164
164
  # =============================================================================
165
165
  # ENVIRONMENT & CONFIGURATION
166
166
  # =============================================================================
167
- .env
168
- .env.local
169
- .env.development.local
170
- .env.test.local
171
- .env.production.local
167
+ .env*
168
+ .mcpregistry_github_token
169
+ .mcpregistry_registry_token
172
170
  .sample-env
173
171
  sample.*
174
172
  !sample.template.*
@@ -40,7 +40,6 @@ dist/
40
40
  # TESTING & COVERAGE
41
41
  # =============================================================================
42
42
  coverage/
43
- !coverage/coverage-final.json
44
43
 
45
44
  # =============================================================================
46
45
  # LOGS & DATABASES
@@ -59,9 +58,10 @@ logs/
59
58
  # =============================================================================
60
59
  # ENVIRONMENT & CONFIGURATION
61
60
  # =============================================================================
62
- .env
63
- .env.local
64
- .env.*.local
61
+ .env*
62
+ !.env.example
63
+ !.env.template
64
+ !.env.sample
65
65
  .wrangler
66
66
  worker-configuration.d.ts
67
67
 
@@ -67,14 +67,14 @@
67
67
  "zod": "{{ZOD_VERSION}}"
68
68
  },
69
69
  "devDependencies": {
70
- "@biomejs/biome": "2.5.14",
70
+ "@biomejs/biome": "2.5.15",
71
71
  "@socketsecurity/bun-security-scanner": "^1.1.3",
72
- "@types/node": "26.6.2",
72
+ "@types/node": "26.6.3",
73
73
  "@vitest/coverage-istanbul": "4.1.11",
74
74
  "depcheck": "^1.4.7",
75
75
  "fast-check": "^4.9.0",
76
- "ignore": "^7.0.9",
77
- "tsc-alias": "^1.9.5",
76
+ "ignore": "^7.0.11",
77
+ "tsc-alias": "^1.9.7",
78
78
  "typescript": "^7.0.2",
79
79
  "vitest": "^4.1.11"
80
80
  }
@@ -12,18 +12,8 @@
12
12
  "registryType": "npm",
13
13
  "registryBaseUrl": "https://registry.npmjs.org",
14
14
  "identifier": "{{PACKAGE_NAME}}",
15
- "runtimeHint": "node",
15
+ "runtimeHint": "npx",
16
16
  "version": "0.1.0",
17
- "packageArguments": [
18
- {
19
- "type": "positional",
20
- "value": "run"
21
- },
22
- {
23
- "type": "positional",
24
- "value": "start:stdio"
25
- }
26
- ],
27
17
  "environmentVariables": [
28
18
  {
29
19
  "name": "MCP_LOG_LEVEL",
@@ -41,19 +31,15 @@
41
31
  "registryType": "npm",
42
32
  "registryBaseUrl": "https://registry.npmjs.org",
43
33
  "identifier": "{{PACKAGE_NAME}}",
44
- "runtimeHint": "node",
34
+ "runtimeHint": "npx",
45
35
  "version": "0.1.0",
46
- "packageArguments": [
36
+ "environmentVariables": [
47
37
  {
48
- "type": "positional",
49
- "value": "run"
38
+ "name": "MCP_TRANSPORT_TYPE",
39
+ "description": "Selects the HTTP transport.",
40
+ "format": "string",
41
+ "value": "http"
50
42
  },
51
- {
52
- "type": "positional",
53
- "value": "start:http"
54
- }
55
- ],
56
- "environmentVariables": [
57
43
  {
58
44
  "name": "MCP_HTTP_HOST",
59
45
  "description": "The hostname for the HTTP server.",
@@ -27,7 +27,8 @@ export const echoTool = tool('template_echo_message', {
27
27
  },
28
28
 
29
29
  // Declare each domain failure mode the agent should plan around. The framework
30
- // types `ctx.fail(reason, …)` against the declared union. Baseline codes
30
+ // types `ctx.fail(reason, …)` against the declared union and puts the entry's
31
+ // `recovery` on both client surfaces when the throw carries none. Baseline codes
31
32
  // (InternalError, ServiceUnavailable, Timeout, ValidationError,
32
33
  // SerializationError) bubble freely — only declare domain-specific reasons.
33
34
  // Delete this block if no domain-specific failures apply to your tool.
@@ -42,13 +43,7 @@ export const echoTool = tool('template_echo_message', {
42
43
 
43
44
  handler(input, ctx) {
44
45
  if (input.message.trim().length === 0) {
45
- // Spreading ctx.recoveryFor puts the declared recovery on the wire. Without
46
- // it the hint reaches neither structuredContent nor content[].
47
- throw ctx.fail(
48
- 'empty_message',
49
- 'Message must contain at least one non-whitespace character.',
50
- { ...ctx.recoveryFor('empty_message') },
51
- );
46
+ throw ctx.fail('empty_message', 'Message must contain at least one non-whitespace character.');
52
47
  }
53
48
  // Reaches both client surfaces with no format() plumbing.
54
49
  ctx.enrich({ characterCount: input.message.length });