Skip to content

fix(launcher): forward gentle-shell mcp to pi's own mcp command - #2204

Merged
Alan-TheGentleman merged 1 commit into
mainfrom
fix/2140-mcp-subcommand
Oct 13, 2026
Merged

Alan-TheGentleman merged 1 commit into
mainfrom
fix/2140-mcp-subcommand

Conversation

@Alan-TheGentleman

@Alan-TheGentleman Alan-TheGentleman commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #2140

Summary

  • gentle-shell mcp <command> now reaches Pi's own mcp command against the resolved home, so standalone installs can add, list, log in to and log out of MCP servers.
  • Root cause (reproduced live): mcp was missing from PI_SUBCOMMANDS, so the launcher injected -e <package> ahead of it and Pi treated mcp list as a prompt (it asked for an API key; mcp add wrote nothing).
  • A -- that follows a pi subcommand is now kept, so gentle-shell mcp add <name> -- <command> reaches Pi verbatim. A leading -- is still the launcher's own separator.

Changes

File Change
lib/gentle-shell-launcher.ts (+ generated runtime/gentle-shell-launcher.mjs) add mcp to PI_SUBCOMMANDS; keep a separator after a pi subcommand; help text
tests/gentle-shell-bin.test.ts end-to-end forwarding of mcp add <name> -- <cmd>; --help lists mcp
tests/gentle-shell-launcher.test.ts separator kept after a pi subcommand; previous behavior without one preserved
docs/readme-reference.md "Configuring MCP servers"

Test plan

  • RED observed before the fix: forwarded args were ['-e', '<pkg>', 'mcp', 'add', 'demo', 'npx', ...] (separator lost); --help had no mcp.
  • node --experimental-strip-types --test tests/gentle-shell-launcher.test.ts tests/gentle-shell-bin.test.ts: 374 pass, 0 fail.
  • npm test: 6629 pass, 0 fail (unit, provider-contract, runtime-harness).
  • node scripts/check-types.mjs: no regressions; pnpm run check:runtime-modules: runtime matches sources.
  • Manual, fresh temp HOME, GENTLE_SHELL_NO_AUTO_SETUP=1: gentle-shell mcp add demo -- echo hi wrote ~/.gentle-shell/agent/mcp.json; gentle-shell mcp list listed it.

Summary by CodeRabbit

  • New Features
    • Added the mcp command to pass commands through to Pi, including support for adding stdio and remote servers and listing configured servers.
    • Updated help and setup documentation with mcp examples. Restart Gentle Shell to load newly configured servers.
    • Preserved -- when passing commands to mcp add, so command arguments are forwarded correctly.

pi dispatches mcp on argv[0], but mcp was missing from PI_SUBCOMMANDS, so
the launcher injected -e ahead of it and pi treated 'mcp list' as a prompt.
A separator after a pi subcommand is now kept, so 'mcp add <name> -- <cmd>'
reaches pi verbatim. Closes #2140.
@Alan-TheGentleman Alan-TheGentleman added the type:bug Bug fix label Oct 13, 2026
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 5f80ca87-985b-423a-b8e1-7f5ec524feb4
📥 Commits

Reviewing files that changed from the base of the PR and between bedba1f and 748a682.

📒 Files selected for processing: 5
  • docs/readme-reference.md
  • lib/gentle-shell-launcher.ts
  • runtime/gentle-shell-launcher.mjs
  • tests/gentle-shell-bin.test.ts
  • tests/gentle-shell-launcher.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

📝 Walkthrough

The launcher now recognizes mcp as a Pi subcommand and forwards MCP command arguments, including the separator in applicable cases. Help text and the reference documentation describe MCP server configuration.

Changes: MCP command passthrough

Layer / File(s) Summary
Recognize and forward MCP commands
lib/gentle-shell-launcher.ts, runtime/gentle-shell-launcher.mjs, tests/gentle-shell-launcher.test.ts, tests/gentle-shell-bin.test.ts, docs/readme-reference.md
The launcher recognizes mcp and preserves the separator after a recognized Pi subcommand. Tests cover argument forwarding and separator handling. Help text and documentation describe MCP commands and configuration examples.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: dnlrsls

Merge Risk: ⚪ Minimal · up to 748a6

The MCP command is routed to Pi with the intended arguments and standalone home. No actionable merge-blocking risk remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 4 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: forwarding the launcher’s mcp command to Pi’s MCP command.
Linked Issues check Passed Issue #2140 requests a supported standalone workflow for MCP configuration. The launcher now recognizes mcp as a Pi subcommand and forwards it to Pi with the resolved home. The launcher preserves th…
Out of Scope Changes check Passed The changed launcher code implements MCP subcommand dispatch and separator forwarding. The generated runtime file mirrors the source change. The tests verify the new argument handling and help text. T…
Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 4 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Alan-TheGentleman
Alan-TheGentleman merged commit c9f8450 into main Oct 13, 2026
9 checks passed
aiorellana502 added a commit to aiorellana502/gentle-shell that referenced this pull request Oct 13, 2026
…ng#2205, Gentleman-Programming#2207) before resolving the launcher import conflict

# Conflicts:
#	bin/gentle-shell.mjs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(standalone): option to configure MCP servers when gentle-shell runs outside pi

1 participant