@cyanheads/mcp-ts-core 0.13.11 → 0.13.12

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 (68) hide show
  1. package/AGENTS.md +4 -4
  2. package/CLAUDE.md +4 -4
  3. package/README.md +1 -1
  4. package/changelog/0.13.x/0.13.12.md +50 -0
  5. package/dist/mcp-server/handlerContext.d.ts +14 -8
  6. package/dist/mcp-server/handlerContext.d.ts.map +1 -1
  7. package/dist/mcp-server/handlerContext.js +16 -9
  8. package/dist/mcp-server/handlerContext.js.map +1 -1
  9. package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts.map +1 -1
  10. package/dist/mcp-server/resources/utils/resourceHandlerFactory.js +7 -10
  11. package/dist/mcp-server/resources/utils/resourceHandlerFactory.js.map +1 -1
  12. package/dist/mcp-server/tools/utils/inputPrevalidation.d.ts +8 -2
  13. package/dist/mcp-server/tools/utils/inputPrevalidation.d.ts.map +1 -1
  14. package/dist/mcp-server/tools/utils/inputPrevalidation.js +18 -7
  15. package/dist/mcp-server/tools/utils/inputPrevalidation.js.map +1 -1
  16. package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts.map +1 -1
  17. package/dist/mcp-server/tools/utils/toolHandlerFactory.js +79 -8
  18. package/dist/mcp-server/tools/utils/toolHandlerFactory.js.map +1 -1
  19. package/dist/mcp-server/transports/auth/lib/authUtils.d.ts +20 -0
  20. package/dist/mcp-server/transports/auth/lib/authUtils.d.ts.map +1 -1
  21. package/dist/mcp-server/transports/auth/lib/authUtils.js +28 -2
  22. package/dist/mcp-server/transports/auth/lib/authUtils.js.map +1 -1
  23. package/dist/mcp-server/transports/auth/lib/checkScopes.d.ts.map +1 -1
  24. package/dist/mcp-server/transports/auth/lib/checkScopes.js +2 -1
  25. package/dist/mcp-server/transports/auth/lib/checkScopes.js.map +1 -1
  26. package/dist/mcp-server/transports/http/httpErrorHandler.d.ts.map +1 -1
  27. package/dist/mcp-server/transports/http/httpErrorHandler.js +4 -2
  28. package/dist/mcp-server/transports/http/httpErrorHandler.js.map +1 -1
  29. package/dist/services/mirror/sqlite/handle.d.ts +13 -2
  30. package/dist/services/mirror/sqlite/handle.d.ts.map +1 -1
  31. package/dist/services/mirror/sqlite/handle.js +17 -6
  32. package/dist/services/mirror/sqlite/handle.js.map +1 -1
  33. package/dist/services/mirror/sqlite/sqliteMirrorStore.d.ts.map +1 -1
  34. package/dist/services/mirror/sqlite/sqliteMirrorStore.js +3 -2
  35. package/dist/services/mirror/sqlite/sqliteMirrorStore.js.map +1 -1
  36. package/dist/utils/internal/error-handler/errorHandler.d.ts +1 -0
  37. package/dist/utils/internal/error-handler/errorHandler.d.ts.map +1 -1
  38. package/dist/utils/internal/error-handler/errorHandler.js +22 -11
  39. package/dist/utils/internal/error-handler/errorHandler.js.map +1 -1
  40. package/dist/utils/internal/error-handler/helpers.d.ts +16 -5
  41. package/dist/utils/internal/error-handler/helpers.d.ts.map +1 -1
  42. package/dist/utils/internal/error-handler/helpers.js +12 -7
  43. package/dist/utils/internal/error-handler/helpers.js.map +1 -1
  44. package/dist/utils/internal/error-handler/types.d.ts +11 -4
  45. package/dist/utils/internal/error-handler/types.d.ts.map +1 -1
  46. package/dist/utils/internal/observabilityCap.d.ts +35 -0
  47. package/dist/utils/internal/observabilityCap.d.ts.map +1 -0
  48. package/dist/utils/internal/observabilityCap.js +43 -0
  49. package/dist/utils/internal/observabilityCap.js.map +1 -0
  50. package/dist/utils/network/fetchWithTimeout.d.ts +3 -1
  51. package/dist/utils/network/fetchWithTimeout.d.ts.map +1 -1
  52. package/dist/utils/network/fetchWithTimeout.js +70 -16
  53. package/dist/utils/network/fetchWithTimeout.js.map +1 -1
  54. package/dist/utils/network/retry.d.ts +22 -2
  55. package/dist/utils/network/retry.d.ts.map +1 -1
  56. package/dist/utils/network/retry.js +29 -1
  57. package/dist/utils/network/retry.js.map +1 -1
  58. package/framework-skills/api-auth/SKILL.md +3 -1
  59. package/framework-skills/api-canvas/SKILL.md +2 -2
  60. package/framework-skills/api-context/SKILL.md +4 -4
  61. package/framework-skills/api-errors/SKILL.md +6 -6
  62. package/framework-skills/api-mirror/SKILL.md +3 -1
  63. package/framework-skills/api-telemetry/SKILL.md +10 -6
  64. package/framework-skills/api-utils/SKILL.md +3 -3
  65. package/framework-skills/field-test/SKILL.md +2 -2
  66. package/framework-skills/git-wrapup/SKILL.md +3 -3
  67. package/framework-skills/tool-defs-analysis/SKILL.md +2 -2
  68. package/package.json +5 -5
@@ -9,6 +9,7 @@ import { withExtra } from '../internal/requestContext.js';
9
9
  import { runtimeCaps } from '../internal/runtime.js';
10
10
  import { httpStatusRetryability, httpStatusToErrorCode, selectErrorHeaders, } from './httpError.js';
11
11
  import { readBoundedResponseText } from './responseBody.js';
12
+ import { causeChainForLog } from './retry.js';
12
13
  import { createHistogram } from '../telemetry/metrics.js';
13
14
  /** Default captured bytes of an upstream error response body. Keeps tool errors from poisoning the agent's context. */
14
15
  const ERROR_BODY_LIMIT = 500;
@@ -36,12 +37,15 @@ export function initHttpClientMetrics() {
36
37
  getHttpClientMetrics();
37
38
  }
38
39
  /**
39
- * Redacts a URL to `origin + pathname` for safe inclusion in error messages and
40
- * logs. Drops the query string — where API keys commonly ride (`?api-key=…`,
41
- * `?api_key=…`, `?key=…`) — along with the fragment and any embedded
42
- * `user:pass@` credentials (`URL.origin` omits userinfo). A trailing `?…` marks
43
- * that a query was present (redacted) so diagnostics still signal it; a
44
- * bare-domain `/` pathname is elided to keep output clean.
40
+ * Names a URL by its origin for error messages and logs:
41
+ * `https://host/sk-key/reverse?lat=1` reads `https://host/…?…`. Credentials
42
+ * ride the query (`?api-key=…`, `?key=…`) and the path alike (Telegram's
43
+ * `/bot<token>/…`, webhook URLs, `https://host/<KEY>/…`), so both are elided
44
+ * behind a marker that still says one was there; a root URL keeps its bare
45
+ * origin (`https://example.com`). The fragment and any `user:pass@` userinfo
46
+ * (`URL.origin` omits it) are dropped. A caller that needs to tell endpoints
47
+ * apart labels the call through its context —
48
+ * `withExtra(ctx, { endpoint: 'reverse' })` — which every record carries.
45
49
  *
46
50
  * Fail-closed: an unparseable URL returns a fixed placeholder rather than
47
51
  * echoing the raw (possibly secret-bearing) string.
@@ -52,14 +56,49 @@ export function initHttpClientMetrics() {
52
56
  function redactUrl(url) {
53
57
  try {
54
58
  const parsed = url instanceof URL ? url : new URL(String(url));
55
- const path = parsed.pathname === '/' ? '' : parsed.pathname;
56
- const marker = parsed.search ? '?…' : '';
57
- return `${parsed.origin}${path}${marker}`;
59
+ const path = parsed.pathname === '/' ? '' : '/…';
60
+ const query = parsed.search ? '?…' : '';
61
+ return `${parsed.origin}${path}${query}`;
58
62
  }
59
63
  catch {
60
64
  return '[unparseable URL]';
61
65
  }
62
66
  }
67
+ /** An absolute `http:`/`https:` URL inside free text, up to the first quote, bracket, or space. */
68
+ const EMBEDDED_URL = /https?:\/\/[^\s"'`<>]+/gi;
69
+ /**
70
+ * Applies {@link redactUrl} to every URL inside a runtime's rejection text. The
71
+ * runtime's message is the one part of a network-error record this helper does
72
+ * not compose, and it can quote the request whole — Bun 1.4 rejects a malformed
73
+ * response with `Malformed_HTTP_Response fetching "<full URL>"`.
74
+ */
75
+ function redactEmbeddedUrls(text) {
76
+ return text.replace(EMBEDDED_URL, (match) => redactUrl(match));
77
+ }
78
+ /**
79
+ * `error` with its `message` set to `message`, written in place so the
80
+ * runtime's identity and transport `code` survive. A rejection that refuses
81
+ * the write — frozen, a getter-only or non-writable `message`, a
82
+ * `DOMException` — is replaced by an `Error` carrying its `name`, `message`,
83
+ * `cause`, and string `code`, so the redaction holds and the failure still
84
+ * classifies as a network error.
85
+ */
86
+ function withRedactedMessage(error, message) {
87
+ if (error.message === message)
88
+ return error;
89
+ try {
90
+ error.message = message;
91
+ }
92
+ catch {
93
+ // A read-only `message` throws in a module; the stand-in below takes over.
94
+ }
95
+ if (error.message === message)
96
+ return error;
97
+ const standIn = new Error(message, error.cause === undefined ? undefined : { cause: error.cause });
98
+ standIn.name = error.name;
99
+ const { code } = error;
100
+ return typeof code === 'string' ? Object.assign(standIn, { code }) : standIn;
101
+ }
63
102
  /**
64
103
  * Parse a dotted-decimal IPv4 address. URL parsing canonicalizes unusual IPv4
65
104
  * spellings (integer, octal, hexadecimal) before this point; DNS answers are
@@ -441,7 +480,9 @@ function withBodyDeadline(response, body, deadline) {
441
480
  * plus the legacy aliases `statusCode` (= `status`) and `responseBody` (= `body`), kept
442
481
  * for existing consumers and slated for consolidation in a future major. List a status in
443
482
  * `options.expectedStatuses` to log it at `debug` rather than `error` (still thrown).
444
- * @throws {McpError} `ServiceUnavailable` if a network-level error occurs.
483
+ * @throws {McpError} `ServiceUnavailable` if a network-level error occurs, chaining
484
+ * the runtime's rejection as `cause` so its transport `code` (`ECONNREFUSED`,
485
+ * `ConnectionRefused`) survives; the failure record carries it as `causeChain`.
445
486
  * @example
446
487
  * ```ts
447
488
  * // Basic GET with a 5-second timeout
@@ -655,18 +696,31 @@ export async function fetchWithTimeout(url, timeoutMs, context, options) {
655
696
  if (fetchSignal.aborted || (error instanceof Error && error.name === 'AbortError')) {
656
697
  throw abortedFailure();
657
698
  }
658
- const errorMessage = error instanceof Error ? error.message : String(error);
699
+ const errorMessage = redactEmbeddedUrls(error instanceof Error ? error.message : String(error));
700
+ /**
701
+ * The runtime's rejection is chained as the wrapper's `cause`, where
702
+ * `handleError` reads its message into `data.rootCause` — client-visible
703
+ * once `tryCatch` throws — and into the logged cause chain. A URL it quotes
704
+ * is redacted on the rejection itself first; its identity, `code`, and
705
+ * every other field stay as the runtime set them. A rejection whose
706
+ * `message` cannot be written is chained as a stand-in instead.
707
+ */
708
+ const cause = error instanceof Error && !(error instanceof McpError)
709
+ ? withRedactedMessage(error, errorMessage)
710
+ : error;
711
+ const originalErrorName = error instanceof Error ? error.name : 'UnknownError';
712
+ const causeChain = causeChainForLog(cause);
659
713
  logger.error(`Network error during ${operationDescription}: ${errorMessage}`, withExtra(context, {
660
- originalErrorName: error instanceof Error ? error.name : 'UnknownError',
714
+ originalErrorName,
661
715
  errorSource: 'FetchNetworkError',
716
+ ...(causeChain && { causeChain }),
662
717
  }));
663
718
  if (error instanceof McpError) {
664
719
  throw error;
665
720
  }
666
- throw serviceUnavailable(`Network error during ${operationDescription}: ${errorMessage}`, {
667
- originalErrorName: error instanceof Error ? error.name : 'UnknownError',
668
- errorSource: 'FetchNetworkErrorWrapper',
669
- });
721
+ // A non-`Error` rejection carries no transport code, and chaining its raw
722
+ // text would put back the URL `errorMessage` redacted.
723
+ throw serviceUnavailable(`Network error during ${operationDescription}: ${errorMessage}`, { originalErrorName, errorSource: 'FetchNetworkErrorWrapper' }, cause instanceof Error ? { cause } : undefined);
670
724
  }
671
725
  finally {
672
726
  if (!deadlineFollowsBody)
@@ -1 +1 @@
1
- {"version":3,"file":"fetchWithTimeout.js","sourceRoot":"","sources":["../../../src/utils/network/fetchWithTimeout.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,EAClB,OAAO,EACP,eAAe,GAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAuB,SAAS,EAAE,MAAM,oCAAoC,CAAC;AACpF,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,uHAAuH;AACvH,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B;;;;;GAKG;AACH,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAErC;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,E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;IAC1E,CAAC;AACH,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { RequestContext } from '../internal/requestContext.js';
1
+ import { type RequestContext } from '../internal/requestContext.js';
2
2
  /**
3
3
  * The per-attempt handle {@link withRetry} passes to its operation.
4
4
  *
@@ -36,7 +36,9 @@ export interface RetryOptions {
36
36
  * Log bindings for correlated logging. When provided, retry log entries
37
37
  * include `requestId`, `traceId`, etc. Passing the handler `Context` is
38
38
  * safe — the logger strips non-serializable fields (`signal`, `log`,
39
- * `state`, protocol method handles) before pino sees them.
39
+ * `state`, protocol method handles) before pino sees them. A retried error
40
+ * with a cause or a string `code` adds `causeChain` to the entry's `extra`,
41
+ * with or without a context.
40
42
  */
41
43
  context?: RequestContext;
42
44
  /**
@@ -126,6 +128,24 @@ export interface RetryOptions {
126
128
  * the same errors, and a second copy of the RFC 9110 forms would drift.
127
129
  */
128
130
  export declare function parseRetryAfterMs(error: unknown): number | undefined;
131
+ /** One entry of the `causeChain` field a retry or network-error log record carries. */
132
+ export interface LoggedCauseNode {
133
+ readonly code?: string;
134
+ readonly message: string;
135
+ readonly name: string;
136
+ }
137
+ /**
138
+ * Projects an error's cause chain for a log record — `{ name, message, code? }`
139
+ * per node, the error itself first — or `undefined` when the error has neither
140
+ * a cause nor a string `code`, so its record stays exactly as it was.
141
+ *
142
+ * Projections only: pino writes an `Error` under any key but `err` as its
143
+ * enumerable properties, and a Bun fetch rejection's `path` holds the full
144
+ * request URL. Stacks and `McpError.data` stay out for the same reason.
145
+ * Module-level, not public: `fetchWithTimeout`'s network-error record carries
146
+ * the same field.
147
+ */
148
+ export declare function causeChainForLog(error: unknown): LoggedCauseNode[] | undefined;
129
149
  /**
130
150
  * Default transient check: `McpError` with a transient code, or any non-McpError
131
151
  * (network failures, unexpected throws) which are assumed transient.
@@ -1 +1 @@
1
- {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../../src/utils/network/retry.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,E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,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,EAAE,GAAG,SAAS,CAQ9E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAuB1D;AA2FD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAC/B,EAAE,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,CAAC,CAAC,EACzC,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,CAAC,CAAC,CA2HZ"}
@@ -5,7 +5,9 @@
5
5
  * @module src/utils/network/retry
6
6
  */
7
7
  import { JsonRpcErrorCode, McpError, timeout } from '../../types-global/errors.js';
8
+ import { extractErrorCauseChain } from '../internal/error-handler/helpers.js';
8
9
  import { logger } from '../internal/logger.js';
10
+ import { withExtra } from '../internal/requestContext.js';
9
11
  /**
10
12
  * Error codes considered transient — eligible for retry.
11
13
  * Matches the framework's error classification in `mappings.ts`.
@@ -71,6 +73,28 @@ export function parseRetryAfterMs(error) {
71
73
  return;
72
74
  return Math.max(0, dateMs - Date.now());
73
75
  }
76
+ /**
77
+ * Projects an error's cause chain for a log record — `{ name, message, code? }`
78
+ * per node, the error itself first — or `undefined` when the error has neither
79
+ * a cause nor a string `code`, so its record stays exactly as it was.
80
+ *
81
+ * Projections only: pino writes an `Error` under any key but `err` as its
82
+ * enumerable properties, and a Bun fetch rejection's `path` holds the full
83
+ * request URL. Stacks and `McpError.data` stay out for the same reason.
84
+ * Module-level, not public: `fetchWithTimeout`'s network-error record carries
85
+ * the same field.
86
+ */
87
+ export function causeChainForLog(error) {
88
+ if (!(error instanceof Error))
89
+ return;
90
+ if (!error.cause && !('code' in error && typeof error.code === 'string'))
91
+ return;
92
+ return extractErrorCauseChain(error).map(({ name, message, code }) => ({
93
+ name,
94
+ message,
95
+ ...(code !== undefined && { code }),
96
+ }));
97
+ }
74
98
  /**
75
99
  * Default transient check: `McpError` with a transient code, or any non-McpError
76
100
  * (network failures, unexpected throws) which are assumed transient.
@@ -331,7 +355,11 @@ export async function withRetry(fn, options = {}) {
331
355
  }
332
356
  const errorMessage = error instanceof Error ? error.message : String(error);
333
357
  const delaySource = retryAfterMs === undefined ? '' : ' (Retry-After)';
334
- logger.debug(`Retry ${attempt + 1}/${maxRetries} for ${operation ?? 'operation'}: ${errorMessage} — waiting ${Math.round(delay)}ms${delaySource}`, context);
358
+ // The transport code (`ECONNRESET`, `ConnectionRefused`) rides the
359
+ // cause chain, not the message — the only trace of why a retry that
360
+ // later succeeds was needed.
361
+ const causeChain = causeChainForLog(error);
362
+ logger.debug(`Retry ${attempt + 1}/${maxRetries} for ${operation ?? 'operation'}: ${errorMessage} — waiting ${Math.round(delay)}ms${delaySource}`, causeChain ? withExtra(context ?? {}, { causeChain }) : context);
335
363
  try {
336
364
  await sleep(delay, attemptSignal);
337
365
  }
@@ -1 +1 @@
1
- {"version":3,"file":"retry.js","sourceRoot":"","sources":["../../../src/utils/network/retry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGpD;;;GAGG;AACH,MAAM,eAAe,GAAG,IAAI,GAAG,CAAmB;IAChD,gBAAgB,CAAC,kBAAkB;IACnC,gBAAgB,CAAC,OAAO;IACxB,gBAAgB,CAAC,WAAW;CAC7B,CAAC,CAAC;AAuHH;;;;;;;;GAQG;AACH,SAAS,YAAY,CACnB,OAAe,EACf,WAAmB,EACnB,UAAkB,EAClB,MAAc;IAEd,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,GAAG,CAAC,IAAI,OAAO,EAAE,UAAU,CAAC,C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IAAI,EAAE,CAAC;IAChB,CAAC;IAED,kDAAkD;IAClD,MAAM,IAAI,QAAQ,CAAC,gBAAgB,CAAC,aAAa,EAAE,iCAAiC,CAAC,CAAC;AACxF,CAAC;AAED,yEAAyE;AACzE,SAAS,KAAK,CAAC,EAAU,EAAE,MAAoB;IAC7C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;YACpB,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACtB,OAAO;QACT,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;QACzC,sFAAsF;QACtF,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC;QAE3F,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,UAAU,CAAC,KAAK,EAAE,CAAC;YACnB,OAAO,EAAE,CAAC;QACZ,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,QAAQ,CAAC,gBAAgB,CACvB,OAAO,EACP,GAAG,EAAE;YACH,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,sEAAsE;YACtE,0EAA0E;YAC1E,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;gBACpB,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACxB,CAAC;QACH,CAAC,EACD,EAAE,IAAI,EAAE,IAAI,EAAE,CACf,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -4,7 +4,7 @@ description: >
4
4
  Authentication, authorization, and multi-tenancy patterns for `@cyanheads/mcp-ts-core`. Use when implementing auth scopes on tools/resources, configuring auth modes (none/jwt/oauth), working with JWT/OAuth env vars, or understanding how tenantId flows through ctx.state.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "1.5"
7
+ version: "1.6"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -36,6 +36,8 @@ When `MCP_AUTH_MODE=none`, auth checks are skipped and defaults are allowed.
36
36
 
37
37
  A failed check returns `Forbidden` (-32005, `Insufficient permissions.`) or, when auth is enabled but the request carries no auth context, `Unauthorized` (-32006). Neither carries `data`: the required, granted, and missing scope names stay in the server log, so a caller cannot enumerate scopes from the error.
38
38
 
39
+ The scope check logs a missing scope at `warning`, naming the missing scopes. On a tool, the call's `Error in tool:<name>` record follows at `notice` with no stack — the refusal is the caller's standing, not a fault in this server — and `mcp.errors.classified` counts it with `mcp.error.severity: "notice"`. That holds for the inline check and for `checkScopes` in a handler alike, and the level is fixed: the refusal carries no `data.reason`, so no `errors[]` entry can set it. A missing auth context keeps its `Error in tool:` record at `error`, and so does a `forbidden()` the handler throws itself. A resource read the inline check refuses writes only the scope check's own records.
40
+
39
41
  ---
40
42
 
41
43
  ## Dynamic auth
@@ -4,7 +4,7 @@ description: >
4
4
  DataCanvas primitive reference — a Tier 3 SQL/analytical workspace for tabular MCP servers, backed by DuckDB. Use when registering tables from upstream APIs, running ad-hoc SQL across them, and exporting results. Covers the acquire → register → query → export flow, per-table TTL, the token-sharing pattern for multi-agent collaboration, env config, and Cloudflare Workers fail-closed behavior.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "2.6"
7
+ version: "2.7"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -329,7 +329,7 @@ Most canvas use cases are public-data analytics: fetch from an upstream API, sta
329
329
  | Table naming | `spillover()` auto-names the table `spilled_<id>`; pass `tableName` for a stable handle. A dataframe-query surface commonly adds its own `df_<id>` convention. |
330
330
  | Access control | Possession of the `canvas_id` is access — unguessable in practice (see [token-sharing model](#the-token-sharing-model)). TTL + the framework rate limiter backstop brute force. |
331
331
  | Enable flag | None of your own — canvas presence is the gate (`CANVAS_PROVIDER_TYPE=duckdb`; `getCanvas()` returns `undefined` otherwise). |
332
- | Tools | A fetcher that spills **plus the dataframe trio — all three ship whenever canvas is integrated**. `dataframe_query` is mandatory once anything emits a `canvas_id`: a token with no query tool in the same server is dead output (the agent can't reach the staged data). `dataframe_describe` is required alongside it — the agent discovers staged table and column names before writing SQL. `dataframe_drop` is implemented but **opt-in via a server env var**: when the flag is off, register it with `disabledTool()` (see `add-tool`) so it stays visible in the manifest with the enable hint while uncallable. None are framework-provided; you register them. |
332
+ | Tools | A fetcher that spills **plus the dataframe trio — all three ship whenever canvas is integrated**. `dataframe_query` is mandatory once anything emits a `canvas_id`: a token with no query tool in the same server is dead output (the agent can't reach the staged data). `dataframe_describe` is required alongside it — the agent discovers staged table and column names before writing SQL. `dataframe_drop` is implemented but **opt-in via a server env var**: when the flag is off, register it with `disabledTool()` (see `add-tool`) so it stays visible in the manifest with the enable hint while uncallable. `acquire()`'s `canvas_not_found` already carries a re-stage hint, which a declared contract recovery never overrides — right for describe/query, wrong for drop (a missing canvas has nothing left to remove). The drop handler catches that reason and re-raises it through its own `ctx.fail('canvas_not_found', …, { cause })`, leaving the contract entry unmarked by `thrownBy: 'service'`. None are framework-provided; you register them. |
333
333
  | Fetcher output | Two things in one response: the inline preview (answer to the immediate question) and the table handle (escape hatch for follow-up SQL via `dataframe_query`). Neither replaces the other. |
334
334
 
335
335
  > The `MCP_HTTP_MAX_BODY_BYTES` request-body cap is **inbound-only** — it bounds the JSON-RPC request, not the upstream data a handler stages into the canvas or the rows it returns. Canvas servers send small requests (queries, SQL, canvas IDs) regardless of dataset size, so the cap never constrains canvas ingestion.
@@ -4,7 +4,7 @@ description: >
4
4
  Canonical reference for the unified `Context` object passed to every tool and resource handler in `@cyanheads/mcp-ts-core`. Covers the full interface, its `RequestContext` base, all sub-APIs (`ctx.log`, `ctx.state`, `ctx.requestInput`, `ctx.inputs`, `ctx.clientCapabilities`, `ctx.enrich`, `ctx.content`), and when to use each.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "2.10"
7
+ version: "2.11"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -87,7 +87,7 @@ interface Context extends RequestContext {
87
87
 
88
88
  | Field | Always present | Source |
89
89
  |:------|:--------------|:-------|
90
- | `requestId` | Yes | The client's JSON-RPC id when it is a string, otherwise a generated `XXXXX-XXXXX` token. Every log record of the call carries it, and the framework returns it on the call's error envelope as `data.requestId` |
90
+ | `requestId` | Yes | A generated `XXXXX-XXXXX` token, one per call — never the client's JSON-RPC id, which the call's log records carry as `jsonRpcId` instead. Every log record of the call carries it, and the framework returns it on the call's error envelope as `data.requestId`. A 2025-era `ctx.requestInput` round trip re-enters the handler under a new token; the shared `jsonRpcId` ties the entries together |
91
91
  | `timestamp` | Yes | ISO 8601, request start |
92
92
  | `tenantId` | Stdio and HTTP+`MCP_AUTH_MODE=none` (as `'default'`); JWT `tid` claim in HTTP+`jwt`/`oauth` | JWT / single-tenant default |
93
93
  | `sessionId` | HTTP `stateful` / `auto` mode; undefined for stdio and stateless HTTP unless opted in | `Mcp-Session-Id` header (or server-minted) — see [§ `ctx.sessionId`](#ctxsessionid) |
@@ -122,11 +122,11 @@ Three supported ways, most common first:
122
122
 
123
123
  ```ts
124
124
  // 1. Per-log-call metadata — the common case. Nothing lands on the context.
125
- ctx.log.info('Retrying upstream call', { attempt, url });
125
+ ctx.log.info('Retrying upstream call', { attempt, endpoint: 'search' });
126
126
 
127
127
  // 2. A copy of this context carrying extra fields. `withExtra` MERGES into any
128
128
  // bag the parent already had; a hand-written `{ ...ctx, extra: {…} }` replaces it.
129
- logger.warning('Retrying upstream call', withExtra(ctx, { attempt, url }));
129
+ logger.warning('Retrying upstream call', withExtra(ctx, { attempt, endpoint: 'search' }));
130
130
 
131
131
  // 3. A derived context for a sub-operation. `additionalContext` lands on `extra`,
132
132
  // merged over whatever the parent already carried.
@@ -4,7 +4,7 @@ description: >
4
4
  McpError constructor, JsonRpcErrorCode reference, and error handling patterns for `@cyanheads/mcp-ts-core`. Use when looking up error codes, understanding where errors should be thrown vs. caught, or using ErrorHandler.tryCatch in services.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "1.19"
7
+ version: "1.20"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -134,14 +134,14 @@ Values are the logger's own level names below `error` — `debug`, `info`, `noti
134
134
 
135
135
  | Surface | Under a declared severity |
136
136
  |:--------|:--------------------------|
137
- | The `Error in tool:<name>` log record | Emitted at the declared level. Same message, same structured fields, the stack included. |
137
+ | The `Error in tool:<name>` log record | Emitted at the declared level. Same message, same structured fields, the stack included — except an argument rejection's record, which is bounded and carries no stack (see below). |
138
138
  | `mcp.errors.classified` | Gains an `mcp.error.severity` attribute. The `reason` itself never becomes a metric attribute. |
139
139
  | `isError`, the JSON-RPC code, `structuredContent.error`, `content[]` | Byte-identical to the undeclared case. |
140
140
  | Span status, `mcp.tool.calls`, `mcp.tool.duration`, `mcp.tool.errors` | Unchanged — the call still failed, and splitting those series would redefine what an error rate means. |
141
141
 
142
142
  **Tools only.** Resolution happens in the tool handler factory, against the thrown error's `data.reason` — the same reason-to-entry lookup that fills `data.recovery`. Resources declare `errors[]` but write no failure record, so the field is accepted there and inert. A reason thrown below the handler that the contract never declared, an entry with no `severity`, and a non-`McpError` throw all keep `error`. A cancelled request keeps its own `info`, stack-free path regardless.
143
143
 
144
- **The framework's own refusals log at `notice`.** An argument rejection (`invalid_arguments`, raised only by the schema gate before the handler runs) and a `ctx.requestInput` the connection cannot serve (`client_capability_missing`) are routine caller or connection traffic, not server faults, so their `Error in tool:<name>` record — and the failure-payload record when `LOG_TOOL_FAILURE_PAYLOADS=true` — is emitted at `notice`, and `mcp.errors.classified` counts them with `mcp.error.severity: "notice"`. Nothing to declare; an `errors[]` entry naming either reason with its own `severity` still wins. The wire envelope and `mcp.tool.rejections` are unchanged, and a schema that wrongly rejects valid calls still shows per tool on `mcp.tool.rejections`.
144
+ **The framework's own refusals log at `notice`.** An argument rejection (`invalid_arguments`, raised only by the schema gate before the handler runs), a `ctx.requestInput` the connection cannot serve (`client_capability_missing`), and a missing-scope refusal (the `Forbidden` the inline `auth` check or `checkScopes` throws) are routine caller or connection traffic, not server faults, so their `Error in tool:<name>` record — and the failure-payload record when `LOG_TOOL_FAILURE_PAYLOADS=true` — is emitted at `notice`, and `mcp.errors.classified` counts them with `mcp.error.severity: "notice"`. Nothing to declare; an `errors[]` entry naming `invalid_arguments` or `client_capability_missing` with its own `severity` still wins, while a missing-scope refusal carries no `data.reason`, so its level is fixed. That refusal is recognized by where it was raised, never by its code: a handler's own `forbidden()`, an upstream 403 mapped by `httpErrorFromResponse`, and a missing auth context (`Unauthorized`) keep `error` and the stack. The missing-scope and argument-rejection records log no stack, and an argument rejection's record is bounded whatever the caller sends: the message, `recovery.hint`, each issue's `message`, each `data.input` key, and every other string keep at most their first 1,024 characters and every array its first 10 entries, with the uncut length or count beside each cut (`originalMessageLength`, `<field>Length`, `<field>Count`, `<field>Lengths`). The wire envelope and `mcp.tool.rejections` are unchanged — the `-32602` result still carries every key and issue whole — and a schema that wrongly rejects valid calls still shows per tool on `mcp.tool.rejections`.
145
145
 
146
146
  **Skip the contract** for one-off internal tools or quick prototypes — `ctx` is plain `Context` (no `fail`) and you throw via [factories](#error-factories-fallback) directly. Behavior is identical at the wire; the contract just adds compile-time safety.
147
147
 
@@ -407,11 +407,11 @@ Recovery: Use pubmed_search_articles to discover valid PMIDs.
407
407
  Important properties:
408
408
  - **`_meta.error` is NOT emitted.** Error code/data live on `structuredContent.error` instead. Don't read `_meta.error` in clients or tests — it doesn't exist.
409
409
  - **`data` propagation is restricted** to explicitly-thrown `McpError.data`, `ZodError.issues`, and the request id. Auto-classified plain errors (`TypeError`, network errors, etc.) emit `code`, `message`, and `data: { requestId }` only, so internal classification context never leaks to clients.
410
- - **`data.requestId` names the request.** The framework sets it on every error envelope it builds — a tool result (handler throws, argument rejections, auth refusals, output-contract failures), a failed resource read, a failed prompt, and the JSON-RPC errors `httpErrorHandler` returns — to the `requestId` that call's log records carry. On a tool, resource, or prompt call that is a generated `XXXXX-XXXXX` token, or the client's JSON-RPC id when that id is a string; `httpErrorHandler` generates its own token, the one on its `Client error:` record. A failure reported from the client resolves to its `Error in tool:<name>` record by that value. A resource read refused before it is measured (an auth refusal, or URI variables that fail `params`) carries an id no log record shares, since resources write no failure record of their own. It is added where the envelope is built, never to the thrown `McpError.data`, so `ErrorHandler.handleError` / `tryCatch` results and the log record's `errorData` stay context-free; it replaces a thrown `data.requestId`, the way canonical fields win in log records. Two envelopes go without it: a resource `-32602` whose `data` is exactly `{ uri }` (the resource-not-found shape clients match exactly), and `runToolContract` results, which have no real request. It closes the `content[]` terms line, alone as `(request <id>)` when there is no `reason` or `retryable` — so a test pinning `content[0].text` exactly sees it.
410
+ - **`data.requestId` names the request.** The framework sets it on every error envelope it builds — a tool result (handler throws, argument rejections, auth refusals, output-contract failures), a failed resource read, a failed prompt, and the JSON-RPC errors `httpErrorHandler` returns — to the `requestId` that call's log records carry. It is always a generated `XXXXX-XXXXX` token, one per call — never the client's JSON-RPC id, which the call's records carry as `jsonRpcId` and the response keeps as its `id`. `httpErrorHandler`'s is the token on its `Client error:` record. A failure reported from the client resolves to its `Error in tool:<name>` record by that value. A resource read refused before it is measured (an auth refusal, or URI variables that fail `params`) carries an id no log record shares, since resources write no failure record of their own. It is added where the envelope is built, never to the thrown `McpError.data`, so `ErrorHandler.handleError` / `tryCatch` results and the log record's `errorData` stay context-free; it replaces a thrown `data.requestId`, the way canonical fields win in log records. Two envelopes go without it: a resource `-32602` whose `data` is exactly `{ uri }` (the resource-not-found shape clients match exactly), and `runToolContract` results, which have no real request. It closes the `content[]` terms line, alone as `(request <id>)` when there is no `reason` or `retryable` — so a test pinning `content[0].text` exactly sees it.
411
411
  - **Recovery hint mirroring is automatic, unless the hint repeats the message.** When the thrown `McpError` carries `data.recovery.hint`, the handler factory appends it to the `content[]` text so the markdown surface matches the JSON surface. Authors don't need to format the hint manually. The one exception is a hint the trimmed message already contains verbatim (case-sensitively) — an argument rejection whose every hint sentence restates an issue, where the hint is the message's issue text verbatim, and an author hint that restates its own message. There the line adds no next step, so it is dropped from the text; `structuredContent.error.data.recovery.hint` stays populated either way.
412
412
  - **`reason`, `retryable`, and `requestId` render as a trailing term line.** `(reason malformed_id · not retryable · request UTFAC-QE0MB)` closes the text whenever `data.reason` is a non-empty string, `data.retryable` is a boolean, or `data.requestId` is a non-empty string — `retryable` for `true`, `not retryable` for `false`, in that order. None present (an `McpError` with no `data` built outside a request, as `runToolContract` does) appends nothing at all. The numeric `code` and `data.issues` stay JSON-only on purpose: the code is the one envelope field a model cannot act on, and the message already renders each issue as a sentence. A consumer test pinning `content[0].text` exactly, rather than asserting it contains the diagnostic, therefore moves for any error carrying a reason.
413
413
  - **Argument-schema rejection is a tool error with the same envelope.** An unknown root key, a wrong type, a missing required field, or a failed constraint returns `isError: true` with `structuredContent.error.code = -32602` (`InvalidParams`) and the readable `Invalid arguments for tool <name>: …` diagnostic in `content[]`. The handler never runs. Two neighbouring failures keep the protocol error path instead, arriving as a JSON-RPC error rather than a tool result: an unknown or disabled tool name, and a malformed request envelope.
414
- - **`invalid_arguments` is the framework-owned reason on every argument rejection.** The rejection carries `data.reason: "invalid_arguments"` and a `data.recovery.hint` the framework synthesizes from the Zod issues, the arguments as sent, and the root schema — an unknown root key names the root properties the tool does accept, an unknown key inside a nested strict object names its full path and that object's own keys (`Unknown key opts.b. opts accepts: a.`, `Unknown key items.1.b. items.1 accepts: name.`), a wrong type names the type to send instead (a fractional number on an integer field reads `Send rows as an integer, not a fractional number.`), missing fields collapse into one `Provide …` sentence, and anything else restates its diagnostic line, field path included (`start: Must be a parseable ISO 8601 date`), so identical constraints on different fields stay distinguishable. When every sentence restates an issue, the hint is the message's issue text verbatim, and its `Recovery:` line is dropped from `content[]`. Beside a framework sentence each restatement is terminated and a repeated sentence appears once: `start: Must be a parseable ISO 8601 date. Send n as a number, not a string.` When pre-validation rewrote or dropped a key the caller wrote, the rejection says so, since its issues name only the keys that were validated: `data.input` carries `{ aliased: [{ alias, target }], ignored: [...] }` — keys only, in argument order, `ignored` holding the undeclared underscore-prefixed keys the drop discarded — and the hint closes with `Validated query as targetQuery.` / `Dropped undeclared key _max.`, framework sentences that keep the `Recovery:` line. An ignore-list drop (`_meta`, `toolCallId`, a server's `input.ignoreKeys`) is a client artifact and is never reported, and a rejection the step changed nothing on carries no `data.input`. The reason renders on the closing `(reason invalid_arguments · request <id>)`; this path sets no `retryable`. Its `Error in tool:<name>` record logs at `notice`, not `error`. Authors declare nothing for this: the rejection happens before the handler and the hint is derived from the schema.
414
+ - **`invalid_arguments` is the framework-owned reason on every argument rejection.** The rejection carries `data.reason: "invalid_arguments"` and a `data.recovery.hint` the framework synthesizes from the Zod issues, the arguments as sent, and the root schema — an unknown root key names the root properties the tool does accept, an unknown key inside a nested strict object names its full path and that object's own keys (`Unknown key opts.b. opts accepts: a.`, `Unknown key items.1.b. items.1 accepts: name.`), a wrong type names the type to send instead (a fractional number on an integer field reads `Send rows as an integer, not a fractional number.`), missing fields collapse into one `Provide …` sentence, and anything else restates its diagnostic line, field path included (`start: Must be a parseable ISO 8601 date`), so identical constraints on different fields stay distinguishable. When every sentence restates an issue, the hint is the message's issue text verbatim, and its `Recovery:` line is dropped from `content[]`. Beside a framework sentence each restatement is terminated and a repeated sentence appears once: `start: Must be a parseable ISO 8601 date. Send n as a number, not a string.` When pre-validation rewrote or dropped a key the caller wrote, the rejection says so, since its issues name only the keys that were validated: `data.input` carries `{ aliased: [{ alias, target }], ignored: [...] }` — keys only, in argument order, `ignored` holding the undeclared underscore-prefixed keys the drop discarded — and the hint closes with `Validated query as targetQuery.` / `Dropped undeclared key _max.`, framework sentences that keep the `Recovery:` line. An ignore-list drop (`_meta`, `toolCallId`, a server's `input.ignoreKeys`) is a client artifact and is never reported, and a rejection the step changed nothing on carries no `data.input`. The reason renders on the closing `(reason invalid_arguments · request <id>)`; this path sets no `retryable`. Its `Error in tool:<name>` record logs at `notice`, not `error`, with no stack and its caller-sized strings and arrays capped (see `severity` above). Authors declare nothing for this: the rejection happens before the handler and the hint is derived from the schema.
415
415
  - **`client_capability_missing` is the other framework-owned reason.** When a handler returns `ctx.requestInput({ inputRequests: … })` on a 2025-era connection whose client declared no matching capability, `ctx.requestInput` throws this failure in place of the input-required signal, before anything reaches the wire. It is an ordinary handler throw from there on, logged at `notice`: measured as the failed call it is, and shaped by the family's usual error path — a tool gets `structuredContent.error.code = -32600` (`InvalidRequest`), `data.reason: "client_capability_missing"`, and a `data.recovery.hint` naming the capability; a resource read gets the same code, reason, and hint through the JSON-RPC error envelope. The hint ends at reconnecting with a client that declares the capability, since a consent gate has no argument that could stand in for its answer; a handler whose arguments can appends its own sentence per call with `ctx.requestInput(spec, { fallbackHint })`. Like `invalid_arguments`, a definition cannot declare it in `errors[]`: it names a property of the connection, not a domain outcome. See `api-context`'s `ctx.requestInput`.
416
416
  - **A schema constraint cannot carry a *declared* reason.** Because the handler never runs, a rejection by `.max()`, `.regex()`, `.min()`, or any other Zod refinement bypasses `errors[]` entirely: it arrives as `InvalidParams` with `data.issues` under the framework's `invalid_arguments`, never the `reason` and authored `recovery` of a contract entry — so a caller has nothing tool-specific to branch on and gets only the schema-derived hint. Decide per constraint which surface it belongs on. A bound that is purely structural — the input is the wrong shape and no guidance beyond the diagnostic would help — belongs on the schema, where it also advertises itself in `inputSchema`. A bound a caller is expected to recover from belongs in the handler as `ctx.fail('reason', message)` against a declared `errors[]` entry, whose `recovery` the framework puts on the wire, with the limit restated in the field's `.describe()` so it is still visible before the call. Enforcing the same bound in both places is the trap: the schema wins, and the contract entry becomes unreachable while still reading as covered.
417
417
  - **A rejected value never reaches the client.** The rendered sentence distinguishes an omitted field from a wrong one (`what: Missing required field. Expected one of "os"|"cpu"` rather than the invalid-option text), and a union renders the branch that says what would have been accepted instead of Zod's `Invalid input` placeholder. Both read the arguments in-process for the absent/present bit and the arriving type only — `data.issues` ships the Zod issues as-is, and no value the caller sent is copied onto them.
@@ -478,7 +478,7 @@ const parsed = await ErrorHandler.tryCatch(
478
478
  | `errorCode` | `JsonRpcErrorCode` | No | Code used if the caught error is not already an `McpError` |
479
479
  | `input` | `unknown` | No | Input value sanitized and logged alongside the error |
480
480
  | `critical` | `boolean` | No | Marks the error as critical in logs (default `false`) |
481
- | `includeStack` | `boolean` | No | Include stack trace in log output (default `true`) |
481
+ | `includeStack` | `boolean` | No | Stack traces in the log record (default `true`). `false` drops every one — `stack`, `errorData.originalStack` (also one carried in a caught `McpError`'s `data`), and each `causeChain` node's `stack` — and keeps the chain itself; the thrown error and the span exception are unaffected |
482
482
  | `errorMapper` | `(error: unknown) => Error` | No | Custom transform applied instead of default `McpError` wrapping |
483
483
 
484
484
  ---
@@ -4,7 +4,7 @@ description: >
4
4
  Stand up a persistent, self-refreshing local mirror of a bulk upstream dataset with the MirrorService (@cyanheads/mcp-ts-core/mirror). Use when a server wraps a large or slow API and should query a synced local index (embedded SQLite + FTS5) instead of paginating the live API per request.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "1.4"
7
+ version: "1.5"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -72,6 +72,8 @@ Why they can't merge: during a from-scratch init the records aren't ordered by t
72
72
  | `schema_version` + migration *runner* | Scheduling + init/refresh bootstrap (see below) |
73
73
  | Generic `query()` + the raw-handle escape hatch | Server-specific access paths via the raw handle |
74
74
 
75
+ A store that cannot be opened or initialized (a lock held past `busyTimeoutMs`, an unreadable or corrupted file, a parent directory that cannot be created, a migration that throws) rejects with `DatabaseError` (`-32010`). The caller sees the store's file name and a `data.recovery.hint`, never its directory; the driver or filesystem error stays on `cause` for the log.
76
+
75
77
  ## Querying
76
78
 
77
79
  `query({ match?, filters?, sort?, limit, offset })` covers the common case:
@@ -4,7 +4,7 @@ description: >
4
4
  Catalog of OpenTelemetry instrumentation built into framework `@cyanheads/mcp-ts-core` — spans, metrics, completion logs, env config, runtime caveats, custom instrumentation patterns, and cardinality rules. Use when enabling OTel export, adding custom spans or metrics in services, debugging missing telemetry, looking up attribute names, or deciding what's safe to put on a metric attribute vs. a span.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "1.17"
7
+ version: "1.18"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -157,7 +157,7 @@ The three `mcp.input.*` counters are the pre-validation step's metrics. Each mar
157
157
 
158
158
  **Every label is author- or framework-defined — the caller's own key text is never one.** `mcp.input.ignore_rule` is the ignore-list entry that matched or the fixed `underscore_prefix`, bounded by the list's length plus one. `mcp.input.aliased` is labelled by the canonical `mcp.input.target` (a declared property of the tool) and `mcp.input.alias_kind`, not by the alias the caller sent — the case-style half accepts every `-`/`_`/case permutation of a declared key, so labelling the alias would put a caller-controlled set on a permanent series. That is the unbounded-label leak removed from the rate-limiter counter in 0.9.0: a metric attribute set lives until process restart, so anything the caller names belongs on a span or in a log, never on a counter.
159
159
 
160
- **To find the raw key, read the debug log**, which carries `ignoredKey` / `alias` alongside the bounded rule and target. The counter tells you a client artifact exists and how often; the log tells you what it is called, which is what you need before extending `input.ignoreKeys`, declaring an `inputAliases` entry, or renaming a parameter.
160
+ **To find the raw key, read the debug log**, which carries `ignoredKey` / `alias` alongside the bounded rule and target — at most its first 1,024 characters, with `ignoredKeyLength` / `aliasLength` holding the uncut length of a longer key. The counter tells you a client artifact exists and how often; the log tells you what it is called, which is what you need before extending `input.ignoreKeys`, declaring an `inputAliases` entry, or renaming a parameter.
161
161
 
162
162
  ### Outbound pacer
163
163
 
@@ -216,7 +216,7 @@ A definition may put `severity` on an `errors[]` entry — `debug`, `info`, `not
216
216
  - The `Error in tool:<name>` log record is emitted at that level instead of `error`, with the same message and structured fields.
217
217
  - `mcp.errors.classified` gains `mcp.error.severity` on that record. It is set only when a severity resolved below `error`.
218
218
 
219
- The framework's own refusals resolve one without a declaration: an argument rejection (`invalid_arguments`) and a `ctx.requestInput` the client connection cannot serve (`client_capability_missing`) log at `notice`, so even a server that declares no severity sees `mcp.error.severity: "notice"` on those `mcp.errors.classified` increments — a bounded split a dashboard can use to separate caller rejections from faults. An argument rejection opens no execution span and reaches no call counter either way; it still counts once on `mcp.tool.rejections`.
219
+ The framework's own refusals resolve one without a declaration: an argument rejection (`invalid_arguments`), a `ctx.requestInput` the client connection cannot serve (`client_capability_missing`), and a missing-scope refusal from the inline `auth` check or `checkScopes` log at `notice`, so even a server that declares no severity sees `mcp.error.severity: "notice"` on those `mcp.errors.classified` increments — a bounded split a dashboard can use to separate caller rejections from faults. A missing auth context (`-32006`), a handler's own `forbidden()`, and an upstream 403 stay at `error`. An argument rejection and an inline missing-scope refusal open no execution span and reach no call counter either way; each still counts once on `mcp.tool.rejections`. Neither the argument-rejection nor the missing-scope record carries a stack.
220
220
 
221
221
  The call still failed: the execution span keeps `SpanStatusCode.ERROR` and its recorded exception, `mcp.tool.calls` / `mcp.tool.duration` / `mcp.tool.errors` record the same values, and the completion log still reads `isSuccess: false`. Splitting those series on an authoring decision would redefine what an error rate means. Tools only — resources write no failure record of their own. A cancelled request keeps its own `info`, stack-free path whatever the contract declares. See `api-errors`.
222
222
 
@@ -224,7 +224,7 @@ The call still failed: the execution span keeps `SpanStatusCode.ERROR` and its r
224
224
 
225
225
  | Metric | Type | Unit | Attributes |
226
226
  |:-------|:-----|:-----|:-----------|
227
- | `mcp.errors.classified` | counter | `{errors}` | `mcp.error.classified_code` (JSON-RPC code), `mcp.error.category` (`upstream`/`server`/`client`, as in [Error category](#error-category)), `operation`, and `mcp.error.severity` when a tool failure's level resolved below `error` — a declared severity, or `notice` for an `invalid_arguments` / `client_capability_missing` refusal |
227
+ | `mcp.errors.classified` | counter | `{errors}` | `mcp.error.classified_code` (JSON-RPC code), `mcp.error.category` (`upstream`/`server`/`client`, as in [Error category](#error-category)), `operation`, and `mcp.error.severity` when a tool failure's level resolved below `error` — a declared severity, or `notice` for an `invalid_arguments` / `client_capability_missing` refusal or a missing-scope refusal |
228
228
  | `mcp.ratelimit.rejections` | counter | `{rejections}` | — (the rate-limit key is caller-supplied and typically per-client, so it would materialize an unbounded series in the meter; per-key attribution lives on the span instead) |
229
229
  | `http.client.request.duration` | histogram | `s` | `http.request.method`, `server.address`, `http.response.status_code` (when > 0; absent on network errors before a response is received) |
230
230
 
@@ -257,11 +257,15 @@ For domain logging inside handlers, use `ctx.log` (`debug`/`info`/`notice`/`warn
257
257
 
258
258
  Every record of a resource read — scope checks, the handler's `ctx.log` lines, the completion record — carries the read's URI as `resourceUri`, capped like `mcp.resource.uri`, plus `resourceUriLength` when the cap cut it. The handler's `ctx.uri` and the response keep the full URI.
259
259
 
260
- A failed tool call or prompt adds exactly one `Error in tool:<name>` / `Error in prompt:<name>` record. Each call — prompts included — logs under its own `requestId`, and the client receives that value as `data.requestId` on the call's error envelope, so a reported failure resolves to its records.
260
+ Every record of a tool call, resource read, or `prompts/get` carries the client's JSON-RPC id as `jsonRpcId`, string or number as sent; a string over 1,024 characters keeps at most its first 1,024, plus `jsonRpcIdLength` with the uncut length. `httpErrorHandler`'s records carry the request body's id the same way. It is a log field only — no span or metric attribute carries it — and never the call's `requestId`; the response `id` returns it unchanged. A 2025-era `ctx.requestInput` round trip, which the SDK serves by re-entering the handler, logs each entry under a new `requestId`; the shared `jsonRpcId` ties them together.
261
+
262
+ A failed tool call or prompt adds exactly one `Error in tool:<name>` / `Error in prompt:<name>` record. Each call — prompts included — logs under its own generated `requestId`, and the client receives that value as `data.requestId` on the call's error envelope, so a reported failure resolves to its records.
263
+
264
+ An argument rejection's `Error in tool:<name>` record is bounded whatever the caller sends: every string it takes from the rejection — the message (so `msg` and `errorData.originalMessage`), `recovery.hint`, each issue's `message`, each `input` key — keeps at most its first 1,024 characters, and every array its first 10 entries. Each cut records the uncut length or count beside it: `originalMessageLength` for the message, `<field>Length` beside a cut string, `<field>Count` beside a cut array, and `<field>Lengths` — the uncut length of each entry kept — beside an array one of whose entries was cut. A rejection within the caps carries no such field. The `-32602` result the caller receives is built from the uncut rejection.
261
265
 
262
266
  ### Failed-call payloads
263
267
 
264
- Off by default. With `LOG_TOOL_FAILURE_PAYLOADS=true`, a failed tool call writes one more record right after its `Error in tool:<name>` record: message `Tool failure payload: <name>`, the same request context (`requestId`, `traceId`, `spanId`, `toolName`), and the same level, a declared `severity` and the `notice` of an argument rejection included. A payload record below `MCP_LOG_LEVEL` is dropped with its `Error in tool:` record, so at `warning` or above an argument rejection writes neither.
268
+ Off by default. With `LOG_TOOL_FAILURE_PAYLOADS=true`, a failed tool call writes one more record right after its `Error in tool:<name>` record: message `Tool failure payload: <name>`, the same request context (`requestId`, `traceId`, `spanId`, `toolName`), and the same level, a declared `severity` and the `notice` of a framework refusal included. A payload record below `MCP_LOG_LEVEL` is dropped with its `Error in tool:` record, so at `warning` or above an argument rejection writes neither.
265
269
 
266
270
  | Field | Content |
267
271
  |:------|:--------|