Skip to content

Serving CmdForge Tools over MCP

CmdForge can turn your personal command line into a typed MCP toolbox. The important word is your: the server exposes only the tools you choose, with their descriptions and argument schemas, while the runner keeps enforcing normal provider and delegation policy.

Start with the Exposure Policy

# ~/.cmdforge/mcp.yaml
version: 1
server:
  expose:
    - summarize
    - official/commit-msg
    - project-*
  deny:
    - project-deploy-*
    - "*-destructive"

No expose patterns means no tools. Exact names and shell-style patterns are supported; deny always wins. This policy is shared by stdio and HTTP transports.

Serve over Stdio

cmdforge mcp serve

Stdio is the normal choice for a local coding agent. The host starts CmdForge when needed and communicates over stdin/stdout. Nothing listens on a network port.

What the Host Sees

Tool arguments become MCP input schemas. Typed, required, and enumerated arguments stay typed:

arguments:
  - flag: --language
    variable: language
    type: string
    enum: [Python, Rust, Go]
    required: true
  - flag: --strict
    variable: strict
    type: boolean
    default: false

CmdForge also accepts an input field for stdin-style content. Namespaced tools are mapped safely, and ambiguous mapped names make server startup fail rather than exposing the wrong tool.

Serve over Streamable HTTP

For local development, loopback defaults are safe:

cmdforge mcp serve --transport streamable-http   --host 127.0.0.1 --port 8000

Binding beyond loopback requires all three pieces: a bearer token, an external HTTPS URL, and an HTTPS origin policy. Put the token in an environment variable:

export CMDFORGE_MCP_TOKEN="..."

cmdforge mcp serve --transport streamable-http   --host 0.0.0.0 --port 8000   --external-url https://mcp.example.com   --allowed-origin https://agent.example.com   --auth-token '${CMDFORGE_MCP_TOKEN}'

TLS terminates before CmdForge

Place nginx, Caddy, or another reviewed TLS proxy in front of a non-loopback server. CmdForge refuses an external configuration that lacks HTTPS identity or auth.

Execution Still Goes Through the Runner

MCP is an entrance, not a bypass. Calls still receive argument coercion, dependency checks, provider policy, fallback controls, schema validation, and maximum nesting depth. Results are returned as MCP content; code emitted by a model is not automatically executed.

Let CmdForge Configure the Host

cmdforge mcp configure codex --dry-run
cmdforge mcp configure claude-code --scope project --dry-run

Review the host command and managed policy diff, then repeat without --dry-run. Continue with Coding Agents That Actually Use Your Tools.