labcontrol-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@labcontrol-mcpcheck the current BLACS and Runmanager status"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
labscript-control
Control BLACS and Runmanager from coding agents or a terminal, using a local Windows connection or SSH from another computer. The same Python client backs the CLI and an MCP server with 16 tools.
Inspect application, device-tab, and queue state.
Pause, resume, add, remove, and reorder queued shots.
Restart individual device tabs or gracefully restart applications.
Read/edit Runmanager globals and compile without submitting shots to BLACS.
Reserve a PC across multiple commands with an expiring lease shared by both apps.
Identify the actual target host and retain mutation receipts across app restarts.
The CLI requires Python 3.10+ and the standard library. MCP support is an optional extra. Application bridges and interactive application startup currently target Windows; remote clients also run on Linux.
Architecture
flowchart LR
Remote[Remote CLI or MCP] -->|SSH| CLI[Windows CLI]
Local[Local CLI or MCP] --> API[Authenticated localhost API]
CLI --> API
API --> BLACS[BLACS plugin]
API --> RM[Runmanager hook]GUI actions run on the application's Qt thread. Application startup uses Windows Task Scheduler with the logged-on user's interactive token. Normal operations do not depend on clicking screen coordinates.
Related MCP server: mcpelauncher-agent
Install the client
git clone https://github.com/kenji0923/labscript-control.git
cd labscript-control
python -m venv .venv
# Activate the virtual environment using your shell's usual command.
python -m pip install '.[mcp]'For CLI-only use, install . without the MCP extra.
Configure remote targets by copying examples/targets.example.json
to a private targets.json, then replace the example hostnames, SSH aliases, and
Python paths with your own. The target Python environment must also have this
package installed.
labctl --config targets.json --target lab-a status
labctl --config targets.json --target lab-b queue listOn the target Windows PC, use labctl --local status. Native Windows clients
also default to local operation when no target is specified. An explicitly named
target automatically uses local transport if its hostname matches this PC.
Install the Windows bridges
Use the Python environment that already runs BLACS and Runmanager:
$daqPython = 'C:\path\to\labscript-env\Scripts\python.exe'
& $daqPython -m pip install C:\src\labscript-control
& $daqPython -m labcontrol.install_windows --labscript-root C:\path\to\labscript-suiteThe installer backs up the files it edits, installs a BLACS plugin and a small Runmanager startup hook, and registers interactive application-start tasks. It does not restart applications or execute shots. Gracefully restart both apps to load the bridges. Package upgrades can replace the hooks; rerun the installer if necessary.
For an isolated local MCP environment, install .[mcp] there and pass its Python
path with --mcp-python when running the installer. Agent configuration examples
are written to %LOCALAPPDATA%\LabscriptAgentControl.
See the HTML operations guide for setup, queue editing, application lifecycle, leases, receipts, and migration from the original scripts. Download or open the HTML file locally for its formatted view.
CLI and MCP
labctl --local queue pause
labctl --local --wait tab restart camera
labctl --local --wait app restart blacs
labctl --local runmanager compile
labcontrol-mcp --local
labcontrol-mcp --config targets.json --target lab-aA remote command can also use the module entry point: python -m labcontrol.
The MCP module entry point is python -m labcontrol.mcp_server.
For coordinated changes, acquire a lease, retain the returned lease_id, pass it
to mutations, and release it afterwards. Each renewal needs a fresh request ID.
labctl --local lease acquire --owner agent-a --ttl 300
labctl --local --lease-id UUID queue pause
labctl --local --lease-id UUID --wait tab restart camera
labctl --local --lease-id UUID lease releaseQueue resume can operate hardware. Adding/editing queued shots requires a paused queue. Restarts leave BLACS paused, and are refused during a shot. Leases coordinate clients using this API; GUI buttons and other native labscript APIs do not honor these leases. Reads remain available to other agents.
Development
python -m pip install -e '.[test]'
python -m pytest -qTests cover authentication, request deduplication, target selection, host identity, leases, queue validation, worker readiness, installer edits, and real MCP stdio messages. They use temporary state and simulated application objects; CI does not connect to laboratory machines or execute shots.
This repository was extracted from a deployment validated on two Windows control PCs. The standalone package layout and installer have additional packaging tests; future BLACS/Runmanager releases may require bridge updates.
License
Released under the MIT License.
This server cannot be deployed
Maintenance
Related MCP Connectors
Run and manage H Company's Computer-Use Agents from any MCP client.
Securely control computers you explicitly pair through files, terminals, processes, screenshots, desktop UI/input, clipboard, browser automation, diagnostics, and document tools.
Start and manage Reason cloud coding agents, projects and sessions from any MCP client.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Related MCP Servers
- FlicenseAqualityCmaintenanceEnables agents to inspect ROS topics, processes, tmux sessions, and logs, and to perform operational actions such as sending tmux commands, restarting services, executing commands in containers, and running SSH remote commands.11-
- FlicenseNot gradedqualityBmaintenanceEnables controlling a real Minecraft Bedrock client by injecting input and reading frames through the launcher's agent socket, including launching, stopping, screenshotting, sending chat, and managing multiple bot instances.5-
- AlicenseNot gradedqualityBmaintenanceEnables an AI client to inspect and control an interactive Windows desktop, including screenshots, mouse and keyboard input, Windows UI Automation, PowerShell commands with managed jobs, and authenticated file uploads/downloads. Connects over remote MCP Streamable HTTP or local stdio without a separate host-side gateway.Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables agents to spawn, monitor, and control CLI coding agents running in isolated tmux sessions, with verified input injection, redacted pane capture, fleet and per-session state classification, lineage tracking, blocking exec with exit codes, cross-agent messaging, waste analytics, and log/ledger reading. Ownership checks, policy controls, and audit events keep every control action safe by default.7 npmApache 2.0