CLI Reference

ZeroMCP ships two commands: serve and audit.

zeromcp serve

Start the MCP server. Scans tool directories, connects remote servers, and serves over configured transports.

zeromcp serve [options] [config-path]

Arguments

ArgumentDefaultDescription
config-path./zeromcp.config.jsonPath to config file. If omitted, searches current directory.

Flags

FlagDefaultDescription
--transport, -tstdioTransport protocol: stdio or http
--port, -p3000Port for HTTP transport (ignored for stdio)
--host127.0.0.1Bind address for HTTP transport
--tools./toolsOverride tool directory (takes precedence over config file)
--watch, -wfalseWatch tool files for changes and hot-reload
--verbose, -vfalseEnable verbose logging to stderr
--quiet, -qfalseSuppress all non-error output
--versionPrint version and exit
--help, -hPrint help and exit

Example: stdio transport (default)

$ zeromcp serve
[zeromcp] v0.1.0
[zeromcp] Config: ./zeromcp.config.json
[zeromcp] Tools:  ./tools
[zeromcp] Loaded: hello
[zeromcp] Loaded: stripe_list_customers
[zeromcp] Loaded: github_list_issues
[zeromcp] 3 local + 0 remote = 3 tool(s)
[zeromcp] stdio transport ready

Example: HTTP transport

$ zeromcp serve --transport http --port 8080
[zeromcp] v0.1.0
[zeromcp] Config: ./zeromcp.config.json
[zeromcp] Tools:  ./tools
[zeromcp] Loaded: hello
[zeromcp] 1 local + 0 remote = 1 tool(s)
[zeromcp] HTTP transport listening on http://localhost:8080/mcp

All log output goes to stderr. For stdio transport, stdout is reserved for MCP JSON-RPC communication. For HTTP transport, the server listens on the specified port.

zeromcp audit

Run static analysis on tool files. Checks for security violations before publishing or deploying.

zeromcp audit [options] [tools-path]

Arguments

ArgumentDefaultDescription
tools-path./toolsDirectory of tool files to audit

Flags

FlagDefaultDescription
--format, -ftextOutput format: text or json
--strictfalseTreat warnings as failures
--fixfalseAuto-fix simple violations (e.g., add missing permission blocks)
--verbose, -vfalseShow detailed violation context
--help, -hPrint help and exit

What it checks

Example: text output

$ zeromcp audit ./tools
✓ stripe/list_customers.js — permissions declared, no raw env access
✓ stripe/create_charge.js — permissions declared, no raw env access
✗ github/issues.js — uses global fetch (should use ctx.fetch)
✗ utils/helper.js — accesses process.env directly

2 passed, 2 failed

Example: JSON output

$ zeromcp audit --format json ./tools
{
  "passed": 2,
  "failed": 2,
  "results": [
    { "file": "stripe/list_customers.js", "status": "pass" },
    { "file": "stripe/create_charge.js", "status": "pass" },
    { "file": "github/issues.js", "status": "fail", "reason": "uses global fetch" },
    { "file": "utils/helper.js", "status": "fail", "reason": "accesses process.env" }
  ]
}

The audit CLI gates the community tool registry. Tools with violations cannot be published.

Environment Variables

VariableDescription
ZEROMCP_CONFIGPath to config file (overrides default ./zeromcp.config.json)
ZEROMCP_TOOLSPath to tools directory (overrides config file tools field)
ZEROMCP_TRANSPORTTransport type: stdio or http
ZEROMCP_PORTHTTP port (default: 3000)
ZEROMCP_HOSTHTTP bind address (default: 127.0.0.1)
ZEROMCP_LOG_LEVELLog verbosity: error, warn, info, debug
NO_COLORDisable colored output (respects the no-color standard)

CLI flags take precedence over environment variables. Environment variables take precedence over config file values.

Exit Codes

CodeMeaning
0Success. For serve: clean shutdown. For audit: all tools passed.
1General error (invalid config, missing tools directory, etc.)
2Audit failures detected (one or more tools have violations)
130Interrupted (SIGINT / Ctrl+C)

Precedence Order

When the same setting is specified in multiple places, the following order applies (highest to lowest):

  1. CLI flags (--port 8080)
  2. Environment variables (ZEROMCP_PORT=8080)
  3. Config file (zeromcp.config.json)
  4. Built-in defaults