Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@master4n/master-cli

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@master4n/master-cli

AI-agent-friendly command-line toolkit: timestamp/date conversion, JWT decoding, port killing, file finding, and directory trees — headless, --json, with a self-describing manifest and a built-in MCP server (mfn mcp).

latest
Source
npmnpm
Version
3.0.5
Version published
Weekly downloads
580
53.03%
Maintainers
1
Weekly downloads
 
Created
Source

@master4n/master-cli (mfn)

CI CodeQL Known Vulnerabilities Socket npm version npm downloads License Owner

Master CLI for developers and AI agents. 51 headless, JSON-first commands in three families: token savers (extract exactly what you need — one JSON field, a line range, a file outline — instead of dumping whole files into context), exact computation (BigInt math, semver, cron, regex, timezones — verified answers instead of guesses), and one-call actions (free a port, wait for a server, bulk-replace with dry-run). Every command runs the same for a human at a terminal and for an agent reading stdout, in ~60ms.

Installation

npm install -g @master4n/master-cli

This installs the mfn command.

Zero-install (agents & one-off use)

No global install needed — npx runs any command directly:

npx -y @master4n/master-cli capabilities --json   # discover every command
npx -y @master4n/master-cli epoch 1622547800 --json

For AI agents: run mfn capabilities --json (or the npx form above) to get the machine-readable manifest, and read llms.txt — it ships inside the npm package and documents the full agent contract.

The contract (why it's agent-friendly)

  • Headless-first — every command runs from flags/stdin. Interactive prompts appear only on a TTY when required input is missing; with --json or when piped, commands never block.
  • Machine-readable — pass --json (or just pipe; non-TTY auto-emits) and you get exactly one JSON object on stdout: { "ok": true, ... } on success, { "ok": false, "error", "message" } on failure.
  • Stable exit codes0 success · 1 runtime error · 2 usage error.
  • Clean channels — the banner, spinners, and logs go to stderr; stdout carries only data, so mfn <cmd> --json | jq always works.
  • Strict parsing — unknown commands/flags and missing args fail loudly ({ok:false}, exit 2), never a silent "success".
  • Self-describingmfn capabilities --json lists every command, and llms.txt documents the full agent contract.

MCP server (built in)

For agent clients that can't run shell commands, mfn mcp serves the whole toolkit over the Model Context Protocol (stdio transport, zero extra dependencies):

// e.g. .mcp.json / claude_desktop_config.json / any MCP client
{
  "mcpServers": {
    "mfn": { "command": "npx", "args": ["-y", "@master4n/master-cli", "mcp"] }
  }
}

Three tools: mfn_capabilities (the manifest), mfn_run ({command, args[]} — runs any catalogued command and returns its single JSON object, guardrails included), and mfn_help (per-command flags). update is deny-listed so an MCP-only client can never install packages. mfn mcp --json describes the server without starting it.

Quick start

mfn -h                 # top-level help (lists every command)
mfn <command> -h       # per-command help: flags + examples
mfn -v                 # version
mfn capabilities --json   # machine-readable manifest of all commands

Commands (51)

Run mfn capabilities for the grouped list, mfn <command> --help for flags.

OS-level — one call on macOS, Windows, and Linux

CommandWhat it doesExample
clipRead/write the system clipboardgit diff | mfn clip --json
notifyDesktop notification — ping the user when a task finishesmfn notify "build finished" --json
openOpen a file/URL in the default app (validated first)mfn open coverage/index.html --json
procsSearch processes by name: pid/cpu/memmfn procs node --json
diskPer-mount disk usage without df parsingmfn disk --json
trashReversible delete to the OS trash — never rm -rfmfn trash old-logs --json
dnsA/AAAA/CNAME/MX/TXT/NS in one callmfn dns github.com --json

Token savers — read less, extract exactly

CommandWhat it doesExample
jsonOne value from JSON by path — don't read the documentmfn json scripts.build -f package.json --json
schemaInfer JSON shape (paths + types); 10MB payload → ~20 linesmfn schema -f response.json --json
countLines/words/chars/bytes + LLM token estimategit diff | mfn count --json
linesExact line range of a file (1-based), never the whole filemfn lines src/app.ts -s 120 -n 30 --json
outlineSymbols + line numbers (.ts .js .py .go .md)mfn outline src/app.ts --json
diffStructured hunks of two files, counts firstmfn diff old.json new.json -s --json
freqMost repeated lines — log triage in one callmfn freq error.log -t 5 --json
importsA file's imports, or who imports a modulemfn imports --who utility --json
repoGit branch/dirty/ahead-behind/commits in one objectmfn repo --json
sys / have / ipSystem facts · tool versions · local addressesmfn have node git docker --json
size / ext / recentDisk usage · composition by extension · newest filesmfn size -t 5 --json
portsALL listening TCP ports with owning processesmfn ports --json
pkgDeclared vs installed dependency versionsmfn pkg --json
env / dotenvEnv inspection (secrets always redacted) · .env completenessmfn dotenv --json

Exact computation — never guess

CommandWhat it doesExample
calcBigInt-exact arithmetic — 2^53 + 1 comes out rightmfn calc "2^53 + 1" --json
basehex/dec/bin/oct conversion, BigInt-safemfn base 0xff --json
semverValidate/compare/sort/bump per semver.orgmfn semver 1.10.0 1.9.2 --json
cronValidate + explain + next run timesmfn cron "*/15 9-17 * * 1-5" --json
regexTest a pattern — matches with line/index/groupsmfn regex "TODO" -f src/app.ts --json
urlURL → components + decoded query paramsmfn url "https://x.com/a?b=1" --json
escapeContext-exact escaping: shell, JSON, regex, HTML, URLmfn escape "it's" --json
casecamel/snake/kebab/pascal/… conversionmfn case getUserName -t snake --json
epoch / dateEpoch ↔ date (auto unit) · timezone conversionmfn epoch 1622547800 --json
decodeJWT header + payload + expiry (signature not verified)mfn decode -t <jwt> --json

Actions — do, don't script

CommandWhat it doesExample
replaceLiteral find/replace across files — dry-run by defaultmfn replace old new -g "src/**/*.ts" --json
waitBlock until port/URL/file is ready — no sleep loopsmfn wait -p 3000 -t 30 --json
killFree the ports your dev server got stuck onmfn kill -p 3000 8080 -y --json
httpProbe a URL: status/headers/timing, capped body previewmfn http localhost:3000/health --json
portFind a free port, or check onemfn port -c 3000 --json
id / hash / encode / randomUUID v4/v7/nano · digests · codecs · CSPRNGmfn id -t uuid7 -n 3 --json
sc / ctsFuzzy file find · directory treemfn sc service --json
capabilities / updateMachine-readable manifest · self-updatemfn capabilities --json
mcpServe every command over the Model Context Protocol (stdio)mfn mcp

Examples

# Timestamps: any unit in, readable date out (parse cleanly in a script)
mfn epoch 1622547800000 --json | jq -r '.utc'        # 2021-06-01 11:43:20.000

# Free the ports your dev server got stuck on
mfn kill -p 3000 5173 -y --json

# Inspect a JWT without a website
mfn decode -t "$TOKEN" --json | jq '.payload.exp'

# Hand an agent the repo layout
mfn cts --json | jq -r '.tree'

Notes

  • Date/time features are powered by @master4n/temporal-transformer v2 (Luxon-backed, integer epochs, yyyy-MM-dd HH:mm:ss tokens).
  • Process/port/package operations use execFile (no shell), so inputs cannot inject commands.

Part of the @master4n toolkit

A small ecosystem of focused, agent-friendly packages:

License

MIT © Master4Novice

Keywords

cli

FAQs

Package last updated on 11 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts