Skip to content

MCP: Tools Without Islands

A useful tool should not care which window you happen to be working in. Model Context Protocol (MCP) gives CmdForge a common doorway: your pipelines can call tools from external MCP servers, and coding agents can call the tools you have built in CmdForge.

The Two-Way Bridge

External MCP server ──► CmdForge McpStep ──► your pipeline

Your CmdForge tools ──► CmdForge MCP server ──► Codex or Claude Code

CmdForge is both an MCP client and an MCP server. These are independent roles; use either one or both.

Why MCP Changes the Shape of a Tool

Before MCP, every integration wanted its own adapter. A filesystem server, browser service, or database helper each came with different setup code. MCP moves that boundary. CmdForge keeps doing what it is good at—composition, provider routing, contracts, and Unix pipes—while the server owns the specialized integration.

The reverse direction is just as powerful. A tool such as review-change can be used from a terminal today and appear as a typed callable tool inside a coding agent tomorrow. Its YAML, policy, tests, and provider choice remain in one place.

Your First Connection: Give an Agent CmdForge

CmdForge can configure supported hosts through their own CLIs. Preview first:

cmdforge mcp configure codex --dry-run
cmdforge mcp configure codex

For Claude Code:

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

The command registers CmdForge's stdio server and adds a clearly marked policy block to AGENTS.md or CLAUDE.md. It does not expose a single tool by itself.

The Empty Shelf Is a Feature

CmdForge's MCP server is closed by default. Choose what a host may see in ~/.cmdforge/mcp.yaml:

version: 1
server:
  expose:
    - summarize
    - project-*
  deny:
    - project-deploy-production

deny always wins. This makes broad patterns convenient without turning accidental exposure into a security model.

Choose the Direction You Need

Bring MCP into a pipeline

Configure an external server, discover its tools, then use an McpStep.

Read the MCP client chapter →

Bring CmdForge into an agent

Expose an intentional allowlist and run CmdForge as an MCP server.

Read the MCP server chapter →

A Practical Safety Model

  • Configuration is consent. Servers added by the CLI are explicitly approved.
  • No shell strings. Stdio commands and arguments are stored separately.
  • Minimal environment. MCP subprocesses inherit an allowlist, not every secret in your shell.
  • Remote means HTTPS. Plain HTTP is accepted only on loopback.
  • Responses are data. MCP content is never implicitly executed.
  • Depth is bounded. Recursive MCP-to-tool loops stop at a fixed nesting limit.