Skip to content

feat: generate npm packages (TypeScript CLI + MCP server) alongside Python #23

@NandishNaik01

Description

@NandishNaik01

Feature

Add TypeScript/Node.js code generation alongside the existing Python generators. When a user generates packages, they should be able to select:

  • Python CLI (typer) — existing
  • Python MCP (fastmcp) — existing
  • npm CLI (commander.js or oclif) — new
  • npm MCP (@modelcontextprotocol/sdk) — new

Each npm package should be a proper publishable package with package.json, tsconfig.json, and src/ layout — ready for npm publish.

Why

  • Many API consumers work in Node.js/TypeScript ecosystems
  • npm is already onboarded as a distribution app in TPS (app_code=21)
  • The publish-to-npm workflow needs actual npm packages to upload
  • TypeScript provides better type safety and IDE support for generated code

Scope

npm CLI Package

  • package.json with commander.js + axios dependencies
  • TypeScript source with commands mapped from route graph
  • Auth lifecycle: login/logout commands, shared token store at ~/.config/{name}/auth.json
  • npx {name} --help entry point

npm MCP Package

  • package.json with @modelcontextprotocol/sdk dependency
  • TypeScript MCP server with tools mapped from route graph
  • authenticate tool for auth lifecycle
  • stdio transport, compatible with Claude Desktop

Generator changes

  • New templates: npm_package/*.j2 and npm_mcp_package/*.j2
  • New generator: src/genalphacli/generators/npm_generator.py
  • Frontend: add "npm CLI" and "npm MCP" checkboxes to output type selector
  • Publish workflow: detect npm packages and use npm registry upload (already have npm TPS handler)

Template structure

{name}/
├── package.json
├── tsconfig.json
└── src/
    ├── index.ts       (CLI entry point)
    ├── client.ts      (HTTP client with auth)
    ├── auth.ts        (token management, shared with MCP)
    └── commands/
        └── *.ts       (one file per command)

{name}-mcp/
├── package.json
├── tsconfig.json
└── src/
    ├── index.ts       (MCP server entry point)
    ├── client.ts      (async HTTP client)
    ├── auth.ts        (token management)
    └── tools/
        └── *.ts       (one file per tool)

Dependencies on other work

Not in scope

  • TypeScript type generation from response schemas (future enhancement)
  • Monorepo support (single package per generation)
  • Deno or Bun-specific output

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions