@cyanheads/mcp-ts-core 0.13.12 → 0.13.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +7 -6
- package/CLAUDE.md +7 -6
- package/README.md +1 -1
- package/changelog/0.13.x/0.13.13.md +93 -0
- package/dist/core/context.d.ts +12 -0
- package/dist/core/context.d.ts.map +1 -1
- package/dist/core/context.js +59 -14
- package/dist/core/context.js.map +1 -1
- package/dist/core/worker.d.ts.map +1 -1
- package/dist/core/worker.js +21 -8
- package/dist/core/worker.js.map +1 -1
- package/dist/mcp-server/inputRequired.d.ts +18 -9
- package/dist/mcp-server/inputRequired.d.ts.map +1 -1
- package/dist/mcp-server/inputRequired.js +29 -15
- package/dist/mcp-server/inputRequired.js.map +1 -1
- package/dist/mcp-server/prompts/prompt-registration.d.ts.map +1 -1
- package/dist/mcp-server/prompts/prompt-registration.js +10 -7
- package/dist/mcp-server/prompts/prompt-registration.js.map +1 -1
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts.map +1 -1
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.js +22 -9
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.js.map +1 -1
- package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts +7 -1
- package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts.map +1 -1
- package/dist/mcp-server/tools/utils/toolHandlerFactory.js +34 -19
- package/dist/mcp-server/tools/utils/toolHandlerFactory.js.map +1 -1
- package/dist/mcp-server/transports/auth/lib/authUtils.d.ts +3 -1
- package/dist/mcp-server/transports/auth/lib/authUtils.d.ts.map +1 -1
- package/dist/mcp-server/transports/auth/lib/authUtils.js +4 -2
- package/dist/mcp-server/transports/auth/lib/authUtils.js.map +1 -1
- package/dist/storage/providers/fileSystem/fileSystemProvider.d.ts.map +1 -1
- package/dist/storage/providers/fileSystem/fileSystemProvider.js +48 -21
- package/dist/storage/providers/fileSystem/fileSystemProvider.js.map +1 -1
- package/dist/types-global/errors.d.ts.map +1 -1
- package/dist/types-global/errors.js +31 -16
- package/dist/types-global/errors.js.map +1 -1
- package/dist/utils/internal/error-handler/errorHandler.d.ts +29 -12
- package/dist/utils/internal/error-handler/errorHandler.d.ts.map +1 -1
- package/dist/utils/internal/error-handler/errorHandler.js +198 -100
- package/dist/utils/internal/error-handler/errorHandler.js.map +1 -1
- package/dist/utils/internal/error-handler/helpers.d.ts +75 -4
- package/dist/utils/internal/error-handler/helpers.d.ts.map +1 -1
- package/dist/utils/internal/error-handler/helpers.js +232 -33
- package/dist/utils/internal/error-handler/helpers.js.map +1 -1
- package/dist/utils/internal/error-handler/types.d.ts +17 -7
- package/dist/utils/internal/error-handler/types.d.ts.map +1 -1
- package/dist/utils/internal/logValue.d.ts +33 -0
- package/dist/utils/internal/logValue.d.ts.map +1 -0
- package/dist/utils/internal/logValue.js +539 -0
- package/dist/utils/internal/logValue.js.map +1 -0
- package/dist/utils/internal/logger.d.ts +38 -9
- package/dist/utils/internal/logger.d.ts.map +1 -1
- package/dist/utils/internal/logger.js +228 -118
- package/dist/utils/internal/logger.js.map +1 -1
- package/dist/utils/internal/performance.d.ts.map +1 -1
- package/dist/utils/internal/performance.js +9 -11
- package/dist/utils/internal/performance.js.map +1 -1
- package/dist/utils/internal/requestContext.d.ts +3 -3
- package/dist/utils/internal/requestContext.js +1 -1
- package/dist/utils/network/fetchWithTimeout.d.ts +18 -10
- package/dist/utils/network/fetchWithTimeout.d.ts.map +1 -1
- package/dist/utils/network/fetchWithTimeout.js +48 -20
- package/dist/utils/network/fetchWithTimeout.js.map +1 -1
- package/dist/utils/network/httpError.d.ts +8 -6
- package/dist/utils/network/httpError.d.ts.map +1 -1
- package/dist/utils/network/httpError.js +23 -7
- package/dist/utils/network/httpError.js.map +1 -1
- package/dist/utils/network/retry.d.ts +7 -4
- package/dist/utils/network/retry.d.ts.map +1 -1
- package/dist/utils/network/retry.js +24 -10
- package/dist/utils/network/retry.js.map +1 -1
- package/dist/utils/security/sanitization.d.ts +24 -28
- package/dist/utils/security/sanitization.d.ts.map +1 -1
- package/dist/utils/security/sanitization.js +25 -84
- package/dist/utils/security/sanitization.js.map +1 -1
- package/dist/utils/security/sensitiveFields.d.ts +32 -4
- package/dist/utils/security/sensitiveFields.d.ts.map +1 -1
- package/dist/utils/security/sensitiveFields.js +85 -4
- package/dist/utils/security/sensitiveFields.js.map +1 -1
- package/dist/utils/telemetry/trace.d.ts +3 -1
- package/dist/utils/telemetry/trace.d.ts.map +1 -1
- package/dist/utils/telemetry/trace.js +6 -6
- package/dist/utils/telemetry/trace.js.map +1 -1
- package/framework-skills/api-config/SKILL.md +2 -1
- package/framework-skills/api-context/SKILL.md +3 -3
- package/framework-skills/api-errors/SKILL.md +17 -15
- package/framework-skills/api-linter/SKILL.md +11 -10
- package/framework-skills/api-telemetry/SKILL.md +6 -4
- package/framework-skills/api-utils/SKILL.md +6 -6
- package/framework-skills/api-utils/references/security.md +4 -2
- package/package.json +6 -5
- package/scripts/check-framework-antipatterns.ts +3 -2
- package/templates/.env.example +2 -0
- package/templates/tests/tools/echo.tool.test.ts +19 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyanheads/mcp-ts-core",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.13",
|
|
4
4
|
"mcpName": "io.github.cyanheads/mcp-ts-core",
|
|
5
5
|
"description": "Agent-native TypeScript framework for building MCP servers.",
|
|
6
6
|
"files": [
|
|
@@ -190,6 +190,7 @@
|
|
|
190
190
|
"test:fuzz": "bunx vitest run --project fuzz",
|
|
191
191
|
"test:typecheck": "bunx vitest run --project typecheck",
|
|
192
192
|
"test:compliance": "bunx vitest run --project compliance",
|
|
193
|
+
"test:contract": "bunx vitest run --project contract",
|
|
193
194
|
"test:leak-gate": "bunx vitest run --project leak-gate",
|
|
194
195
|
"test:worker": "bun run scripts/with-node.ts ./node_modules/vitest/vitest.mjs run --config tests/config/vitest.worker.ts && bun run scripts/with-node.ts ./node_modules/vitest/vitest.mjs run --config tests/config/vitest.worker-bundle.ts",
|
|
195
196
|
"test:ui": "bunx vitest --ui",
|
|
@@ -231,7 +232,7 @@
|
|
|
231
232
|
"@vitest/coverage-istanbul": "4.1.11",
|
|
232
233
|
"@vitest/ui": "4.1.11",
|
|
233
234
|
"better-sqlite3": "^13.0.3",
|
|
234
|
-
"chrono-node": "^2.10.
|
|
235
|
+
"chrono-node": "^2.10.2",
|
|
235
236
|
"clipboardy": "^5.3.2",
|
|
236
237
|
"defuddle": "^0.19.4",
|
|
237
238
|
"depcheck": "^1.4.7",
|
|
@@ -239,7 +240,7 @@
|
|
|
239
240
|
"execa": "^10.0.1",
|
|
240
241
|
"fast-check": "^4.10.2",
|
|
241
242
|
"fast-xml-parser": "^5.11.2",
|
|
242
|
-
"ignore": "^7.0.
|
|
243
|
+
"ignore": "^7.0.12",
|
|
243
244
|
"js-yaml": "^5.4.2",
|
|
244
245
|
"linkedom": "^0.18.13",
|
|
245
246
|
"node-cron": "^4.6.0",
|
|
@@ -300,9 +301,9 @@
|
|
|
300
301
|
"@hono/node-server": "^2.1.3",
|
|
301
302
|
"@modelcontextprotocol/server": "^2.2.0",
|
|
302
303
|
"@opentelemetry/api": "^1.9.1",
|
|
303
|
-
"hono": "^4.13.
|
|
304
|
+
"hono": "^4.13.13",
|
|
304
305
|
"jose": "^6.2.12",
|
|
305
|
-
"pino": "^10.
|
|
306
|
+
"pino": "^10.4.0",
|
|
306
307
|
"zod": "^4.6.5"
|
|
307
308
|
},
|
|
308
309
|
"peerDependencies": {
|
|
@@ -64,13 +64,14 @@ interface Rule {
|
|
|
64
64
|
const RULES: Rule[] = [
|
|
65
65
|
{
|
|
66
66
|
id: 'inputSchema-downgrade',
|
|
67
|
-
pattern:
|
|
67
|
+
pattern:
|
|
68
|
+
'inputSchema:[[:space:]]*z\\.(unknown|any)\\(\\)|inputSchema:[^,]*\\.passthrough\\(\\)',
|
|
68
69
|
pathspec: ['src/mcp-server/tools/', ':!**/*.test.ts'],
|
|
69
70
|
message: 'Framework must not downgrade tool inputSchema — breaks tools/list advertising',
|
|
70
71
|
},
|
|
71
72
|
{
|
|
72
73
|
id: 'inputSchema-mutation',
|
|
73
|
-
pattern: '\\.inputSchema
|
|
74
|
+
pattern: '\\.inputSchema[[:space:]]*=([^=]|$)',
|
|
74
75
|
pathspec: ['src/', ':!src/linter/', ':!**/*.test.ts'],
|
|
75
76
|
message: 'Post-register inputSchema mutation breaks tools/list advertising',
|
|
76
77
|
},
|
package/templates/.env.example
CHANGED
|
@@ -36,6 +36,8 @@ MCP_SESSION_MODE=stateless # stateful | stateless | auto. Set here, not
|
|
|
36
36
|
# LOG_TOOL_FAILURE_PAYLOADS=false # Log failed tool calls' arguments + result (key-name redaction only;
|
|
37
37
|
# secrets in free-form values are kept). Reaches stderr, files, and OTLP
|
|
38
38
|
# LOG_TOOL_FAILURE_PAYLOAD_MAX_BYTES=16384 # Per-payload cap, UTF-8 bytes
|
|
39
|
+
# LOG_LLM_INTERACTIONS=false # Write full OpenRouter request/response bodies to interactions.log
|
|
40
|
+
# instead of metadata (transcripts can carry PII and secrets)
|
|
39
41
|
|
|
40
42
|
# ── Telemetry ─────────────────────────────────────────────────────────
|
|
41
43
|
# OTEL_ENABLED=false # Enable OpenTelemetry (default: false)
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { HandlerContext, ReasonOf } from '@cyanheads/mcp-ts-core';
|
|
7
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
8
|
import { describe, expect, it } from 'vitest';
|
|
8
|
-
import { createMockContext } from '@cyanheads/mcp-ts-core/testing';
|
|
9
|
+
import { createMockContext, getEnrichment } from '@cyanheads/mcp-ts-core/testing';
|
|
9
10
|
import { mcpTest } from '@cyanheads/mcp-ts-core/testing/vitest';
|
|
10
11
|
import { echoTool } from '@/mcp-server/tools/definitions/echo.tool.js';
|
|
11
12
|
|
|
@@ -62,6 +63,23 @@ describe('echoTool', () => {
|
|
|
62
63
|
expect(result).toEqual(expect.schemaMatching(echoTool.output));
|
|
63
64
|
});
|
|
64
65
|
|
|
66
|
+
it('enriches the result with the character count', async () => {
|
|
67
|
+
const ctx = echoContext();
|
|
68
|
+
await echoTool.handler(echoTool.input.parse({ message: 'hello world' }), ctx);
|
|
69
|
+
expect(getEnrichment(ctx)).toEqual({ characterCount: 11 });
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('fails a whitespace-only message with the declared empty_message reason', async () => {
|
|
73
|
+
const ctx = echoContext();
|
|
74
|
+
const input = echoTool.input.parse({ message: ' ' });
|
|
75
|
+
// The async wrapper turns a synchronous throw into a rejection, so this
|
|
76
|
+
// form holds whether the handler is sync or async.
|
|
77
|
+
await expect(async () => echoTool.handler(input, ctx)).rejects.toMatchObject({
|
|
78
|
+
code: JsonRpcErrorCode.InvalidParams,
|
|
79
|
+
data: { reason: 'empty_message' },
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
65
83
|
it('formats output as text content', () => {
|
|
66
84
|
const blocks = echoTool.format!({ message: 'hello world' });
|
|
67
85
|
expect(blocks).toEqual([{ type: 'text', text: 'hello world' }]);
|