Skip to main content

CLI Reference

Reference for the mcpg CLI (daemon lifecycle and client configuration).

Installation

# Install globally
npm install -g @hotnsoursoup/mcp-gateway

# Or run directly with npx
npx @hotnsoursoup/mcp-gateway <command>

Core Commands

mcpg init

Initialize ~/.mcp-gateway/ with template files.

mcpg init [--force] [--port <PORT>] [--config <PATH>]

mcpg start

Start the gateway in the background (pidfile + logs).

mcpg start [--port <PORT>] [--config <PATH>] [--keep-alive]

mcpg stop

Stop a background gateway (from pidfile).

mcpg stop

mcpg restart

Restart a background gateway.

mcpg restart

mcpg status

Show gateway status.

mcpg status

mcpg logs

Print recent gateway logs.

mcpg logs [--lines <N>] [--follow]

mcpg run

Run the gateway in the foreground.

mcpg run

mcpg daemon

Run the daemon in the foreground (used by the wrapper for IPC mode).

mcpg daemon

Client Configuration

mcpg configure <tool>

Configure an AI tool to use the gateway.

mcpg configure claude
mcpg configure cursor
mcpg configure codex
mcpg configure gemini

# Remove instead of adding
mcpg configure claude --remove

mcpg print-config <tool>

Print MCP configuration JSON for manual setup.

mcpg print-config claude

Autostart

mcpg enable-autostart

mcpg enable-autostart

mcpg disable-autostart

mcpg disable-autostart

HTTP Commands

mcpg enable-http
mcpg disable-http
mcpg show-token
mcpg rotate-token

Licensing

mcpg install-license

mcpg install-license <JWT>

Help

mcpg help
mcpg help quickstart
mcpg help config
mcpg help tools

Environment Variables

VariablePurposeDefault
MCP_GATEWAY_HOMEConfig directory~/.mcp-gateway
MCP_CONFIG_PATHConfig file path~/.mcp-gateway/config.yaml
MCP_CATALOG_PATHCatalog file path~/.mcp-gateway/catalog.yaml
MCP_KNOWLEDGE_PATHKnowledge base path~/.mcp-gateway/knowledge.yaml
MCP_GATEWAY_LICENSELicense JWT (if not passed to install-license)unset
MCP_GATEWAY_KEEP_ALIVEDisable idle timeout when setunset
MCP_GATEWAY_IDLE_TIMEOUTOverride idle timeout (ms)from config