Skip to content

fix(mcp): respect catalog capabilities and aborts - #1228

Merged
Astro-Han merged 2 commits into
devfrom
codex/upstream-mcp-a1
Jun 10, 2026
Merged

fix(mcp): respect catalog capabilities and aborts#1228
Astro-Han merged 2 commits into
devfrom
codex/upstream-mcp-a1

Conversation

@Astro-Han

Copy link
Copy Markdown
Owner

Summary

Teach MCP catalog handling to respect advertised server capabilities, follow paginated tool, prompt, and resource catalogs, and forward tool execution abort signals into client.callTool.

No PawWork issue is linked; this is upstream-value Line A1 for anomalyco/opencode #31271, #31442, and #31455.

Why

Some MCP servers expose only prompts or resources, but PawWork still tried to list tools and install tool-change handlers. Catalog listing also stopped after the first page, and canceled tool executions did not pass the parent abort signal to MCP.

Related Issue

No PawWork issue. Upstream references: anomalyco/opencode#31271, anomalyco/opencode#31442, anomalyco/opencode#31455.

Human Review Status

Pending

Review Focus

Please focus on the MCP capability checks around connect/auth flows, pagination cursor handling, and whether the tolerant tools/list fallback still strips unsupported output schemas without losing pagination.

Risk Notes

Skipped conditional checklist items:

  • Visible UI check: no visible UI or copy changed.
  • Platform check: no platform, packaging, updater, signing, path, shell, or permission surface changed.
  • Docs/deps/release/local-file check: no docs, release notes, dependencies, credentials, generated content, or local file behavior changed.

How To Verify

Regression RED: new lifecycle tests failed before implementation for capabilities, pagination, and abort signal propagation.
MCP tests: bun test test/mcp --timeout 30000 -> 44 passed.
Focused lifecycle retest: bun test test/mcp/lifecycle.test.ts --timeout 30000 -> 25 passed.
Typecheck: bun run typecheck in packages/opencode -> passed.
Diff check: git diff --check -> no whitespace errors.

Screenshots or Recordings

Not applicable; no visible UI changed.

Checklist

How to use this checklist:

  • Tick a box by replacing [ ] with [x]. Do not edit, add, or remove items.
  • The bot-applied label items can only be honestly ticked AFTER the PR is opened and the labeler / priority-triage bots have run — return to the PR description and tick them then.
  • Most items are required. The few that are conditional are explicitly marked (conditional); for those, leave unticked if they truly do not apply and explain why in Risk Notes. All other items must be ticked before requesting human review.
  • Type label — this PR carries exactly one of bug, enhancement, task, documentation. Type labels are author-added; the labeler bot does NOT assign them. Add the label in the GitHub UI, then tick this.
  • Routing labels — this PR carries at least one of app, ui, platform, harness, ci. The labeler bot assigns these on PR open based on changed paths. Confirm the bot's choice (or override if wrong), then tick this.
  • Priority label — this PR carries exactly one of P0, P1, P2, P3. The priority-triage bot suggests one on PR open. Confirm or override, then tick this.
  • Human Review Status above is set to Pending, Approved by @<reviewer>, or Not required: <reason> (default is Pending; "not required" is restricted to bot-authored low-risk PRs).
  • I linked the related issue, or stated in Summary why there is no issue.
  • I described the review focus and any meaningful risks.
  • I replaced the example block in How To Verify with the real verification steps and the key result for each.
  • I did not introduce unrelated refactors, dependencies, generated files, or file changes beyond the stated scope.
  • (conditional) I manually checked visible UI or copy changes when needed, with screenshots or recordings. Leave unticked only if no visible UI or copy changed.
  • (conditional) I considered macOS and Windows impact for platform, packaging, updater, signing, paths, shell, or permissions changes. Leave unticked only if no platform/packaging surface was touched.
  • (conditional) I called out docs, release notes, dependencies, permissions, credentials, deletion behavior, generated content, or local file changes when relevant. Leave unticked only if none of those surfaces was touched.
  • I reviewed the final diff for unrelated changes and suspicious dependency changes.
  • I am targeting dev, and my PR title and commit messages use Conventional Commits in English.

@Astro-Han Astro-Han added bug Something isn't working P2 Medium priority upstream Tracked upstream or vendor behavior harness Model harness, prompts, tool descriptions, and session mechanics labels Jun 10, 2026
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@Astro-Han, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 3 minutes and 37 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 25ac4471-1215-4d10-bcb7-60867a21e5f7

📥 Commits

Reviewing files that changed from the base of the PR and between aff7ce2 and 481cac2.

📒 Files selected for processing (3)
  • packages/opencode/src/mcp/index.ts
  • packages/opencode/test/mcp/lifecycle.test.ts
  • packages/opencode/test/mcp/oauth-auto-connect.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/upstream-mcp-a1

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 and usage tips.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested priority: P2 (includes non-doc, non-test paths outside the low-risk bucket).

P1/P0 are reserved for maintainer confirmation. Please relabel manually if this is a release blocker, security issue, data-loss risk, or updater/runtime failure.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces pagination support for MCP client listings (tools, prompts, and resources) with a safety limit of 1,000 pages, and adds capability checks to prevent calling unsupported endpoints. It also forwards abort signals to tool execution and adds comprehensive test coverage. The review feedback suggests making the capability checks more robust by using loose nullish checks (!= null) and improving the pagination helper to defensively handle null cursors and verify that the returned items are arrays before spreading them.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread packages/opencode/src/mcp/index.ts
Comment thread packages/opencode/src/mcp/index.ts Outdated
@Astro-Han

Copy link
Copy Markdown
Owner Author

Fresh-eye reviewer pass: no actionable P0-P3 findings. Reviewed the A1 MCP diff for capability gating, catalog pagination, abort signal propagation, tests, and scope. Residual risk noted: no live third-party MCP server smoke; local MCP tests and typecheck passed.

@Astro-Han

Copy link
Copy Markdown
Owner Author

Fresh-eye re-review after 481cac2: no actionable P0-P3 findings. Rechecked null capability/null cursor handling and the decision to keep malformed non-array catalogs rejected by SDK/zod validation rather than silently ignored. Local re-review verification passed.

@Astro-Han
Astro-Han merged commit 07a6c78 into dev Jun 10, 2026
33 checks passed
@Astro-Han
Astro-Han deleted the codex/upstream-mcp-a1 branch June 10, 2026 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working harness Model harness, prompts, tool descriptions, and session mechanics P2 Medium priority upstream Tracked upstream or vendor behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant