Skip to content

feat: publish typed MCP setup contract (DVR-212) - #217

Draft
xsvfat wants to merge 22 commits into
mainfrom
feat/browserless-setup-for-agents-plan
Draft

feat: publish typed MCP setup contract (DVR-212)#217
xsvfat wants to merge 22 commits into
mainfrom
feat/browserless-setup-for-agents-plan

Conversation

@xsvfat

@xsvfat xsvfat commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Publish the typed Browserless MCP setup contract that Account and Docs consume as owner truth.
  • Bind runtime registration, generated JSON exports, package exports, and tarball verification to the same registry.
  • Point MCP setup references to the Account-owned canonical skill and document the MCP → Account → Docs release order.

Related issues

DVR-212

Changes

  • Add the typed MCP surface registry and generated setup export.
  • Verify runtime registration parity and fixed full/compliant inventories.
  • Verify package exports, tarball contents, release workflow inputs, and Slack notification state.
  • Update README/install references without duplicating the universal setup guide.
  • No new dependencies were introduced.

Test plan

  • npm test passes locally — 570 passed after rebasing onto current main.
  • npm run lint passes locally.
  • npm run coverage thresholds still met — no separate coverage gate was run.
  • Manual smoke test against a real Browserless token — final hosted smoke used OAuth instead and returned HTTP 200 / Example Domain.
  • N/A — docs / chore / refactor only.

Additional verification: typed/JSON imports, tarball allowlist, shell syntax, Account snapshot byte parity, and hosted OAuth tool execution passed.

Checklist

  • I have read CONTRIBUTING.md — the linked file is absent from this repository.
  • My commits follow the conventional-commit prefix convention.
  • I have updated documentation where relevant (README, CHANGELOG, etc.).
  • I have not introduced new dependencies without flagging them in the summary.

🤖 Built with the /implement-plan skill from pasted-text.txt

Summary by CodeRabbit

  • New Features

    • Added a machine-readable setup manifest covering installation, authentication, endpoints, supported clients, and verification.
    • Added package exports for setup metadata and contract information.
    • Added OAuth and Bearer authentication guidance, regional endpoint details, and supported MCP surface availability.
  • Bug Fixes

    • Improved package validation before publishing, including setup export checks.
    • Publish notifications now clearly report success or failure status.
  • Documentation

    • Simplified installation guidance with links to canonical setup instructions and configuration resources.

@coderabbitai

coderabbitai Bot commented Aug 3, 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: da5bbad1-defe-4438-9ae9-ec3787d68e0d

📥 Commits

Reviewing files that changed from the base of the PR and between d7aa923 and f74cb60.

📒 Files selected for processing (2)
  • scripts/ci/notify-slack.sh
  • test/setup-contract.spec.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • test/setup-contract.spec.ts
  • scripts/ci/notify-slack.sh

Walkthrough

The PR adds a typed MCP setup contract and generated manifest. It exports both artifacts, centralizes surface registration, updates setup documentation, and validates generation, packaging, runtime surfaces, authentication, and publish status.

Changes

Setup contract and publication

Layer / File(s) Summary
Contract and runtime surface registry
src/setup-contract.ts, src/tools/register.ts, test/setup-contract.spec.ts
Defines the setup contract, authentication methods, client configurations, surface inventories, and verification settings. Runtime registration uses the shared surface registry.
Generated manifest and package validation
scripts/generate-setup-contract.mjs, setup/*, package.json, scripts/ci/verify-package-tarball.sh, test/setup-contract.spec.ts
Generates and checks the setup manifest. Package exports and tarball checks validate the published setup files.
Canonical setup documentation
README.md, install.md, llms-install.md
Documents canonical setup resources, OAuth and bearer authentication, HTTP streaming, endpoint configuration, surface availability, and setup validation.
Publish test and notification flow
.github/workflows/npm-publish.yml, scripts/ci/notify-slack.sh, test/setup-contract.spec.ts
Runs setup and runtime tests before publishing. Slack notifications report successful and failed publish jobs.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant SetupManifest
  participant BrowserlessMcpPackage
  participant MCPServer
  Client->>SetupManifest: Read setup and authentication configuration
  SetupManifest->>BrowserlessMcpPackage: Resolve published setup exports
  BrowserlessMcpPackage->>MCPServer: Launch stdio or connect to streamable HTTP
  Client->>MCPServer: Authenticate with OAuth or bearer headers
  MCPServer-->>Client: Expose configured MCP surfaces
Loading

Possibly related PRs

Poem

A rabbit checks the manifest bright,
OAuth guides the setup right.
Surfaces gather, tools align,
Tests guard every publish line.
Slack reports the final state.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: publishing a typed MCP setup contract.
Description check ✅ Passed The description covers the required sections, changes, test results, limitations, related issue, and checklist status.
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 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/browserless-setup-for-agents-plan

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: 2

🧹 Nitpick comments (2)
src/tools/register.ts (1)

28-28: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

The no-op couples browserless_skill availability to browserless_agent without a compile-time guard.

registerAgentTools registers both surfaces. If a future change sets a different surface value for browserless_skill and browserless_agent in MCP_SURFACE_REGISTRY, the generated inventory and the runtime surface diverge, and the type system stays silent. Both entries are 'both' today, so there is no current defect.

Consider asserting the invariant next to the no-op so the failure is loud.

♻️ Optional: assert the shared surface value
-    browserless_skill: () => {}, // registered together with browserless_agent
+    // Registered together with browserless_agent; guard the shared availability
+    // so a registry edit cannot split them silently.
+    browserless_skill: () => {
+      const agent = MCP_SURFACE_REGISTRY.find(
+        (e) => e.id === 'browserless_agent',
+      );
+      const skill = MCP_SURFACE_REGISTRY.find(
+        (e) => e.id === 'browserless_skill',
+      );
+      if (agent?.surface !== skill?.surface) {
+        throw new Error(
+          'browserless_skill must share browserless_agent availability.',
+        );
+      }
+    },
🤖 Prompt for 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.

In `@src/tools/register.ts` at line 28, Add a compile-time assertion beside the
browserless_skill no-op in registerAgentTools that verifies browserless_skill
and browserless_agent have the same surface value in MCP_SURFACE_REGISTRY, while
preserving the existing registration behavior.
src/setup-contract.ts (1)

48-48: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider deriving the endpoint from the runtime base URL and narrowing the exported literals.

HOSTED_URL duplicates config.mcpBaseUrl. test/setup-contract.spec.ts (lines 110-122) only proves parity when MCP_BASE_URL is unset, so a deployment that sets MCP_BASE_URL produces a contract that no longer matches the served endpoint.

The returned object is also not as const, so endpoint.transport, auth.methods[].id, and clients[].setupKind widen to string in BrowserlessMcpSetupContract. Consumers in Account and Docs then lose discriminated-union checking on a contract that exists to be typed.

♻️ Optional: narrow the published literals
-    endpoint: {
-      url: HOSTED_URL,
-      transport: 'streamable-http',
-    },
+    endpoint: {
+      url: HOSTED_URL,
+      transport: 'streamable-http' as const,
+    },

Also applies to: 65-84

🤖 Prompt for 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.

In `@src/setup-contract.ts` at line 48, Replace the hard-coded HOSTED_URL in the
setup contract with the runtime config.mcpBaseUrl so the published endpoint
matches deployments that override MCP_BASE_URL. Mark the returned
BrowserlessMcpSetupContract object as const to preserve literal types for
endpoint.transport, auth.methods[].id, and clients[].setupKind.
🤖 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 `@README.md`:
- Around line 25-28: Centralize the Browserless setup skill URL in the
createSetupContract contract, then generate the links in README.md (lines
25-28), install.md (lines 3-4), and llms-install.md (lines 3-4) from that
contract value; update the affected test to use the same source, or switch all
consumers to an unversioned alias so future skill releases require no manual
documentation changes.

In `@scripts/ci/notify-slack.sh`:
- Line 19: Update the PUBLISH_STATUS initialization in the notification script
to require an explicitly provided status, matching the required handling used
for TAG and RELEASE_URL, rather than defaulting to success; also update the
corresponding literal assertion in setup-contract.spec.ts to reflect the new
initialization.

---

Nitpick comments:
In `@src/setup-contract.ts`:
- Line 48: Replace the hard-coded HOSTED_URL in the setup contract with the
runtime config.mcpBaseUrl so the published endpoint matches deployments that
override MCP_BASE_URL. Mark the returned BrowserlessMcpSetupContract object as
const to preserve literal types for endpoint.transport, auth.methods[].id, and
clients[].setupKind.

In `@src/tools/register.ts`:
- Line 28: Add a compile-time assertion beside the browserless_skill no-op in
registerAgentTools that verifies browserless_skill and browserless_agent have
the same surface value in MCP_SURFACE_REGISTRY, while preserving the existing
registration behavior.
🪄 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: f135512b-7cf1-42d5-9c4c-ed5dfc751bdb

📥 Commits

Reviewing files that changed from the base of the PR and between 7028be6 and 7e52a80.

📒 Files selected for processing (12)
  • .github/workflows/npm-publish.yml
  • README.md
  • install.md
  • llms-install.md
  • package.json
  • scripts/ci/notify-slack.sh
  • scripts/ci/verify-package-tarball.sh
  • scripts/generate-setup-contract.mjs
  • setup/browserless-mcp-setup.json
  • src/setup-contract.ts
  • src/tools/register.ts
  • test/setup-contract.spec.ts

Comment thread README.md
Comment thread scripts/ci/notify-slack.sh Outdated
@xsvfat
xsvfat force-pushed the feat/browserless-setup-for-agents-plan branch from 7e52a80 to d7aa923 Compare August 3, 2026 21:01

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

🧹 Nitpick comments (1)
scripts/generate-setup-contract.mjs (1)

1-56: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add Node globals if scripts enters the lint scope.

eslint.config.js does not declare globals.node for scripts/**/*.mjs. Directly linting this file reports nine no-undef errors. The current npm run lint command excludes scripts, so update the lint scope and config together.

🤖 Prompt for 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.

In `@scripts/generate-setup-contract.mjs` around lines 1 - 56, Update
eslint.config.js to include Node globals for scripts/**/*.mjs, then expand the
npm run lint target so the scripts directory is linted alongside the existing
sources. Ensure scripts/generate-setup-contract.mjs passes lint without no-undef
errors for Node globals such as process, URL, and Buffer.
🤖 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.

Nitpick comments:
In `@scripts/generate-setup-contract.mjs`:
- Around line 1-56: Update eslint.config.js to include Node globals for
scripts/**/*.mjs, then expand the npm run lint target so the scripts directory
is linted alongside the existing sources. Ensure
scripts/generate-setup-contract.mjs passes lint without no-undef errors for Node
globals such as process, URL, and Buffer.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8035d849-07ee-430e-bba1-bf6ae4d95e61

📥 Commits

Reviewing files that changed from the base of the PR and between 7e52a80 and d7aa923.

📒 Files selected for processing (12)
  • .github/workflows/npm-publish.yml
  • README.md
  • install.md
  • llms-install.md
  • package.json
  • scripts/ci/notify-slack.sh
  • scripts/ci/verify-package-tarball.sh
  • scripts/generate-setup-contract.mjs
  • setup/browserless-mcp-setup.json
  • src/setup-contract.ts
  • src/tools/register.ts
  • test/setup-contract.spec.ts
🚧 Files skipped from review as they are similar to previous changes (9)
  • setup/browserless-mcp-setup.json
  • llms-install.md
  • package.json
  • install.md
  • scripts/ci/verify-package-tarball.sh
  • .github/workflows/npm-publish.yml
  • src/tools/register.ts
  • src/setup-contract.ts
  • scripts/ci/notify-slack.sh

@xsvfat

xsvfat commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Automated PR watch summary:

  • Addressed CodeRabbit's fail-open PUBLISH_STATUS finding in f74cb60; the thread is resolved and CodeRabbit passes.
  • The 570-test suite, validation, Prettier, lint, tarball, generation, and export checks pass.
  • The draft PR is mergeable.
  • The remaining Package hygiene failure is inherited unchanged from current main (package-lock.json is byte-identical), not introduced by this branch.
  • Release order is MCP first, then Account, then Docs.

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.

1 participant