Skip to content

cli: add cli/__main__.py so MCP clients can run python -m cli mcp - #146

Merged
WintersCoder merged 1 commit into
IkarusAILabs:mainfrom
chiragjangiir:fix/145-cli-main-module
Oct 25, 2026
Merged

WintersCoder merged 1 commit into
IkarusAILabs:mainfrom
chiragjangiir:fix/145-cli-main-module

Conversation

@chiragjangiir

Copy link
Copy Markdown
Contributor

Resolves #145

Summary

When openpulse is not directly on the client's PATH (common in virtualenvs and on Windows), MCP clients configure the Python interpreter directly:

{
  "mcpServers": {
    "openpulse": {
      "command": "/path/to/venv/bin/python",
      "args": ["-m", "cli", "mcp"]
    }
  }
}

Previously, python -m cli failed with No module named cli.__main__; 'cli' is a package and cannot be directly executed.

Changes

  1. Added cli/__main__.py calling cli.main.cli().
  2. Updated tests/test_mcp_server.py::test_stdio_end_to_end_with_the_sdk_client to invoke -m cli directly instead of the -c "from cli.main import cli; cli()" workaround.
  3. Added test_cli_main_module_executable() regression test to tests/test_packaging.py.
  4. Documented interpreter-based configuration in docs/MCP.md under "Connect your agent".

Verification

  • Tested python -m cli --version -> outputs openpulse, version 0.6.3.
  • Ran pytest tests/test_packaging.py -> 5 passed.

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.

cli: add cli/__main__.py so MCP clients can run python -m cli mcp

2 participants