-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathindex.ts
53 lines (47 loc) · 1.5 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env node
import { Command } from "commander";
import { createProject } from "./project/create.js";
import { addTool } from "./project/add-tool.js";
import { addPrompt } from "./project/add-prompt.js";
import { addResource } from "./project/add-resource.js";
import { buildFramework } from "./framework/build.js";
const program = new Command();
program
.name("mcp")
.description("CLI for managing MCP server projects")
.version("0.2.2");
program
.command("build")
.description("Build the MCP project")
.action(buildFramework);
program
.command("create")
.description("Create a new MCP server project")
.argument("[name]", "project name")
.option("--http", "use HTTP transport instead of default stdio")
.option("--cors", "enable CORS with wildcard (*) access")
.option("--port <number>", "specify HTTP port (only valid with --http)", (val) => parseInt(val, 10))
.option("--no-install", "skip npm install and build steps")
.action(createProject);
program
.command("add")
.description("Add a new component to your MCP server")
.addCommand(
new Command("tool")
.description("Add a new tool")
.argument("[name]", "tool name")
.action(addTool)
)
.addCommand(
new Command("prompt")
.description("Add a new prompt")
.argument("[name]", "prompt name")
.action(addPrompt)
)
.addCommand(
new Command("resource")
.description("Add a new resource")
.argument("[name]", "resource name")
.action(addResource)
);
program.parse();