labgrid-mcp: drive a labgrid lab from an LLM agent (or any MCP client) #1951
Replies: 2 comments 3 replies
|
Hi, thanks for sharing this! Interesting work. I went through the repo and had a few questions. Curious about scope beyond power-cycle and console check. Thinking of a scenario like a developer on our side is making changes on the ethernet driver, and we would want to actually run tests against that change on real hardware, not just power it on and check the console comes up. I see we can send a shell command to the DUT, so something like ethtool could probably be run manually through that. But I did not see pytest or test-suite integration, or a way to say "run this hardware test and report pass/fail," it looks like it is mainly CLI primitives right now. So is there an infrastructure planned that would let a developer actually trigger a real test run against their change and get a result back, or is this meant to stay more of a wrapper around the CLI? Also, any plans on testing this on real hardware? I want to see how the agent behaves against real world problems, flaky serial, power glitches, timing issues that fakes will not reproduce. I think we need to be careful here, I do not want an agent power cycling my board 1000 times during a nightly test :) One more small thing, I went looking for a monitor.sh you used in demo above, thought maybe it parsed labgrid-client show output, but could not find it in the repo. Just curiosity. Hope to see you at the next community call and discuss more! |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi all. I've open-sourced labgrid-mcp, a standalone MCP server that exposes the labgrid client workflow to LLM agents and other MCP clients (Claude, Cursor, VS Code agent mode, or anything speaking MCP over stdio). You can ask an agent to list places, reserve/acquire a board, control power, read the serial console, SSH in, or flash it, and it maps onto the same operations
labgrid-clientdoes.I wonder what people think about it :)
Repo: https://github.com/onurcelep/labgrid-mcp
A few notes on how it's built, since that's what I'd want to know first:
labgrid-clientCLI or reuseClientSession. The interesting parts of an MCP server are session-ful (keepalive-backed reservations, interactive console sessions, background flash jobs) and a subprocess-per-call model can't hold any of that. Acquire/release are also session-bound to the gRPC stream that did the handshake, and parsing the CLI's human-oriented output isn't a stable API either.ClientSessionitself is argparse/print-coupled. So the server speaks the coordinator's gRPC protocol directly (persistent stream, reconnect, keepalive) and uses labgrid's client-side driver stack for power/io/mux/console/flash/SSH. Identity and config are the nativeLG_*env vars, and security stays at the network layer, same as labgrid itself.>=26.0,<27and a weekly CI job runs the full suite againstmasterto catch drift. The internals I had to verify empirically are documented with file/line citations in docs/DESIGN.md §11. Corrections welcome if I misread anything.To try it without a lab,
uvx labgrid-mcp demoboots a complete fake lab locally (real coordinator + exporter, simulated power and console) and prints a paste-ready MCP client config.Apache-2.0, with labgrid used as a regular unmodified dependency.
If you run a shared lab and try it, I'd like to hear what breaks.
All reactions