@cyanheads/mcp-ts-core 0.7.6 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +22 -7
- package/README.md +2 -2
- package/changelog/0.8.x/0.8.0.md +33 -0
- package/changelog/0.8.x/0.8.1.md +17 -0
- package/changelog/template.md +13 -0
- package/dist/core/context.d.ts +67 -0
- package/dist/core/context.d.ts.map +1 -1
- package/dist/core/context.js +46 -1
- package/dist/core/context.js.map +1 -1
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -1
- package/dist/linter/rules/error-contract-rules.d.ts +45 -0
- package/dist/linter/rules/error-contract-rules.d.ts.map +1 -0
- package/dist/linter/rules/error-contract-rules.js +321 -0
- package/dist/linter/rules/error-contract-rules.js.map +1 -0
- package/dist/linter/rules/handler-body-rules.d.ts +18 -0
- package/dist/linter/rules/handler-body-rules.d.ts.map +1 -0
- package/dist/linter/rules/handler-body-rules.js +134 -0
- package/dist/linter/rules/handler-body-rules.js.map +1 -0
- package/dist/linter/rules/index.d.ts +2 -0
- package/dist/linter/rules/index.d.ts.map +1 -1
- package/dist/linter/rules/index.js +2 -0
- package/dist/linter/rules/index.js.map +1 -1
- package/dist/linter/rules/resource-rules.d.ts.map +1 -1
- package/dist/linter/rules/resource-rules.js +9 -0
- package/dist/linter/rules/resource-rules.js.map +1 -1
- package/dist/linter/rules/source-text.d.ts +19 -0
- package/dist/linter/rules/source-text.d.ts.map +1 -0
- package/dist/linter/rules/source-text.js +96 -0
- package/dist/linter/rules/source-text.js.map +1 -0
- package/dist/linter/rules/tool-rules.d.ts.map +1 -1
- package/dist/linter/rules/tool-rules.js +9 -0
- package/dist/linter/rules/tool-rules.js.map +1 -1
- package/dist/logs/combined.log +4 -4
- package/dist/logs/error.log +4 -4
- package/dist/mcp-server/apps/appBuilders.d.ts +9 -4
- package/dist/mcp-server/apps/appBuilders.d.ts.map +1 -1
- package/dist/mcp-server/apps/appBuilders.js +4 -0
- package/dist/mcp-server/apps/appBuilders.js.map +1 -1
- package/dist/mcp-server/resources/resource-registration.d.ts.map +1 -1
- package/dist/mcp-server/resources/resource-registration.js +3 -2
- package/dist/mcp-server/resources/resource-registration.js.map +1 -1
- package/dist/mcp-server/resources/utils/resourceDefinition.d.ts +13 -5
- package/dist/mcp-server/resources/utils/resourceDefinition.d.ts.map +1 -1
- package/dist/mcp-server/resources/utils/resourceDefinition.js.map +1 -1
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts.map +1 -1
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.js +5 -4
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.js.map +1 -1
- package/dist/mcp-server/tools/tool-registration.d.ts.map +1 -1
- package/dist/mcp-server/tools/tool-registration.js +13 -7
- package/dist/mcp-server/tools/tool-registration.js.map +1 -1
- package/dist/mcp-server/tools/utils/toolDefinition.d.ts +64 -16
- package/dist/mcp-server/tools/utils/toolDefinition.d.ts.map +1 -1
- package/dist/mcp-server/tools/utils/toolDefinition.js +25 -11
- package/dist/mcp-server/tools/utils/toolDefinition.js.map +1 -1
- package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts.map +1 -1
- package/dist/mcp-server/tools/utils/toolHandlerFactory.js +6 -4
- package/dist/mcp-server/tools/utils/toolHandlerFactory.js.map +1 -1
- package/dist/testing/index.d.ts +8 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +5 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/types-global/errors.d.ts +82 -0
- package/dist/types-global/errors.d.ts.map +1 -1
- package/dist/types-global/errors.js +25 -0
- package/dist/types-global/errors.js.map +1 -1
- package/dist/utils/formatting/index.d.ts +1 -0
- package/dist/utils/formatting/index.d.ts.map +1 -1
- package/dist/utils/formatting/index.js +1 -0
- package/dist/utils/formatting/index.js.map +1 -1
- package/dist/utils/formatting/partialResult.d.ts +145 -0
- package/dist/utils/formatting/partialResult.d.ts.map +1 -0
- package/dist/utils/formatting/partialResult.js +145 -0
- package/dist/utils/formatting/partialResult.js.map +1 -0
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/network/httpError.d.ts +112 -0
- package/dist/utils/network/httpError.d.ts.map +1 -0
- package/dist/utils/network/httpError.js +153 -0
- package/dist/utils/network/httpError.js.map +1 -0
- package/dist/utils/network/retry.d.ts.map +1 -1
- package/dist/utils/network/retry.js +0 -1
- package/dist/utils/network/retry.js.map +1 -1
- package/package.json +5 -4
- package/scripts/split-changelog.ts +133 -0
- package/skills/add-app-tool/SKILL.md +12 -0
- package/skills/add-resource/SKILL.md +40 -0
- package/skills/add-service/SKILL.md +54 -1
- package/skills/add-test/SKILL.md +39 -0
- package/skills/add-tool/SKILL.md +42 -5
- package/skills/api-context/SKILL.md +75 -1
- package/skills/api-errors/SKILL.md +183 -5
- package/skills/api-linter/SKILL.md +223 -3
- package/skills/api-testing/SKILL.md +79 -4
- package/skills/api-utils/SKILL.md +4 -2
- package/skills/design-mcp-server/SKILL.md +13 -10
- package/skills/field-test/SKILL.md +81 -15
- package/skills/maintenance/SKILL.md +5 -2
- package/skills/report-issue-framework/SKILL.md +2 -2
- package/skills/security-pass/SKILL.md +6 -5
- package/templates/AGENTS.md +23 -8
- package/templates/CLAUDE.md +23 -8
- package/templates/changelog/template.md +18 -5
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Shared text utilities for handler-source heuristic lint rules.
|
|
3
|
+
* @module src/linter/rules/source-text
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Replaces the contents of single-line comments, block comments, and string
|
|
7
|
+
* literals with same-length whitespace runs. Preserves line structure (so any
|
|
8
|
+
* future line-aware diagnostics still align) without falsely matching
|
|
9
|
+
* anti-pattern regexes against documentation or sample text inside literals.
|
|
10
|
+
*
|
|
11
|
+
* Used by the handler-body and error-contract conformance rules so a comment
|
|
12
|
+
* like `// throws NotFound` doesn't pollute the scan.
|
|
13
|
+
*
|
|
14
|
+
* Limitations: regex literals are not stripped. If a regex contains the literal
|
|
15
|
+
* text `throw new Error(`, it would still trigger a false positive — but that is
|
|
16
|
+
* a deliberate trade-off; full lexing is overkill for a heuristic warning.
|
|
17
|
+
*/
|
|
18
|
+
export function stripCommentsAndStrings(source) {
|
|
19
|
+
let out = '';
|
|
20
|
+
let i = 0;
|
|
21
|
+
const n = source.length;
|
|
22
|
+
while (i < n) {
|
|
23
|
+
const ch = source[i];
|
|
24
|
+
const next = source[i + 1];
|
|
25
|
+
// Line comment
|
|
26
|
+
if (ch === '/' && next === '/') {
|
|
27
|
+
out += '//';
|
|
28
|
+
i += 2;
|
|
29
|
+
while (i < n && source[i] !== '\n') {
|
|
30
|
+
out += ' ';
|
|
31
|
+
i++;
|
|
32
|
+
}
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
// Block comment
|
|
36
|
+
if (ch === '/' && next === '*') {
|
|
37
|
+
out += '/*';
|
|
38
|
+
i += 2;
|
|
39
|
+
while (i < n && !(source[i] === '*' && source[i + 1] === '/')) {
|
|
40
|
+
out += source[i] === '\n' ? '\n' : ' ';
|
|
41
|
+
i++;
|
|
42
|
+
}
|
|
43
|
+
if (i < n) {
|
|
44
|
+
out += '*/';
|
|
45
|
+
i += 2;
|
|
46
|
+
}
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
// String literal: ', ", `
|
|
50
|
+
if (ch === "'" || ch === '"' || ch === '`') {
|
|
51
|
+
const quote = ch;
|
|
52
|
+
out += quote;
|
|
53
|
+
i++;
|
|
54
|
+
while (i < n && source[i] !== quote) {
|
|
55
|
+
if (source[i] === '\\' && i + 1 < n) {
|
|
56
|
+
out += ' ';
|
|
57
|
+
i += 2;
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
// Template literals can contain `${...}` — preserve those so we don't
|
|
61
|
+
// miss patterns like `throw new Error(\`x: ${JSON.stringify(y)}\`)`.
|
|
62
|
+
if (quote === '`' && source[i] === '$' && source[i + 1] === '{') {
|
|
63
|
+
let depth = 1;
|
|
64
|
+
out += '${';
|
|
65
|
+
i += 2;
|
|
66
|
+
while (i < n && depth > 0) {
|
|
67
|
+
if (source[i] === '{')
|
|
68
|
+
depth++;
|
|
69
|
+
else if (source[i] === '}')
|
|
70
|
+
depth--;
|
|
71
|
+
if (depth > 0) {
|
|
72
|
+
out += source[i];
|
|
73
|
+
i++;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (i < n) {
|
|
77
|
+
out += '}';
|
|
78
|
+
i++;
|
|
79
|
+
}
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
out += source[i] === '\n' ? '\n' : ' ';
|
|
83
|
+
i++;
|
|
84
|
+
}
|
|
85
|
+
if (i < n) {
|
|
86
|
+
out += quote;
|
|
87
|
+
i++;
|
|
88
|
+
}
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
out += ch;
|
|
92
|
+
i++;
|
|
93
|
+
}
|
|
94
|
+
return out;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=source-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-text.js","sourceRoot":"","sources":["../../../src/linter/rules/source-text.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAc;IACpD,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC;IAExB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACb,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QACrB,MAAM,IAAI,GAAG,MAA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E,CAAC;IACN,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-rules.d.ts","sourceRoot":"","sources":["../../../src/linter/rules/tool-rules.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-rules.d.ts","sourceRoot":"","sources":["../../../src/linter/rules/tool-rules.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAWlD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,cAAc,EAAE,CA4FjE;AAED,+EAA+E;AAC/E,wBAAgB,cAAc,CAC5B,IAAI,EAAE,OAAO,EACb,cAAc,EAAE,cAAc,CAAC,gBAAgB,CAAC,EAChD,cAAc,EAAE,MAAM,GACrB,cAAc,EAAE,CA8BlB;AAgDD;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,OAAO,EAAE,EAChB,SAAS,EAAE,OAAO,EAAE,GACnB,cAAc,EAAE,CA6ClB"}
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
* Validates tool definitions against MCP spec and framework conventions.
|
|
4
4
|
* @module src/linter/rules/tool-rules
|
|
5
5
|
*/
|
|
6
|
+
import { lintErrorContract, lintErrorContractConformance } from './error-contract-rules.js';
|
|
6
7
|
import { lintFormatParity } from './format-parity-rules.js';
|
|
8
|
+
import { lintHandlerBody } from './handler-body-rules.js';
|
|
7
9
|
import { checkNameRequired, checkToolNameFormat } from './name-rules.js';
|
|
8
10
|
import { checkFieldDescriptions, checkIsZodObject, checkSchemaSerializable, } from './schema-rules.js';
|
|
9
11
|
/**
|
|
@@ -82,6 +84,13 @@ export function lintToolDefinition(def) {
|
|
|
82
84
|
if (d?._meta && typeof d._meta === 'object') {
|
|
83
85
|
diagnostics.push(...lintToolMeta(d._meta, displayName));
|
|
84
86
|
}
|
|
87
|
+
// Handler body heuristic checks (error-handling anti-patterns)
|
|
88
|
+
diagnostics.push(...lintHandlerBody(d, 'tool'));
|
|
89
|
+
// Declarative error contract validation
|
|
90
|
+
if (d?.errors !== undefined) {
|
|
91
|
+
diagnostics.push(...lintErrorContract(d.errors, 'tool', displayName));
|
|
92
|
+
diagnostics.push(...lintErrorContractConformance(d, 'tool', displayName));
|
|
93
|
+
}
|
|
85
94
|
return diagnostics;
|
|
86
95
|
}
|
|
87
96
|
/** Validates that auth scopes are well-formed (array of non-empty strings). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-rules.js","sourceRoot":"","sources":["../../../src/linter/rules/tool-rules.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAE3B;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAY;IAC7C,MAAM,WAAW,GAAqB,EAAE,CAAC;IACzC,MAAM,CAAC,GAAG,GAA8B,CAAC;IACzC,MAAM,IAAI,GAAG,OAAO,CAAC,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IACvD,MAAM,WAAW,GAAG,IAAI,IAAI,WAAW,CAAC;IAExC,kBAAkB;IAClB,MAAM,OAAO,GAAG,iBAAiB,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACzD,IAAI,OAAO;QAAE,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAEvC,IAAI,IAAI,EAAE,CAAC;Q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,cAAc,EAAE,QAAQ;aACzB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,+EAA+E;IAC/E,IAAI,WAAW,CAAC,YAAY,KAAK,IAAI,IAAI,iBAAiB,IAAI,WAAW,EAAE,CAAC;QAC1E,WAAW,CAAC,IAAI,CAAC;YACf,IAAI,EAAE,sBAAsB;YAC5B,QAAQ,EAAE,SAAS;YACnB,OAAO,EACL,SAAS,QAAQ,qDAAqD;gBACtE,qDAAqD;YACvD,cAAc,EAAE,MAAM;YACtB,cAAc,EAAE,QAAQ;SACzB,CAAC,CAAC;IACL,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
package/dist/logs/combined.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{"level":50,"time":
|
|
2
|
-
{"level":50,"time":
|
|
3
|
-
{"level":50,"time":
|
|
4
|
-
{"level":50,"time":
|
|
1
|
+
{"level":50,"time":1777415595855,"env":"testing","version":"0.0.0-test","pid":99019,"requestId":"63RGD-YP65A","timestamp":"2026-04-28T22:33:15.853Z","operation":"HandleToolRequest","critical":false,"errorCode":-32005,"originalErrorType":"McpError","finalErrorType":"McpError","sessionId":"5a13b0091a5f90f81e77c9eb13f93c113b034065cf9fae82c794997d56c9cf18","toolName":"scoped_echo","tenantId":"authz-tenant","auth":{"sub":"authz-user","scopes":["tool:other:read"],"clientId":"authz-client","tenantId":"authz-tenant"},"errorData":{"sessionId":"5a13b0091a5f90f81e77c9eb13f93c113b034065cf9fae82c794997d56c9cf18","toolName":"scoped_echo","requestId":"63RGD-YP65A","timestamp":"2026-04-28T22:33:15.853Z","tenantId":"authz-tenant","operation":"HandleToolRequest","auth":{"sub":"authz-user","scopes":["tool:other:read"],"clientId":"authz-client","tenantId":"authz-tenant"},"originalErrorName":"McpError","originalMessage":"Insufficient permissions.","originalStack":"McpError: Insufficient permissions.\n at forbidden (/Users/casey/Developer/github/mcp-ts-core/dist/types-global/errors.js:84:58)\n at withRequiredScopes (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/auth/lib/authUtils.js:61:15)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/tools/utils/toolHandlerFactory.js:72:17)\n at executeToolHandler (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:231:34)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:126:43)\n at processTicksAndRejections (native:7:39)"},"stack":"McpError: Insufficient permissions.\n at handleError (/Users/casey/Developer/github/mcp-ts-core/dist/utils/internal/error-handler/errorHandler.js:169:23)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/tools/utils/toolHandlerFactory.js:107:42)\n at executeToolHandler (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:231:34)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:126:43)\n at processTicksAndRejections (native:7:39)","msg":"Error in tool:scoped_echo: Insufficient permissions."}
|
|
2
|
+
{"level":50,"time":1777415596525,"env":"testing","version":"0.8.1","pid":99023,"requestId":"SJ7A2-YIFMY","timestamp":"2026-04-28T22:33:16.524Z","operation":"httpErrorHandler","critical":false,"errorCode":-32006,"originalErrorType":"McpError","finalErrorType":"McpError","path":"/mcp","method":"POST","errorData":{"path":"/mcp","method":"POST","requestId":"SJ7A2-YIFMY","timestamp":"2026-04-28T22:33:16.524Z","operation":"httpErrorHandler","originalErrorName":"McpError","originalMessage":"Missing or invalid Authorization header. Bearer scheme required.","originalStack":"McpError: Missing or invalid Authorization header. Bearer scheme required.\n at unauthorized (/Users/casey/Developer/github/mcp-ts-core/dist/types-global/errors.js:86:61)\n at authMiddleware (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/auth/authMiddleware.js:64:19)\n at dispatch (/Users/casey/Developer/github/mcp-ts-core/node_modules/hono/dist/compose.js:22:23)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/http/httpTransport.js:232:22)\n at dispatch (/Users/casey/Developer/github/mcp-ts-core/node_modules/hono/dist/compose.js:22:23)\n at cors2 (/Users/casey/Developer/github/mcp-ts-core/node_modules/hono/dist/middleware/cors/index.js:82:11)\n at processTicksAndRejections (native:7:39)"},"stack":"McpError: Missing or invalid Authorization header. Bearer scheme required.\n at handleError (/Users/casey/Developer/github/mcp-ts-core/dist/utils/internal/error-handler/errorHandler.js:169:23)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/http/httpErrorHandler.js:59:39)\n at dispatch (/Users/casey/Developer/github/mcp-ts-core/node_modules/hono/dist/compose.js:26:25)\n at processTicksAndRejections (native:7:39)","msg":"Error in httpTransport: Missing or invalid Authorization header. Bearer scheme required."}
|
|
3
|
+
{"level":50,"time":1777415596539,"env":"testing","version":"0.8.1","pid":99023,"requestId":"OO6W9-ZL8EV","timestamp":"2026-04-28T22:33:16.539Z","operation":"httpErrorHandler","critical":false,"errorCode":-32006,"originalErrorType":"McpError","finalErrorType":"McpError","path":"/mcp","method":"POST","errorData":{"path":"/mcp","method":"POST","requestId":"OO6W9-ZL8EV","timestamp":"2026-04-28T22:33:16.539Z","operation":"httpErrorHandler","originalErrorName":"McpError","originalMessage":"Token has expired.","originalStack":"McpError: Token has expired.\n at unauthorized (/Users/casey/Developer/github/mcp-ts-core/dist/types-global/errors.js:86:61)\n at handleJoseVerifyError (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/auth/lib/claimParser.js:56:11)\n at verify (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/auth/strategies/jwtStrategy.js:91:13)\n at processTicksAndRejections (native:7:39)"},"stack":"McpError: Token has expired.\n at handleError (/Users/casey/Developer/github/mcp-ts-core/dist/utils/internal/error-handler/errorHandler.js:169:23)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/http/httpErrorHandler.js:59:39)\n at dispatch (/Users/casey/Developer/github/mcp-ts-core/node_modules/hono/dist/compose.js:26:25)\n at processTicksAndRejections (native:7:39)","msg":"Error in httpTransport: Token has expired."}
|
|
4
|
+
{"level":50,"time":1777415596544,"env":"testing","version":"0.8.1","pid":99023,"requestId":"3NQXB-GTIJC","timestamp":"2026-04-28T22:33:16.544Z","operation":"httpErrorHandler","critical":false,"errorCode":-32006,"originalErrorType":"McpError","finalErrorType":"McpError","path":"/mcp","method":"GET","errorData":{"path":"/mcp","method":"GET","requestId":"3NQXB-GTIJC","timestamp":"2026-04-28T22:33:16.544Z","operation":"httpErrorHandler","originalErrorName":"McpError","originalMessage":"Missing or invalid Authorization header. Bearer scheme required.","originalStack":"McpError: Missing or invalid Authorization header. Bearer scheme required.\n at unauthorized (/Users/casey/Developer/github/mcp-ts-core/dist/types-global/errors.js:86:61)\n at authMiddleware (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/auth/authMiddleware.js:64:19)\n at dispatch (/Users/casey/Developer/github/mcp-ts-core/node_modules/hono/dist/compose.js:22:23)\n at dispatch (/Users/casey/Developer/github/mcp-ts-core/node_modules/hono/dist/compose.js:22:23)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/http/httpTransport.js:232:22)\n at dispatch (/Users/casey/Developer/github/mcp-ts-core/node_modules/hono/dist/compose.js:22:23)\n at cors2 (/Users/casey/Developer/github/mcp-ts-core/node_modules/hono/dist/middleware/cors/index.js:82:11)\n at processTicksAndRejections (native:7:39)"},"stack":"McpError: Missing or invalid Authorization header. Bearer scheme required.\n at handleError (/Users/casey/Developer/github/mcp-ts-core/dist/utils/internal/error-handler/errorHandler.js:169:23)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/http/httpErrorHandler.js:59:39)\n at dispatch (/Users/casey/Developer/github/mcp-ts-core/node_modules/hono/dist/compose.js:26:25)\n at processTicksAndRejections (native:7:39)","msg":"Error in httpTransport: Missing or invalid Authorization header. Bearer scheme required."}
|
package/dist/logs/error.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{"level":50,"time":
|
|
2
|
-
{"level":50,"time":
|
|
3
|
-
{"level":50,"time":
|
|
4
|
-
{"level":50,"time":
|
|
1
|
+
{"level":50,"time":1777415595855,"env":"testing","version":"0.0.0-test","pid":99019,"requestId":"63RGD-YP65A","timestamp":"2026-04-28T22:33:15.853Z","operation":"HandleToolRequest","critical":false,"errorCode":-32005,"originalErrorType":"McpError","finalErrorType":"McpError","sessionId":"5a13b0091a5f90f81e77c9eb13f93c113b034065cf9fae82c794997d56c9cf18","toolName":"scoped_echo","tenantId":"authz-tenant","auth":{"sub":"authz-user","scopes":["tool:other:read"],"clientId":"authz-client","tenantId":"authz-tenant"},"errorData":{"sessionId":"5a13b0091a5f90f81e77c9eb13f93c113b034065cf9fae82c794997d56c9cf18","toolName":"scoped_echo","requestId":"63RGD-YP65A","timestamp":"2026-04-28T22:33:15.853Z","tenantId":"authz-tenant","operation":"HandleToolRequest","auth":{"sub":"authz-user","scopes":["tool:other:read"],"clientId":"authz-client","tenantId":"authz-tenant"},"originalErrorName":"McpError","originalMessage":"Insufficient permissions.","originalStack":"McpError: Insufficient permissions.\n at forbidden (/Users/casey/Developer/github/mcp-ts-core/dist/types-global/errors.js:84:58)\n at withRequiredScopes (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/auth/lib/authUtils.js:61:15)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/tools/utils/toolHandlerFactory.js:72:17)\n at executeToolHandler (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:231:34)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:126:43)\n at processTicksAndRejections (native:7:39)"},"stack":"McpError: Insufficient permissions.\n at handleError (/Users/casey/Developer/github/mcp-ts-core/dist/utils/internal/error-handler/errorHandler.js:169:23)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/tools/utils/toolHandlerFactory.js:107:42)\n at executeToolHandler (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:231:34)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:126:43)\n at processTicksAndRejections (native:7:39)","msg":"Error in tool:scoped_echo: Insufficient permissions."}
|
|
2
|
+
{"level":50,"time":1777415596525,"env":"testing","version":"0.8.1","pid":99023,"requestId":"SJ7A2-YIFMY","timestamp":"2026-04-28T22:33:16.524Z","operation":"httpErrorHandler","critical":false,"errorCode":-32006,"originalErrorType":"McpError","finalErrorType":"McpError","path":"/mcp","method":"POST","errorData":{"path":"/mcp","method":"POST","requestId":"SJ7A2-YIFMY","timestamp":"2026-04-28T22:33:16.524Z","operation":"httpErrorHandler","originalErrorName":"McpError","originalMessage":"Missing or invalid Authorization header. Bearer scheme required.","originalStack":"McpError: Missing or invalid Authorization header. Bearer scheme required.\n at unauthorized (/Users/casey/Developer/github/mcp-ts-core/dist/types-global/errors.js:86:61)\n at authMiddleware (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/auth/authMiddleware.js:64:19)\n at dispatch (/Users/casey/Developer/github/mcp-ts-core/node_modules/hono/dist/compose.js:22:23)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/http/httpTransport.js:232:22)\n at dispatch (/Users/casey/Developer/github/mcp-ts-core/node_modules/hono/dist/compose.js:22:23)\n at cors2 (/Users/casey/Developer/github/mcp-ts-core/node_modules/hono/dist/middleware/cors/index.js:82:11)\n at processTicksAndRejections (native:7:39)"},"stack":"McpError: Missing or invalid Authorization header. Bearer scheme required.\n at handleError (/Users/casey/Developer/github/mcp-ts-core/dist/utils/internal/error-handler/errorHandler.js:169:23)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/http/httpErrorHandler.js:59:39)\n at dispatch (/Users/casey/Developer/github/mcp-ts-core/node_modules/hono/dist/compose.js:26:25)\n at processTicksAndRejections (native:7:39)","msg":"Error in httpTransport: Missing or invalid Authorization header. Bearer scheme required."}
|
|
3
|
+
{"level":50,"time":1777415596539,"env":"testing","version":"0.8.1","pid":99023,"requestId":"OO6W9-ZL8EV","timestamp":"2026-04-28T22:33:16.539Z","operation":"httpErrorHandler","critical":false,"errorCode":-32006,"originalErrorType":"McpError","finalErrorType":"McpError","path":"/mcp","method":"POST","errorData":{"path":"/mcp","method":"POST","requestId":"OO6W9-ZL8EV","timestamp":"2026-04-28T22:33:16.539Z","operation":"httpErrorHandler","originalErrorName":"McpError","originalMessage":"Token has expired.","originalStack":"McpError: Token has expired.\n at unauthorized (/Users/casey/Developer/github/mcp-ts-core/dist/types-global/errors.js:86:61)\n at handleJoseVerifyError (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/auth/lib/claimParser.js:56:11)\n at verify (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/auth/strategies/jwtStrategy.js:91:13)\n at processTicksAndRejections (native:7:39)"},"stack":"McpError: Token has expired.\n at handleError (/Users/casey/Developer/github/mcp-ts-core/dist/utils/internal/error-handler/errorHandler.js:169:23)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/http/httpErrorHandler.js:59:39)\n at dispatch (/Users/casey/Developer/github/mcp-ts-core/node_modules/hono/dist/compose.js:26:25)\n at processTicksAndRejections (native:7:39)","msg":"Error in httpTransport: Token has expired."}
|
|
4
|
+
{"level":50,"time":1777415596544,"env":"testing","version":"0.8.1","pid":99023,"requestId":"3NQXB-GTIJC","timestamp":"2026-04-28T22:33:16.544Z","operation":"httpErrorHandler","critical":false,"errorCode":-32006,"originalErrorType":"McpError","finalErrorType":"McpError","path":"/mcp","method":"GET","errorData":{"path":"/mcp","method":"GET","requestId":"3NQXB-GTIJC","timestamp":"2026-04-28T22:33:16.544Z","operation":"httpErrorHandler","originalErrorName":"McpError","originalMessage":"Missing or invalid Authorization header. Bearer scheme required.","originalStack":"McpError: Missing or invalid Authorization header. Bearer scheme required.\n at unauthorized (/Users/casey/Developer/github/mcp-ts-core/dist/types-global/errors.js:86:61)\n at authMiddleware (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/auth/authMiddleware.js:64:19)\n at dispatch (/Users/casey/Developer/github/mcp-ts-core/node_modules/hono/dist/compose.js:22:23)\n at dispatch (/Users/casey/Developer/github/mcp-ts-core/node_modules/hono/dist/compose.js:22:23)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/http/httpTransport.js:232:22)\n at dispatch (/Users/casey/Developer/github/mcp-ts-core/node_modules/hono/dist/compose.js:22:23)\n at cors2 (/Users/casey/Developer/github/mcp-ts-core/node_modules/hono/dist/middleware/cors/index.js:82:11)\n at processTicksAndRejections (native:7:39)"},"stack":"McpError: Missing or invalid Authorization header. Bearer scheme required.\n at handleError (/Users/casey/Developer/github/mcp-ts-core/dist/utils/internal/error-handler/errorHandler.js:169:23)\n at <anonymous> (/Users/casey/Developer/github/mcp-ts-core/dist/mcp-server/transports/http/httpErrorHandler.js:59:39)\n at dispatch (/Users/casey/Developer/github/mcp-ts-core/node_modules/hono/dist/compose.js:26:25)\n at processTicksAndRejections (native:7:39)","msg":"Error in httpTransport: Missing or invalid Authorization header. Bearer scheme required."}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import type { ZodObject, ZodRawShape } from 'zod';
|
|
10
10
|
import type { ResourceDefinition } from '../../mcp-server/resources/utils/resourceDefinition.js';
|
|
11
11
|
import type { ToolDefinition } from '../../mcp-server/tools/utils/toolDefinition.js';
|
|
12
|
+
import type { ErrorContract } from '../../types-global/errors.js';
|
|
12
13
|
/**
|
|
13
14
|
* MIME type for MCP Apps HTML resources.
|
|
14
15
|
* Matches `RESOURCE_MIME_TYPE` from `@modelcontextprotocol/ext-apps/server`
|
|
@@ -16,7 +17,7 @@ import type { ToolDefinition } from '../../mcp-server/tools/utils/toolDefinition
|
|
|
16
17
|
*/
|
|
17
18
|
export declare const APP_RESOURCE_MIME_TYPE = "text/html;profile=mcp-app";
|
|
18
19
|
/** Options for `appTool()` — extends standard tool options with the UI resource URI. */
|
|
19
|
-
type AppToolOptions<TInput extends ZodObject<ZodRawShape>, TOutput extends ZodObject<ZodRawShape
|
|
20
|
+
type AppToolOptions<TInput extends ZodObject<ZodRawShape>, TOutput extends ZodObject<ZodRawShape>, TErrors extends readonly ErrorContract[] | undefined = undefined> = Omit<ToolDefinition<TInput, TOutput, TErrors>, '_meta' | 'name'> & {
|
|
20
21
|
/**
|
|
21
22
|
* Additional `_meta` fields. `ui` sub-fields (e.g. `csp`, `visibility`, `permissions`)
|
|
22
23
|
* are merged with the auto-populated `resourceUri`. The `resourceUri` value from the
|
|
@@ -31,6 +32,10 @@ type AppToolOptions<TInput extends ZodObject<ZodRawShape>, TOutput extends ZodOb
|
|
|
31
32
|
* - `_meta.ui.resourceUri` set automatically
|
|
32
33
|
* - `_meta['ui/resourceUri']` compat key set automatically
|
|
33
34
|
*
|
|
35
|
+
* Accepts the same `errors: [...]` contract as the standard `tool()` builder —
|
|
36
|
+
* the `const TErrors` modifier preserves literal reasons so the handler's
|
|
37
|
+
* `ctx.fail` is typed against the declared reason union.
|
|
38
|
+
*
|
|
34
39
|
* @example
|
|
35
40
|
* ```ts
|
|
36
41
|
* import { appTool, z } from '@cyanheads/mcp-ts-core';
|
|
@@ -44,9 +49,9 @@ type AppToolOptions<TInput extends ZodObject<ZodRawShape>, TOutput extends ZodOb
|
|
|
44
49
|
* });
|
|
45
50
|
* ```
|
|
46
51
|
*/
|
|
47
|
-
export declare function appTool<TInput extends ZodObject<ZodRawShape>, TOutput extends ZodObject<ZodRawShape
|
|
52
|
+
export declare function appTool<TInput extends ZodObject<ZodRawShape>, TOutput extends ZodObject<ZodRawShape>, const TErrors extends readonly ErrorContract[] | undefined = undefined>(name: string, options: AppToolOptions<TInput, TOutput, TErrors>): ToolDefinition<TInput, TOutput, TErrors>;
|
|
48
53
|
/** Options for `appResource()` — standard resource options with app-specific defaults. */
|
|
49
|
-
type AppResourceOptions<TParams extends ZodObject<ZodRawShape>, TOutput extends ZodObject<ZodRawShape> | undefined = undefined> = Omit<ResourceDefinition<TParams, TOutput>, 'mimeType' | 'uriTemplate'> & {
|
|
54
|
+
type AppResourceOptions<TParams extends ZodObject<ZodRawShape>, TOutput extends ZodObject<ZodRawShape> | undefined = undefined, TErrors extends readonly ErrorContract[] | undefined = undefined> = Omit<ResourceDefinition<TParams, TOutput, TErrors>, 'mimeType' | 'uriTemplate'> & {
|
|
50
55
|
/** Override the default `text/html;profile=mcp-app` MIME type. Rarely needed. */
|
|
51
56
|
mimeType?: string;
|
|
52
57
|
};
|
|
@@ -78,6 +83,6 @@ type AppResourceOptions<TParams extends ZodObject<ZodRawShape>, TOutput extends
|
|
|
78
83
|
* });
|
|
79
84
|
* ```
|
|
80
85
|
*/
|
|
81
|
-
export declare function appResource<TParams extends ZodObject<ZodRawShape>, TOutput extends ZodObject<ZodRawShape> | undefined = undefined>(uriTemplate: string, options: AppResourceOptions<TParams, TOutput>): ResourceDefinition<TParams, TOutput>;
|
|
86
|
+
export declare function appResource<TParams extends ZodObject<ZodRawShape>, TOutput extends ZodObject<ZodRawShape> | undefined = undefined, const TErrors extends readonly ErrorContract[] | undefined = undefined>(uriTemplate: string, options: AppResourceOptions<TParams, TOutput, TErrors>): ResourceDefinition<TParams, TOutput, TErrors>;
|
|
82
87
|
export {};
|
|
83
88
|
//# sourceMappingURL=appBuilders.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appBuilders.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/apps/appBuilders.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAG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,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,GAChD,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAiB1C;AAMD,0FAA0F;AAC1F,KAAK,kBAAkB,CACrB,OAAO,SAAS,SAAS,CAAC,WAAW,CAAC,EACtC,OAAO,SAAS,SAAS,CAAC,WAAW,CAAC,GAAG,SAAS,GAAG,SAAS,EAC9D,OAAO,SAAS,SAAS,aAAa,EAAE,GAAG,SAAS,GAAG,SAAS,IAC9D,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,aAAa,CAAC,GAAG;IACpF,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,WAAW,CACzB,OAAO,SAAS,SAAS,CAAC,WAAW,CAAC,EACtC,OAAO,SAAS,SAAS,CAAC,WAAW,CAAC,GAAG,SAAS,GAAG,SAAS,EAC9D,KAAK,CAAC,OAAO,SAAS,SAAS,aAAa,EAAE,GAAG,SAAS,GAAG,SAAS,EAEtE,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,GACrD,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAe/C"}
|
|
@@ -74,6 +74,10 @@ function createAppResourceFormat(format, defaultUiMeta) {
|
|
|
74
74
|
* - `_meta.ui.resourceUri` set automatically
|
|
75
75
|
* - `_meta['ui/resourceUri']` compat key set automatically
|
|
76
76
|
*
|
|
77
|
+
* Accepts the same `errors: [...]` contract as the standard `tool()` builder —
|
|
78
|
+
* the `const TErrors` modifier preserves literal reasons so the handler's
|
|
79
|
+
* `ctx.fail` is typed against the declared reason union.
|
|
80
|
+
*
|
|
77
81
|
* @example
|
|
78
82
|
* ```ts
|
|
79
83
|
* import { appTool, z } from '@cyanheads/mcp-ts-core';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appBuilders.js","sourceRoot":"","sources":["../../../src/mcp-server/apps/appBuilders.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,EAAE,QAAQ,EAAE,MAAM,oDAAoD,CAAC;AAE9E,OAAO,EAAE,IAAI,EAAE,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"appBuilders.js","sourceRoot":"","sources":["../../../src/mcp-server/apps/appBuilders.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,EAAE,QAAQ,EAAE,MAAM,oDAAoD,CAAC;AAE9E,OAAO,EAAE,IAAI,EAAE,MAAM,4CAA4C,CAAC;AAGlE;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,2BAA2B,CAAC;AAElE;;;GAGG;AACH,MAAM,qBAAqB,GAAG,gBAAgB,CAAC;AAQ/C,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,cAAc,CAAC,QAAgB;IACtC,MAAM,kBAAkB,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC;IACjF,OAAO,kBAAkB,KAAK,kBAAkB,IAAI,kBAAkB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC3F,CAAC;AAED,SAAS,kBAAkB,CAAC,MAAe,EAAE,QAAgB;IAC3D,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC;QAC5D,CAAC,CAAC,MAAM;QAC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AC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IACtE,MAAM,iBAAiB,GAAG,uBAAuB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAEzE,OAAO,QAAQ,CAAC,WAAW,EAAE;QAC3B,GAAG,IAAI;QACP,GAAG,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,CAAC;QACvB,GAAG,CAAC,iBAAiB,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC;QACvD,QAAQ,EAAE,QAAQ,IAAI,sBAAsB;QAC5C,WAAW,EAAE;YACX,QAAQ,EAAE,CAAC,MAAM,CAAC;YAClB,GAAG,WAAW;SACf;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-registration.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/resources/resource-registration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,yCAAyC,CAAC;AAE3F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAChG,OAAO,EAEL,KAAK,8BAA8B,EAEpC,MAAM,wDAAwD,CAAC;AAchE,qBAAa,gBAAgB;IAKzB,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,QAAQ;IALlB,wEAAwE;IACxE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAqB;gBAG3C,YAAY,EAAE,qBAAqB,EAAE,EACrC,QAAQ,EAAE,8BAA8B;IAGlD;;OAEG;IACU,WAAW,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IA2B1D,iFAAiF;IACjF,OAAO,CAAC,gBAAgB;YAUV,gBAAgB;
|
|
1
|
+
{"version":3,"file":"resource-registration.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/resources/resource-registration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,yCAAyC,CAAC;AAE3F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAChG,OAAO,EAEL,KAAK,8BAA8B,EAEpC,MAAM,wDAAwD,CAAC;AAchE,qBAAa,gBAAgB;IAKzB,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,QAAQ;IALlB,wEAAwE;IACxE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAqB;gBAG3C,YAAY,EAAE,qBAAqB,EAAE,EACrC,QAAQ,EAAE,8BAA8B;IAGlD;;OAEG;IACU,WAAW,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IA2B1D,iFAAiF;IACjF,OAAO,CAAC,gBAAgB;YAUV,gBAAgB;CAqD/B"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
6
6
|
import { createResourceHandler, } from '../../mcp-server/resources/utils/resourceHandlerFactory.js';
|
|
7
|
-
import { JsonRpcErrorCode } from '../../types-global/errors.js';
|
|
7
|
+
import { buildMetaWithErrorContract, 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';
|
|
10
10
|
import { requestContextService } from '../../utils/internal/requestContext.js';
|
|
@@ -64,6 +64,7 @@ export class ResourceRegistry {
|
|
|
64
64
|
const handler = createResourceHandler(def, this.services, notifiers);
|
|
65
65
|
const title = def.title ?? resourceName;
|
|
66
66
|
const mimeType = def.mimeType ?? 'application/json';
|
|
67
|
+
const mergedMeta = buildMetaWithErrorContract(def._meta, def.errors);
|
|
67
68
|
const metadata = {
|
|
68
69
|
title,
|
|
69
70
|
description: def.description,
|
|
@@ -71,7 +72,7 @@ export class ResourceRegistry {
|
|
|
71
72
|
...(def.size != null && { size: def.size }),
|
|
72
73
|
...(def.examples && { examples: def.examples }),
|
|
73
74
|
...(def.annotations && { annotations: def.annotations }),
|
|
74
|
-
...(
|
|
75
|
+
...(mergedMeta && { _meta: mergedMeta }),
|
|
75
76
|
};
|
|
76
77
|
if (hasUriTemplateVariables(def.uriTemplate)) {
|
|
77
78
|
const template = new ResourceTemplate(def.uriTemplate, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-registration.js","sourceRoot":"","sources":["../../../src/mcp-server/resources/resource-registration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAkB,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAG3F,OAAO,EACL,qBAAqB,GAGtB,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"resource-registration.js","sourceRoot":"","sources":["../../../src/mcp-server/resources/resource-registration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAkB,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAG3F,OAAO,EACL,qBAAqB,GAGtB,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAM3E,SAAS,uBAAuB,CAAC,WAAmB;IAClD,OAAO,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,OAAO,gBAAgB;IAKjB;IACA;IALV,wEAAwE;IACvD,eAAe,GAAG,IAAI,GAAG,EAAU,CAAC;IAErD,YACU,YAAqC,EACrC,QAAwC;QADxC,iBAAY,GAAZ,YAAY,CAAyB;QACrC,aAAQ,GAAR,QAA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WAAW,EAAE;oBACrD,IAAI,EAAE,GAAG,CAAC,IAAI;iBACf,CAAC,CAAC;gBAEH,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC7D,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE,GAAG,CAAC,WAAW,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CACtE,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,KAAK,CAAC,CACxB,CAAC;YACJ,CAAC;YAED,MAAM,CAAC,KAAK,CAAC,aAAa,YAAY,4BAA4B,EAAE,mBAAmB,CAAC,CAAC;QAC3F,CAAC,EACD;YACE,SAAS,EAAE,uBAAuB,YAAY,EAAE;YAChD,OAAO,EAAE,mBAAmB;YAC5B,SAAS,EAAE,gBAAgB,CAAC,oBAAoB;YAChD,QAAQ,EAAE,IAAI;SACf,CACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
10
10
|
import type { ListResourcesResult, ReadResourceResult, ServerNotification, ServerRequest } from '@modelcontextprotocol/sdk/types.js';
|
|
11
11
|
import type { ZodObject, ZodRawShape, z } from 'zod';
|
|
12
|
-
import type {
|
|
12
|
+
import type { HandlerContext, ReasonOf } from '../../../core/context.js';
|
|
13
|
+
import type { ErrorContract } from '../../../types-global/errors.js';
|
|
13
14
|
/**
|
|
14
15
|
* Optional annotations providing clients additional context about a resource.
|
|
15
16
|
* Mirrors the MCP SDK's Annotations type.
|
|
@@ -28,7 +29,7 @@ export type ListExtra = RequestHandlerExtra<ServerRequest, ServerNotification>;
|
|
|
28
29
|
* Represents a complete, self-contained definition of an MCP resource.
|
|
29
30
|
* Handler receives `(params, ctx)` — URI is available on `ctx.uri`.
|
|
30
31
|
*/
|
|
31
|
-
export interface ResourceDefinition<TParams extends ZodObject<ZodRawShape> = ZodObject<ZodRawShape>, TOutput extends ZodObject<ZodRawShape> | undefined = undefined> {
|
|
32
|
+
export interface ResourceDefinition<TParams extends ZodObject<ZodRawShape> = ZodObject<ZodRawShape>, TOutput extends ZodObject<ZodRawShape> | undefined = undefined, TErrors extends readonly ErrorContract[] | undefined = undefined> {
|
|
32
33
|
/**
|
|
33
34
|
* Protocol-level metadata for the resource registration itself.
|
|
34
35
|
* For plain `resource()` MCP Apps UI resources, host-consumed UI metadata that
|
|
@@ -55,6 +56,13 @@ export interface ResourceDefinition<TParams extends ZodObject<ZodRawShape> = Zod
|
|
|
55
56
|
auth?: string[];
|
|
56
57
|
/** LLM-facing description. */
|
|
57
58
|
description: string;
|
|
59
|
+
/**
|
|
60
|
+
* Declarative contract describing the failure modes this resource can surface.
|
|
61
|
+
* See `ToolDefinition.errors` for full semantics. Surfaces in `resources/list`
|
|
62
|
+
* under `_meta['mcp-ts-core/errors']`. When declared, `ctx.fail(reason, …)` is
|
|
63
|
+
* typed against the reason union — see the example on `tool()`.
|
|
64
|
+
*/
|
|
65
|
+
errors?: TErrors;
|
|
58
66
|
/** Optional examples for discoverability. */
|
|
59
67
|
examples?: {
|
|
60
68
|
name: string;
|
|
@@ -73,7 +81,7 @@ export interface ResourceDefinition<TParams extends ZodObject<ZodRawShape> = Zod
|
|
|
73
81
|
* The core handler function. Receives validated params and unified Context.
|
|
74
82
|
* URI is available on `ctx.uri`. Throw on failure.
|
|
75
83
|
*/
|
|
76
|
-
handler
|
|
84
|
+
handler(params: z.infer<TParams>, ctx: HandlerContext<ReasonOf<TErrors>>): TOutput extends ZodObject<ZodRawShape> ? z.infer<TOutput> | Promise<z.infer<TOutput>> : unknown | Promise<unknown>;
|
|
77
85
|
/**
|
|
78
86
|
* Optional provider for resource discovery/listing.
|
|
79
87
|
*/
|
|
@@ -102,7 +110,7 @@ export interface ResourceDefinition<TParams extends ZodObject<ZodRawShape> = Zod
|
|
|
102
110
|
uriTemplate: string;
|
|
103
111
|
}
|
|
104
112
|
/** Type-erased union for mixed arrays. */
|
|
105
|
-
export type AnyResourceDefinition = ResourceDefinition<ZodObject<ZodRawShape>, ZodObject<ZodRawShape> | undefined>;
|
|
113
|
+
export type AnyResourceDefinition = ResourceDefinition<ZodObject<ZodRawShape>, ZodObject<ZodRawShape> | undefined, readonly ErrorContract[] | undefined>;
|
|
106
114
|
/**
|
|
107
115
|
* Creates a resource definition with the URI template as first argument.
|
|
108
116
|
*
|
|
@@ -119,5 +127,5 @@ export type AnyResourceDefinition = ResourceDefinition<ZodObject<ZodRawShape>, Z
|
|
|
119
127
|
* });
|
|
120
128
|
* ```
|
|
121
129
|
*/
|
|
122
|
-
export declare function resource<TParams extends ZodObject<ZodRawShape>, TOutput extends ZodObject<ZodRawShape> | undefined = undefined>(uriTemplate: string, options: Omit<ResourceDefinition<TParams, TOutput>, 'uriTemplate'>): ResourceDefinition<TParams, TOutput>;
|
|
130
|
+
export declare function resource<TParams extends ZodObject<ZodRawShape>, TOutput extends ZodObject<ZodRawShape> | undefined = undefined, const TErrors extends readonly ErrorContract[] | undefined = undefined>(uriTemplate: string, options: Omit<ResourceDefinition<TParams, TOutput, TErrors>, 'uriTemplate'>): ResourceDefinition<TParams, TOutput, TErrors>;
|
|
123
131
|
//# sourceMappingURL=resourceDefinition.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resourceDefinition.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/utils/resourceDefinition.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACd,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAErD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"resourceDefinition.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/utils/resourceDefinition.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACd,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAErD,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,qEAAqE;IACrE,QAAQ,CAAC,EAAE,CAAC,MAAM,GAAG,WAAW,CAAC,EAAE,CAAC;IACpC,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,iDAAiD;AACjD,MAAM,MAAM,SAAS,GAAG,mBAAmB,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;AAE/E;;;GAGG;AACH,MAAM,WAAW,kBAAkB,CACjC,OAAO,SAAS,SAAS,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC,WAAW,CAAC,EAC/D,OAAO,SAAS,SAAS,CAAC,WAAW,CAAC,GAAG,SAAS,GAAG,SAAS,EAC9D,OAAO,SAAS,SAAS,aAAa,EAAE,GAAG,SAAS,GAAG,SAAS;IAEhE;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,8BAA8B;IAC9B,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,4BAA4B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AAC,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,0CAA0C;AAC1C,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,CACpD,SAAS,CAAC,WAAW,CAAC,EACtB,SAAS,CAAC,WAAW,CAAC,GAAG,SAAS,EAClC,SAAS,aAAa,EAAE,GAAG,SAAS,CACrC,CAAC;AAMF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,QAAQ,CACtB,OAAO,SAAS,SAAS,CAAC,WAAW,CAAC,EACtC,OAAO,SAAS,SAAS,CAAC,WAAW,CAAC,GAAG,SAAS,GAAG,SAAS,EAC9D,KAAK,CAAC,OAAO,SAAS,SAAS,aAAa,EAAE,GAAG,SAAS,GAAG,SAAS,EAEtE,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,aAAa,CAAC,GAC1E,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAE/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resourceDefinition.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/utils/resourceDefinition.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"resourceDefinition.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/utils/resourceDefinition.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAgIH,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,QAAQ,CAKtB,WAAmB,EACnB,OAA2E;IAE3E,OAAO,EAAE,WAAW,EAAE,GAAG,OAAO,EAAE,CAAC;AACrC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resourceHandlerFactory.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/utils/resourceHandlerFactory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iDAAiD,CAAC;AACjF,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACd,MAAM,oCAAoC,CAAC;AAK5C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAEhG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAGvE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAQzD,KAAK,QAAQ,GAAG,mBAAmB,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;AAOvE,qEAAqE;AACrE,MAAM,WAAW,8BAA8B;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,cAAc,CAAC;CACzB;AAED;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC,yBAAyB,CAAC,EAAE,MAAM,IAAI,CAAC;IACvC,qBAAqB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C;AAqDD;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,qBAAqB,EAC1B,QAAQ,EAAE,8BAA8B,EACxC,SAAS,EAAE,wBAAwB,GAClC,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,KAAK,OAAO,CAAC,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"resourceHandlerFactory.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/utils/resourceHandlerFactory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iDAAiD,CAAC;AACjF,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACd,MAAM,oCAAoC,CAAC;AAK5C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAEhG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAGvE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAQzD,KAAK,QAAQ,GAAG,mBAAmB,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;AAOvE,qEAAqE;AACrE,MAAM,WAAW,8BAA8B;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,cAAc,CAAC;CACzB;AAED;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC,yBAAyB,CAAC,EAAE,MAAM,IAAI,CAAC;IACvC,qBAAqB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C;AAqDD;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,qBAAqB,EAC1B,QAAQ,EAAE,8BAA8B,EACxC,SAAS,EAAE,wBAAwB,GAClC,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,KAAK,OAAO,CAAC,kBAAkB,CAAC,CA2ElF"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Constructs Context (with `uri`), checks inline auth, validates params, formats response.
|
|
4
4
|
* @module src/mcp-server/resources/utils/resourceHandlerFactory
|
|
5
5
|
*/
|
|
6
|
-
import { createContext } from '../../../core/context.js';
|
|
6
|
+
import { attachTypedFail, createContext } from '../../../core/context.js';
|
|
7
7
|
import { withRequiredScopes } from '../../../mcp-server/transports/auth/lib/authUtils.js';
|
|
8
8
|
import { McpError } from '../../../types-global/errors.js';
|
|
9
9
|
import { ErrorHandler } from '../../../utils/internal/error-handler/errorHandler.js';
|
|
@@ -91,8 +91,9 @@ export function createResourceHandler(def, services, notifiers) {
|
|
|
91
91
|
}
|
|
92
92
|
// Validate params via schema if defined
|
|
93
93
|
const validatedParams = def.params ? def.params.parse(variables) : variables;
|
|
94
|
-
// Construct Context with uri set
|
|
95
|
-
|
|
94
|
+
// Construct Context with uri set. `attachTypedFail` adds `ctx.fail`
|
|
95
|
+
// when the definition declares an error contract; otherwise no-op.
|
|
96
|
+
const ctx = attachTypedFail(createContext({
|
|
96
97
|
appContext,
|
|
97
98
|
logger: services.logger,
|
|
98
99
|
storage: services.storage,
|
|
@@ -102,7 +103,7 @@ export function createResourceHandler(def, services, notifiers) {
|
|
|
102
103
|
notifyResourceListChanged: notifiers.notifyResourceListChanged,
|
|
103
104
|
notifyResourceUpdated: notifiers.notifyResourceUpdated,
|
|
104
105
|
uri,
|
|
105
|
-
});
|
|
106
|
+
}), def.errors);
|
|
106
107
|
// Execute handler with performance measurement
|
|
107
108
|
const resourceName = def.name ?? def.uriTemplate;
|
|
108
109
|
const handlerResult = await measureResourceExecution(() => Promise.resolve(def.handler(validatedParams, ctx)), { ...appContext, resourceName }, { uri: uri.href, mimeType });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resourceHandlerFactory.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/utils/resourceHandlerFactory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"resourceHandlerFactory.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/utils/resourceHandlerFactory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AAEnF,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,YAAY,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