check-mcp-hosted-schema.mjs
sha256:65ccb454656ea5acdea0a10e559b78bcde1eb6ff753ecc2911bc99d1c3d7cadd
feat(calendar): enforce agent context tiers in retrieval AP…
Human
minor
⚠ breaking
1 day ago
| 1 | #!/usr/bin/env node |
| 2 | /** |
| 3 | * CI guard: z.record(z.unknown()) breaks Zod v4 JSON Schema export in @modelcontextprotocol/sdk |
| 4 | * for hosted tools/list — one bad schema fails the entire tool list. |
| 5 | * Scope: hub/gateway/mcp-hosted*.mjs only. |
| 6 | */ |
| 7 | |
| 8 | import { readdirSync, readFileSync } from 'node:fs'; |
| 9 | import { join } from 'node:path'; |
| 10 | import { fileURLToPath } from 'node:url'; |
| 11 | import { dirname } from 'node:path'; |
| 12 | |
| 13 | const __dirname = dirname(fileURLToPath(import.meta.url)); |
| 14 | const root = join(__dirname, '..'); |
| 15 | const gatewayDir = join(root, 'hub', 'gateway'); |
| 16 | const FORBIDDEN = 'z.record(z.unknown())'; |
| 17 | |
| 18 | const files = readdirSync(gatewayDir).filter((f) => f.startsWith('mcp-hosted') && f.endsWith('.mjs')); |
| 19 | let failed = false; |
| 20 | |
| 21 | for (const name of files) { |
| 22 | const path = join(gatewayDir, name); |
| 23 | const src = readFileSync(path, 'utf8'); |
| 24 | if (src.includes(FORBIDDEN)) { |
| 25 | console.error(`[check-mcp-hosted-schema] Forbidden pattern ${JSON.stringify(FORBIDDEN)} in ${path}`); |
| 26 | failed = true; |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | if (failed) { |
| 31 | console.error('[check-mcp-hosted-schema] Use z.record(z.string(), z.unknown()) or explicit object shapes.'); |
| 32 | process.exit(1); |
| 33 | } |
| 34 | |
| 35 | console.log(`[check-mcp-hosted-schema] OK (${files.length} file(s))`); |
File History
2 commits
sha256:65ccb454656ea5acdea0a10e559b78bcde1eb6ff753ecc2911bc99d1c3d7cadd
feat(calendar): enforce agent context tiers in retrieval AP…
Human
minor
⚠
1 day ago
sha256:9103f98c89257ed2b01c237cea895dabb3e85ea337dccb1161c175e4422355b6
docs: accept Calendar Events v0 spec with Phase 0 security …
Human
1 day ago