@cyanheads/mcp-ts-core 0.12.5 → 0.12.6

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 (131) hide show
  1. package/AGENTS.md +25 -14
  2. package/CLAUDE.md +25 -14
  3. package/README.md +1 -1
  4. package/changelog/0.12.x/0.12.6.md +44 -0
  5. package/dist/core/app.d.ts +2 -2
  6. package/dist/core/app.js +2 -2
  7. package/dist/core/index.d.ts +5 -5
  8. package/dist/core/index.js +2 -2
  9. package/dist/core/worker.d.ts +1 -1
  10. package/dist/core/worker.js +1 -1
  11. package/dist/mcp-server/apps/appBuilders.d.ts +2 -2
  12. package/dist/mcp-server/apps/appBuilders.js +2 -2
  13. package/dist/mcp-server/cacheHints.d.ts +1 -1
  14. package/dist/mcp-server/prompts/prompt-registration.d.ts +1 -1
  15. package/dist/mcp-server/prompts/prompt-registration.js +1 -1
  16. package/dist/mcp-server/resources/resource-registration.d.ts +3 -3
  17. package/dist/mcp-server/resources/resource-registration.js +1 -1
  18. package/dist/mcp-server/resources/resourceSubscriptions.d.ts +1 -1
  19. package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts +2 -2
  20. package/dist/mcp-server/resources/utils/resourceHandlerFactory.js +4 -4
  21. package/dist/mcp-server/server.d.ts +4 -4
  22. package/dist/mcp-server/server.js +1 -1
  23. package/dist/mcp-server/tools/tool-registration.d.ts +3 -3
  24. package/dist/mcp-server/tools/tool-registration.js +2 -2
  25. package/dist/mcp-server/tools/utils/disabled-tool.d.ts +1 -1
  26. package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts +1 -1
  27. package/dist/mcp-server/tools/utils/toolHandlerFactory.js +4 -4
  28. package/dist/mcp-server/transports/auth/authFactory.d.ts +1 -1
  29. package/dist/mcp-server/transports/auth/authFactory.js +2 -2
  30. package/dist/mcp-server/transports/auth/authMiddleware.d.ts +1 -1
  31. package/dist/mcp-server/transports/auth/authMiddleware.js +1 -1
  32. package/dist/mcp-server/transports/auth/lib/authUtils.js +1 -1
  33. package/dist/mcp-server/transports/auth/lib/claimParser.d.ts +1 -1
  34. package/dist/mcp-server/transports/auth/strategies/authStrategy.d.ts +1 -1
  35. package/dist/mcp-server/transports/auth/strategies/jwtStrategy.d.ts +2 -2
  36. package/dist/mcp-server/transports/auth/strategies/jwtStrategy.js +1 -1
  37. package/dist/mcp-server/transports/auth/strategies/oauthStrategy.d.ts +2 -2
  38. package/dist/mcp-server/transports/auth/strategies/oauthStrategy.js +1 -1
  39. package/dist/mcp-server/transports/http/httpErrorHandler.d.ts +1 -1
  40. package/dist/mcp-server/transports/http/httpServer.d.ts +1 -1
  41. package/dist/mcp-server/transports/http/httpServer.js +1 -1
  42. package/dist/mcp-server/transports/http/httpTransport.d.ts +3 -3
  43. package/dist/mcp-server/transports/http/httpTransport.js +12 -12
  44. package/dist/mcp-server/transports/http/landing-page/handler.d.ts +1 -1
  45. package/dist/mcp-server/transports/http/sessionStore.js +1 -1
  46. package/dist/mcp-server/transports/manager.d.ts +2 -2
  47. package/dist/mcp-server/transports/manager.js +3 -3
  48. package/dist/services/llm/providers/openrouter.provider.d.ts +1 -1
  49. package/dist/storage/core/StorageService.d.ts +1 -1
  50. package/dist/storage/core/StorageService.js +1 -1
  51. package/dist/storage/core/storageFactory.d.ts +2 -2
  52. package/dist/storage/core/storageFactory.js +6 -6
  53. package/dist/storage/core/storageValidation.d.ts.map +1 -1
  54. package/dist/storage/core/storageValidation.js +5 -3
  55. package/dist/storage/core/storageValidation.js.map +1 -1
  56. package/dist/storage/providers/cloudflare/d1Provider.d.ts +1 -1
  57. package/dist/storage/providers/cloudflare/d1Provider.js +1 -1
  58. package/dist/storage/providers/cloudflare/kvProvider.d.ts +1 -1
  59. package/dist/storage/providers/cloudflare/kvProvider.js +1 -1
  60. package/dist/storage/providers/cloudflare/r2Provider.d.ts +1 -1
  61. package/dist/storage/providers/cloudflare/r2Provider.js +1 -1
  62. package/dist/storage/providers/fileSystem/fileSystemProvider.d.ts +1 -1
  63. package/dist/storage/providers/fileSystem/fileSystemProvider.js +1 -1
  64. package/dist/storage/providers/inMemory/inMemoryProvider.d.ts +3 -1
  65. package/dist/storage/providers/inMemory/inMemoryProvider.d.ts.map +1 -1
  66. package/dist/storage/providers/inMemory/inMemoryProvider.js +11 -7
  67. package/dist/storage/providers/inMemory/inMemoryProvider.js.map +1 -1
  68. package/dist/storage/providers/supabase/supabaseProvider.d.ts +2 -2
  69. package/dist/storage/providers/supabase/supabaseProvider.js +1 -1
  70. package/dist/testing/fuzz.d.ts.map +1 -1
  71. package/dist/testing/fuzz.js +92 -53
  72. package/dist/testing/fuzz.js.map +1 -1
  73. package/dist/utils/formatting/diffFormatter.d.ts +2 -2
  74. package/dist/utils/formatting/diffFormatter.js +4 -4
  75. package/dist/utils/formatting/tableFormatter.d.ts +2 -2
  76. package/dist/utils/formatting/tableFormatter.js +3 -3
  77. package/dist/utils/formatting/treeFormatter.d.ts +3 -3
  78. package/dist/utils/formatting/treeFormatter.js +4 -4
  79. package/dist/utils/internal/error-handler/errorHandler.js +6 -6
  80. package/dist/utils/internal/error-handler/helpers.js +1 -1
  81. package/dist/utils/internal/error-handler/types.d.ts +1 -1
  82. package/dist/utils/internal/health.js +2 -2
  83. package/dist/utils/internal/lazyImport.js +1 -1
  84. package/dist/utils/internal/logger.d.ts +3 -3
  85. package/dist/utils/internal/logger.js +4 -4
  86. package/dist/utils/internal/performance.d.ts +1 -1
  87. package/dist/utils/internal/performance.js +6 -6
  88. package/dist/utils/internal/requestContext.d.ts +1 -1
  89. package/dist/utils/internal/requestContext.js +2 -2
  90. package/dist/utils/metrics/tokenCounter.d.ts +1 -1
  91. package/dist/utils/metrics/tokenCounter.js +2 -2
  92. package/dist/utils/network/fetchWithTimeout.d.ts +1 -1
  93. package/dist/utils/network/fetchWithTimeout.js +6 -6
  94. package/dist/utils/network/httpError.js +1 -1
  95. package/dist/utils/network/retry.d.ts +1 -1
  96. package/dist/utils/network/retry.js +1 -1
  97. package/dist/utils/pagination/pagination.d.ts +2 -2
  98. package/dist/utils/pagination/pagination.js +4 -4
  99. package/dist/utils/parsing/csvParser.d.ts +4 -4
  100. package/dist/utils/parsing/csvParser.js +6 -6
  101. package/dist/utils/parsing/dateParser.d.ts +3 -3
  102. package/dist/utils/parsing/dateParser.js +6 -6
  103. package/dist/utils/parsing/frontmatterParser.d.ts +2 -2
  104. package/dist/utils/parsing/frontmatterParser.js +3 -3
  105. package/dist/utils/parsing/htmlExtractor.d.ts +3 -3
  106. package/dist/utils/parsing/htmlExtractor.js +5 -5
  107. package/dist/utils/parsing/jsonParser.d.ts +4 -4
  108. package/dist/utils/parsing/jsonParser.js +6 -6
  109. package/dist/utils/parsing/pdfParser.d.ts +2 -2
  110. package/dist/utils/parsing/pdfParser.js +4 -4
  111. package/dist/utils/parsing/xmlParser.d.ts +4 -4
  112. package/dist/utils/parsing/xmlParser.js +5 -5
  113. package/dist/utils/parsing/yamlParser.d.ts +4 -4
  114. package/dist/utils/parsing/yamlParser.js +6 -6
  115. package/dist/utils/scheduling/scheduler.d.ts +3 -3
  116. package/dist/utils/scheduling/scheduler.js +5 -5
  117. package/dist/utils/security/rateLimiter.d.ts +2 -2
  118. package/dist/utils/security/rateLimiter.js +3 -3
  119. package/dist/utils/security/rateLimiter.js.map +1 -1
  120. package/dist/utils/security/sanitization.d.ts +3 -3
  121. package/dist/utils/security/sanitization.js +7 -7
  122. package/dist/utils/telemetry/instrumentation.d.ts.map +1 -1
  123. package/dist/utils/telemetry/instrumentation.js +7 -8
  124. package/dist/utils/telemetry/instrumentation.js.map +1 -1
  125. package/dist/utils/telemetry/trace.d.ts +1 -1
  126. package/dist/utils/telemetry/trace.js +1 -1
  127. package/package.json +13 -7
  128. package/scripts/devcheck.ts +6 -4
  129. package/skills/api-workers/SKILL.md +3 -3
  130. package/templates/AGENTS.md +2 -2
  131. package/templates/CLAUDE.md +2 -2
package/AGENTS.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Developer Protocol
2
2
 
3
3
  **Package:** `@cyanheads/mcp-ts-core`
4
- **Version:** 0.12.5
4
+ **Version:** 0.12.6
5
5
  **Engines:** Bun ≥1.3.0, Node ≥24.0.0
6
6
  **MCP SDK:** `@modelcontextprotocol/server` ^2.0.0 (protocol revisions 2026-07-28 and 2025-*)
7
7
  **Zod:** ^4.5.4
@@ -59,7 +59,7 @@ Both paths share the same public API. Init copies starter `package.json`, config
59
59
  | `/utils` | formatting, encoding, network, pagination, overflow (`outlineOnOverflow`, `OUTLINE_VARIANT`, `selectSections`, `formatOutline`), logging, runtime, telemetry, token counting, parsers†, sanitization†, scheduling† | All utilities (†optional peer deps) |
60
60
  | `/services` | `OpenRouterProvider`, `SpeechService`, `createSpeechProvider`, `ElevenLabsProvider`, `WhisperProvider`, `GraphService`, provider interfaces and types | LLM, Speech (TTS/STT), Graph services |
61
61
  | `/linter` | `validateDefinitions`, `LintReport`, `LintDiagnostic`, `LintInput`, `LintSeverity` | Definition validation |
62
- | `/testing` | `createMockContext`, `createMockSession`, `createFetchMock`, `runToolContract`, `createMockLogger`, `getEnrichment`, `getContentBlocks`, `createInMemoryStorage` | Test kit for handlers and upstream HTTP boundaries |
62
+ | `/testing` | `createMockContext`, `createMockSession`, `createFetchMock`, `runToolContract`, `createMockLogger`, `getEnrichment`, `getContentBlocks`, `createInMemoryStorage`, `expectInputRequired` | Test kit for handlers and upstream HTTP boundaries |
63
63
  | `/testing/fuzz` | `fuzzTool`, `fuzzResource`, `fuzzPrompt`, `zodToArbitrary`, `adversarialArbitrary`, `ADVERSARIAL_STRINGS` | Fuzz testing |
64
64
  | `/testing/vitest` | `mcpTest`, `toolContractSuite`, `McpTestFixtures` (+ re-exported `/testing` helpers) | Vitest fixtures and tool conformance suites (optional peer `vitest`) |
65
65
 
@@ -76,7 +76,7 @@ import { McpError, JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
76
76
  import { getMyService } from '@/services/my-domain/my-service.js';
77
77
  ```
78
78
 
79
- Build configs exported for consumer extension: `tsconfig.json` extends `@cyanheads/mcp-ts-core/tsconfig.base.json`, `biome.json` extends `@cyanheads/mcp-ts-core/biome`, `vitest.config.ts` spreads from `@cyanheads/mcp-ts-core/vitest.config`.
79
+ Build configs exported for consumer extension: `tsconfig.json` extends `@cyanheads/mcp-ts-core/tsconfig.base.json`, `biome.json` extends `@cyanheads/mcp-ts-core/biome`, `vitest.config.ts` folds in `@cyanheads/mcp-ts-core/vitest.config` via `mergeConfig`.
80
80
 
81
81
  ---
82
82
 
@@ -115,7 +115,7 @@ await createApp({
115
115
 
116
116
  **Identity fields** — Optional `title`, `websiteUrl`, `description`, `icons` (SEP-973) pass through to the SDK's `initialize` serverInfo and to the server manifest, keeping the `/.well-known/mcp.json` server card and landing page consistent with what `initialize` reports. Explicit `description` wins over `MCP_SERVER_DESCRIPTION`/package.json.
117
117
 
118
- **Also available** — `landing` (`LandingConfig`, HTTP transport only: landing-page config, all fields optional), `context: { exposeStatelessSessionId }` (populate `ctx.sessionId` from the SDK's per-request token in stateless HTTP mode; default `false`), and `cacheHints` (2026-07-28 `ttlMs`/`cacheScope` per cacheable operation — see Adding a Resource for the per-resource override).
118
+ **Also available** — `landing` (`LandingConfig`, HTTP transport only: landing-page config, all fields optional), `context: { exposeStatelessSessionId }` (populate `ctx.sessionId` from the SDK's per-request token in stateless HTTP mode; default `false`), `eventBus` (the `ServerEventBus` backing `subscriptions/listen`; defaults to an in-process bus — supply one for a multi-isolate or multi-process runtime, Workers most of all), and `cacheHints` (2026-07-28 `ttlMs`/`cacheScope` per cacheable operation — see Adding a Resource for the per-resource override).
119
119
 
120
120
  ### Cloudflare Workers — `createWorkerHandler(options)`
121
121
 
@@ -146,6 +146,7 @@ interface CoreServices {
146
146
  logger: Logger;
147
147
  storage: StorageService;
148
148
  rateLimiter: RateLimiter;
149
+ notify: ServerNotifier; // out-of-request list-changed / resource-updated publishing
149
150
  canvas?: DataCanvas; // present when CANVAS_PROVIDER_TYPE=duckdb; never on Workers
150
151
  llmProvider?: ILlmProvider;
151
152
  speechService?: SpeechService;
@@ -299,7 +300,7 @@ interface Context {
299
300
  readonly uri?: URL; // present for resource handlers
300
301
  readonly content: ContentCollect; // media blocks → prepended to content[]; never in structuredContent
301
302
  readonly enrich: Enrich; // success-path agent context → structuredContent + content[]; typed on HandlerContext<R, E>
302
- recoveryFor(reason: string): { recovery: { hint: string } } | {}; // opt-in contract resolver
303
+ recoveryFor(reason: string): { recovery: { hint: string } } | Record<string, never>; // opt-in contract resolver
303
304
  }
304
305
  ```
305
306
 
@@ -388,7 +389,7 @@ async handler(input, ctx) {
388
389
 
389
390
  **`ctx.recoveryFor(reason)`** returns `{}` when no contract exists (spread-safe). Typed against the declared reason union on `HandlerContext<R>`. Works in services: `throw validationError(msg, { reason: 'X', ...ctx.recoveryFor('X') })`. Opt-in — author spreads explicitly.
390
391
 
391
- **Contracts are inline, per-tool.** Don't extract shared `errors[]` constants — locality is the point, and dynamic `recovery` hints need tool-specific context. Declare domain-specific failures only; **baseline codes** (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`) are auto-allowed by conformance lint. The lint scans handler source only — service-layer throws still reach clients via auto-classification.
392
+ **Contracts are inline, per-tool.** Don't extract shared `errors[]` constants — locality is the point, and dynamic `recovery` hints need tool-specific context. Declare domain-specific failures only; **baseline codes** (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`, `RequestCancelled`) are auto-allowed by conformance lint. The lint scans handler source only — service-layer throws still reach clients via auto-classification.
392
393
 
393
394
  **Fallback for ad-hoc throws** (no contract entry fits, prototype tools, service-layer code): use error factories.
394
395
 
@@ -398,7 +399,7 @@ throw notFound('Item not found', { itemId: '123' });
398
399
  throw validationError('Missing required field: name', { field: 'name' });
399
400
  ```
400
401
 
401
- Available factories: `invalidParams`, `invalidRequest`, `notFound`, `forbidden`, `unauthorized`, `validationError`, `conflict`, `rateLimited`, `timeout`, `serviceUnavailable`, `configurationError`, `internalError`, `serializationError`, `databaseError`. All accept `(message, data?, options?)` where `options` is `{ cause?: unknown }`.
402
+ Available factories: `invalidParams`, `invalidRequest`, `notFound`, `forbidden`, `unauthorized`, `validationError`, `conflict`, `rateLimited`, `timeout`, `serviceUnavailable`, `configurationError`, `internalError`, `serializationError`, `databaseError`, `requestCancelled`. All accept `(message, data?, options?)` where `options` is `{ cause?: unknown }`.
402
403
 
403
404
  For HTTP responses from upstream APIs, use `httpErrorFromResponse(response, { service, data })` from `/utils` — maps the full status table (401/403/408/422/429/5xx) and captures body + `Retry-After`.
404
405
 
@@ -467,7 +468,7 @@ describe('myTool', () => {
467
468
  });
468
469
  ```
469
470
 
470
- **`createMockContext` options:** `createMockContext()` (state included), `{ tenantId: 'test-tenant' }` (explicit tenant; defaults to `'default'`, as stdio resolves it), `{ errors: myTool.errors }` (typed `ctx.fail`), `{ elicit: vi.fn() }`, `{ progress: true }` (task progress).
471
+ **`createMockContext` options:** `createMockContext()` (state included), `{ tenantId: 'test-tenant' }` (explicit tenant; defaults to `'default'`, as stdio resolves it), `{ errors: myTool.errors }` (typed `ctx.fail`), `{ inputResponses }` / `{ requestState }` (seed `ctx.inputs` to drive a multi-round-trip handler's second round directly), plus `auth`, `sessionId`, `signal`, `requestId`, `uri`, and the four `notify*` callbacks.
471
472
 
472
473
  **`ctx.state` in tests is the production path.** The mock backs it with a real `StorageService` over an `InMemoryProvider`, so key validation (`[a-zA-Z0-9_.\-/]+` — colons rejected) and TTL expiry behave exactly as they do in a deployment. Passing `errors` narrows the return type to `HandlerContext<ReasonOf<…>>`, which is what a definition declaring a contract types its handler's `ctx` as — so `definition.handler(input, ctx)` typechecks.
473
474
 
@@ -544,16 +545,26 @@ Skills live in `skills/<name>/SKILL.md`; the full list is discoverable via the a
544
545
  | `bun run lint:mcp` | Validate MCP definitions against spec |
545
546
  | `bun run format` | Auto-fix Biome lint/format issues (safe fixes only) |
546
547
  | `bun run format:unsafe` | Also apply Biome's unsafe autofixes — review the diff; they can change behavior, not just formatting |
547
- | `bun run test` | Unit/compliance/smoke/fuzz/typecheck suites (Bun runtime) |
548
- | `bun run test:all` | Release gate: `test:coverage` + `test:node` + `test:worker` + `test:integration` |
549
- | `bun run test:node` | Same suites + integration under real Node (bypasses the bun-node PATH shim) |
550
- | `bun run test:leaks` | Suites with Vitest async-leak detection (`--detect-async-leaks`) |
551
- | `bun run test:typecheck` | Typecheck project only — `.test-d.ts` contracts with `@ts-expect-error` negative cases |
548
+ | `bun run tree` | Regenerate `docs/tree.md` after the directory structure changes |
549
+ | `bun run test` | Every root project — unit, leak-gate, compliance, smoke, fuzz, typecheck (Bun runtime) |
550
+ | `bun run test:unit` / `:smoke` / `:fuzz` / `:compliance` / `:typecheck` | One root project via `--project`. `test:typecheck` runs the `.test-d.ts` contracts, whose `@ts-expect-error` cases are the negative assertions |
551
+ | `bun run test:leak-gate` | The retention gate's own sentinel suite. Each case spawns a full Vitest run, so it is excluded from the `unit` project |
552
+ | `bun run test:coverage` | Root projects with coverage thresholds enforced |
553
+ | `bun run test:integration` | Real server subprocesses over stdio and HTTP |
554
+ | `bun run test:worker` | The framework under real `workerd`, then a standalone Worker bundle through the Wrangler toolchain — real Node on both legs |
555
+ | `bun run test:package` | Rebuilds, packs the tarball, and consumes it as an external project would (exports, declarations, both runtimes) |
556
+ | `bun run test:node` | Root projects + integration under real Node via `scripts/with-node.ts`, which bypasses Bun's `node` PATH shim |
557
+ | `bun run test:order` | Root projects on real Node in shuffled file order under a pinned seed — catches inter-file state leakage |
558
+ | `bun run test:leaks` | Real-Node root async-resource retention gate; [scope and evidence](tests/leaks/README.md) |
559
+ | `bun run test:all` | Release gate: `rebuild` → `test:coverage` → `test:node` → `test:worker` → `test:integration`. `test:package` and `test:leaks` are separate lanes |
560
+ | `bun run bench` / `bench:node` / `bench:io` / `bench:io:bun` | Microbenchmarks (`tests/benchmarks/micro`) and opt-in transport I/O measurements (`tests/benchmarks/io`) |
552
561
  | `bun run start:stdio` | Production mode (stdio, after build) |
553
562
  | `bun run start:http` | Production mode (HTTP, after build) |
554
563
  | `bun run changelog:build` | Regenerate `CHANGELOG.md` from `changelog/*.md` |
555
564
  | `bun run changelog:check` | Verify `CHANGELOG.md` is in sync with `changelog/` (used by devcheck) |
556
565
 
566
+ Lane configs live in `tests/config/` (`vitest.integration.ts`, `vitest.worker.ts`, `vitest.worker-bundle.ts`, `vitest.package.ts`, `vitest.benchmark.ts`, `vitest.performance.ts`, `vitest.leaks.ts`, `vitest.leak-sentinels.ts`). Two configs stay at the repo root: `vitest.config.ts`, the root `projects` list a bare `vitest` invocation discovers, and `vitest.config.base.mjs`, the published `./vitest.config` export.
567
+
557
568
  After `bun update --latest`, run the `maintenance` skill to investigate changelogs, adopt upstream changes, and sync project skills.
558
569
 
559
570
  ---
@@ -591,7 +602,7 @@ security: false # optional, default fals
591
602
 
592
603
  Badge order when both set: `· ⚠️ Breaking · 🛡️ Security`. Summary > 350 chars or malformed boolean fails `changelog:check`.
593
604
 
594
- **Section order** (Keep a Changelog): Added, Changed, Deprecated, Removed, Fixed, Security. Omit empty sections. Pre-release versions consolidate as sub-headers inside the final version's file — no separate files per pre-release.
605
+ **Section order:** the Keep a Changelog sequence — Added, Changed, Deprecated, Removed, Fixed, Security — then `Dependencies` last. Omit empty sections. Pre-release versions consolidate as sub-headers inside the final version's file — no separate files per pre-release.
595
606
 
596
607
  ---
597
608
 
package/CLAUDE.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Developer Protocol
2
2
 
3
3
  **Package:** `@cyanheads/mcp-ts-core`
4
- **Version:** 0.12.5
4
+ **Version:** 0.12.6
5
5
  **Engines:** Bun ≥1.3.0, Node ≥24.0.0
6
6
  **MCP SDK:** `@modelcontextprotocol/server` ^2.0.0 (protocol revisions 2026-07-28 and 2025-*)
7
7
  **Zod:** ^4.5.4
@@ -59,7 +59,7 @@ Both paths share the same public API. Init copies starter `package.json`, config
59
59
  | `/utils` | formatting, encoding, network, pagination, overflow (`outlineOnOverflow`, `OUTLINE_VARIANT`, `selectSections`, `formatOutline`), logging, runtime, telemetry, token counting, parsers†, sanitization†, scheduling† | All utilities (†optional peer deps) |
60
60
  | `/services` | `OpenRouterProvider`, `SpeechService`, `createSpeechProvider`, `ElevenLabsProvider`, `WhisperProvider`, `GraphService`, provider interfaces and types | LLM, Speech (TTS/STT), Graph services |
61
61
  | `/linter` | `validateDefinitions`, `LintReport`, `LintDiagnostic`, `LintInput`, `LintSeverity` | Definition validation |
62
- | `/testing` | `createMockContext`, `createMockSession`, `createFetchMock`, `runToolContract`, `createMockLogger`, `getEnrichment`, `getContentBlocks`, `createInMemoryStorage` | Test kit for handlers and upstream HTTP boundaries |
62
+ | `/testing` | `createMockContext`, `createMockSession`, `createFetchMock`, `runToolContract`, `createMockLogger`, `getEnrichment`, `getContentBlocks`, `createInMemoryStorage`, `expectInputRequired` | Test kit for handlers and upstream HTTP boundaries |
63
63
  | `/testing/fuzz` | `fuzzTool`, `fuzzResource`, `fuzzPrompt`, `zodToArbitrary`, `adversarialArbitrary`, `ADVERSARIAL_STRINGS` | Fuzz testing |
64
64
  | `/testing/vitest` | `mcpTest`, `toolContractSuite`, `McpTestFixtures` (+ re-exported `/testing` helpers) | Vitest fixtures and tool conformance suites (optional peer `vitest`) |
65
65
 
@@ -76,7 +76,7 @@ import { McpError, JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
76
76
  import { getMyService } from '@/services/my-domain/my-service.js';
77
77
  ```
78
78
 
79
- Build configs exported for consumer extension: `tsconfig.json` extends `@cyanheads/mcp-ts-core/tsconfig.base.json`, `biome.json` extends `@cyanheads/mcp-ts-core/biome`, `vitest.config.ts` spreads from `@cyanheads/mcp-ts-core/vitest.config`.
79
+ Build configs exported for consumer extension: `tsconfig.json` extends `@cyanheads/mcp-ts-core/tsconfig.base.json`, `biome.json` extends `@cyanheads/mcp-ts-core/biome`, `vitest.config.ts` folds in `@cyanheads/mcp-ts-core/vitest.config` via `mergeConfig`.
80
80
 
81
81
  ---
82
82
 
@@ -115,7 +115,7 @@ await createApp({
115
115
 
116
116
  **Identity fields** — Optional `title`, `websiteUrl`, `description`, `icons` (SEP-973) pass through to the SDK's `initialize` serverInfo and to the server manifest, keeping the `/.well-known/mcp.json` server card and landing page consistent with what `initialize` reports. Explicit `description` wins over `MCP_SERVER_DESCRIPTION`/package.json.
117
117
 
118
- **Also available** — `landing` (`LandingConfig`, HTTP transport only: landing-page config, all fields optional), `context: { exposeStatelessSessionId }` (populate `ctx.sessionId` from the SDK's per-request token in stateless HTTP mode; default `false`), and `cacheHints` (2026-07-28 `ttlMs`/`cacheScope` per cacheable operation — see Adding a Resource for the per-resource override).
118
+ **Also available** — `landing` (`LandingConfig`, HTTP transport only: landing-page config, all fields optional), `context: { exposeStatelessSessionId }` (populate `ctx.sessionId` from the SDK's per-request token in stateless HTTP mode; default `false`), `eventBus` (the `ServerEventBus` backing `subscriptions/listen`; defaults to an in-process bus — supply one for a multi-isolate or multi-process runtime, Workers most of all), and `cacheHints` (2026-07-28 `ttlMs`/`cacheScope` per cacheable operation — see Adding a Resource for the per-resource override).
119
119
 
120
120
  ### Cloudflare Workers — `createWorkerHandler(options)`
121
121
 
@@ -146,6 +146,7 @@ interface CoreServices {
146
146
  logger: Logger;
147
147
  storage: StorageService;
148
148
  rateLimiter: RateLimiter;
149
+ notify: ServerNotifier; // out-of-request list-changed / resource-updated publishing
149
150
  canvas?: DataCanvas; // present when CANVAS_PROVIDER_TYPE=duckdb; never on Workers
150
151
  llmProvider?: ILlmProvider;
151
152
  speechService?: SpeechService;
@@ -299,7 +300,7 @@ interface Context {
299
300
  readonly uri?: URL; // present for resource handlers
300
301
  readonly content: ContentCollect; // media blocks → prepended to content[]; never in structuredContent
301
302
  readonly enrich: Enrich; // success-path agent context → structuredContent + content[]; typed on HandlerContext<R, E>
302
- recoveryFor(reason: string): { recovery: { hint: string } } | {}; // opt-in contract resolver
303
+ recoveryFor(reason: string): { recovery: { hint: string } } | Record<string, never>; // opt-in contract resolver
303
304
  }
304
305
  ```
305
306
 
@@ -388,7 +389,7 @@ async handler(input, ctx) {
388
389
 
389
390
  **`ctx.recoveryFor(reason)`** returns `{}` when no contract exists (spread-safe). Typed against the declared reason union on `HandlerContext<R>`. Works in services: `throw validationError(msg, { reason: 'X', ...ctx.recoveryFor('X') })`. Opt-in — author spreads explicitly.
390
391
 
391
- **Contracts are inline, per-tool.** Don't extract shared `errors[]` constants — locality is the point, and dynamic `recovery` hints need tool-specific context. Declare domain-specific failures only; **baseline codes** (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`) are auto-allowed by conformance lint. The lint scans handler source only — service-layer throws still reach clients via auto-classification.
392
+ **Contracts are inline, per-tool.** Don't extract shared `errors[]` constants — locality is the point, and dynamic `recovery` hints need tool-specific context. Declare domain-specific failures only; **baseline codes** (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`, `RequestCancelled`) are auto-allowed by conformance lint. The lint scans handler source only — service-layer throws still reach clients via auto-classification.
392
393
 
393
394
  **Fallback for ad-hoc throws** (no contract entry fits, prototype tools, service-layer code): use error factories.
394
395
 
@@ -398,7 +399,7 @@ throw notFound('Item not found', { itemId: '123' });
398
399
  throw validationError('Missing required field: name', { field: 'name' });
399
400
  ```
400
401
 
401
- Available factories: `invalidParams`, `invalidRequest`, `notFound`, `forbidden`, `unauthorized`, `validationError`, `conflict`, `rateLimited`, `timeout`, `serviceUnavailable`, `configurationError`, `internalError`, `serializationError`, `databaseError`. All accept `(message, data?, options?)` where `options` is `{ cause?: unknown }`.
402
+ Available factories: `invalidParams`, `invalidRequest`, `notFound`, `forbidden`, `unauthorized`, `validationError`, `conflict`, `rateLimited`, `timeout`, `serviceUnavailable`, `configurationError`, `internalError`, `serializationError`, `databaseError`, `requestCancelled`. All accept `(message, data?, options?)` where `options` is `{ cause?: unknown }`.
402
403
 
403
404
  For HTTP responses from upstream APIs, use `httpErrorFromResponse(response, { service, data })` from `/utils` — maps the full status table (401/403/408/422/429/5xx) and captures body + `Retry-After`.
404
405
 
@@ -467,7 +468,7 @@ describe('myTool', () => {
467
468
  });
468
469
  ```
469
470
 
470
- **`createMockContext` options:** `createMockContext()` (state included), `{ tenantId: 'test-tenant' }` (explicit tenant; defaults to `'default'`, as stdio resolves it), `{ errors: myTool.errors }` (typed `ctx.fail`), `{ elicit: vi.fn() }`, `{ progress: true }` (task progress).
471
+ **`createMockContext` options:** `createMockContext()` (state included), `{ tenantId: 'test-tenant' }` (explicit tenant; defaults to `'default'`, as stdio resolves it), `{ errors: myTool.errors }` (typed `ctx.fail`), `{ inputResponses }` / `{ requestState }` (seed `ctx.inputs` to drive a multi-round-trip handler's second round directly), plus `auth`, `sessionId`, `signal`, `requestId`, `uri`, and the four `notify*` callbacks.
471
472
 
472
473
  **`ctx.state` in tests is the production path.** The mock backs it with a real `StorageService` over an `InMemoryProvider`, so key validation (`[a-zA-Z0-9_.\-/]+` — colons rejected) and TTL expiry behave exactly as they do in a deployment. Passing `errors` narrows the return type to `HandlerContext<ReasonOf<…>>`, which is what a definition declaring a contract types its handler's `ctx` as — so `definition.handler(input, ctx)` typechecks.
473
474
 
@@ -544,16 +545,26 @@ Skills live in `skills/<name>/SKILL.md`; the full list is discoverable via the a
544
545
  | `bun run lint:mcp` | Validate MCP definitions against spec |
545
546
  | `bun run format` | Auto-fix Biome lint/format issues (safe fixes only) |
546
547
  | `bun run format:unsafe` | Also apply Biome's unsafe autofixes — review the diff; they can change behavior, not just formatting |
547
- | `bun run test` | Unit/compliance/smoke/fuzz/typecheck suites (Bun runtime) |
548
- | `bun run test:all` | Release gate: `test:coverage` + `test:node` + `test:worker` + `test:integration` |
549
- | `bun run test:node` | Same suites + integration under real Node (bypasses the bun-node PATH shim) |
550
- | `bun run test:leaks` | Suites with Vitest async-leak detection (`--detect-async-leaks`) |
551
- | `bun run test:typecheck` | Typecheck project only — `.test-d.ts` contracts with `@ts-expect-error` negative cases |
548
+ | `bun run tree` | Regenerate `docs/tree.md` after the directory structure changes |
549
+ | `bun run test` | Every root project — unit, leak-gate, compliance, smoke, fuzz, typecheck (Bun runtime) |
550
+ | `bun run test:unit` / `:smoke` / `:fuzz` / `:compliance` / `:typecheck` | One root project via `--project`. `test:typecheck` runs the `.test-d.ts` contracts, whose `@ts-expect-error` cases are the negative assertions |
551
+ | `bun run test:leak-gate` | The retention gate's own sentinel suite. Each case spawns a full Vitest run, so it is excluded from the `unit` project |
552
+ | `bun run test:coverage` | Root projects with coverage thresholds enforced |
553
+ | `bun run test:integration` | Real server subprocesses over stdio and HTTP |
554
+ | `bun run test:worker` | The framework under real `workerd`, then a standalone Worker bundle through the Wrangler toolchain — real Node on both legs |
555
+ | `bun run test:package` | Rebuilds, packs the tarball, and consumes it as an external project would (exports, declarations, both runtimes) |
556
+ | `bun run test:node` | Root projects + integration under real Node via `scripts/with-node.ts`, which bypasses Bun's `node` PATH shim |
557
+ | `bun run test:order` | Root projects on real Node in shuffled file order under a pinned seed — catches inter-file state leakage |
558
+ | `bun run test:leaks` | Real-Node root async-resource retention gate; [scope and evidence](tests/leaks/README.md) |
559
+ | `bun run test:all` | Release gate: `rebuild` → `test:coverage` → `test:node` → `test:worker` → `test:integration`. `test:package` and `test:leaks` are separate lanes |
560
+ | `bun run bench` / `bench:node` / `bench:io` / `bench:io:bun` | Microbenchmarks (`tests/benchmarks/micro`) and opt-in transport I/O measurements (`tests/benchmarks/io`) |
552
561
  | `bun run start:stdio` | Production mode (stdio, after build) |
553
562
  | `bun run start:http` | Production mode (HTTP, after build) |
554
563
  | `bun run changelog:build` | Regenerate `CHANGELOG.md` from `changelog/*.md` |
555
564
  | `bun run changelog:check` | Verify `CHANGELOG.md` is in sync with `changelog/` (used by devcheck) |
556
565
 
566
+ Lane configs live in `tests/config/` (`vitest.integration.ts`, `vitest.worker.ts`, `vitest.worker-bundle.ts`, `vitest.package.ts`, `vitest.benchmark.ts`, `vitest.performance.ts`, `vitest.leaks.ts`, `vitest.leak-sentinels.ts`). Two configs stay at the repo root: `vitest.config.ts`, the root `projects` list a bare `vitest` invocation discovers, and `vitest.config.base.mjs`, the published `./vitest.config` export.
567
+
557
568
  After `bun update --latest`, run the `maintenance` skill to investigate changelogs, adopt upstream changes, and sync project skills.
558
569
 
559
570
  ---
@@ -591,7 +602,7 @@ security: false # optional, default fals
591
602
 
592
603
  Badge order when both set: `· ⚠️ Breaking · 🛡️ Security`. Summary > 350 chars or malformed boolean fails `changelog:check`.
593
604
 
594
- **Section order** (Keep a Changelog): Added, Changed, Deprecated, Removed, Fixed, Security. Omit empty sections. Pre-release versions consolidate as sub-headers inside the final version's file — no separate files per pre-release.
605
+ **Section order:** the Keep a Changelog sequence — Added, Changed, Deprecated, Removed, Fixed, Security — then `Dependencies` last. Omit empty sections. Pre-release versions consolidate as sub-headers inside the final version's file — no separate files per pre-release.
595
606
 
596
607
  ---
597
608
 
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  <div align="center">
7
7
 
8
- [![Version](https://img.shields.io/badge/Version-0.12.5-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![MCP Spec](https://img.shields.io/badge/MCP%20Spec-2026--07--28-8A2BE2.svg?style=flat-square)](https://modelcontextprotocol.io/specification/2026-07-28)
8
+ [![Version](https://img.shields.io/badge/Version-0.12.6-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![MCP Spec](https://img.shields.io/badge/MCP%20Spec-2026--07--28-8A2BE2.svg?style=flat-square)](https://modelcontextprotocol.io/specification/2026-07-28)
9
9
 
10
10
  [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^2.0.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![TypeScript](https://img.shields.io/badge/TypeScript-^7.0.2-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.3.0%2B-blueviolet.svg?style=flat-square)](https://bun.sh/)
11
11
 
@@ -0,0 +1,44 @@
1
+ ---
2
+ summary: "Five source fixes: detached storage writes after a capacity sweep, an unevictable empty rate-limit key, a module-load cursor key that broke standalone Worker startup, fuzz that never reached pattern-validated handlers, and a leaked shutdown deadline. The test suite trades type-only assertions for behavior and gains three lanes."
3
+ breaking: false
4
+ security: true
5
+ agent-notes: |
6
+ Scaffold sync only: re-sync a project copy of CLAUDE.md/AGENTS.md for the
7
+ Dependencies and RequestCancelled bullet under Changed. Nothing else to adopt.
8
+ ---
9
+
10
+ # 0.12.6 — 2026-09-06
11
+
12
+ ## Added
13
+
14
+ - **`bun run test:leaks` is an async-resource retention gate** ([#404](https://github.com/cyanheads/mcp-ts-core/issues/404)) — it runs the root runtime projects on real Node, observes every allocation from file collection through worker teardown, and exits nonzero on retained operations, missing evidence, or forced termination. Its sentinel suite runs separately as `bun run test:leak-gate`. Scope and evidence: [tests/leaks/README.md](tests/leaks/README.md).
15
+ - **Benchmark lanes** — `bun run bench` / `bench:node` for micro workloads over the tool pipeline, storage, and rate limiter, and `bench:io` / `bench:io:bun` for opt-in HTTP, Workerd, and native I/O measurements. Reports carry runtime and machine provenance; no timing threshold enters `test:all`. See [tests/benchmarks/README.md](tests/benchmarks/README.md).
16
+ - **`bun run test:worker` also boots the built bundle standalone** ([#406](https://github.com/cyanheads/mcp-ts-core/issues/406)) — a Wrangler-hosted lane outside the Workerd test pool's module loader, which is where a startup-time failure is observable at all.
17
+
18
+ ## Changed
19
+
20
+ - **Lane configs live in `tests/config/`** — `vitest.integration.ts`, `vitest.worker.ts`, and `vitest.package.ts` moved there, joined by the new worker-bundle, benchmark, performance, and leak configs. `vitest.config.ts` and the published `vitest.config.base.mjs` stay at the repository root.
21
+ - **`scripts/with-node.ts` selects the real Node binary** for `test:node`, `test:order`, `test:worker`, and `bench:node`, replacing the inline shell each script carried.
22
+ - **Scaffolded `CLAUDE.md` / `AGENTS.md`** — the changelog section order ends with `Dependencies`, and `RequestCancelled` is listed among the baseline error codes a tool need not declare.
23
+ - **Test assertions moved from type shapes to behavior** — ten type-only suites that imported no runtime value, plus a duplicate `Context` suite, are gone (~2,700 lines). The behavior they claimed to cover is now exercised directly: `Context` state bounds and cancellation between I/O steps, the multi-round-trip input helper, format parity across every enum member, and Worker lifecycle-failure, storage-failure, and wire-contract paths.
24
+ - **Every suite passes in shuffled order** — session stores, mirror handles, sockets, and response bodies that outlived their cases are settled per test, and paired tests no longer depend on file order. The disabled OpenRouter provider suite is rewritten and running again.
25
+ - **The skip-only telemetry suite is gone** ([#362](https://github.com/cyanheads/mcp-ts-core/issues/362)) — `instrumentation.test.ts` carried nine skips and a todo attributing them to Bun; `instrumentation.lifecycle.test.ts` now covers all of it, including the lightweight-mode and idempotency cases the skips masked.
26
+ - Shipped skills: `api-workers` 1.8.
27
+
28
+ ## Fixed
29
+
30
+ - **`InMemoryProvider` reattaches the tenant map after a capacity sweep** ([#403](https://github.com/cyanheads/mcp-ts-core/issues/403)) — a sweep that removed the target tenant left `set()` writing into a detached map, so the value was unreachable while `size` still counted it. `setMany()` now preflights against the snapshot it counted rather than a later one.
31
+ - **The cursor HMAC key is generated on first use, not at module load** ([#406](https://github.com/cyanheads/mcp-ts-core/issues/406)) — Workerd forbids random generation during global evaluation, so a standalone bundle failed to start. Cursor encoding, truncation, and tenant/tamper rejection are unchanged.
32
+ - **`fuzzTool` and `fuzzResource` reach pattern-validated handlers** ([#385](https://github.com/cyanheads/mcp-ts-core/issues/385), [#350](https://github.com/cyanheads/mcp-ts-core/issues/350)) — a `.regex()` field now drives generation instead of rejecting every sample at parse, resource runs receive the definition's `errors[]`, and tool, resource, and prompt results are validated after the call rather than assumed.
33
+ - **`shutdownOpenTelemetry()` clears its timeout on every path** — a rejected shutdown left the deadline timer armed.
34
+ - **The root `.mcpbignore` anchors its development-directory patterns** ([#343](https://github.com/cyanheads/mcp-ts-core/issues/343)) — `/.claude/`, `/.agents/`, and `/skills/` no longer strip matching paths under `node_modules`, and `devcheck` runs Packaging whenever `.mcpbignore` exists, not only alongside a manifest.
35
+
36
+ ## Security
37
+
38
+ - **An empty rate-limit key is evicted like any other** ([#405](https://github.com/cyanheads/mcp-ts-core/issues/405)) — the eviction candidate was tested for truthiness, so `''` was selected and never deleted; a server whose `keyGenerator` can produce it grew the tracked map past `maxTrackedKeys` under distinct-key churn.
39
+
40
+ ## Dependencies
41
+
42
+ - `@opentelemetry/resources`, `@opentelemetry/sdk-metrics`, `@opentelemetry/sdk-trace-node` 2.10.0 → 2.11.0
43
+ - `@supabase/supabase-js` 2.112.4 → 2.114.0
44
+ - `ignore` 7.0.7 → 7.0.8, `tsc-alias` 1.9.2 → 1.9.4 (lockfile only; the declared ranges are unchanged)
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { type Implementation, type ServerEventBus, type ServerNotifier } from '@modelcontextprotocol/server';
9
9
  import { config } from '../config/index.js';
10
- import { type LandingConfig, type ServerManifest } from '../core/serverManifest.js';
10
+ import { type LandingConfig, type ServerManifest } from './serverManifest.js';
11
11
  import { type CacheHints } from '../mcp-server/cacheHints.js';
12
12
  import type { AnyPromptDefinition } from '../mcp-server/prompts/utils/promptDefinition.js';
13
13
  import type { AnyResourceDefinition } from '../mcp-server/resources/utils/resourceDefinition.js';
@@ -237,7 +237,7 @@ export declare function composeServices<TSupabaseClient extends object = Supabas
237
237
  */
238
238
  export declare function createApp<TSupabaseClient extends object = SupabaseClientHandle>(options?: CreateAppOptions<TSupabaseClient>): Promise<ServerHandle<TSupabaseClient>>;
239
239
  export { z } from 'zod';
240
- export type { Context, ContextInputs, ContextLogger, ContextState } from '../core/context.js';
240
+ export type { Context, ContextInputs, ContextLogger, ContextState } from './context.js';
241
241
  export type { PromptDefinition } from '../mcp-server/prompts/utils/promptDefinition.js';
242
242
  export { prompt } from '../mcp-server/prompts/utils/promptDefinition.js';
243
243
  export type { AnyResourceDefinition, ResourceDefinition, } from '../mcp-server/resources/utils/resourceDefinition.js';
package/dist/core/app.js CHANGED
@@ -8,8 +8,8 @@
8
8
  import { InMemoryServerEventBus, } from '@modelcontextprotocol/server';
9
9
  import { z } from 'zod';
10
10
  import { config, resetConfig } from '../config/index.js';
11
- import { startGcPressureLoop } from '../core/gcPressure.js';
12
- import { buildServerManifest, } from '../core/serverManifest.js';
11
+ import { startGcPressureLoop } from './gcPressure.js';
12
+ import { buildServerManifest, } from './serverManifest.js';
13
13
  import { assertValidCacheHints } from '../mcp-server/cacheHints.js';
14
14
  import { notifierFor } from '../mcp-server/notifications.js';
15
15
  import { PromptRegistry } from '../mcp-server/prompts/prompt-registration.js';
@@ -5,13 +5,13 @@
5
5
  * `DefinitionCounts`, `Database`) out of the consumer-facing surface.
6
6
  * @module src/core/index
7
7
  */
8
- export type { ContextOptions, CoreServices, CreateAppOptions, ServerHandle, SupabaseClientHandle, } from '../core/app.js';
9
- export { createApp } from '../core/app.js';
10
- export type { LandingConfig, LandingLink } from '../core/serverManifest.js';
8
+ export type { ContextOptions, CoreServices, CreateAppOptions, ServerHandle, SupabaseClientHandle, } from './app.js';
9
+ export { createApp } from './app.js';
10
+ export type { LandingConfig, LandingLink } from './serverManifest.js';
11
11
  export type { CacheableResultMethod, CacheHints } from '../mcp-server/cacheHints.js';
12
12
  export { z } from 'zod';
13
- export type { AuthContext, ContentCollect, Context, ContextInputs, ContextLogger, ContextState, Enrich, EnrichHelpers, HandlerContext, ReasonOf, TypedEnrich, TypedFail, TypedRecoveryFor, } from '../core/context.js';
14
- export { createFail, createRecoveryFor } from '../core/context.js';
13
+ export type { AuthContext, ContentCollect, Context, ContextInputs, ContextLogger, ContextState, Enrich, EnrichHelpers, HandlerContext, ReasonOf, TypedEnrich, TypedFail, TypedRecoveryFor, } from './context.js';
14
+ export { createFail, createRecoveryFor } from './context.js';
15
15
  export { APP_RESOURCE_MIME_TYPE, appResource, appTool } from '../mcp-server/apps/appBuilders.js';
16
16
  export type { AnyPromptDefinition, PromptDefinition, } from '../mcp-server/prompts/utils/promptDefinition.js';
17
17
  export { prompt } from '../mcp-server/prompts/utils/promptDefinition.js';
@@ -5,12 +5,12 @@
5
5
  * `DefinitionCounts`, `Database`) out of the consumer-facing surface.
6
6
  * @module src/core/index
7
7
  */
8
- export { createApp } from '../core/app.js';
8
+ export { createApp } from './app.js';
9
9
  // ---------------------------------------------------------------------------
10
10
  // Zod re-export (consumers use the framework's copy, no separate zod dep)
11
11
  // ---------------------------------------------------------------------------
12
12
  export { z } from 'zod';
13
- export { createFail, createRecoveryFor } from '../core/context.js';
13
+ export { createFail, createRecoveryFor } from './context.js';
14
14
  // ---------------------------------------------------------------------------
15
15
  // Definition builders & types
16
16
  // ---------------------------------------------------------------------------
@@ -10,7 +10,7 @@
10
10
  * @module src/core/worker
11
11
  */
12
12
  import type { Ai, D1Database, KVNamespace, R2Bucket, ScheduledController } from '@cloudflare/workers-types';
13
- import { type CreateAppOptions } from '../core/app.js';
13
+ import { type CreateAppOptions } from './app.js';
14
14
  /**
15
15
  * Cloudflare Worker Bindings with proper type safety.
16
16
  * No index signature — servers extend via intersection types.
@@ -1,5 +1,5 @@
1
1
  import { normalizeLogLevelAlias } from '../config/logLevelAlias.js';
2
- import { composeServices } from '../core/app.js';
2
+ import { composeServices } from './app.js';
3
3
  import { createHttpApp } from '../mcp-server/transports/http/httpTransport.js';
4
4
  import { logger } from '../utils/internal/logger.js';
5
5
  import { requestContextService, withExtra } from '../utils/internal/requestContext.js';
@@ -7,8 +7,8 @@
7
7
  * @module src/mcp-server/apps/appBuilders
8
8
  */
9
9
  import type { ZodObject, ZodRawShape } from 'zod';
10
- import type { ResourceDefinition } from '../../mcp-server/resources/utils/resourceDefinition.js';
11
- import type { ToolDefinition } from '../../mcp-server/tools/utils/toolDefinition.js';
10
+ import type { ResourceDefinition } from '../resources/utils/resourceDefinition.js';
11
+ import type { ToolDefinition } from '../tools/utils/toolDefinition.js';
12
12
  import type { ErrorContract } from '../../types-global/errors.js';
13
13
  /**
14
14
  * MIME type for MCP Apps HTML resources.
@@ -6,8 +6,8 @@
6
6
  * app resource `_meta.ui` into `resources/read` content items.
7
7
  * @module src/mcp-server/apps/appBuilders
8
8
  */
9
- import { resource } from '../../mcp-server/resources/utils/resourceDefinition.js';
10
- import { tool } from '../../mcp-server/tools/utils/toolDefinition.js';
9
+ import { resource } from '../resources/utils/resourceDefinition.js';
10
+ import { tool } from '../tools/utils/toolDefinition.js';
11
11
  /**
12
12
  * MIME type for MCP Apps HTML resources.
13
13
  * Matches `RESOURCE_MIME_TYPE` from `@modelcontextprotocol/ext-apps/server`
@@ -10,7 +10,7 @@
10
10
  * @module src/mcp-server/cacheHints
11
11
  */
12
12
  import type { ServerOptions } from '@modelcontextprotocol/server';
13
- import type { AnyResourceDefinition } from '../mcp-server/resources/utils/resourceDefinition.js';
13
+ import type { AnyResourceDefinition } from './resources/utils/resourceDefinition.js';
14
14
  /**
15
15
  * Cache hints keyed by operation, for the closed set of methods whose
16
16
  * 2026-07-28 results carry `ttlMs` / `cacheScope`: `tools/list`,
@@ -6,7 +6,7 @@
6
6
  * @module src/mcp-server/prompts/prompt-registration
7
7
  */
8
8
  import type { McpServer } from '@modelcontextprotocol/server';
9
- import type { AnyPromptDefinition } from '../../mcp-server/prompts/utils/promptDefinition.js';
9
+ import type { AnyPromptDefinition } from './utils/promptDefinition.js';
10
10
  import type { logger as defaultLogger } from '../../utils/internal/logger.js';
11
11
  export declare class PromptRegistry {
12
12
  private promptDefs;
@@ -1,4 +1,4 @@
1
- import { isInputRequiredSignal } from '../../mcp-server/inputRequired.js';
1
+ import { isInputRequiredSignal } from '../inputRequired.js';
2
2
  import { JsonRpcErrorCode, McpError } from '../../types-global/errors.js';
3
3
  import { ErrorHandler } from '../../utils/internal/error-handler/errorHandler.js';
4
4
  import { measurePromptGeneration } from '../../utils/internal/performance.js';
@@ -3,9 +3,9 @@
3
3
  * @module src/mcp-server/resources/resource-registration
4
4
  */
5
5
  import { type McpServer, type ServerNotifier } from '@modelcontextprotocol/server';
6
- import type { ResourceSubscriptions } from '../../mcp-server/notifications.js';
7
- import type { AnyResourceDefinition } from '../../mcp-server/resources/utils/resourceDefinition.js';
8
- import { type ResourceHandlerFactoryServices } from '../../mcp-server/resources/utils/resourceHandlerFactory.js';
6
+ import type { ResourceSubscriptions } from '../notifications.js';
7
+ import type { AnyResourceDefinition } from './utils/resourceDefinition.js';
8
+ import { type ResourceHandlerFactoryServices } from './utils/resourceHandlerFactory.js';
9
9
  export declare class ResourceRegistry {
10
10
  private resourceDefs;
11
11
  private services;
@@ -3,7 +3,7 @@
3
3
  * @module src/mcp-server/resources/resource-registration
4
4
  */
5
5
  import { ResourceTemplate, } from '@modelcontextprotocol/server';
6
- import { createResourceHandler, } from '../../mcp-server/resources/utils/resourceHandlerFactory.js';
6
+ import { createResourceHandler, } from './utils/resourceHandlerFactory.js';
7
7
  import { JsonRpcErrorCode } from '../../types-global/errors.js';
8
8
  import { ErrorHandler } from '../../utils/internal/error-handler/errorHandler.js';
9
9
  import { logger } from '../../utils/internal/logger.js';
@@ -24,7 +24,7 @@
24
24
  * @module src/mcp-server/resources/resourceSubscriptions
25
25
  */
26
26
  import type { McpServer } from '@modelcontextprotocol/server';
27
- import type { ResourceSubscriptions } from '../../mcp-server/notifications.js';
27
+ import type { ResourceSubscriptions } from '../notifications.js';
28
28
  /**
29
29
  * Read-only view of one connection's subscription set. The set is mutated only
30
30
  * by the `resources/subscribe` / `resources/unsubscribe` handlers installed
@@ -4,8 +4,8 @@
4
4
  * @module src/mcp-server/resources/utils/resourceHandlerFactory
5
5
  */
6
6
  import type { InputRequiredResult, ReadResourceResult, ServerContext, ServerNotifier, Variables } from '@modelcontextprotocol/server';
7
- import { type ResourceSubscriptions } from '../../../mcp-server/notifications.js';
8
- import type { AnyResourceDefinition } from '../../../mcp-server/resources/utils/resourceDefinition.js';
7
+ import { type ResourceSubscriptions } from '../../notifications.js';
8
+ import type { AnyResourceDefinition } from './resourceDefinition.js';
9
9
  import type { StorageService } from '../../../storage/core/StorageService.js';
10
10
  import type { Logger } from '../../../utils/internal/logger.js';
11
11
  /** Services required by the handler factory to construct Context. */
@@ -5,10 +5,10 @@
5
5
  */
6
6
  import { config } from '../../../config/index.js';
7
7
  import { attachTypedFail, createContext } from '../../../core/context.js';
8
- import { createContextInputs, createRequestInput, isInputRequiredSignal, } from '../../../mcp-server/inputRequired.js';
9
- import { selectNotifiers } from '../../../mcp-server/notifications.js';
10
- import { withRequiredScopes } from '../../../mcp-server/transports/auth/lib/authUtils.js';
11
- import { resolveSessionMode } from '../../../mcp-server/types.js';
8
+ import { createContextInputs, createRequestInput, isInputRequiredSignal, } from '../../inputRequired.js';
9
+ import { selectNotifiers } from '../../notifications.js';
10
+ import { withRequiredScopes } from '../../transports/auth/lib/authUtils.js';
11
+ import { resolveSessionMode } from '../../types.js';
12
12
  import { McpError } from '../../../types-global/errors.js';
13
13
  import { ErrorHandler } from '../../../utils/internal/error-handler/errorHandler.js';
14
14
  import { measureResourceExecution } from '../../../utils/internal/performance.js';
@@ -11,10 +11,10 @@
11
11
  */
12
12
  import { type Implementation, McpServer, type ServerNotifier } from '@modelcontextprotocol/server';
13
13
  import type { AppConfig } from '../config/index.js';
14
- import type { CacheHints } from '../mcp-server/cacheHints.js';
15
- import type { PromptRegistry } from '../mcp-server/prompts/prompt-registration.js';
16
- import type { ResourceRegistry } from '../mcp-server/resources/resource-registration.js';
17
- import type { ToolRegistry } from '../mcp-server/tools/tool-registration.js';
14
+ import type { CacheHints } from './cacheHints.js';
15
+ import type { PromptRegistry } from './prompts/prompt-registration.js';
16
+ import type { ResourceRegistry } from './resources/resource-registration.js';
17
+ import type { ToolRegistry } from './tools/tool-registration.js';
18
18
  /** Dependencies required to create an MCP server instance. */
19
19
  export interface McpServerDeps {
20
20
  /**
@@ -10,7 +10,7 @@
10
10
  * @module src/mcp-server/server
11
11
  */
12
12
  import { McpServer, } from '@modelcontextprotocol/server';
13
- import { installResourceSubscriptions } from '../mcp-server/resources/resourceSubscriptions.js';
13
+ import { installResourceSubscriptions } from './resources/resourceSubscriptions.js';
14
14
  import { logger } from '../utils/internal/logger.js';
15
15
  import { requestContextService } from '../utils/internal/requestContext.js';
16
16
  /**
@@ -3,9 +3,9 @@
3
3
  * @module src/mcp-server/tools/tool-registration
4
4
  */
5
5
  import type { McpServer, ServerNotifier } from '@modelcontextprotocol/server';
6
- import type { ResourceSubscriptions } from '../../mcp-server/notifications.js';
7
- import type { AnyToolDefinition } from '../../mcp-server/tools/utils/toolDefinition.js';
8
- import { type HandlerFactoryServices } from '../../mcp-server/tools/utils/toolHandlerFactory.js';
6
+ import type { ResourceSubscriptions } from '../notifications.js';
7
+ import type { AnyToolDefinition } from './utils/toolDefinition.js';
8
+ import { type HandlerFactoryServices } from './utils/toolHandlerFactory.js';
9
9
  /**
10
10
  * Union of all accepted tool definition shapes.
11
11
  *
@@ -1,5 +1,5 @@
1
- import { getDisabledMetadata } from '../../mcp-server/tools/utils/disabled-tool.js';
2
- import { advertisedOutputSchema, createToolHandler, } from '../../mcp-server/tools/utils/toolHandlerFactory.js';
1
+ import { getDisabledMetadata } from './utils/disabled-tool.js';
2
+ import { advertisedOutputSchema, createToolHandler, } from './utils/toolHandlerFactory.js';
3
3
  import { JsonRpcErrorCode } from '../../types-global/errors.js';
4
4
  import { ErrorHandler } from '../../utils/internal/error-handler/errorHandler.js';
5
5
  import { logger } from '../../utils/internal/logger.js';
@@ -23,7 +23,7 @@
23
23
  *
24
24
  * @module src/mcp-server/tools/utils/disabled-tool
25
25
  */
26
- import type { AnyToolDef } from '../../../mcp-server/tools/tool-registration.js';
26
+ import type { AnyToolDef } from '../tool-registration.js';
27
27
  /**
28
28
  * Operator-facing metadata describing why a tool is disabled in the current
29
29
  * deployment and (optionally) how to enable it.
@@ -6,7 +6,7 @@
6
6
  import type { CallToolResult, ContentBlock, InputRequiredResult, ServerContext, ServerNotifier } from '@modelcontextprotocol/server';
7
7
  import { type ZodObject, type ZodRawShape } from 'zod';
8
8
  import type { Context } from '../../../core/context.js';
9
- import { type ResourceSubscriptions } from '../../../mcp-server/notifications.js';
9
+ import { type ResourceSubscriptions } from '../../notifications.js';
10
10
  import type { StorageService } from '../../../storage/core/StorageService.js';
11
11
  import { type JsonRpcErrorCode } from '../../../types-global/errors.js';
12
12
  import type { Logger } from '../../../utils/internal/logger.js';