Architecture & Lifecycle

How CodeMCP mediates between AI and code.

A transparent, local-first proxy that turns your project folder into a secure, bounded agentic workspace.

01Initialization

Project Scope Binding

You run `codemcp` in any project root. CodeMCP anchors itself to this working directory, verifies Git status, and establishes path containment rules so operations cannot escape the repo root.

$ codemcp Resolving project root: C:\projects\landing Validating directory boundary: OK
02Policy Definition

Context & Security Ingestion

CodeMCP reads `.mcpignore` to shield sensitive files (.env, credentials, secrets) and loads `CONTEXT.md` to equip AI models with coding conventions, design tokens, and project architecture.

Reading codemcp.json... OK Shielding 14 patterns from .mcpignore... OK Indexing CONTEXT.md (3.2KB)... OK
03Server Startup

Secure MCP Protocol Server

A local Model Context Protocol server starts on localhost (or over stdio). If remote AI web clients (like ChatGPT or Google AI Studio) need access, an encrypted ngrok tunnel is orchestrated with ephemeral vault authentication.

Local MCP SSE: http://127.0.0.1:4173/mcp Tunnel: https://tunnel.codemcp.dev/mcp Vault token generated & locked: OK
04Execution & Mediation

Human-in-the-Loop Mediation

When an AI client issues a file edit, AST search, or terminal command, CodeMCP inspects the request against permission rules, presents diffs for human confirmation if enabled, and applies writes atomically.

-> tools/call: write_file (path: components/button.tsx) -> Diff computed: +14 lines, -2 lines -> Approval granted -> File written atomically.
Walkthrough

See CodeMCP in action

From running codemcp to approving your first diff.

0:00
0:00
Zero-Trust Model

Standard AI Tools vs. CodeMCP

Traditional Unbounded Tools

  • ✕ Access to entire user home directory (`/home/user` or `C:\Users`)
  • ✕ Can read `.env` secrets, AWS keys, and private SSH keys
  • ✕ Silent file writes with zero diff preview or approval
  • ✕ Ephemeral context lost between sessions

CodeMCP Controlled Architecture

  • Strictly bounded to chosen project repository root
  • Deterministic file shielding via `.mcpignore` rules
  • Interactive terminal diff reviews and auto-apply toggles
  • Persistent repository guidelines with `CONTEXT.md`