Skip to main content
Glama
Moku MCP Server

Moku MCP Server

by sealablab

moku-mcp

Model Context Protocol (MCP) server for Moku device control.

Overview

This MCP server provides LLM-friendly tools for controlling Moku devices:

  • Device Discovery: Find Moku devices on the network

  • Connection Management: Attach/detach with graceful ownership handoff

  • Configuration Deployment: Push MokuConfig models to hardware

  • Routing Control: Configure MCC signal routing

  • Metadata Queries: Get device info and slot status

Related MCP server: Instrument MCP Server

Architecture

Session Model: Stateful connection management

  • attach(device_id) → Connect and maintain ownership

  • detach() → Release ownership (allows iPad/CLI handoff)

Graceful Handoff: Supports common workflow where ownership moves between:

  • Machine A (CLI) → iPad (GUI) → Machine B (LLM) → ...

MokuConfig-Driven: Uses moku-models package for type-safe configuration.

Installation

# Clone repository
git clone https://github.com/sealablab/moku-mcp.git
cd moku-mcp

# Install with uv (recommended)
uv pip install -e .

# Or with pip
pip install -e .

Usage

Running the MCP Server

# Run server via stdio (MCP standard)
python -m moku_mcp

# Or with uv
uv run python -m moku_mcp

Integration with Claude Desktop

Add to your Claude Desktop config file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "moku": {
      "command": "uv",
      "args": ["run", "python", "-m", "moku_mcp"],
      "cwd": "/path/to/moku-mcp"
    }
  }
}

Using the Session Context Manager

For safe device management with automatic cleanup:

from moku_mcp.session import MokuSession

async def deploy_config_safely(device_id: str, config: dict):
    async with MokuSession(device_id) as moku:
        # Device is automatically connected
        result = await moku.push_config(config)
        # Device is automatically released even if error occurs
        return result

MCP Tools

1. discover_mokus()

Discover Moku devices on network via zeroconf.

Returns: List of devices with IP, name, serial number

2. attach_moku(device_id)

Connect to Moku device and assume ownership.

Args:

  • device_id (str): IP address, device name, or serial number

Returns: Connection status and device metadata

3. release_moku()

Disconnect and release ownership.

Returns: Disconnect status

4. push_config(config)

Deploy MokuConfig to connected device.

Args:

  • config (dict): MokuConfig serialized as dictionary

Returns: Deployment status

Example:

config = {
    "platform": {...},
    "slots": {
        1: {
            "instrument": "CloudCompile",
            "bitstream": "path/to/bitstream.tar"
        }
    },
    "routing": [
        {"source": "Slot1OutA", "destination": "Output1"}
    ]
}

5. get_config()

Retrieve current device configuration.

Returns: MokuConfig as dict

6. set_routing(connections)

Configure MCC signal routing.

Args:

  • connections (list): List of MokuConnection dicts

Example:

connections = [
    {"source": "Input1", "destination": "Slot1InA"},
    {"source": "Slot1OutA", "destination": "Output1"}
]

7. get_device_info()

Query device metadata.

Returns: Dict with name, serial, IP, platform type

8. list_slots()

List configured instrument slots.

Returns: Dict of slot numbers to instrument info

Implementation Status

✅ Core Implementation Complete

All 8 MCP tools are fully implemented:

  • Device discovery via zeroconf

  • Connection management with singleton pattern

  • Configuration deployment (CloudCompile & Oscilloscope)

  • Signal routing configuration

  • Device metadata queries

  • Session context manager for safe cleanup

Development

# Install dev dependencies
uv pip install -e ".[dev]"

# Run tests (when implemented)
pytest

# Format code
black src/
ruff check src/

Dependencies

1st Party:

  • moku-models - Pydantic models for Moku configuration

  • moku - Official Moku hardware API

3rd Party:

  • mcp - Model Context Protocol SDK

  • pydantic - Data validation

  • loguru - Logging

  • zeroconf - Device discovery via mDNS/Bonjour

Next Steps

See IMPLEMENTATION_GUIDE.md for:

  • MCP SDK setup

  • Tool implementation patterns

  • Testing strategies

  • Deployment workflows

License

MIT License - see LICENSE file for details.

Available Tools

8 tools
attach_mokuB

Connect to Moku device and assume ownership

Inputs: device_id (required), force.

discover_mokusB

Discover Moku devices on network via zeroconf

Inputs: timeout.

get_configB

Retrieve current device configuration

Inputs: no named parameters.

get_device_infoB

Query device metadata (name, serial, IP, etc.)

Inputs: no named parameters.

list_slotsB

List configured instrument slots

Inputs: no named parameters.

push_configC

Deploy MokuConfig to connected device

Inputs: config_dict (required).

release_mokuB

Disconnect from Moku and release ownership

Inputs: no named parameters.

set_routingD

Configure MCC signal routing

Inputs: connections (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose with no overlap: discovery, connection, device info, configuration retrieval, slot listing, configuration deployment, disconnection, and routing setup. The descriptions make it easy to distinguish between tools like get_config (retrieve config) and push_config (deploy config), avoiding any ambiguity.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern with snake_case, such as attach_moku, discover_mokus, get_config, and release_moku. This uniformity makes the tool set predictable and easy to navigate, with no deviations in naming conventions.

    Tool Count5/5

    With 8 tools, the server is well-scoped for managing Moku devices, covering essential operations like discovery, connection, configuration, and release. Each tool earns its place without feeling excessive or insufficient, aligning perfectly with the domain's needs.

    Completeness5/5

    The tool set provides complete lifecycle coverage for Moku device management, from discovery and attachment to configuration, monitoring, and release. There are no obvious gaps; all core operations are included, ensuring agents can handle typical workflows without dead ends.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      MCP server for quantum device physics laboratory instrumentation control, enabling LLMs to interact with physics instruments and measurement systems through QCodes and JupyterLab.
      39
      MIT
    • A
      license
      C
      quality
      B
      maintenance
      Enables natural language control of test instruments like spectrum analyzers and power supplies via SCPI commands, with auto-discovery and multi-instrument session support.
      100
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables LLMs to control a PicoScope 5000A USB oscilloscope for signal generation, block capture, measurements, and frequency response sweeps.
      1
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables LLM agents to safely route signals through Pickering PXI/LXI switching by logical endpoint names, with connectivity-graph interlock enforcement and a built-in chassis simulator.
      18
      MIT