mcp-codegen

A code generator that turns an analysis of an MCP server into a TypeScript command-line tool. A command-line tool is a program you run by typing commands in a terminal.

In plain words
What is it for?
Use it to scaffold an npm-based CLI from an analyzed MCP server, including command names, parameter handling, formatted output, JSON output, help, version, and verbosity options.
Why use it?
It removes the need to design the command structure and write the starter code by hand. It maps the server's tools and settings into commands, arguments, and options.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/myeolinmalchi/mcp2cli/mcp-codegen
Any agent
npx skills add myeolinmalchi/mcp2cli --skill mcp-codegen
Clone the repo
git clone --depth 1 https://github.com/myeolinmalchi/mcp2cli

Made for: Claude Code, Codex.

Per session 73 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 472 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00073 $0.00472
Opus 5 $0.00036 $0.00236
Sonnet 5 $0.00015 $0.00094
Haiku 4.5 $0.00007 $0.00047

Measured 2d ago against content hash d5479a0c46d6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

mcp-codegen scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/mcp-codegen/SKILL.md · 48 lines

What it actually says

CLI Code Generation

Generate a TypeScript/npm-based CLI tool from an analyzed MCP server.

Prerequisites

Run mcp-analyze first to get the tool list, parameters, and pattern classification.

Step 1: Design CLI Command Structure

Map MCP tools to CLI commands:

Naming Convention:

  • Tool prefix groups become subcommands: lol_get_summoner_profile<cli> lol profile
  • Single-domain tools become direct commands: parse_document<cli> parse
  • Use kebab-case for multi-word commands

Parameter Mapping:

  • Required MCP params → positional CLI args
  • Optional MCP params → named flags (--flag value)
  • Boolean params → boolean flags (--verbose, --no-cache)
  • Complex objects → JSON string flags or --file references

Output Design:

  • Default: human-readable formatted text
  • --json: raw JSON output for piping
  • Progress/status → stderr, data → stdout

Standard Flags (always include):

  • --help, --version, --json, --verbose / -v

Step 2: Generate Code

Always generate TypeScript/npm-based CLI tools, regardless of the source MCP server's language.

See references/cli-scaffold.md for the project template, stack, and implementation rules.

Select the appropriate code template from references/tier-1-templates.md or references/tier-2-templates.md based on the pattern classification from mcp-analyze.

If the pattern is Tier 3, see references/tier-3-strategies.md for partial conversion approach.

If the source MCP server is Python, see references/porting-cheatsheet.md for Python → TypeScript translation patterns (httpx → fetch, pydantic → interfaces, asyncio → ESM await, etc.).

Files

What ships with it

5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 48 lines · 73 tokens per session scan A d5479a0c46d6

Subscribe to this mod's changes

mcp-codegen is a skill published in the GitHub repository myeolinmalchi/mcp2cli (4 stars, last pushed 5mo ago), licensed MIT. It adds 73 tokens to every session and 472 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.