fastmcp
Version:
A TypeScript framework for building MCP servers.
49 lines (48 loc) • 1.14 kB
JavaScript
// src/bin/fastmcp.ts
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { execa } from "execa";
await yargs(hideBin(process.argv)).scriptName("fastmcp").command(
"dev <file>",
"Start a development server",
(yargs2) => {
return yargs2.positional("file", {
type: "string",
describe: "The path to the server file",
demandOption: true
});
},
async (argv) => {
try {
await execa({
stdin: "inherit",
stdout: "inherit",
stderr: "inherit"
})`npx @wong2/mcp-cli npx tsx ${argv.file}`;
} catch {
process.exit(1);
}
}
).command(
"inspect <file>",
"Inspect a server file",
(yargs2) => {
return yargs2.positional("file", {
type: "string",
describe: "The path to the server file",
demandOption: true
});
},
async (argv) => {
try {
await execa({
stdout: "inherit",
stderr: "inherit"
})`npx @modelcontextprotocol/inspector npx tsx ${argv.file}`;
} catch {
process.exit(1);
}
}
).help().parseAsync();
//# sourceMappingURL=fastmcp.js.map