Skip to content

fix: register all MCP tools via registerSurface so /mcp/connector stays compliant - #186

Merged
Gikoskos merged 3 commits into
mainfrom
fix/gate-profiles-compliant
Jul 17, 2026
Merged

fix: register all MCP tools via registerSurface so /mcp/connector stays compliant#186
Gikoskos merged 3 commits into
mainfrom
fix/gate-profiles-compliant

Conversation

@Xrazik1

@Xrazik1 Xrazik1 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Problem

/mcp/connector (the compliant, reduced surface for the OpenAI/Anthropic app directories) was serving the full tool surface — including browserless_smartscraper, function, map, crawl, and the new browserless_profiles. Those are exactly the tools the compliant surface exists to hide, and this surfaced mid-resubmission after v1.0.0 was rejected for data-collection concerns.

Root cause

At #166 src/index.ts registered tools only through registerSurface, which is the compliance gate — each tool declares both or full, and full tools are skipped when MCP_COMPLIANCE_MODE=true.

#179 (get browserless profiles) re-introduced the old block of direct register*() calls in index.ts above the registerSurface call. Those direct calls register every tool unconditionally, bypassing the gate entirely, so compliance mode no longer reduced anything. browserless_profiles also had no gating of its own.

The existing compliance tests drive registerSurface directly, so they could not see registrations added straight to index.ts — the regression slipped through.

Fix

  • Remove the unconditional registration block from src/index.ts; registerSurface is again the sole registration path.
  • Add browserless_profiles to the register.ts surface table as full, so it is exposed on the full surface and hidden on the compliant one.

Tests

  • Full-surface count guard updated 9 to 10 to include browserless_profiles.
  • New guard: browserless_profiles is full-only, absent from the compliant surface.
  • New source guard: index.ts must register only via registerSurface — it fails if any tool registrar is called directly in index.ts, catching this exact regression class that the registerSurface-driven tests cannot.

Verification

Full suite: 533 passing. Compliant surface now registers exactly 5 tools; full registers 10.

Summary by CodeRabbit

  • New Features

    • Added the browserless_profiles tool to full-mode users.
  • Bug Fixes

    • Ensured browserless_profiles is not available in compliant mode, and kept the active tool surface consistent at startup.
  • Tests

    • Expanded compliance-mode regression coverage to validate tool-surface membership and to prevent reintroducing per-tool registration logic.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 06a2fbae-4445-41a0-8e7a-7ad522fba5f5

📥 Commits

Reviewing files that changed from the base of the PR and between f4c2b25 and 25a6061.

📒 Files selected for processing (2)
  • src/tools/register.ts
  • test/tools/compliance-mode.spec.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/tools/register.ts
  • test/tools/compliance-mode.spec.ts

Walkthrough

The server now delegates tool and resource registration to registerSurface. The full compliance surface includes browserless_profiles, while compliant mode excludes it. Regression tests verify tool counts, mode-specific availability, and centralized registration.

Changes

MCP surface registration

Layer / File(s) Summary
Centralize surface wiring
src/index.ts
Replaces individual tool and resource registration calls with registerSurface(server, config, analytics).
Add full-only profiles registration
src/tools/register.ts, test/tools/compliance-mode.spec.ts
Registers browserless_profiles on the full surface and tests its availability, updated tool counts, and centralized registration path.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant index as src/index.ts
  participant surface as registerSurface
  participant server as MCP server
  index->>surface: server, config, analytics
  surface->>server: register compliance-selected tools
  surface->>server: register browserless_profiles in full mode
Loading

Possibly related PRs

Poem

A bunny found tools in a neat little row,
With profiles reserved for the full-mode show.
One surface now gathers each resource and call,
While tests guard the right count for them all.
Hop, hop—central wiring stands tall!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: routing MCP tool registration through registerSurface to keep the connector compliant.
Description check ✅ Passed The description is detailed and covers the problem, fix, tests, and verification, though it doesn't follow the template sections exactly.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/gate-profiles-compliant

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/tools/compliance-mode.spec.ts`:
- Around line 115-141: Update the forbidden registrar list in the test named
“index.ts registers the surface only via registerSurface (no direct tool calls)”
to include registerScrapeUrlPrompt( and registerExtractContentPrompt(. Keep the
existing registerSurface assertion and direct-registration checks unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5397c990-3ab4-4b93-b731-87cffdd893b9

📥 Commits

Reviewing files that changed from the base of the PR and between d4ebc83 and 8b7575f.

📒 Files selected for processing (3)
  • src/index.ts
  • src/tools/register.ts
  • test/tools/compliance-mode.spec.ts
💤 Files with no reviewable changes (1)
  • src/index.ts

Comment thread test/tools/compliance-mode.spec.ts
@Gikoskos
Gikoskos merged commit 78417cc into main Jul 17, 2026
6 checks passed
@Gikoskos
Gikoskos deleted the fix/gate-profiles-compliant branch July 17, 2026 15:58
Xrazik1 pushed a commit that referenced this pull request Jul 17, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.14.0](v1.13.0...v1.14.0)
(2026-07-17)


### Features

* add source tracking for analytics
([#184](#184))
([d4ebc83](d4ebc83))


### Bug Fixes

* register all MCP tools via registerSurface so /mcp/connector stays
compliant
([#186](#186))
([78417cc](78417cc))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: browserless-actions-bot[bot] <186328842+browserless-actions-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants