UNPKG

create-strawberry-toolserver

Version:

Create a new Strawberry Tool Server project

53 lines (51 loc) 1.69 kB
#!/usr/bin/env node import { downloadTemplate } from 'giget'; import { runMain } from 'citty'; const DEFAULT_TEMPLATE = "strawberry"; const DEFAULT_REGISTRY = "https://gist.githubusercontent.com/cryppadotta/6734b1217387c1404a4de662c15dab7f/raw/58e798cd7365edfa5c580e29961635b01f37e669"; runMain({ args: { name: { type: "string", description: "Name of the template to use", required: false }, registry: { type: "string", description: "Registry URL to download the template from", default: DEFAULT_REGISTRY }, dir: { type: "string", description: "Directory where the project will be created", required: false }, _dir: { type: "positional", default: ".", description: "Project directory (prefer using --dir)" } }, async run(context) { try { const templateName = context.args.name || DEFAULT_TEMPLATE; const targetDir = context.args.dir || context.args._dir; console.log(`Creating new Strawberry Tool Server in ${targetDir}...`); const res = await downloadTemplate(templateName, { registry: context.args.registry, dir: targetDir }); console.log(` Success! Created Strawberry Tool Server at ${res.dir}`); console.log("\nGetting Started:"); console.log(` cd ${res.dir}`); console.log(" npm install"); console.log(" npm start"); console.log("\nTo test the server:"); console.log(" npx @strawberryprotocol/mcp-cli --sse http://localhost:3000/sse"); } catch (error) { console.error("Error:", "message" in error ? error.message : "unknown error"); process.exit(1); } } });