Skip to content

refactor(powerio): re-export canonical powerio.mcp.server instead of vendoring#44

Merged
qian-harvard merged 1 commit into
mainfrom
refactor/powerio-reexport-canonical
Jun 14, 2026
Merged

refactor(powerio): re-export canonical powerio.mcp.server instead of vendoring#44
qian-harvard merged 1 commit into
mainfrom
refactor/powerio-reexport-canonical

Conversation

@qian-harvard

Copy link
Copy Markdown
Contributor

Follow-up to #30 (powerio is now a core dependency), which unblocks de-duplicating the standalone server against the canonical upstream one.

What

powerio/powerio_mcp.py previously vendored its own copy of the eight text-format tools and their _load/_summary/_parse helpers — a copy the file header itself flagged as something to hand-sync against upstream powerio.mcp.server. Since powerio is core, this rewrites the file to re-export the canonical mcp instance and its tools verbatim, so they track powerio with zero divergence (~370 lines of duplicated logic removed; net +48 / -421).

The folder/Parquet tools

The four tools added in #41read_pypsa_csv_folder / write_pypsa_csv_folder and read_gridfm / write_gridfm — are not exposed as MCP tools by the canonical server (powerio ships the library functions but not the tool wrappers). Rather than drop them, they stay as a thin overlay registered on the same mcp, reusing powerio's _load/_summary for identical input-resolution and summary shape.

Upstreaming note: per the file's own convention ("land changes upstream first"), these four overlay tools should be ported into powerio.mcp.server in eigenergy/powerio. Once a powerio release includes them, delete the overlay here and the file becomes a pure re-export. I can prepare that upstream PR separately — it's a different repo.

Changes

  • powerio/powerio_mcp.py: import mcp + the 8 canonical tools (+ _load/_summary) from powerio.mcp.server; keep the 4 folder/Parquet tools as an overlay.
  • pyproject.toml: bump powerio pin >=0.1.1>=0.2.1 (the version whose powerio.mcp.server / _load/_summary we re-export; PyPI latest).

Tests

Full suite: 100 passed, 4 skipped. The existing tests/test_powerio_server.py exercises all 8 canonical tools and the 4 overlay tools through the re-exported module unchanged.

Trade-off

The overlay imports powerio's private _load/_summary. That's intentional coupling to the pinned powerio version (the file's whole purpose is to track the canonical server); if powerio renames them the pin/import surface breaks loudly. Acceptable given the explicit version pin.

🤖 Generated with Claude Code

…vendoring

powerio is a core dependency now, so powerio/powerio_mcp.py no longer keeps its
own copy of the eight text-format tools (convert_case, save_case, case_summary,
parse_case, normalize_case, case_to_json, compute_matrix, dense_view) or their
_load/_summary/_parse helpers. It imports the canonical FastMCP `mcp` instance
and those tools from powerio.mcp.server verbatim, so they track powerio with
zero hand-sync (~370 lines of duplicated logic removed).

The four folder/Parquet tools (read/write_pypsa_csv_folder, read/write_gridfm)
that the canonical server does not expose as MCP tools yet stay as a thin
overlay registered on the same `mcp`, reusing powerio's _load/_summary so they
match the canonical input-resolution and summary shape. They should migrate
upstream into powerio.mcp.server; once a powerio release includes them this file
becomes a pure re-export.

- pyproject: bump powerio pin to >=0.2.1 (the version whose powerio.mcp.server
  and _load/_summary we re-export).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@qian-harvard qian-harvard merged commit f6f1a3a into main Jun 14, 2026
2 checks passed
@qian-harvard qian-harvard deleted the refactor/powerio-reexport-canonical branch June 14, 2026 18:52
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