A generic, dynamic Model Context Protocol (MCP) ↔ SiLA 2 bridge for scientists and lab-workflow orchestrators.
Connect SiLA 2 laboratory devices to LLM clients — OpenCode, Claude Desktop, or a custom orchestrator — and operate real hardware in natural language. The bridge exposes each device's real types, units, and constraints as MCP tools, handles SiLA 2's asynchronous and stateful execution model, and gates unsafe actions behind a server-side policy engine and confirmation prompts.
flowchart LR subgraph client["🧑🔬 Lab agent"] LLM["LLM client
orchestrator"] end subgraph bridge["mcp-server-sila"] direction TB Tools["Core tools + promoted tools
resources"] Policy["Policy engine
confirm gate"] Exec["Execution registry
binary store"] Disc["mDNS discovery"] Tools --> Policy --> Exec end subgraph lab["Laboratory network"] direction TB Mover["Plate mover
SiLA 2 server "] Reader["Plate reader
SiLA 2 server "] Thermo["Thermometer
SiLA 2 server "] end LLM |"MCP
stdio · streamable-http"| Tools Exec |"SiLA 2 / gRPC
TLS · mTLS"| Mover Exec |"SiLA 2 / gRPC"| Reader Exec |"SiLA 2 / gRPC"| Thermo Disc -.->|"mDNS / DNS-SD
auto-discovery"| Mover Disc -.-> Reader Disc -.-> Thermo Mover -.->|"labware transfer
(SiLA, device-to-device)"| Reader classDef clientStyle fill:#15222B,stroke:#15222B,color:#fff classDef bridgeStyle fill:#41889F,stroke:#2f6d81,color:#fff classDef labStyle fill:#CDDCE2,stroke:#41889F,color:#15222B class LLM clientStyle class Tools,Policy,Exec,Disc bridgeStyle class Mover,Reader,Thermo labStyle LLM clients speak MCP to the bridge; the bridge speaks SiLA 2 to the instruments. Instruments can also act on each other over SiLA — a plate mover hands labware to a plate reader, discovered through mDNS.
MCP is request/response; SiLA 2 is long-lived and stateful (execution UUIDs, polling subscriptions, observable properties). The bridge resolves that mismatch with server-side state + pull-style tools:
Because an LLM can be wrong (or prompt-injected), safety is not delegated to tool annotations: a policy engine decides allow / confirm / deny before any SiLA call is made, and destructive actions require an explicit human confirmation when the client can show one.
uv tool install mcp-server-sila # or pip install mcp-server-sila Both install the mcp-server-sila console script; python -m mcp_server_sila is equivalent.
docker build -f docker/Dockerfile -t mcp-server-sila:dev . docker run --rm -e MCP_SILA_SERVER_HOST=0.0.0.0 -e MCP_SILA_AUTH_TOKEN=change-me \ -p 8765:8765 mcp-server-sila:dev The image serves streamable-http by default. Mount certificate material at /opt/mcp-server-sila/certificates (the compose file maps ./docker/mcp-server-sila/certificates there) and reference it by path in the configuration.
Point your MCP client at mcp-server-sila --transport stdio and configure the devices — either statically (MCP_SILA_ENDPOINT_0_*) or by mDNS discovery (no endpoint configuration at all). With discovery enabled and an allowlist, the client only needs:
{ "mcpServers": { "sila": { "command": "mcp-server-sila", "args": ["--transport", "stdio"], "env": { "MCP_SILA_DISCOVERY_ENABLED": "true", "MCP_SILA_DISCOVERY_ALLOWLIST": "Plate Mover,Plate Reader" } } } } Then ask things like "Which devices are connected?", "What can the pump do?", or "Set the setpoint to 42 and tell me when it's done." The exact configuration for OpenCode and Claude Desktop, including the remote variant, is in Connect a client.
MCP_SILA_AUTH_TOKEN=change-me MCP_SILA_SERVER_HOST=0.0.0.0 \ mcp-server-sila --transport streamable-http --port 8765 The endpoint is http:// :8765/mcp; clients send Authorization: Bearer change-me. A non-loopback host without a token is refused at startup.
mcp-server-sila --config bridge.toml --check-config # prints a redacted summary and exits 0 (errors exit 2) Connect a client Any MCP client works. The bridge serves stdio (the client starts it as a child process) or streamable-http (a URL plus a bearer token). Confirmation prompts and tool-list changes are supported on both protocol eras; see the notes below.
OpenCode's V2 configuration declares MCP servers under mcp.servers — in opencode.jsonc for a project or in the global config.
local (stdio) — OpenCode starts the bridge itself:
{ "$schema": "https://opencode.ai/config.json", "mcp": { "servers": { "sila": { "type": "local", "command": ["mcp-server-sila", "--transport", "stdio"], "environment": { "MCP_SILA_DISCOVERY_ENABLED": "true", "MCP_SILA_DISCOVERY_ALLOWLIST": "Plate Mover,Plate Reader" }, "protocol": "auto" } } } } The same entry can be created from the CLI:
opencode mcp add sila \ --env MCP_SILA_DISCOVERY_ENABLED=true \ --env MCP_SILA_DISCOVERY_ALLOWLIST="Plate Mover,Plate Reader" \ -- mcp-server-sila --transport stdio opencode mcp list # expect: ✓ sila connected remote (streamable-http) — for a bridge running elsewhere (or in a container):
{ "mcp": { "servers": { "sila": { "type": "remote", "url": "http://127.0.0.1:8765/mcp", "oauth": false, "headers": { "Authorization": "Bearer {env:MCP_SILA_TOKEN}" }, "protocol": "auto" } } } } oauth is set to false because the bridge uses a static bearer token, not OAuth; {env:MCP_SILA_TOKEN} keeps the secret out of the configuration file. /mcps in the TUI shows the connection state, and OpenCode's default Code Mode groups the tools under tools.sila.*.
Claude Desktop uses mcpServers in claude_desktop_config.json:
Clients that cannot show a prompt never get a silent "yes": destructive actions are denied (see Safety & security).
With MCP_SILA_DISCOVERY_ENABLED=true, the bridge finds SiLA servers on the network by itself — nothing else to configure. Ask the agent "Which SiLA devices are on the network?", then "Promote the plate mover's feature and hand the plate to the reader." See Discovery (mDNS / Bonjour) for the mechanics and examples/sila-labware-transfer for a working two-server lab.
Element tools (read_property, write_property, execute_command, poll_property) accept an optional device argument. When several connected devices implement the same FQID and no device is given, the call is refused rather than guessing — actuating the wrong instrument is worse than an actionable error.
Binary values (properties or command responses) are stored in an ephemeral store with a 10 MB per-value and 500 MB per-device cap, returned to the model as {"$binary": size, "type": "binary", "uri": "sila://binaries/ "}, and cleaned up when their execution leaves the retention window, when the device leaves discovery, or after one hour.
See docs/architecture.md for the component table and lifecycle diagram, and the design specification for the full rationale.
SiLA 2 servers announce themselves with multicast DNS / DNS-based Service Discovery — the same Bonjour/Avahi mechanism printers and Chromecasts use. The bridge consumes those announcements to find and configure devices, and (for configured pinned endpoints) resolves a device's CA certificate from them.
Over IPv4 multicast (UDP 5353) a server publishes, under the service type _sila._tcp.local.:
On shutdown the server sends an mDNS "goodbye". Most SiLA 2 SDKs advertise automatically: the unitelabs-cdk (used by the copier templates) enables it by default and lets you tune it in the discovery: section of its config.
Enable it in the configuration file:
[discovery] enabled = true allowlist = ["Plate Mover", "Plate Reader"] # names or UUIDs or through the environment:
MCP_SILA_DISCOVERY_ENABLED=true \ MCP_SILA_DISCOVERY_ALLOWLIST="Plate Mover,Plate Reader" \ mcp-server-sila --transport stdio Practical notes Discovery needs a shared multicast domain: the same LAN, network_mode: host in Docker, or an mDNS reflector (e.g. Avahi in bridge mode). A container on Docker's default bridge network does not see the lab's multicast. avahi-browse -rt _sila._tcp (or dns-sd -B _sila._tcp) lists what the network actually advertises; the bridge logs Discovered SiLA server ' ' ( ) …. A device can be configured statically and discovered at the same time: a discovered service that matches a known endpoint is not adopted twice, and ca_cert always wins over a discovered CA. A complete worked example — two copier-generated servers (plate mover and plate reader), mDNS-only bridge configuration, and a plate transfer plus read over MCP — is in examples/sila-labware-transfer. Configuration The bridge is 12-factor: a TOML file (--config PATH or $MCP_SILA_CONFIG) plus MCP_SILA_* environment variables, which win per key. CLI flags win over both. A minimal file:
[server] transport = "stdio" # stdio | streamable-http host = "127.0.0.1" # streamable-http only port = 8765 log_level = "INFO" [[endpoint]] name = "pump1" # alias used in tool names and references address = "192.168.1.40" port = 50065 tls = "pinned" # insecure | pinned | ca | mtls # ca_cert = "/srv/certs/lab-ca.pem" # tls = ca | mtls # client_cert = "/srv/certs/mcp.pem" # tls = mtls # client_key = "/srv/certs/mcp.key" The full key reference, defaults, environment-variable mapping, and validation rules live in docs/configuration.md. The important defaults:
The short version; details in docs/security.md.
Policy engine is the enforcement point. Every write and command is checked first: read-only devices and deny globs reject immediately; destructive commands and property writes require confirmation; rate and concurrency limits bound the traffic.
Confirmation degrades to policy, never to "always yes". Interactive clients get an elicitation form (proceed/reason). Clients that cannot answer (unattended orchestrators) get: destructive → denied, non-destructive → allowed — and under confirm_all_commands everything is denied.
Discovered devices are read-only until allowlisted. mDNS adoption alone never grants write or execute access.
ca_cert always wins over a discovered CA; PEM contents are never logged or returned.
Bearer token for streamable-http. Compared in constant time; required whenever the host is not loopback; set via config or MCP_SILA_AUTH_TOKEN only (never a CLI argument).
Untrusted metadata. Device descriptions are truncated into tool descriptions, the server instructions say metadata is data (not instructions), and values are capped (4 KB text, 100-element lists, binaries by reference).
Annotations are hints, not security. readOnlyHint/destructiveHint inform clients; enforcement never depends on them.
mcp-server-sila [--config PATH] [--transport {stdio,streamable-http}] [--host HOST] [--port PORT] [--log-level LEVEL] [--check-config] --config PATH — TOML file (default $MCP_SILA_CONFIG). --transport, --host, --port, --log-level — override the configuration. --check-config — validate, print a redacted summary, exit 0 (or 2 with the aggregated error). Exit codes: 0 success, 2 configuration/auth errors.
uv sync # create the environment (Python 3.13) uv run pytest # full suite (in-process SiLA 2 test device) uv run ruff check --fix . # lint + import order uv run ruff format . # formatting (line length 120) uv run zuban check # static types (src/ and tests/) uv run --group docs python -m sphinx -b html docs /tmp/docs-build uv build # wheel + sdist The suite covers the bridge end-to-end through an in-memory MCP client against a real in-process SiLA 2 server: device discovery and reconnection, command execution and error mapping, confirmations in both protocol eras, policy decisions, TLS with ephemeral certificates, bearer-token auth, binary round-trips, and GC.
Project layout: src/mcp_server_sila/ (package), tests/ (mirrors it, plus tests/fixtures/sila_device.py), docs/ (user documentation; the design and plan live in docs/development/), docker/ (image + entrypoint).
Rendered documentation: https://opensourcelab.gitlab.io/sila/mcp-server-sila/
0.x — pre-1.0. All core capabilities are implemented and tested: the core tool set, typed tool promotion, policy and confirmation gates, TLS modes, mDNS discovery, binary resources, and both transports. Planned for later releases: push-based resource subscriptions, full OAuth for streamable-http, and re-adopting in-flight executions after a bridge restart.
mcp model-context-protocol sila sila2 laboratory automation llm
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
None of the files in this release were uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.
Nov 21, 2026 2 release files No provenance




