Skip to content

feat: improve MCP operator workflows - #88467

Merged
steipete merged 1 commit into
mainfrom
feat/mcp-operator-workflows
May 30, 2026
Merged

steipete merged 1 commit into
mainfrom
feat/mcp-operator-workflows

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Summary

  • Add MCP operator workflows for adding, configuring, enabling/disabling, probing, reloading, and logging into configured MCP servers.
  • Add config/runtime support for server enablement, tool filters, request/connect timeouts, parallel tool-call hints, OAuth, scoped HTTP headers, TLS verification, and client certificates.
  • Document the MCP CLI/config surface and cover the new runtime, projection, OAuth credential lifecycle, and CLI mutation paths with focused tests.

Verification

Behavior addressed: MCP operators can manage configured servers, tune runtime behavior, authorize OAuth-backed HTTP servers, clear stored OAuth credentials, and project the same config into agent runtimes safely.

Real environment tested: local focused tests/typecheck; Crabbox AWS Linux for live MCP server E2E and changed-gate proof.

Exact steps or command run after this patch:

  • node scripts/run-vitest.mjs src/agents/mcp-oauth.test.ts src/agents/mcp-http-fetch.test.ts src/agents/mcp-transport.test.ts src/cli/mcp-cli.test.ts
  • node scripts/run-tsgo.mjs -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core.tsbuildinfo
  • git diff --check
  • .agents/skills/autoreview/scripts/autoreview --mode local
  • Crabbox AWS live MCP E2E against real npm MCP servers: run_4d0ac1a4b74b
  • Crabbox AWS changed gate: run_3925ad1a00a5 with git fetch origin main --deepen=100000 || git fetch origin main --depth=100000; pnpm check:changed

Evidence after fix: autoreview clean; focused tests passed; core typecheck passed; run_3925ad1a00a5 exited 0; live E2E run exercised add/probe/filter/disable/enable/timeout/parallel/OAuth config/reload flows against real MCP servers.

Observed result after fix: configured MCP servers honor operator controls in runtime and CLI flows, OAuth credentials are scoped and cleaned on auth clear/unset/replacement, and HTTP TLS/header behavior stays scoped to the MCP resource origin.

What was not tested: full browser-based third-party OAuth callback with a real provider; the SDK-backed login/exchange and local credential lifecycle are covered by unit/transport tests.

@steipete
steipete requested a review from a team as a code owner May 30, 2026 22:44
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime cli CLI command changes agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels May 30, 2026
@clawsweeper

clawsweeper Bot commented May 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed May 30, 2026, 6:51 PM ET / 22:51 UTC.

Summary
This PR adds MCP CLI operator commands and config/runtime support for enablement, timeouts, tool filters, parallel-call hints, OAuth login and credential lifecycle, scoped HTTP headers, TLS controls, and docs/tests for those flows.

PR surface: Source +1197, Tests +694, Docs +65. Total +1956 across 28 files.

Reproducibility: not applicable. as a bug reproduction: this is a new MCP operator workflow feature rather than a report of broken existing behavior. The PR body provides focused test and Crabbox live E2E proof for the intended paths.

Review metrics: 1 noteworthy metric.

  • MCP config/default surface: 19 added schema-visible fields or aliases. The PR expands saved MCP server configuration with enablement, timeout, OAuth, TLS, mTLS, and parallel-call controls, which is compatibility-sensitive before merge.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster ✨ media proof bonus
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Have maintainers explicitly review and accept the persisted MCP config/auth/TLS operator surface before merge.

Risk before merge

  • [P2] Merging this PR establishes a broad persisted MCP operator contract for enablement, timeout aliases, OAuth, TLS verification, mTLS paths, and parallel-call hints; maintainers should explicitly accept that upgrade surface before landing.
  • [P1] The new TLS and OAuth controls are security-boundary behavior even though the sampled implementation scopes headers and TLS dispatchers to the MCP resource origin.

Maintainer options:

  1. Approve the MCP operator contract (recommended)
    Maintainers can accept the new persisted MCP config/auth/TLS surface as the intended core operator workflow after reviewing the upgrade behavior and docs.
  2. Narrow before merge
    If maintainers want less core surface, split optional OAuth/TLS or alias behavior behind a smaller follow-up design before landing this branch.
  3. Pause for product direction
    If MCP operator workflows should live outside core or wait for a plugin/API decision, pause this PR rather than merging the new contract now.

Next step before merge

  • [P2] The remaining action is maintainer judgment on the broad MCP config/auth/TLS contract, not a narrow automated repair.

Security
Cleared: No concrete security or supply-chain defect was found in the sampled diff; the auth and TLS surface still needs maintainer acceptance because it is security-sensitive.

Review details

Best possible solution:

Review and explicitly accept the new MCP operator contract, then land it with the included docs, tests, and Crabbox proof if maintainers agree this should be core behavior.

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

Not applicable as a bug reproduction: this is a new MCP operator workflow feature rather than a report of broken existing behavior. The PR body provides focused test and Crabbox live E2E proof for the intended paths.

Is this the best way to solve the issue?

Yes, if maintainers want this in core: the implementation keeps MCP management in the existing CLI/config/runtime paths and adds docs plus focused coverage. The remaining decision is whether the broad persisted operator surface is the desired stable contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model gpt-5.5, reasoning high; reviewed against d05e4a4bc6f2.

Label changes

Label changes:

  • add P2: This is a normal-priority MCP operator feature with broad but bounded config/runtime impact.
  • add merge-risk: 🚨 compatibility: The PR adds and projects new persisted MCP server config keys and aliases that affect existing runtime discovery, disabled servers, and operator workflows.
  • add merge-risk: 🚨 auth-provider: The PR introduces MCP OAuth login, token persistence, token clearing, and runtime auth-provider wiring.
  • add merge-risk: 🚨 security-boundary: The PR changes HTTP header scoping, TLS verification, and mTLS certificate/key handling for remote MCP servers.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix real behavior proof with Crabbox AWS live MCP E2E and changed-gate run IDs, plus exact focused local commands and observed runtime results.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR body includes after-fix real behavior proof with Crabbox AWS live MCP E2E and changed-gate run IDs, plus exact focused local commands and observed runtime results.

Label justifications:

  • P2: This is a normal-priority MCP operator feature with broad but bounded config/runtime impact.
  • merge-risk: 🚨 compatibility: The PR adds and projects new persisted MCP server config keys and aliases that affect existing runtime discovery, disabled servers, and operator workflows.
  • merge-risk: 🚨 auth-provider: The PR introduces MCP OAuth login, token persistence, token clearing, and runtime auth-provider wiring.
  • merge-risk: 🚨 security-boundary: The PR changes HTTP header scoping, TLS verification, and mTLS certificate/key handling for remote MCP servers.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR body includes after-fix real behavior proof with Crabbox AWS live MCP E2E and changed-gate run IDs, plus exact focused local commands and observed runtime results.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix real behavior proof with Crabbox AWS live MCP E2E and changed-gate run IDs, plus exact focused local commands and observed runtime results.
Evidence reviewed

PR surface:

Source +1197, Tests +694, Docs +65. Total +1956 across 28 files.

View PR surface stats
Area Files Added Removed Net
Source 16 1284 87 +1197
Tests 10 694 0 +694
Docs 2 81 16 +65
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 28 2059 103 +1956

What I checked:

  • Repository policy applied: Read the full root AGENTS.md from the checkout plus scoped docs and agents AGENTS.md files; the review applied the protected maintainer-label rule and the compatibility-sensitive MCP/config/auth guidance. (AGENTS.md:1, d05e4a4bc6f2)
  • Protected PR context: The provided GitHub context shows this PR has the protected maintainer label, so conservative cleanup should not close it automatically.
  • PR surface verified: The PR commit changes 28 files with 2059 insertions and 103 deletions across MCP CLI, agent runtime/transport, config schema/types, tests, and docs. (b86c491825aa)
  • Persisted MCP config surface: The PR adds persisted MCP server fields for enablement, request/connect timeout aliases, OAuth, TLS verification, mTLS certificate/key paths, and parallel-call hints. (src/config/types.mcp.ts:23, b86c491825aa)
  • OAuth storage behavior: The new OAuth provider stores MCP OAuth state under the OpenClaw state directory with 0600 file permissions and clears credentials by the exact server name plus URL store path. (src/agents/mcp-oauth.ts:36, b86c491825aa)
  • HTTP security scoping: The new MCP fetch helper scopes custom TLS dispatchers and same-origin HTTP headers to the MCP resource origin before falling back to the normal Undici fetch path. (src/agents/mcp-http-fetch.ts:21, b86c491825aa)

Likely related people:

  • Peter Steinberger: Current main history and blame show recent MCP CLI, transport, config, and docs work in the same surface, including the existing MCP CLI commands this PR extends. (role: recent area contributor; confidence: high; commits: ec78a21e0b31, 98822fdd6352, 7043705ef3f3; files: src/cli/mcp-cli.ts, src/agents/mcp-transport.ts, src/agents/agent-bundle-mcp-runtime.ts)
  • Vincent Koc: History shows adjacent MCP documentation and agent/runtime work in the same broader area, including docs coverage and bundled MCP agent integration commits. (role: adjacent docs and agent contributor; confidence: medium; commits: c42659176a56, 06459ca0dfba; files: docs/cli/mcp.md, src/agents/agent-bundle-mcp-runtime.ts)
  • dhananjai1729: History shows prior SSE MCP transport and redaction hardening work that is adjacent to this PR's remote MCP transport changes. (role: prior MCP transport contributor; confidence: medium; commits: d89bfed5cce6, bf8303370eeb; files: src/agents/mcp-transport.ts, docs/cli/mcp.md)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b86c491825

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/cli/mcp-cli.ts
Comment on lines +132 to +133
if (nextResolved?.kind === "http" && nextResolved.url === previousResolved.url) {
return;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Clear stale OAuth cache when metadata changes

When an OAuth MCP server is replaced or reconfigured with the same URL but different oauth.clientMetadataUrl, redirect URL, or scope, this early return keeps the old mcp-oauth store. The MCP SDK auth flow loads cached clientInformation before consulting clientMetadataUrl or dynamic registration, so future openclaw mcp login and runtime auth can continue using the previous client registration/token despite the new OAuth settings. Include the OAuth metadata in the staleness check, or clear credentials on any OAuth config change.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 30, 2026
@steipete
steipete merged commit 38d3d11 into main May 30, 2026
186 of 191 checks passed
@clawsweeper clawsweeper Bot added the rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. label May 30, 2026
@steipete
steipete deleted the feat/mcp-operator-workflows branch May 30, 2026 22:51
@clawsweeper clawsweeper Bot added the status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. label May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling cli CLI command changes docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant