Not sure whether to make a CLI or MCP? Why not both!
mcpli is a TypeScript/Node framework for defining commands once and exposing them as both a CLI and an MCP stdio server.
Command files live under commands/ and default export defineCommand(...). The framework discovers those commands, validates their schemas, and emits dist/cli.js, dist/mcp.js, compiled command modules, and dist/manifest.json.
npx mcpli init mytool
cd mytool
npm run build
node dist/cli.js hello --name Ashley
node dist/mcp.jsAdd commands under commands/:
import { defineCommand } from "mcpli";
import { z } from "zod";
export default defineCommand({
description: "Say hello.",
input: z.object({
name: z.string().default("world").describe("Name to greet")
}),
handler({ input }) {
return `Hello, ${input.name}!`;
}
});mcpli init <name>
mcpli build
mcpli list
mcpli servemcpli serve runs an MCP stdio server directly from source. mcpli build creates generated CLI and MCP entrypoints in dist/.
See docs/quickstart.md and docs/reference.md for conventions, schema support, generated CLI behavior, MCP serving, packaging, publishing, and errors.