Skip to content

Agents (MCP)

lucisv-mcp is lucisv as a Model Context Protocol server. A coding agent spawns it over stdio and asks it about the Verilog/SystemVerilog tree instead of reading whole files: a module’s ports, a file’s outline, one always block, who instantiates what, every reference to a signal. It can also make the edits lucisv already knows how to make safely — format, lint fixes, rename, the port refactorings and single-item replacements — each one verified before anything is written.

It is the same engine as the CLI and the language server (parser, index, formatter, linter, refactorings), in a third binary that shares no state with either.

The platform .vsix packages (darwin-arm64, darwin-x64, linux-x64, linux-arm64, win32-x64, and all) carry lucisv-mcp next to lucisv and lucisv-server. On VS Code 1.101 or later the extension registers it with agent mode, one server per workspace folder, named lucisv (<folder>): open MCP: List Servers to see it, trust it once, and agent mode can call its tools. The extension starts it as

Terminal window
lucisv-mcp --root <folder> --index-cache <the extension's workspace storage>

Two settings govern it:

setting default what it does
lucisv.mcp.enabled true false withdraws the server from agent mode (takes effect without a reload)
lucisv.mcp.path "" a lucisv-mcp to use instead of the bundled one; empty means the bundled one, else lucisv-mcp on PATH

The universal .vsix carries no binaries: it looks lucisv-mcp up on PATH, and when there is none it says so in the lucisv output channel instead of starting anything. VS Code older than 1.101 has no MCP API; the extension then registers nothing and everything else works as before.

These read their own config file, not VS Code’s. In VS Code, run lucisv: Copy MCP server config, pick the host, and paste the snippet into the file the message names. It points at the binary the extension would run (the bundled one’s path changes when the extension updates — copy it again then, or point at a lucisv-mcp on PATH).

By hand, with lucisv-mcp on PATH:

Terminal window
# Claude Code, from the project directory
claude mcp add lucisv -- lucisv-mcp --root .

.mcp.json (Claude Code, at the project root) or .cursor/mcp.json (Cursor):

{
"mcpServers": {
"lucisv": { "command": "lucisv-mcp", "args": ["--root", "/path/to/project"] }
}
}

.vscode/mcp.json (VS Code, when configured by hand instead of through the extension):

{
"servers": {
"lucisv": { "type": "stdio", "command": "lucisv-mcp", "args": ["--root", "/path/to/project"] }
}
}
Terminal window
cargo build --release -p lucisv_mcp # target/release/lucisv-mcp

Arguments: --root DIR (repeatable; default the current directory), --filelist FILE (index exactly the files an EDA filelist names), --index-cache DIR, --verbose (per-call timing on stderr). Anything else is refused with a usage line and exit status 2.

Generated from the binary’s own tools/list (node editors/vscode/mcp_smoke.js target/release/lucisv-mcp --tool-table); the first sentence of each description. The agent sees the full description and input schema.

tool writes what it answers
project_overview Files, units by kind, top modules, largest files.
list_units Units (modules, interfaces, packages, classes, programs) with file:line.
unit_interface A unit’s parameters, ports (direction, type, range), modports or members; template: true adds an instantiation.
outline A file’s declarations as a tree with line ranges, and its parse errors.
read_item One item’s exact source and lines.
search_symbols Declarations whose name contains query (any case), members included.
defines The `define table (name, parameters, body, file:line) of a file, a macro name, or all.
definition Where a name or macro is declared: file:line:col, kind, line.
references Uses of one declaration, then its unresolved mentions (strings, comments, macro text).
hierarchy Who instantiates a module (up, with file:line) or what it instantiates (down, default).
diagnostics Parse errors and lint findings (line:col severity message [rule]) of file or all.
format yes Format file/files as lucisv format; lines limits it.
fix_lint yes Apply the safe lint fixes to file/files; says what remains.
rename yes Rename a declaration and its uses; select as definition.
expand_wildcard yes Replace one instance’s .* with the named connections it binds.
convert_ports yes Rewrite a module’s non-ANSI header as an ANSI port list.
organize_imports yes Remove unused imports in the scope at a position; sort the rest.
inline_module yes Replace one instance with its module’s body, connections substituted.
propagate_ports yes Connect by name every port one instance leaves unconnected.
remove_port yes Delete a port and its connection in every instantiation; refused while the body uses it.
add_port yes Add an ANSI port to a module, connected in every instantiation; after positions it.
extract_module yes Move whole items in lines start_line..end_line to a new module instantiated in their place.
replace_item yes Replace one item with text: one item, same kind and names (unless rename; references untouched).
insert_item yes Insert items text before or after item anchor, or at end (end@NAME) of the last unit (unit NAME).
delete_item yes Delete one item and its leading comments; refused while its names are used (sites listed) or it holds a `define, unless force.
instantiate Instantiation text for module name: parameters, instance name, named or .* ports.
  • Answers come from the disk. Every call first re-checks the files it indexes, so no answer is older than the disk at the moment the call arrived. Unsaved editor buffers are invisible to it — save before asking.
  • Edits are verified, then written whole. Every edit tool computes and verifies every file’s new text before the first write; a refusal names the reason and touches nothing. The formatter’s own safety net applies to format; replace_item, insert_item and delete_item require the file to still parse and change no byte outside the item.
  • dry_run: true on any edit tool returns the unified diff instead of writing.
  • Nothing outside the roots. Every path a tool takes must resolve inside a --root; anything else is refused.
  • The language server’s cache is never written. --index-cache names the directory the extension gives lucisv-server; lucisv-mcp accepts it today and will read that store (read-only) for a warm start in a later release — never write it, so there are never two writers.