Modules and capabilities·/docs/cli-and-mcp

CLI, IDE, and MCP reference

The lakeport CLI drives scaffolding, toolchain setup, Vite-style development servers, theorem checking, 6-target builds, size budgets, and the MCP gateway for coding agents.

Core commands

sh
lakeport init my-app # scaffold a CSS-first project (--template tailwind for Tailwind)
lakeport init my-app --template mobile # scaffold via installed CLI
lakeport setup # install pinned toolchains & closures
lakeport doctor # validate Lean, Wasm & native SDKs
lakeport check . # type-check .lp, CSS classes & theorems
lakeport dev . # Vite-style dev server + 6-target HMR
lakeport build web . --release # optimized build (web/ios/android/macos/windows/linux)
lakeport size . --target web # Wasm/ELF/APK/Mach-O size budget report
lakeport mcp --project . # MCP server for Claude Code, Codex & Cursor

Vite-style lakeport.json pipeline

Configure build plugins, environment variables, path aliases, and dev proxies in lakeport.json (packages/lakeport-cli/src/LakeportCli/Config.lean, Pipeline.lean):

•
Hookable plugin lifecycle: Ordered pre → normal → post hooks across config, configResolved, resolveId, load, transform, cssTransform, configureServer, optimizeBundle, generateBundle, writeBundle, and handleHotUpdate, including external JSON-RPC 2.0 plugins.
•
Built-in core hooks: lakeport:env-define (.env* loading with strict LAKEPORT_PUBLIC_* client isolation), lakeport:alias-resolve (@/, @components), lakeport:asset-query (?url, ?raw, ?inline, custom font bundling), lakeport:css-import, lakeport:hmr-router, and lakeport:dev-proxy (HTTP/1.1 chunked-aware reverse proxy).
•
Optional CSS plugins (Tailwind, PostCSS, Lightning CSS): Install the Tailwind CLI and import tailwindcss in your entry stylesheet to run Tailwind during lakeport dev and lakeport build.
•
Development reload: CSS-only edits can update the stylesheet without recompiling Lean. App edits rebuild changed modules. State preservation depends on the host and the app checkpoint.

MCP gateway (lakeport mcp)

lakeport mcp exposes Lakeport directly to coding agents (Claude Code, Codex, Cursor, Zed) over stdio or HTTP:

•
lakeport_check runs offline checks or delegates to a running lakeport dev session, returning structured .lp source locations, compiler errors, reachability data, and remaining Lean proof goals.
•
Because failing proofs return the exact compiler goal state, agents can iterate on state logic and proofs autonomously until lakeport check passes with zero unfinished proofs (sorry).

Editor & IDE support (lakeport-lsp)

tools/lakeport-lsp/ is a bidirectional .lp ↔ .lean LSP bridge used by the official VS Code / Cursor (tools/vscode-lakeport/) and Zed (tools/zed-lakeport/) extensions:

•
Compiles open .lp buffers in memory to shadow .lean projections with token-level bidirectional source maps (lpCompiler.ts, sourceMap.ts).
•
Narrows diagnostics to exact tags, attribute names, and {expr} spans instead of whole blocks.
•
Supports go-to-definition on opening and closing custom component tags (</MyCard>), Lean type hover, project CSS class completions (plus Tailwind completions when enabled), and automatic lakeport mcp registration.