check-mcp-hosted-schema.mjs
sha256:c2dbf04d56308f3bbf2d06e6d2eb022b8948b1e827195fe525a44e5e18d5f9c0
feat(auth): Phase B Connect cloud agent (RFC 8628) + Hermes…
Human
minor
⚠ breaking
11 days 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
1 commit
sha256:93bcf8f9bd56d8c5b9339f4ec73b9ebd66571398d56262d38eedc2cfa9db9882
fix(test): align Band B landing assertion with desktop MCP …
Human
11 days ago