refactor(powerio): re-export canonical powerio.mcp.server instead of vendoring#44
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.pypreviously vendored its own copy of the eight text-format tools and their_load/_summary/_parsehelpers — a copy the file header itself flagged as something to hand-sync against upstreampowerio.mcp.server. Since powerio is core, this rewrites the file to re-export the canonicalmcpinstance 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 #41 —
read_pypsa_csv_folder/write_pypsa_csv_folderandread_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 samemcp, reusing powerio's_load/_summaryfor identical input-resolution and summary shape.Changes
powerio/powerio_mcp.py: importmcp+ the 8 canonical tools (+_load/_summary) frompowerio.mcp.server; keep the 4 folder/Parquet tools as an overlay.pyproject.toml: bump powerio pin>=0.1.1→>=0.2.1(the version whosepowerio.mcp.server/_load/_summarywe re-export; PyPI latest).Tests
Full suite: 100 passed, 4 skipped. The existing
tests/test_powerio_server.pyexercises 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