Skip to content

Connect a coding agent

Give a coding agent the same component tree and timeline the panel shows, so it reads the running app instead of guessing from source. One MCP entry covers every dev server on your machine.

Terminal window
claude mcp add lit-devtools -- npx -y @oddsquad/vite-plugin-lit mcp

The equivalent claude_desktop_config.json or mcp.json entry:

mcp.json
{
"mcpServers": {
"lit-devtools": {
"command": "npx",
"args": ["-y", "@oddsquad/vite-plugin-lit", "mcp"]
}
}
}

The command needs two optional peers, cac and @devframes/agentic. See the CLI reference for the message it prints when one is missing.

Tool Answers
lit_get-meta Plugin version, available timeline layers, resolved settings.
lit_list-components The live element tree, read from the page on each call, with each component’s source file and line. A tag no custom element defines appears with notDefined: true, and a custom element another library defines with notLit: true. Bound it with maxDepth.
lit_component-details Reactive properties, attributes, update flags and Lit dev-mode warnings for one element id, or for every element of a tag name, read from the page on each call.
lit_component-docs The documented API of a tag (descriptions, events, slots, CSS parts and custom properties), from your components’ JSDoc or the Custom Elements Manifests your dependencies ship.
lit_update-summary Which components updated, how often, how long for, and what changed.
lit_recent-events Recent lifecycle, Lit warning, render and input events, filterable by tag name, element or layer.
lit_range-summary What happened between two instants: spans per layer and which components updated, for a start and end taken from lit_recent-events times.
lit_hmr-history Recent hot patches that landed (instances, duration, child-state mode) and ones that could not, oldest first, up to 50 of each.
lit_hmr-incompatibilities Components the plugin could not hot-patch in place, and why.
lit_set-recording Starts or stops timeline recording. The only tool that changes state.

Nine of the ten only read. lit_set-recording exists because lit_recent-events is a dead end while recording is off, and an agent that can read the timeline but not start it just hands the question back to you. Recording is a shared toggle, so an agent turning it on also changes what you see in an open panel. The layer toggles and the element picker stay panel-only.

All ten answer only while a dev server with DevTools is running. Nothing is stored, so with the server down an agent gets a connection error rather than an empty answer.

Point the agent at lit_update-summary first for anything shaped like “why did this re-render”. It returns the same derived cycles and per-component totals the Updates tab shows, so the agent never pairs thousands of start and end events itself.

lit_range-summary takes a start and an end in milliseconds, on the same clock as the time of each event lit_recent-events returns, so an agent can bracket a click and the update it caused with times it already saw. It does not read the range you selected in the panel, because that selection lives in the browser; a link or a pasted range has to carry the numbers.

Two prompts that work:

  • “Record ten seconds of the running app while I click the filter bar, then tell me which component updated most and which properties caused it.”
  • “I just edited src/todo-item.ts. Did the change land in the running page without a reload? Check lit_hmr-history.”
  • “The page reloads whenever I edit src/app-shell.ts. Check lit_hmr-incompatibilities and tell me which shape is to blame.”

vite-plugin-lit mcp runs devframe’s own connector over stdio. The plugin publishes each running dev server to devframe’s instance registry, and the connector lists them through two gateway tools, devframe_connect_list-instances and devframe_connect_call-tool. One entry therefore covers every project you have running. Being a shared connector, it also surfaces every other devframe on the machine.

When registry discovery is unavailable the plugin warns once at startup, naming the reason:

Terminal window
[lit-plugin] devframe instance-registry discovery unavailable (no HTTP server (middleware mode?)); stdio MCP clients cannot auto-discover this dev server. The MCP endpoint itself is unaffected — point clients at <dev-server-origin>/__devtools/__mcp directly.

Vite DevTools mounts the endpoint at /__devtools/__mcp on the dev server, so bridge that URL instead and skip discovery altogether:

Terminal window
claude mcp add lit-devtools -- npx -y mcp-remote http://localhost:5179/__devtools/__mcp