psu-mcp

psu-mcp

MCP server for programmable bench power supply control, enabling autonomous bootloader-entry probing via precise power cycling and telemetry.

Category
访问服务器

README

psu-mcp

MCP server for programmable bench PSU control with autonomous bootloader-entry probing.

MVP: Korad KA3005P / RND 320-KA3005P. Vendor-extensible via vendors.py strategy registry.

Why

  • Hardware security engagements often hinge on getting a target into bootloader mode via a precisely-timed power cycle. Doing this manually is error-prone and unrepeatable.
  • An agent driving the PSU over MCP can sweep timings autonomously, observe the post-restore current curve, and converge on a working pattern.
  • Removes a human-in-the-loop step from BK7231/ESP-class extraction workflows.

Tools

Tool Tier Purpose
connect read-only Probe PSU, verify declared profiles against live VSET
list_profiles read-only Return operator-declared profile slot labels
get_status read-only Live VSET/ISET/VOUT/IOUT/output_on and declared profiles; warns if VSET does not match any declared profile
recall_profile allowed-write Load operator-declared profile slot N. Refuses slots not in config. Forces output_off on profile mismatch
output_on allowed-write Enable output. Refuses if live VSET does not match any declared profile
output_off allowed-write Disable output
yank_restore allowed-write Atomic power cycle (with optional repeat); refuses if VSET is not in a declared profile
pulse_off_observe allowed-write Power cycle + telemetry sample of restore curve; same VSET pre-flight

Safety model

Two tiers in active use:

  • read-only: full autonomy
  • allowed-write: autonomous, logged

APPROVAL_WRITE exists in the tier enum but no MVP tools live there. There is no MCP-side voltage or current setter -- the agent cannot fire a voltage at a target that the operator did not deliberately pre-load into a memory slot.

Profile-as-protection (the only contract)

The operator pre-loads memory slots M1-M5 on the PSU at the bench (slow, deliberate, physical). The agent picks a profile slot -- it never picks a voltage. Voltage authority is a hand on a knob, not a software config value.

Output-affecting tools (output_on, yank_restore, pulse_off_observe) verify at entry that the live VSET equals one of the operator-declared profile mv values. A stray VSET (panel knob, post-power-cycle default, prior session) does not satisfy this check; the tool refuses until the agent calls recall_profile.

recall_profile only accepts slots that are declared in config. The post-recall VSET is verified against the declared mv; mismatch forces output_off if it was on. SAV{n} is not exposed at all -- profile contents are operator authority.

Pre-flight checks happen at tool entry. The yank_restore and pulse_off_observe timed cycles are atomic against the agent -- no checks during the window. Operator discipline carries the rest: do not touch the panel during a sequence.

Installation

pip install -e ".[dev]"

System requirement: user must be in the dialout group for serial access:

sudo usermod -aG dialout $USER
# log out and back in for group membership to take effect

Configuration

First-time setup: copy config.example.json to wherever you want it and edit to match the M1-M5 slot labels you have physically loaded on the PSU panel:

mkdir -p ~/.config/psu-mcp
cp config.example.json ~/.config/psu-mcp/config.json
$EDITOR ~/.config/psu-mcp/config.json

The MCP reads PSU_CONFIG_PATH at startup. Changing the file mid-session does not take effect until the MCP restarts.

Schema:

{
  "port": "/dev/ttyACM0",
  "vendor": "korad_ka3005p",
  "profiles": {
    "1": {"mv": 3300, "label": "BK7231"},
    "2": {"mv": 3300, "label": "ESP_logic"},
    "3": {"mv": 5000, "label": "ESP_via_USB"},
    "4": {"mv": 1800, "label": "core_logic"},
    "5": {"mv": 2500, "label": "spare"}
  }
}

profiles must declare at least one slot. There is no separate max_voltage_mv / max_current_ma setting -- the set of declared profile mv values is the implicit allowlist, and the operator's physical M-slot load is the authoritative source.

MCP client (.mcp.json)

{
  "mcpServers": {
    "psu": {
      "command": "/path/to/.venv/bin/python",
      "args": ["-m", "psu_mcp"],
      "env": {
        "PSU_CONFIG_PATH": "/home/you/.config/psu-mcp/config.json"
      }
    }
  }
}

Engagement logging (optional)

yank_restore and pulse_off_observe accept optional engagement_name and project_path arguments. When either is provided, the tool appends a JSONL line per invocation to <engagement>/uart/logs/psu.jsonl. The line includes the full result payload -- cycle log for yanks, telemetry array for pulse observations -- so the engagement folder accumulates raw data for later analysis (chip-family signature library, post-mortem evidence, drift detection).

Resolution rules:

  • project_path (absolute) -> <project_path>/uart/logs/psu.jsonl
  • engagement_name -> $PIDEV_ENGAGEMENTS_DIR/<engagement_name>/uart/logs/psu.jsonl
  • Both provided -> project_path wins
  • Neither provided -> no log; tool returns payload only

Set PIDEV_ENGAGEMENTS_DIR in the MCP client config:

{
  "psu": {
    "command": "/path/to/.venv/bin/python",
    "args": ["-m", "psu_mcp"],
    "env": {
      "PSU_CONFIG_PATH": "/home/you/.config/psu-mcp/config.json",
      "PIDEV_ENGAGEMENTS_DIR": "/home/you/engagements"
    }
  }
}

If engagement_name is requested but the env var is not set, the tool returns successfully and adds a warning to result["warnings"] (the probe already happened; logging failure does not abort it).

Resolution: 10 Hz max sampling on pulse_off_observe -- enough for steady-state classification and curve-shape archival, not for sub-millisecond waveform analysis. See the spec for the trade-off discussion.

Operator notes

  • Do not touch the panel during a yank or pulse sequence. The cycle is atomic against the agent but not against a hand on the M-buttons.
  • KA3005P firmware has no remote-lock. Last command wins between panel and serial.
  • connect skips profile verification if output is on -- recalling each slot would whipsaw the live voltage. Call output_off first.
  • If you change a profile mv at the bench (e.g., reload M3 from 5000 to 3300), update the config to match before the next engagement. The MCP loads config at startup, so changes require a restart.

Tests

pytest                          # 129 unit tests, no hardware needed
pytest tests/ -m hardware       # 6 integration tests, real KA3005P required

The hardware suite expects the PSU panel slot 1 to be loaded with 3300 mV; the test fixture declares a single profile to match. Override the port with PSU_TEST_PORT=/dev/ttyACMx.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选