mcp

v0.11.3
@simten/mcp Checked 2 days ago Published 11 days ago

MCP server for Simten: check, simulate, verify and show TypeScript circuits, with a live browser canvas.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_started

Start here when the user is new to simten, asks what it is, or wants a demo. With no arguments: a short orientation plus the menu of bundled example circuits (Snake, a RISC-V computer, a systolic array, an ALU, ...). With example:"<id>": writes that example to circuits/<id>.circuit.ts, ready for show_circuit — works in an empty folder, no setup or install needed. If the user asked for a specific circuit of their own, skip this tool and build it.

ParameterTypeDescription
dirstringProject root to write the example under (default: the MCP working directory)
examplestringExample id to write to circuits/<id>.circuit.ts (one of: snake, rv32i-computer, 6502-computer, nes, figlet, hack-alu, tpu-3x3, fibonacci, rule30, alu, half-adder). Omit to get the orientation and exam…

check_circuit

Compile a circuit and report whether it builds: a compile error with its location, or the circuits it defines and the components they use. A file with imports loads as a module, so its own imports resolve; source text with no imports runs in-process. No setup needed.

ParameterTypeDescription
filePathstringPath to a .circuit.ts file
sourcestringTypeScript circuit code as a string

simulate_circuit

Compile and simulate a circuit and return signal traces and the steady-state cycle. OBSERVATION ONLY: this shows what the circuit does, NOT whether it is correct; use verify_circuit to establish correctness. Never touches the browser canvas; call show_circuit to paint.

ParameterTypeDescription
circuitNamestringName of the circuit to simulate (defaults to last defined)
filePathstringPath to a .circuit.ts file
inputsobjectWhere the inputs sit at the start, as { key: value }, e.g. { "a": 1, "b": 0 }. A key is an input port name or the path of a Switch or Input node inside the circuit ("d", "cpu.kbd"). Keys resolve exact…
memoryDataobjectMemory contents to load before cycle 0, as { nodePath: { address: value } }, e.g. { "rom": { "0": 62, "1": 7 } }. A node is named by its exact path inside the circuit ("rom", "cpu.imem"); a path that…
sourcestringTypeScript circuit code as a string
ticksintegerNumber of clock ticks to simulate (default: 10)

verify_circuit

Run a self-checking testbench FILE against a circuit and report the result AT A DECLARED ORACLE TIER. simulate_circuit shows what a circuit does; verify_circuit tells you whether it's correct — a design isn't "done" until it passes at the highest feasible tier. You usually write both the circuit and its testbench, so what matters is how INDEPENDENT the expected values are from the implementation. The required `oracle` block declares that; the gate refuses a passed result without it. Don't weaken the oracle to pass — `independence_basis` makes that visible. ORACLE TIERS (highest → lowes…

ParameterTypeDescription
oracle *objectRequired declaration of the oracle tier and its independence basis — the contract gate
testbench *stringPath to the .verify.ts testbench file (it imports its own DUT). Relative to the project root.
timeoutMsintegerWall-clock budget in ms (default 30000); the subprocess is killed past it

setup_project

Make the current folder ready to RUN verify_circuit. check_circuit and simulate_circuit need no setup; verify_circuit does, because it runs the testbench on the host via tsx and resolves @simten/core + fast-check from this project. Call this once before a project's first verify_circuit (or whenever it reports "setup_required") — it is NOT needed just to check, simulate, or show circuits, including the get_started examples. It is idempotent — safe to re-run. It writes an ESM package.json (never clobbering an explicit CommonJS one), a minimal tsconfig for editor IntelliSense, a circuits/ di…

ParameterTypeDescription
dirstringProject root to set up (default: the MCP working directory)
packageManagerstringOverride the package manager (default: detect from lockfile, else npm)

show_circuit

Paint or update the live circuit canvas in the browser. This is the only tool that draws, and the ONLY thing that updates the canvas: editing the .circuit.ts file does NOT update the browser, so call show_circuit again (typically after a verify tier-pass) to repaint. inputs and memoryData start the canvas's run the way they start simulate_circuit's. Call with NO source/filePath to count connected browser tabs. Pass close:true to close the preview and stop the server. Canvas policy: don't paint during tight iteration; paint at a verify tier-pass or for a specific result worth showing.

ParameterTypeDescription
closebooleanClose the live preview and stop the server.
filePathstringPath to a .circuit.ts file (read once, not watched: call show_circuit again to repaint)
inputsobjectWhere the inputs sit at the start, as { key: value }, e.g. { "a": 1, "b": 0 }. A key is an input port name or the path of a Switch or Input node inside the circuit ("d", "cpu.kbd"). Keys resolve exact…
memoryDataobjectMemory contents to load before cycle 0, as { nodePath: { address: value } }, e.g. { "rom": { "0": 62, "1": 7 } }. A node is named by its exact path inside the circuit ("rom", "cpu.imem"); a path that…
sessionstringTarget a specific browser tab by session ID. If omitted, uses the most recently active tab or opens a new one.
sourcestringTypeScript circuit code as a string

get_grammar

Return the circuit-builder API: how to write a `circuit()` module — inputs/outputs, nodes, connect — with worked examples. Call this before writing a circuit.

list_components

Return the full catalog of available components from `@simten/core/std`, each with its ports and constructor options (e.g. `Register({ width })`). Call this to discover exact part names and parameters instead of guessing.

get_verify_api

Return how to write a `.verify.ts` testbench for `verify_circuit`: `simulate(top, { memory })` and its stepper API (set for ports and switches, tick, get, read, reset), `verify.exhaustive` vs `verify.check`, `declareOracle`, and worked examples (including the Tier-A npm-oracle pattern). Call this before writing a testbench.