mcp #

Start the lvkit MCP (Model Context Protocol) server over stdio, so an AI agent can load a VI's graph and query it interactively — across multiple VIs in a single session, rather than one CLI invocation per question.

Synopsis #

lvkit mcp

mcp takes no arguments beyond -h. It runs the same server as the lvkit-mcp console script installed with the lvkit package: lvkit mcp is the subcommand form, lvkit-mcp is a standalone entry point that calls the identical main(). Use whichever form your agent's launcher expects — lvkit-mcp is the one tools like uvx invoke by name.

Tools #

The server exposes 12 tools, in three groups.

Stateless — no load required:

ToolDescription
generate_documentsGenerate the static HTML documentation site for a VI, library, class, or directory — same output as docs.
generate_pythonGenerate a Python package from a VI — same conversion as generate, with an output-review workflow (needs_review/errors lists) for the calling agent.

Stateful graph — build and manage the in-memory VI graph for the session:

ToolDescription
loadLoad a VI, and by default its SubVIs, into the session's graph.
list_loadedList VIs currently loaded in the graph.
clearClear the graph.
get_contextGet a loaded VI's full context — inputs, outputs, operations, wires, constants.
generate_ast_codeGenerate Python for a loaded VI via the same AST translation as generate.

Graph exploration — read a VI already in the graph:

ToolDescription
describeHuman-readable signature, inputs/outputs, SubVI calls, and control flow — same content as describe.
get_operationsExecution-ordered operations, with nested structures.
get_dataflowWire connections between operations, optionally filtered to one operation.
get_structureDetail on one case/loop/sequence structure node — selector, tunnels, frame contents.
get_constantsEvery constant's name, type, and value.

The get_context, generate_ast_code, describe, get_operations, get_dataflow, get_structure, and get_constants tools all read from the session's graph and require a load call first.

Example #

Add lvkit as an MCP server in your agent's configuration:

{
  "mcpServers": {
    "lvkit": { "command": "uvx", "args": ["--from", "lvkit", "lvkit-mcp"] }
  }
}

The agent's runtime starts the server itself over stdio and issues tool calls against it — you don't run lvkit mcp / lvkit-mcp by hand.

Notes #

  • load takes the same SubVI resolution parameters as the CLI's resolution flags — search_paths, vilib_root, userlib_root, auto_vilib — see SubVI & vi.lib resolution. auto_vilib defaults to true, matching the CLI's default (auto-detection on unless --no-auto-vilib is passed).
  • Before each load, generate_python, or generate_documents call, the server re-resolves the project's .lvkit/ store (see setup) from the given VI path, so primitive and vi.lib mappings already saved there apply without re-running setup per session.

See also #

  • describe — the equivalent one-shot CLI query for a single VI.
  • generate — the equivalent one-shot CLI conversion, including PrimitiveResolutionNeeded/VILibResolutionNeeded behavior that generate_python surfaces per file.
  • setup — install AI-agent skills that pair with this server.