(cwd = process.cwd())
| 6 | import type { EmitInput } from './emit' |
| 7 | |
| 8 | async function generate(cwd = process.cwd()): Promise<void> { |
| 9 | const config = await loadConfig(cwd) |
| 10 | const input: EmitInput = {} |
| 11 | for (const [name, server] of Object.entries(config.servers)) { |
| 12 | process.stderr.write(`Introspecting MCP server "${name}"…\n`) |
| 13 | const surface = await introspectServer(server) |
| 14 | input[name] = { prefix: server.prefix, surface } |
| 15 | } |
| 16 | const out = await emitDescriptors(input) |
| 17 | const outPath = resolve(cwd, config.outFile) |
| 18 | writeFileSync(outPath, out, 'utf8') |
| 19 | process.stderr.write(`Wrote ${outPath}\n`) |
| 20 | } |
| 21 | |
| 22 | const cmd = process.argv[2] |
| 23 | if (cmd === 'generate') { |
no test coverage detected