Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mcpli

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.

Quickstart

npx mcpli init mytool
cd mytool
npm run build
node dist/cli.js hello --name Ashley
node dist/mcp.js

Add 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}!`;
  }
});

Framework Commands

mcpli init <name>
mcpli build
mcpli list
mcpli serve

mcpli 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.

About

Convention-based framework for generating an MCP server and CLI from the same TypeScript command definitions

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages