Skip to content

feat: add powerio conversion server (synced to 0.1.1) with ANDES bridge#1

Closed
samtalki wants to merge 4 commits into
mainfrom
feat/powerio-0.1.0
Closed

feat: add powerio conversion server (synced to 0.1.1) with ANDES bridge#1
samtalki wants to merge 4 commits into
mainfrom
feat/powerio-0.1.0

Conversation

@samtalki

Copy link
Copy Markdown
Owner

Summary

  • Adds the powerio MCP server (powerio/powerio_mcp.py) — 8 tools covering case conversion, the JSON transport, matrix builders (B′, B″, Y-bus, PTDF, LODF, LACPF, Laplacian), and dense views; synced to upstream 0.1.1 including error-shape hardening from fix(mcp): unreadable files keep the ValueError shape; harden error mapping eigenergy/powerio#93
  • Registers powerio in the tool registry and packages it in the wheel under powermcp/_servers/powerio
  • Adds powerio bridges to the PyPSA and pandapower servers (JSON transport ingestion, out-of-service element handling)
  • Adds an ANDES bridge (load_network_from_json, load_network_from_any) — converts any powerio-readable format to MATPOWER and stages it for run_power_flow
  • Bumps the powerio extra pin to >=0.1.1
  • 35 new tests; full suite at 93 passed, 4 skipped

Test plan

  • pip install -e ".[andes,egret,opendss]" and pytest tests/ — 93 passed, 4 skipped expected
  • powermcp run powerio launches the server over stdio
  • ANDES bridge tests (test_andes_load_network_from_any, test_andes_load_network_from_json) pass when andes is installed

🤖 Generated with Claude Code

samtalki and others added 4 commits June 10, 2026 22:30
…memory

powerio 0.1.0 ships convert_str, so the server's inline conversion no longer
stages temp files; the _EXT/_stage/_unlink_quietly machinery is gone. The
file is now a faithful copy of the canonical powerio.mcp.server (same eight
tools, the docstring polish from its review, the save_case newline fix both
copies already shared), with the standalone header pointing at upstream. The
powerio extra pins >=0.1.0 and a regression test asserts inline conversion
never touches tempfile.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
PyPSA bridge: drop out-of-service branches and generators before
import_from_pypower_ppc, which ignores the ppc status columns; gencost
rows are realigned after generator drops. pandapower's from_ppc honors
status so its bridge is unchanged (documented by a new test).

powerio server: shadow-import guard on startup; explicit laplacian elif
with unreachable-else guard; OSError arm in convert_case; belt-and-
braces (ValueError/KeyError/TypeError) arm in _load.

tests: 7 new cases covering OOS branch/generator drops, pandapower
status contrast, laplacian matrix, bad-JSON ValueError, and OSError
normalization.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Upstream landed the error-shape hardening from the Power-Agent#34 review
(eigenergy/powerio#93, released as 0.1.1): _parse maps an unreadable
file (OSError) to the documented ValueError shape, convert_case says
"cannot read file" instead of "conversion failed" for that case, and
the defensive-arm comments came along. Ports the upstream suite's
unreadable-file and wrong-schema tests. No new powerio API, so the
>=0.1.0 floor stands.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds load_network_from_json and load_network_from_any to ANDES/andes_mcp.py,
following the same pattern as the PyPSA bridge. Both tools accept a powerio
JSON transport string or any powerio-readable file (MATPOWER, PSS/E, PowerWorld
.aux, PowerModels JSON, egret JSON), convert to MATPOWER via powerio's
case.to_format("matpower"), and write the result to out_path for ANDES to
consume via run_power_flow. Bumps the powerio extra pin to >=0.1.1 to match
the 0.1.1 server already on this branch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@samtalki

Copy link
Copy Markdown
Owner Author

@qian-harvard — carried your OOS fix and error hardening from Power-Agent#34 into this branch (see 73ee997). The ANDES bridge in this PR follows the same pattern you established for PyPSA. Would love your eyes on the bridge section in ANDES/andes_mcp.py if you get a chance!

@samtalki

Copy link
Copy Markdown
Owner Author

Opened by mistake — the correct PR is Power-Agent#35.

@samtalki samtalki closed this Jun 11, 2026
@samtalki samtalki deleted the feat/powerio-0.1.0 branch June 14, 2026 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant