Skip to main content
Glama
hidock-mcp
by kms254

hidock-mcp

An MCP (Model Context Protocol) server for HiDock USB audio recorder devices. Communicate with HiDock hardware directly from AI assistants like Claude, Cursor, or any MCP-compatible client.

Supports the HiDock H1, H1E, P1, and P1 Mini over USB.

What it does

This server exposes HiDock device operations as MCP tools, letting an AI assistant:

  • Query device info, firmware versions, and serial number

  • Read and set the device clock

  • List, count, and delete recording files

  • Check storage capacity and card health

  • Read and update device settings (auto-record, auto-play, notifications)

  • Format the storage card

  • Switch the device into USB mass-storage mode

  • Send raw commands for debugging

Related MCP server: matter-mcp-server

Tools

Tool

Description

hidock_connect

Scan USB for a HiDock device and open a connection

hidock_disconnect

Close the USB connection

hidock_device_info

Firmware version, version number, serial number

hidock_version_info

Detailed versions: Bluetooth, DSP, UAC, inter-chip gateway, earphone, base

hidock_get_time

Read device clock

hidock_set_time

Set device clock (optional ISO 8601 timestamp, defaults to system time)

hidock_file_count

Number of recording files on device

hidock_list_files

All files with name, size, timestamp, MD5 signature

hidock_delete_file

Delete a recording by exact filename

hidock_card_info

Storage capacity (MB), used space (MB), card status

hidock_format_card

Format/erase the storage card (up to 5 min)

hidock_get_settings

Read auto-record, auto-play, notification preferences

hidock_set_settings

Update one or more device settings

hidock_mass_storage

Switch to USB mass-storage mode (drops USB connection)

hidock_raw_command

Send an arbitrary command ID + hex payload for debugging

Resources

URI

Description

hidock://status

JSON with connected (bool) and model (string)

Prerequisites

  • Node.js 22+

  • libusb — required by the usb npm package

    • macOS: brew install libusb

    • Ubuntu/Debian: sudo apt install libusb-1.0-0-dev

    • Windows: Zadig to install a WinUSB driver for the device

  • A HiDock device connected via USB

Setup

git clone https://github.com/kms254/hidock-mcp.git
cd hidock-mcp
npm install
npm run build

Usage with Cursor

Add to your Cursor MCP config (~/.cursor/mcp.json or workspace .cursor/mcp.json):

{
  "mcpServers": {
    "hidock": {
      "command": "node",
      "args": ["/path/to/hidock-mcp/dist/index.js"]
    }
  }
}

Restart Cursor, then ask your assistant to hidock_connect and interact with the device.

Usage with Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "hidock": {
      "command": "node",
      "args": ["/path/to/hidock-mcp/dist/index.js"]
    }
  }
}

Project structure

src/
├── index.ts      — Entry point: creates device and runs the MCP server
├── server.ts     — MCP server setup, request handlers (tools, resources), stdio transport
├── tools.ts      — Tool registry: definitions and execute handlers for all 15 tools
├── device.ts     — HiDock device API (connect, getDeviceInfo, listFiles, formatCard, etc.)
├── transport.ts  — Low-level USB transport (frame encode/decode, polling, dispatch)
├── protocol.ts   — Binary wire protocol: frame encode/decode, BCD time encoding, response parsers
└── types.ts      — TypeScript interfaces, enums, and constants for the HiDock protocol

Development

npm install
npm run build      # compile TypeScript to dist/
npm test           # run unit tests
npm run test:coverage   # run tests with coverage report
npm run lint       # ESLint
npm run format     # Prettier

Protocol

The HiDock USB protocol is based on the publicly available test interface. Key details:

  • Transport: USB bulk transfer (vendor ID 0x10D6)

  • Frame format: 0x1234 header, 2-byte command ID, 4-byte sequence number, 4-byte length (with padding in high byte), then body

  • Encoding: Big-endian integers, BCD-encoded timestamps

  • 18 command opcodes covering device info, time sync, file management, storage, settings, firmware updates, and mass storage mode

Card status decoding

The hidock_card_info tool returns a status field as a hex string. This maps to the standard 32-bit SD Card Status Register (CSR):

Bit

Flag

Meaning

31

OUT_OF_RANGE

Command argument out of range

30

ADDRESS_ERROR

Misaligned address or bad NAND blocks

29

BLOCK_LEN_ERROR

Wrong block length

26

WP_VIOLATION

Write failed due to write protection

11

ERASE_RESET

Previous erase sequence interrupted

10

CARD_ECC_DISABLED

ECC disabled

9

WP_ERASE_SKIP

Skipped erasing bad/write-protected blocks

8

READY_FOR_DATA

Card ready for next data transfer

A healthy card typically returns 0x000000 or a value with only bit 8 set.

Troubleshooting

Format / optimize fails with error code 0x01

If hidock_format_card returns { "result": "failed", "rawCode": 1 }, check the card status with hidock_card_info.

Status 0x400E00 — This indicates degraded onboard flash memory. Decoded:

  • ADDRESS_ERROR (bit 30) — the card controller cannot address certain memory regions, pointing to bad NAND blocks

  • ERASE_RESET (bit 11) — a previous erase/format was interrupted or never completed

  • CARD_ECC_DISABLED (bit 10) — error correction is off

  • WP_ERASE_SKIP (bit 9) — the controller is skipping damaged blocks during erase operations

Other symptoms include used space showing several GB with zero files on the device. The HiDock H1's 32 GB storage is soldered onboard eMMC/NAND and is not user-replaceable. If you see this status, contact HiDock support for a replacement.

Device info times out

If hidock_device_info returns { "error": "timeout" }, try disconnecting and reconnecting. Sending multiple commands in rapid succession can cause the device to miss a response. Each command uses a sequence number, so a timed-out command won't block subsequent ones.

No HiDock device found

  • Make sure the device is connected via USB (not just Bluetooth)

  • On macOS, your terminal may need USB access permission in System Settings > Privacy & Security

  • On Linux, you may need a udev rule granting access to vendor ID 0x10D6

  • On Windows, use Zadig to install the WinUSB driver for the device

License

MIT

Available Tools

15 tools
hidock_card_infoA

Get SD card / storage information: total capacity (MB), used space (MB), and card status.

Inputs: no named parameters.

hidock_connectA

Scan the USB bus for a connected HiDock device (H1, H1E, P1, P1 Mini) and open a connection. Must be called before any other hidock_* tool.

Inputs: no named parameters.

hidock_delete_fileC

Delete a recording file from the device by filename.

Inputs: filename (required).

hidock_device_infoB

Get device information including firmware version code, version number, and serial number.

Inputs: no named parameters.

hidock_disconnectA

Close the USB connection to the HiDock device.

Inputs: no named parameters.

hidock_file_countB

Get the number of recording files stored on the device.

Inputs: no named parameters.

hidock_format_cardA

Format (optimize) the device storage card. WARNING: This erases all recordings. Takes up to 5 minutes.

Inputs: no named parameters.

hidock_get_settingsA

Read device settings: auto-record, auto-play, and notification preferences.

Inputs: no named parameters.

hidock_get_timeB

Read the current date/time set on the HiDock device.

Inputs: no named parameters.

hidock_list_filesA

List all recording files on the device. Returns name, size, recording timestamp, and MD5 signature for each file.

Inputs: no named parameters.

hidock_mass_storageA

Switch the device into USB mass-storage mode so it appears as a removable drive. The USB connection will be lost after this.

Inputs: no named parameters.

hidock_raw_commandB

Send a raw command to the device for debugging. Provide the command ID as a hex number and an optional body as space-separated hex bytes.

Inputs: commandId (required), body, timeoutSec.

hidock_set_settingsC

Update one or more device settings.

Inputs: autoPlay, autoRecord, notification.

hidock_set_timeC

Set the HiDock device clock. If no ISO timestamp is provided, uses the current system time.

Inputs: timestamp.

hidock_version_infoB

Get detailed firmware version info: Bluetooth, DSP, UAC, inter-chip gateway, earphone, and base versions.

Inputs: no named parameters.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 15 tools

    Disambiguation4/5

    Most tools target clearly distinct actions (connect, list_files, delete_file, format_card, get/set_time, get/set_settings). The only mild overlap is hidock_device_info vs hidock_version_info, both returning firmware/version data, though the descriptions differentiate basic vs detailed component versions.

    Naming Consistency4/5

    All tools share the hidock_ prefix, giving strong predictability. The suffix convention mixes verb_noun (hidock_list_files, hidock_set_time) with noun-only names (hidock_device_info, hidock_card_info, hidock_file_count), but this remains readable and internally coherent.

    Tool Count5/5

    15 tools is well within the ideal range and each tool maps to a concrete device operation. No redundant or filler tools are present; even hidock_raw_command serves a clear debugging escape hatch.

    Completeness3/5

    The surface covers connection lifecycle, device/time/settings management, and file listing/deletion, but there is no tool to download or read the actual recording file contents — a core operation for a recorder. hidock_mass_storage offers a partial filesystem workaround, mitigating but not eliminating the gap.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers