Skip to content

fix: add mcp command with setup guidance#315

Merged
milla-jovovich merged 6 commits intoMemPalace:mainfrom
kpulik:fix/mcp-command-guidance-296
Apr 9, 2026
Merged

fix: add mcp command with setup guidance#315
milla-jovovich merged 6 commits intoMemPalace:mainfrom
kpulik:fix/mcp-command-guidance-296

Conversation

@kpulik
Copy link
Copy Markdown
Contributor

@kpulik kpulik commented Apr 9, 2026

Fixes #296

Summary

  • adds a first-class mcp CLI command so mempalace mcp is recognized
  • prints clear MCP setup guidance instead of argparse invalid-choice failure
  • updates CLI help surfaces for discoverability
  • adds focused CLI test coverage

Changes

  • mempalace/cli.py: add cmd_mcp, register mcp subcommand, wire dispatch
  • mempalace/instructions/help.md: include mempalace mcp in command list
  • README.md: include mempalace mcp in all commands section
  • tests/test_cli.py: add regression test for mcp command output

Validation

  • python3 -m pytest tests/test_cli.py tests/test_version_consistency.py -q
  • python3 -m mempalace mcp

Copilot AI review requested due to automatic review settings April 9, 2026 00:19
@kpulik
Copy link
Copy Markdown
Contributor Author

kpulik commented Apr 9, 2026

Friendly follow-up: required checks look configured but have not started yet, and the PR UI indicates a maintainer workflow approval is needed before CI can run.

Could a maintainer approve workflows for this PR so lint and tests can start?

Happy to make any changes requested in review.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a first-class mcp subcommand to the mempalace CLI so mempalace mcp is recognized and prints MCP setup guidance (instead of failing with an argparse invalid-choice error), and updates docs/tests accordingly.

Changes:

  • Register mcp as a CLI subcommand and dispatch it to a new cmd_mcp handler.
  • Update help/documentation command lists to include mempalace mcp.
  • Add a regression test asserting the mcp command prints setup guidance.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
mempalace/cli.py Adds cmd_mcp, registers mcp subcommand, wires dispatch.
mempalace/instructions/help.md Adds mempalace mcp to the instructions help command list.
README.md Adds mempalace mcp to the “all commands” section.
tests/test_cli.py Adds a regression test for mcp command output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mempalace/cli.py Outdated
@kpulik
Copy link
Copy Markdown
Contributor Author

kpulik commented Apr 9, 2026

Addressed Copilot note about --palace guidance in mcp output.

What changed:

  • mempalace mcp now prints python -m mempalace.mcp_server [--palace /path/to/palace] by default
  • when --palace is provided, output now includes the resolved path
  • added regression test for explicit --palace behavior

Validation:

  • python3 -m pytest tests/test_cli.py tests/test_version_consistency.py -q (4 passed)
  • python3 -m mempalace mcp
  • python3 -m mempalace --palace "~/tmp/my palace" mcp

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mempalace/cli.py Outdated
Comment thread tests/test_cli.py Outdated
@kpulik
Copy link
Copy Markdown
Contributor Author

kpulik commented Apr 9, 2026

Addressed the latest Copilot comments about non-runnable bracket placeholders.

Update:

  • default output now prints runnable commands without bracket notation
  • added a separate Optional custom palace section for --palace /path/to/palace examples
  • when --palace is provided, output still prints the resolved, quoted path
  • tests updated to lock in runnable default guidance

Validation:

  • python3 -m pytest tests/test_cli.py tests/test_version_consistency.py -q (4 passed)
  • python3 -m mempalace mcp
  • python3 -m mempalace --palace "~/tmp/my palace" mcp

@milla-jovovich
Copy link
Copy Markdown
Collaborator

@kpulik Please check conflicts

@kpulik
Copy link
Copy Markdown
Contributor Author

kpulik commented Apr 9, 2026

Conflicts resolved against latest main in commit 1d2a5b6 (including tests/test_cli.py).

I retained upstream CLI test additions and re-applied the mcp guidance tests. Local validation after merge:

  • python3 -m pytest tests/test_cli.py tests/test_version_consistency.py -q (42 passed)

Ready for re-review.

@kpulik
Copy link
Copy Markdown
Contributor Author

kpulik commented Apr 9, 2026

Quick verification after v3.1.0 release: I tested the published wheel and mempalace mcp is still not recognized.

Repro from clean install:

  • python3 -m pip install --user --upgrade mempalace==3.1.0
  • python3 -m mempalace mcp

Observed:

  • invalid choice: "mcp"

So #296 appears closed by release/version bump, but the exact CLI path this PR addresses (mempalace mcp) is still missing in the published package.

Happy path from here could be either:

  1. merge fix: add mcp command with setup guidance #315 and include in next patch release, or
  2. cherry-pick equivalent changes and cut a 3.1.1 hotfix.

@milla-jovovich milla-jovovich self-requested a review April 9, 2026 18:20
@milla-jovovich milla-jovovich merged commit 2981433 into MemPalace:main Apr 9, 2026
6 checks passed
gnusam pushed a commit to gnusam/mempalace-pgsql that referenced this pull request Apr 9, 2026
New `mempalace mcp` command prints copy-pastable instructions for
wiring the MemPalace MCP server into Claude Code (or any MCP-capable
host). Honours the top-level --palace flag to include a --palace
argument in the printed command.

Adapted from upstream 2981433 (PR MemPalace#315), by @kpulik. Upstream prints
`python -m mempalace.mcp_server` which assumes a pip install; this
fork's delivery model is Docker Compose, so the printed commands wrap
the module invocation in `docker compose run --rm -i --entrypoint
python mempalace -m mempalace.mcp_server`. Upstream's help.md edit
is dropped because this fork does not ship the instructions/ package.

Co-Authored-By: Kevin Pulikkottil <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
gnusam pushed a commit to gnusam/mempalace-pgsql that referenced this pull request Apr 9, 2026
)

Record the four commits ported in this sync window (MCP null-args fix,
MCP protocol version negotiation, 500 MB file-size guard, mempalace mcp
subcommand) in the Sync status paragraph, with upstream hashes, PR
numbers, and original authors for attribution.

Also list the newly-skipped commits from the same window so a future
audit doesn't re-walk them: the ChromaDB-specific Windows handle
release and cmd_repair recursion fix, the PR MemPalace#252 palace.py / KG
consolidation and md5→sha256 drawer-ID change, the metadata TTL cache
upstream itself removed, upstream's macOS/Windows CI split, and the
3.0.x/3.1.0 version bump chore commits.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
phobicdotno pushed a commit to phobicdotno/mempalace-gpu that referenced this pull request Apr 10, 2026
* fix: add mcp command with setup guidance

* fix: include --palace guidance in mcp command output

* fix: make mcp guidance commands copy-pastable

---------

Co-authored-by: Milla J <[email protected]>
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.

Invalid command 'mcp' not recognized

3 participants