Skip to content

feat(cli): add pi-mcp-adapter install support - #663

Closed
zh-xl-kang wants to merge 4 commits into
DeusData:mainfrom
zh-xl-kang:feat/add-pi-agent-support-v2
Closed

feat(cli): add pi-mcp-adapter install support#663
zh-xl-kang wants to merge 4 commits into
DeusData:mainfrom
zh-xl-kang:feat/add-pi-agent-support-v2

Conversation

@zh-xl-kang

@zh-xl-kang zh-xl-kang commented Jun 28, 2026

Copy link
Copy Markdown

Summary

Add install/uninstall support for pi-mcp-adapter, a third-party tool that adds MCP support to the Pi coding agent.

Note: This is distinct from #534, which adds native Pi support via extensions. This PR specifically supports the pi-mcp-adapter workflow for users who have that adapter installed.

Context

Pi's official README states: "No MCP. Build CLI tools with READMEs (Skills), or build an extension that adds MCP support."

The pi-mcp-adapter is a community tool that bridges this gap by adding MCP support to Pi. This PR adds codebase-memory-mcp install/uninstall support for users who have pi-mcp-adapter installed.

Changes

  • cli.c: Add install_pi_mcp_adapter() and uninstall_pi_mcp_adapter() functions

    • Detection checks for ~/.pi/agent/ (Pi agent directory) AND ~/.pi/agent/mcp.json (pi-mcp-adapter config file)
    • Install writes mcpServers entry to ~/.pi/agent/mcp.json
    • Uninstall removes the entry
    • Both functions follow the same error handling pattern as other installers
  • cli.h: Add function declarations

  • test_cli.c: Add test cases for install/uninstall lifecycle

Usage

Users who have both Pi agent and pi-mcp-adapter installed can now run:

codebase-memory-mcp install
# Detects pi-mcp-adapter presence and writes mcpServers entry

codebase-memory-mcp uninstall
# Removes the mcpServers entry

Users without pi-mcp-adapter should use #534's native extension-based integration instead.

Testing

  • Verified install writes correct mcpServers entry to ~/.pi/agent/mcp.json
  • Verified uninstall removes the entry cleanly
  • Verified detection correctly identifies pi-mcp-adapter presence (requires both Pi agent dir and mcp.json file)

Add a `pi` field to cbm_detected_agents_t and detect the Pi agent
(pi-mcp-adapter) by the presence of its ~/.pi/agent/ config directory,
mirroring the existing Kiro/Cursor detection. List it in the
"Detected agents" output.

Signed-off-by: kangxl <230263957+zh-xl-kang@users.noreply.github.com>
Wire the Pi agent into the editor-style install and uninstall flows,
mirroring Kiro/Cursor: write the codebase-memory-mcp entry to
~/.pi/agent/mcp.json (standard mcpServers format) via
cbm_install_editor_mcp, and remove it on uninstall. Pi reads no
instruction file, so none is written. Pi is also included in the
install plan JSON.

Signed-off-by: kangxl <230263957+zh-xl-kang@users.noreply.github.com>
Add cli_detect_agents_finds_pi (mirroring finds_kiro) and assert Pi is
not detected in cli_detect_agents_none_found. The new test also covers
Pi's nested-path detection: ~/.pi alone must not trigger, only
~/.pi/agent/ does. Register the test in the cli suite.

Signed-off-by: kangxl <230263957+zh-xl-kang@users.noreply.github.com>
Add the Pi agent to the supported-agents lists and bump the agent
count from 11 to 12 across README, the docs site, llms.txt, and the
npm package README. Add a Pi row to the README agent config table
(~/.pi/agent/mcp.json; no instruction file or hooks).

Signed-off-by: kangxl <230263957+zh-xl-kang@users.noreply.github.com>
@DeusData

Copy link
Copy Markdown
Owner

Huge thanks for opening this PR and for the work you put into it.

The maintainer shop is currently full, so this may sit for a bit before it gets a proper review. We will come back to this as soon as possible with real feedback; I wanted to make sure it did not sit unacknowledged in the meantime.

@DeusData DeusData added enhancement New feature or request editor/integration Editor compatibility and CLI integration priority/backlog Valuable contribution, lower scheduling urgency; review when maintainer capacity opens. labels Jun 29, 2026
@DeusData

DeusData commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Thanks. This overlaps with #534 but uses a different Pi integration model. Before merge, maintainers should choose one path; please add an authoritative reference that Pi/pi-mcp-adapter consumes ~/.pi/agent/mcp.json using mcpServers.

@zh-xl-kang

Copy link
Copy Markdown
Author

Thanks for the feedback! Here are the authoritative references:

Official Documentation: https://github.com/nicobailon/pi-mcp-adapter

The README explicitly states the file precedence, including:

<Pi agent dir>/mcp.json | Pi global override & compatibility imports (Default: ~/.pi/agent/mcp.json)

Regarding mcpServers format: pi-mcp-adapter reads standard MCP config files that use the mcpServers key structure, same as Claude Desktop, Cursor, and other MCP clients. The adapter automatically imports configs from these tools via /mcp setup or pi-mcp-adapter init.

Regarding #534: This PR focuses on install/uninstall support for pi-mcp-adapter itself (the adapter tool), not the Pi agent binary. The detection checks for ~/.pi/agent/ directory to identify Pi agent presence, then installs the adapter's MCP config into ~/.pi/agent/mcp.json.

Let me know if you need additional clarification on the integration model!

@zh-xl-kang zh-xl-kang changed the title feat(cli): add Pi agent (pi-mcp-adapter) install support feat(cli): add pi-mcp-adapter install support Jul 1, 2026
@zh-xl-kang

Copy link
Copy Markdown
Author

After further analysis and discussion, I'm closing this PR in favor of #534 which takes the better architectural approach.

Reasoning:

  • Pi officially does not support MCP (per its README: "No MCP. Build CLI tools with READMEs (Skills), or build an extension that adds MCP support.")
  • feat(install): detect and configure pi coding agent #534 uses Pi's native extension mechanism — zero extra dependencies, works for all Pi users out of the box
  • This PR only serves users who already have pi-mcp-adapter installed, which is a narrow audience
  • Maintaining two integration paths for the same agent adds unnecessary complexity

Happy to review or help test #534 if needed. Thanks for the consideration, @DeusData.

@zh-xl-kang zh-xl-kang closed this Jul 1, 2026
@DeusData

DeusData commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Thanks for the clarification and for closing this in favor of a single Pi integration path. We’ll evaluate #534 separately since it uses the native extension install path and needs a more focused review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

editor/integration Editor compatibility and CLI integration enhancement New feature or request priority/backlog Valuable contribution, lower scheduling urgency; review when maintainer capacity opens.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants