Repository navigation
feat(python): add Python MCP client library for GridCraft automation - #444
dronov-dmitry wants to merge 3 commits into
Conversation
f17ef31 to
58b6c9c
Compare
FredApps
left a comment
There was a problem hiding this comment.
Read the whole diff at 58b6c9c. Changes needed:
-
The library does not do what the README, docs and examples say. gridcraft_mcp/client.py has five methods (execute_command, new_workbook, set_cell, get_cell, read_range), but the shipped examples call client.evaluate_formula (16 times), format_range (16), insert_chart (5), save_workbook (5), create_table (3), write_range (4) and sort_range, none of which exist, so those examples fail with AttributeError. The PR text promises charting and formula evaluation. The tests only mock the socket, so nothing runs against a real control port. Please either implement the documented methods or cut the examples and docs down to what exists, and add at least one test against gridcraft-cli or a real control port.
-
read_range sends engine.execute with command "read_range". docs/control-protocol.md has no such method or command: reading a range is the sheet.read method (and cell.get is its own method too). Please use the documented method names and reply shape, and add a test that checks the request/response against the protocol doc.
-
Scope/policy: AGENTS.md says the repo is Rust only, and this adds about 5,000 lines of Python, docs and a new CI workflow under libs/. That is a maintainer decision; a separate repo may be the better home. docs/testing.md (718 lines) and docs/development.md are largely generic templates (unittest.mock examples with mock_post, a clone path of gridcraft/gridcraft-python), not about this library.
-
The new workflow pins actions by tag (actions/checkout@v4, setup-python@v5); the other workflows pin full commit SHAs.
Validation was source reading only. No hosted checks have run on this head, and no local tests were run (builds are paused).
|
Review notes (comment only). I read the whole diff and compared the client with main's control server docs and source; I did not run the Python tests or build GridCraft, and no Excel check applies here.
|
This PR introduces a new Python library (
libs/mcp-python) that enables programmatic control of GridCraft via the MCP/TCP control channel. This allows users and AI agents to automate spreadsheet tasks using Python.Key Features
new_workbook), data manipulation (set_cell,read_range), formula evaluation, and charting..github/workflows/gridcraft-python-ci.yml) to automatically test, lint, and format Python code.run_tests.shandrun_ci.shfor easy development and CI execution.Demo
https://youtu.be/nV-wnZiPR-M
Why this is useful
This library opens GridCraft to the Python data science and automation ecosystem (Pandas, NumPy, etc.), making it easier for users to perform complex data workflows and integrate GridCraft into their existing Python-based pipelines.