Skip to content

fix(mcp): discover enabled plugin servers in the CLI - #160245

Closed
Patrick-Erichsen wants to merge 1 commit into
codex/fix-native-mcp-header-envfrom
codex/fix-plugin-mcp-cli-discovery
Closed

Patrick-Erichsen wants to merge 1 commit into
codex/fix-native-mcp-header-envfrom
codex/fix-plugin-mcp-cli-discovery

Conversation

@Patrick-Erichsen

@Patrick-Erichsen Patrick-Erichsen commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Enabled plugins can contribute MCP servers to the agent runtime while openclaw mcp list, diagnostics and login only see manually configured servers.

User Impact

The CLI now discovers enabled plugin MCP servers, supports their OAuth login/logout, and preserves user overrides and disabled entries. Users can enable a built-in service and connect it without copying its URL into config.

Why This Change Was Made

Use the existing merged MCP inventory for reads. Probe and doctor retain original plugin ownership, including preparation of Agent bundle data directories. Mutations remain config-owned. Displayed headers and sensitive command arguments are redacted; login rechecks its source immediately before code completion. Doctor inspects authored header references so environment-backed credentials are not mistaken for hard-coded tokens, while mixed literal credentials, escaped references, and nonempty fallback secrets still warn.

A source change during the token-exchange request is not revalidated at save time; this existing lifecycle limitation is unchanged. Authored user-config environment references also retain the existing CLI behavior.

Evidence

  • Native-plugin tests exercise inventory, arbitrary-header redaction, OAuth login/logout, disabled config overrides and disabled plugin exclusion.
  • A real local stdio fixture fails to provide a catalog when probe drops plugin data-directory ownership; the fix passes both probe and doctor, recreating the directory for each launch.
  • Existing CLI and OAuth tests pass after updating the disabled-login expectation to require explicit enablement.
  • OAuth responses in unit tests are simulated. No UI behavior changed.

Stack-head validation

  • node scripts/check-changed.mjs --base 1fe560c198c2917154e2e1b130b0df3352ac5114 passed: static guards, dependency/lock checks, generated metadata, all typecheck graphs, dead-code scans, lint and runtime import cycles.
  • pnpm test src/agents/mcp-oauth.test.ts src/plugins/bundle-mcp.test.ts src/agents/bundle-mcp-config.test.ts src/cli/mcp-cli.test.ts src/cli/mcp-cli.plugins.test.ts src/cli/mcp-cli.oauth.test.ts src/plugins/contracts/package-manifest.contract.test.ts src/plugins/contracts/extension-runtime-dependencies.contract.test.ts --maxWorkers=1 passed: 729 tests / 8 files / 5 routed shards in 420.34s. The new CLI plugin suite took 54.31s including cold transformation (3 tests); the infra suite took 200.74s (67 tests). Hosted CI timing was not yet available.
  • Six additional Doctor contract/closure tests passed in the full check. Fresh P2 review findings about Typeform/Customer.io regions were addressed through documented existing overrides and live regional registration proof.

Package and upgrade proof

Validated stack head 5859d7c3d184e80cfed01304a93681ff69d64036 on macOS arm64 / Node 24.19.0:

  • Canonical node scripts/package-openclaw-for-docker.mjs --allow-unreleased-changelog --output-dir .artifacts/claw-723/package passed (19m47.6s), including declaration builds, UI build, package inventory and extracted runtime import-graph checks.
  • Built openclaw-2026.9.6.tgz, 99,082,240 bytes, SHA-256 0ee3ab0c8d43e777431ce557797c9609dbeb10bef9fbaf40a0d5dcf4954bcb04. All 35 compiled entries are present; packed manifests match source exactly.
  • Fresh isolated npm install: plugins list --json finds all 35 under the installed package, origin bundled, disabled. Enabling GoDaddy/Excalidraw exposes native MCP servers without manual config; live mcp probe returns 2/5 tools. Authenticated GitHub returns 45 tools; output is redacted. Missing-key fail-closed behavior and regional endpoint overrides pass. npm lifecycle-script approvals are limited to this disposable fixture; no user/global npm policy changed.
  • Real published-driver cell: registry [email protected] ran update --tag <candidate.tgz> --yes --json --no-restart --timeout 900. Result status: ok, installed build 2026.9.6-5859d7c3d184-2026-09-28T06-43-34.310Z; maintained upgrade-survivor helper verified baseline, candidate and installed application-byte identities. Existing disabled MCP config and enabled memory-core survived unchanged; all 35 additions remain disabled.
  • The updater's migration rehearsal, config validation, plugin resolution, isolated Gateway canary, Doctor and post-plugin lint passed. Its nonfatal warnings described deferred model-retirement repair, loopback-only hosting and deliberately skipped service management for isolated state. No personal Gateway restart or production release. Upgrade endpoint is a disabled synthetic fixture; separate provider calls above are live.

An earlier package attempt correctly refused a namespace change caused by concurrent generated-doc work. The final build ran after generation and checks finished, on stable inputs. OAuth consent/account tools and ten additional key-service accounts remain unverified; discovery-only inclusion is the approved milestone.

Stack order

  1. fix(mcp): retry typed OAuth client metadata errors #160243 — typed OAuth registration retry
  2. fix(plugins): resolve native MCP header environment references #160244 — native MCP header environment resolution
  3. fix(mcp): discover enabled plugin servers in the CLI #160245 — enabled plugin MCP discovery in the CLI
  4. feat(plugins): add opt-in company MCP built-ins #160246 — 35 opt-in company built-ins

Review only; no merge or release is authorized.

Hosted CI follow-up

Hosted CI is not green. Local validation above passed on the pinned stack; GitHub's later merge-ref/stack runs reported:

  • Bottom OAuth PR: run 36391006397 failed four unchanged service-operation-lock.retained-custody.test.ts cases (missing, unknown-phase, unknown-version, relative-source); sibling jobs were cancelled. The newer merge base includes upstream b107d4af, whose handoff-store refactor makes release() throw for malformed custody where the unchanged test expects false. The OAuth PR changes neither that owner nor its tests. A local replay of the same test-group order on pure upstream c136ec631464 reproduced all four failures with no CLAW-723 code present: 900 passed, 4 failed, 5 skipped across the same 18-file group in 112.43s (macOS; hosted run was Linux). The first archive attempt stopped before tests because scoped dependency links were missing; the corrected prerequisite setup is the reproducing run.
  • Header and built-in layers: run 36391038048 and run 36391101586 stop in preflight because the existing changed-owner planner generates 169/148 Node rows against its 130-row cap. No tests execute in those runs. Upstream a08479ac already fixes that planner handoff without raising the limit or dropping coverage; it is newer than this validated stack base.
  • The CLI layer's hosted checks were still processing with no failed checks at the follow-up read. No workflow dispatch, rerun, policy bypass or push merely to obtain green was performed.

These hosted outcomes remain review/landing context, not passing evidence. No merge is authorized.

@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes labels Sep 28, 2026
@Patrick-Erichsen Patrick-Erichsen changed the title fix: expose enabled plugin MCP servers in the CLI fix(mcp): discover enabled plugin servers in the CLI Sep 28, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 28, 2026, 3:40 AM ET / 07:40 UTC (Revision 2).

ClawSweeper review

What this changes

The branch makes the openclaw mcp CLI discover enabled plugin servers alongside saved servers, with plugin-aware probing, diagnostics, OAuth commands, redacted output, tests, and docs.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 3 items remain

This PR remains useful because current main does not expose enabled plugin MCP servers through the CLI. The pinned head still has the blocking OAuth compatibility regression identified in the earlier review.

Priority: P2
Reviewed head: b988429cb62fe18a28b52ea08365cb334d9d9368

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The real package and probe evidence is strong, but the established disabled-server OAuth regression blocks this otherwise coherent patch.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body reports an after-fix macOS package run where enabled plugin servers appeared through the production openclaw mcp probe path and returned live tool counts; a published-driver upgrade retained existing disabled state. Plugin OAuth completion was simulated, so that part remains a coverage limit. No stored-data contract changes.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body reports an after-fix macOS package run where enabled plugin servers appeared through the production openclaw mcp probe path and returned live tool counts; a published-driver upgrade retained existing disabled state. Plugin OAuth completion was simulated, so that part remains a coverage limit. No stored-data contract changes.
Evidence reviewed 9 items Introduced login guard: The pinned PR rejects login whenever the selected server has enabled: false, including an operator-saved OAuth server.
Existing CLI behavior: Current main selects saved servers for OAuth login without requiring them to be enabled.
Existing regression check: The current-main test configures a saved OAuth server as disabled, then successfully calls login and checks that the server remains disabled.
Findings 1 actionable finding [P1] Preserve OAuth login for saved disabled servers
Security None None.

How this fits together

Enabled plugins and operator config supply MCP server definitions that OpenClaw merges for agent runtimes. The CLI uses those definitions to display, diagnose, probe, and authorize servers.

flowchart LR
  A[Enabled plugin manifests] --> C[Effective MCP inventory]
  B[Saved MCP config] --> C
  C --> D{CLI command}
  D --> E[List and diagnose]
  D --> F[Probe server]
  D --> G[OAuth credentials]
Loading

Before merge

  • Preserve OAuth login for saved disabled servers (P1) - This guard rejects a saved HTTP OAuth server with enabled: false, although current main permits login before enablement and tests that sequence. Keep saved-server preauthorization available while handling unavailable plugin declarations separately.
  • Resolve merge risk (P1) - Existing saved OAuth servers with enabled: false can no longer be authorized before enablement, changing an established upgrade workflow.
  • Complete next step (P2) - Preserve preauthorization of saved disabled OAuth servers and restore regression coverage before merge.

Findings

  • [P1] Preserve OAuth login for saved disabled servers — src/cli/mcp-cli.ts:1261-1265
Agent review details

Security

None.

PR surface

Source +164, Tests +318, Docs +1. Total +483 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 2 252 88 +164
Tests 3 327 9 +318
Docs 2 18 17 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 597 114 +483

Review metrics

Metric Value Why it matters
Production and test growth production +164 net lines; tests +318 net lines The production growth adds a CLI adapter over the existing merge owner, while the tests cover plugin discovery and the changed login behavior.

Merge-risk options

Maintainer options:

  1. Preserve saved-server preauthorization (recommended)
    Keep login available for saved disabled OAuth servers and add a regression check that distinguishes them from unavailable plugin declarations.

Technical review

Best possible solution:

Use the shared plugin and config inventory for CLI reads while retaining OAuth login for saved disabled servers and rejecting plugin declarations that are unavailable.

Do we have a high-confidence way to reproduce the issue?

Yes. The current-main test establishes the disabled saved-server login sequence, and the introduced guard rejects it; this read-only review did not execute the command.

Is this the best way to solve the issue?

No, not as submitted. Reusing the shared inventory fits the subsystem, but login must distinguish a saved disabled server from an unavailable plugin declaration.

Full review comments:

  • [P1] Preserve OAuth login for saved disabled servers — src/cli/mcp-cli.ts:1261-1265
    This guard rejects a saved HTTP OAuth server with enabled: false, although current main permits login before enablement and tests that sequence. Keep saved-server preauthorization available while handling unavailable plugin declarations separately.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against ff8c752d852f.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Plugin-aware CLI discovery is a useful bounded improvement, with a compatibility regression that must be fixed before merge.
  • merge-risk: 🚨 compatibility: The new login guard changes behavior for existing disabled saved server configurations.
  • merge-risk: 🚨 auth-provider: The affected workflow is OAuth authorization of saved MCP servers.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (terminal): The PR body reports an after-fix macOS package run where enabled plugin servers appeared through the production openclaw mcp probe path and returned live tool counts; a published-driver upgrade retained existing disabled state. Plugin OAuth completion was simulated, so that part remains a coverage limit. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body reports an after-fix macOS package run where enabled plugin servers appeared through the production openclaw mcp probe path and returned live tool counts; a published-driver upgrade retained existing disabled state. Plugin OAuth completion was simulated, so that part remains a coverage limit. No stored-data contract changes.

Evidence

Acceptance criteria:

  • [P1] pnpm test src/cli/mcp-cli.oauth.test.ts src/cli/mcp-cli.plugins.test.ts --maxWorkers=1.
  • [P1] node scripts/check-changed.mjs --base 9105520.

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Restore saved-disabled-server preauthorization and its regression check.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-28T07:27:15.142Z sha b988429 :: blocked before merge. :: [P1] Preserve login for saved disabled OAuth servers

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Oct 13, 2026
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Closing: #167090 remains open for the same CLI discovery of plugin-contributed MCP servers.

Closed by Roboclaw at the author's request after an audit of his open PRs. The branch is kept, so this can be reopened if needed.

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

Labels

cli CLI command changes docs Improvements or additions to documentation merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L stale Marked as stale due to inactivity status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants