Repository navigation
refactor(mcp): split server entrypoint from CLI - #679
Conversation
Problem: the interactive Polylogue CLI exposed MCP as a root subcommand even though MCP is a protocol adapter launched by clients, not a query-first archive verb. That polluted root help and kept MCP setup examples tied to polylogue mcp.\n\nWhat changed: remove the root polylogue mcp command, add the standalone polylogue-mcp console script, move the click entrypoint into polylogue.mcp.cli, update MCP setup docs and README examples, and regenerate CLI/topology/verification/showcase surfaces. The MCP server internals and role-gated tool registration are unchanged.\n\nVerification: pytest -q tests/unit/mcp/test_cli.py tests/unit/cli/test_click_app.py tests/unit/cli/test_cli_error_boundaries.py tests/unit/cli/test_operator_support_runtime.py tests/unit/cli/test_terminal_snapshots.py tests/unit/proof/test_witnesses.py; devtools render-all --check; devtools verify-topology; devtools verify-layering; devtools verify-test-ownership; mypy polylogue/; devtools verify --quick.\n\nRef #635\nRef #593
Polylogue Proof PackRefs: Affected Domains
Required Gates
Known Gaps
Oracle / Cost
|
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (20)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 9 minutes and 3 seconds.Comment |
There was a problem hiding this comment.
Pull request overview
Refactors the MCP (Model Context Protocol) server launch surface out of the interactive polylogue CLI into a standalone polylogue-mcp console script, and updates tests/docs/generated references accordingly.
Changes:
- Add
polylogue-mcp = polylogue.mcp.cli:mainconsole script and implement standalone Click entrypoint. - Remove
polylogue mcpsubcommand from root CLI registration and update CLI tests/snapshots/witnesses. - Update MCP integration docs/README and regenerate CLI reference + verification/topology artifacts.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
pyproject.toml |
Declares new polylogue-mcp console script. |
polylogue/mcp/cli.py |
New standalone Click entrypoint for starting MCP stdio server. |
polylogue/cli/commands/mcp.py |
Removes old polylogue mcp subcommand implementation. |
polylogue/cli/click_command_registration.py |
Stops registering MCP as a root subcommand. |
polylogue/cli/click_app.py |
Updates CLI docstring/exports to reflect MCP removal. |
tests/unit/mcp/test_cli.py |
Adds unit tests for polylogue.mcp.cli:main and script declaration. |
tests/unit/cli/test_operator_support_runtime.py |
Removes tests tied to the old polylogue mcp command. |
tests/unit/cli/test_click_app.py |
Updates help/subcommand registration expectations after MCP removal. |
tests/unit/cli/test_cli_error_boundaries.py |
Removes MCP-specific error-boundary test now that MCP isn’t a subcommand. |
tests/unit/cli/__snapshots__/test_terminal_snapshots.ambr |
Updates CLI help snapshots to omit MCP command. |
tests/data/witnesses/cli-command-surface.json |
Updates command-surface witness; requires polylogue-mcp script. |
tests/baselines/showcase/help-mcp.txt |
Removes baseline for deleted polylogue mcp help output. |
tests/baselines/showcase/help-main.txt |
Updates main help baseline to omit MCP command. |
docs/mcp-integration.md |
Updates setup instructions to use polylogue-mcp --role read. |
docs/cli-reference.md |
Removes MCP section from polylogue CLI reference. |
devtools/render_cli_reference.py |
Stops rendering MCP section in CLI reference generator. |
docs/verification-catalog.md |
Regenerated verification catalog counts/command list after MCP removal. |
docs/test-quality-workflows.md |
Regenerated scenario projection registry; removes help-mcp exercise. |
docs/plans/topology-target.yaml |
Regenerated topology targets; removes MCP command file, adds polylogue/mcp/cli.py. |
README.md |
Updates usage examples to launch MCP via polylogue-mcp. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| try: | ||
| from polylogue.mcp.server import serve_stdio | ||
| except ImportError as exc: | ||
| click.echo(f"MCP dependencies not installed: {exc}", err=True) | ||
| click.echo( | ||
| "Install the base polylogue package in an environment that includes its runtime dependencies.", err=True | ||
| ) | ||
| raise SystemExit(1) from None | ||
|
|
||
| serve_stdio(role=cast(MCPRole, role)) |
| def test_polylogue_mcp_handles_missing_dependency() -> None: | ||
| runner = CliRunner() | ||
| real_import = __import__ | ||
|
|
||
| def raise_mcp_import_error(name: str, *args: Any, **kwargs: Any) -> object: | ||
| if name == "polylogue.mcp.server": | ||
| raise ImportError("No module named 'mcp'") | ||
| return real_import(name, *args, **kwargs) | ||
|
|
||
| with patch("builtins.__import__", side_effect=raise_mcp_import_error): | ||
| result = runner.invoke(main, []) | ||
|
|
||
| assert result.exit_code == 1 | ||
| assert "MCP dependencies not installed" in result.stderr | ||
| assert "Install the base polylogue package" in result.stderr | ||
|
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4ae6d8eef6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary Move MCP out of the interactive query-first CLI and expose it as the standalone `polylogue-mcp` console script. Problem `polylogue mcp` put a protocol adapter beside query verbs and archive/operator commands. MCP stdio servers are normally launched by MCP clients, so the root CLI help and setup docs were advertising a service/protocol mode as if it were an interactive archive command. Solution - Added `polylogue-mcp = polylogue.mcp.cli:main` to project scripts. - Moved the Click entrypoint to `polylogue/mcp/cli.py` and kept `--role read|write|admin`. - Removed `polylogue mcp` from root command registration and CLI exports. - Updated README and MCP setup docs to use `polylogue-mcp --role read`. - Regenerated CLI reference, topology, verification catalog, quality docs, showcase baselines, and terminal snapshots. - Updated CLI/MCP tests and the CLI command-surface witness. Verification - `pytest -q tests/unit/mcp/test_cli.py tests/unit/cli/test_click_app.py tests/unit/cli/test_cli_error_boundaries.py tests/unit/cli/test_operator_support_runtime.py tests/unit/cli/test_terminal_snapshots.py tests/unit/proof/test_witnesses.py` -> 116 passed - `devtools render-all --check` - `devtools verify-topology` - `devtools verify-layering` - `devtools verify-test-ownership` - `mypy polylogue/` - `devtools verify --quick` -> all checks passed - `git push -u origin feature/refactor/mcp-entrypoint` -> pre-push `devtools verify --quick` all checks passed - CI: auto-merge waits for all required checks. Ref #635 Ref #593
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Move MCP out of the interactive query-first CLI and expose it as the standalone
polylogue-mcpconsole script.Problem
polylogue mcpput a protocol adapter beside query verbs and archive/operator commands. MCP stdio servers are normally launched by MCP clients, so the root CLI help and setup docs were advertising a service/protocol mode as if it were an interactive archive command.Solution
polylogue-mcp = polylogue.mcp.cli:mainto project scripts.polylogue/mcp/cli.pyand kept--role read|write|admin.polylogue mcpfrom root command registration and CLI exports.polylogue-mcp --role read.Verification
pytest -q tests/unit/mcp/test_cli.py tests/unit/cli/test_click_app.py tests/unit/cli/test_cli_error_boundaries.py tests/unit/cli/test_operator_support_runtime.py tests/unit/cli/test_terminal_snapshots.py tests/unit/proof/test_witnesses.py-> 116 passeddevtools render-all --checkdevtools verify-topologydevtools verify-layeringdevtools verify-test-ownershipmypy polylogue/devtools verify --quick-> all checks passedgit push -u origin feature/refactor/mcp-entrypoint-> pre-pushdevtools verify --quickall checks passedRef #635
Ref #593