Skip to content

docs(fx): use fx’s supported integration setup - #2977

Open
shrey150 wants to merge 3 commits into
integrations/claude-pluginfrom
integrations/fx-setup
Open

shrey150 wants to merge 3 commits into
integrations/claude-pluginfrom
integrations/fx-setup

Conversation

@shrey150

@shrey150 shrey150 commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

The fx integration already has a supported host tool API: built-in MCP management. Lead the public guide with that integration route and a portable configuration for an existing application, instead of requiring a full Stagehand checkout.

This is an SDK/MCP integration, not a separate marketplace plugin. The source example remains available. Update the profile template and document the current /mcp add command, environment merging, project trust, and the legacy v0.0.3 differences.

Stacked on #2971 for the shared @browserbasehq/stagehand-mcp package. The first 0.1.0 release is required before the portable npm command is available; the guide explicitly identifies this prerequisite.

E2E Test Matrix

Command / flow Observed output Confidence / sufficiency
Host-specific example/config check Profile JSON parsed and retains the bounded-screenshot option. Commands and configuration were checked against current official fx docs; no installed fx binary was available for a host runtime test. Host contract and configuration; no full model-loop benchmark claimed
Shared packed MCP server from #2971 Real Browserbase navigation, persistent snapshot, JPEG, and shutdown passed on example.com Shared browser implementation; npm download awaits publication

Documentation validation: a combined snapshot of all nine updated integration guides passed mint validate and mint broken-links --check-anchors --check-redirects --check-snippets.

@shrey150
shrey150 requested a review from a team as a code owner September 17, 2026 22:31
@changeset-bot

changeset-bot Bot commented Sep 17, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c0a4f84

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@cubic-dev-ai cubic-dev-ai 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.

4 issues found and verified against the latest diff

Confidence score: 3/5

  • packages/docs/v4/integrations/fx.mdx no longer explains that mcp_stagehand_run executes model-authored JavaScript in the browser, which could cause users to miss the local-browser security boundary; restore the Browserbase warning and security-boundary link.
  • packages/docs/v4/integrations/fx.mdx leads with fx’s integration mechanism rather than the user workflow, making the Stagehand setup harder to follow; start with connecting fx to a persistent Stagehand browser before describing the built-in MCP client.
  • The unreleased source-build instructions in packages/docs/v4/integrations/fx.mdx invoke pnpm without establishing it as a prerequisite, which can block users following that path; require the repository-pinned pnpm 11.10.0.
  • packages/docs/v4/integrations/fx.mdx does not identify the launched process as the Stagehand facade MCP server, making its stdio tools and diagnostics harder to match; add that process name.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/docs/v4/integrations/fx.mdx">

<violation number="1" location="packages/docs/v4/integrations/fx.mdx:6">
P3: Name the launched process the Stagehand facade MCP server so users can match this stdio runtime to its tools and diagnostics.</violation>

<violation number="2" location="packages/docs/v4/integrations/fx.mdx:6">
P2: Custom agent: **Stagehand docs prose guide**

Lead with what the reader can do before explaining fx's integration mechanism. Start with connecting fx to a persistent Stagehand browser, then describe the built-in MCP client and `/mcp add` setup.</violation>

<violation number="3" location="packages/docs/v4/integrations/fx.mdx:40">
P2: When fx uses `mcp_stagehand_run`, model-authored JavaScript runs in the browser, but this guide no longer warns about the local-browser security boundary. Restore the Browserbase warning and security-boundary link before users apply this setup to untrusted tasks.</violation>

<violation number="4" location="packages/docs/v4/integrations/fx.mdx:92">
P2: When users choose the unreleased source build, this section invokes `pnpm` without requiring or installing it. Add the repository-pinned `pnpm 11.10.0` prerequisite for the source path.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

```bash
git clone https://github.com/browserbase/stagehand.git
cd stagehand
pnpm install --frozen-lockfile

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: When users choose the unreleased source build, this section invokes pnpm without requiring or installing it. Add the repository-pinned pnpm 11.10.0 prerequisite for the source path.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/docs/v4/integrations/fx.mdx, line 92:

<comment>When users choose the unreleased source build, this section invokes `pnpm` without requiring or installing it. Add the repository-pinned `pnpm 11.10.0` prerequisite for the source path.</comment>

<file context>
@@ -1,162 +1,110 @@
+```bash
+git clone https://github.com/browserbase/stagehand.git
+cd stagehand
+pnpm install --frozen-lockfile
+pnpm exec turbo run build --filter @browserbasehq/stagehand-integrations

</file context>


</details>

</Steps>

## Tool discovery
The browser launches on the first tool call and persists across subsequent calls. fx can discover the tools through `capability_search`; direct tool selection remains available for the exact names `mcp_stagehand_run`, `mcp_stagehand_snapshot`, and `mcp_stagehand_screenshot`.

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: When fx uses mcp_stagehand_run, model-authored JavaScript runs in the browser, but this guide no longer warns about the local-browser security boundary. Restore the Browserbase warning and security-boundary link before users apply this setup to untrusted tasks.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/docs/v4/integrations/fx.mdx, line 40:

<comment>When fx uses `mcp_stagehand_run`, model-authored JavaScript runs in the browser, but this guide no longer warns about the local-browser security boundary. Restore the Browserbase warning and security-boundary link before users apply this setup to untrusted tasks.</comment>

<file context>
@@ -1,162 +1,110 @@
-</Steps>
 
-## Tool discovery
+The browser launches on the first tool call and persists across subsequent calls. fx can discover the tools through `capability_search`; direct tool selection remains available for the exact names `mcp_stagehand_run`, `mcp_stagehand_snapshot`, and `mcp_stagehand_screenshot`.
 
-fx prefixes MCP tool names with the server name. The Stagehand tools appear as:
</file context>
Suggested change
The browser launches on the first tool call and persists across subsequent calls. fx can discover the tools through `capability_search`; direct tool selection remains available for the exact names `mcp_stagehand_run`, `mcp_stagehand_snapshot`, and `mcp_stagehand_screenshot`.
The browser launches on the first tool call and persists across subsequent calls. fx can discover the tools through `capability_search`; direct tool selection remains available for the exact names `mcp_stagehand_run`, `mcp_stagehand_snapshot`, and `mcp_stagehand_screenshot`.
<Warning>
`mcp_stagehand_run` executes model-authored JavaScript in the browser. Use Browserbase for untrusted tasks and review the [integration security boundary](/v4/integrations/overview#security-boundary).
</Warning>

---

The fx integration connects the [fx coding agent](https://fx.sh) to the Stagehand facade MCP server over MCP/stdio. One MCP server process owns the browser, so navigation, authentication, and page state survive across tool calls.
fx’s supported integration mechanism is its [built-in MCP client](https://fx.sh/docs/capabilities/mcp). Register the Stagehand server with `/mcp add`; no separate fx marketplace plugin is needed.

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: Custom agent: Stagehand docs prose guide

Lead with what the reader can do before explaining fx's integration mechanism. Start with connecting fx to a persistent Stagehand browser, then describe the built-in MCP client and /mcp add setup.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/docs/v4/integrations/fx.mdx, line 6:

<comment>Lead with what the reader can do before explaining fx's integration mechanism. Start with connecting fx to a persistent Stagehand browser, then describe the built-in MCP client and `/mcp add` setup.</comment>

<file context>
@@ -1,162 +1,110 @@
 ---
 
-The fx integration connects the [fx coding agent](https://fx.sh) to the Stagehand facade MCP server over MCP/stdio. One MCP server process owns the browser, so navigation, authentication, and page state survive across tool calls.
+fx’s supported integration mechanism is its [built-in MCP client](https://fx.sh/docs/capabilities/mcp). Register the Stagehand server with `/mcp add`; no separate fx marketplace plugin is needed.
 
 <Note>
</file context>
Suggested change
fx’s supported integration mechanism is its [built-in MCP client](https://fx.sh/docs/capabilities/mcp). Register the Stagehand server with `/mcp add`; no separate fx marketplace plugin is needed.
Connect fx to a persistent Stagehand browser through its [built-in MCP client](https://fx.sh/docs/capabilities/mcp). Register the Stagehand server with `/mcp add`; no separate fx marketplace plugin is needed.

---

The fx integration connects the [fx coding agent](https://fx.sh) to the Stagehand facade MCP server over MCP/stdio. One MCP server process owns the browser, so navigation, authentication, and page state survive across tool calls.
fx’s supported integration mechanism is its [built-in MCP client](https://fx.sh/docs/capabilities/mcp). Register the Stagehand server with `/mcp add`; no separate fx marketplace plugin is needed.

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.

P3: Name the launched process the Stagehand facade MCP server so users can match this stdio runtime to its tools and diagnostics.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/docs/v4/integrations/fx.mdx, line 6:

<comment>Name the launched process the Stagehand facade MCP server so users can match this stdio runtime to its tools and diagnostics.</comment>

<file context>
@@ -1,162 +1,110 @@
 ---
 
-The fx integration connects the [fx coding agent](https://fx.sh) to the Stagehand facade MCP server over MCP/stdio. One MCP server process owns the browser, so navigation, authentication, and page state survive across tool calls.
+fx’s supported integration mechanism is its [built-in MCP client](https://fx.sh/docs/capabilities/mcp). Register the Stagehand server with `/mcp add`; no separate fx marketplace plugin is needed.
 
 <Note>
</file context>
Suggested change
fx’s supported integration mechanism is its [built-in MCP client](https://fx.sh/docs/capabilities/mcp). Register the Stagehand server with `/mcp add`; no separate fx marketplace plugin is needed.
fx’s supported integration mechanism is its [built-in MCP client](https://fx.sh/docs/capabilities/mcp). Register the Stagehand facade MCP server over stdio with `/mcp add`; no separate fx marketplace plugin is needed.

@cubic-dev-ai cubic-dev-ai 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.

3 existing issues remain and 1 new issue found across 3 files

Confidence score: 4/5

  • packages/docs/v4/integrations/fx.mdx has several documentation correctness and onboarding gaps: the integration’s capability is not led with clearly, the local-Chrome default is wrong when BROWSERBASE_API_KEY is set, and the source fallback omits the pnpm prerequisite, which could mislead users or make setup fail—clarify the selection logic and add the pinned pnpm install prerequisite.
  • packages/integrations/fx/README.md calls the launched process Stagehand, which could blur the distinction between the stdio facade and the Stagehand SDK—rename it to Stagehand facade MCP server.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/docs/v4/integrations/fx.mdx">

<violation number="1" location="packages/docs/v4/integrations/fx.mdx:44">
P2: When `BROWSERBASE_API_KEY` is exported without `STAGEHAND_BROWSER`, the facade selects Browserbase, so this default statement is incorrect. Describe local Chrome as the default only when the Browserbase key is unset.</violation>
</file>
Architecture diagram
sequenceDiagram
    participant User as User
    participant FX as fx CLI
    participant MCPMgr as fx MCP Manager
    participant Profile as ~/.fx/mcp.json
    participant NPM as npm registry
    participant SMMCP as @browserbasehq/stagehand-mcp
    participant Chrome as Chrome/Browserbase

    Note over User,MCPMgr: Current fx MCP setup flow

    User->>FX: /mcp add stagehand npx -y @browserbasehq/stagehand-mcp@0.1.0
    FX->>MCPMgr: addMCP (admin command)
    MCPMgr->>Profile: Write server config with startup_timeout_ms and operation_timeout_ms
    MCPMgr-->>FX: Confirm server added and reloading
    FX->>MCPMgr: Load MCP profile
    MCPMgr->>NPM: Fetch @browserbasehq/stagehand-mcp@0.1.0
    NPM-->>MCPMgr: Package binary
    MCPMgr->>SMMCP: Spawn MCP server (stdio)

    Note over FX,SMMCP: Browser session persistence

    User->>FX: Ask to browse https://example.com
    FX->>SMMCP: mcp_stagehand_run (page.goto)
    SMMCP->>Chrome: Launch browser (first tool call)
    Chrome-->>SMMCP: Page content
    SMMCP-->>FX: Result with snapshot ID

    Note over User,FX: Environment and trust flow

    alt Current fx (env merge)
        FX->>FX: Inherit parent env + merge environment object
        FX-->>User: Prompt for project .mcp.json trust
    else Legacy v0.0.3 (env replace)
        FX->>FX: Replace env entirely (omit environment object)
    end

    Note over User,FX: Screenshot size constraint

    User->>FX: Request screenshot
    FX->>SMMCP: mcp_stagehand_screenshot
    SMMCP->>SMMCP: Apply max-screenshot-base64-bytes=60000
    alt Image fits frame limit
        SMMCP-->>FX: JPEG at quality 40
    else Too large (progressive retries)
        SMMCP->>SMMCP: Retry with smaller viewport JPEG
        alt Still too large
            SMMCP-->>FX: Tool error (session preserved)
        end
    end
    FX-->>User: Display result
Loading

Requires human review: Auto-approval blocked because this review re-detected 3 unresolved issues already reported by Cubic.

Re-trigger cubic

- `mcp_stagehand_run`
- `mcp_stagehand_snapshot`
- `mcp_stagehand_screenshot`
Local Chrome is the default. To use Browserbase, export its credential before starting fx:

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: When BROWSERBASE_API_KEY is exported without STAGEHAND_BROWSER, the facade selects Browserbase, so this default statement is incorrect. Describe local Chrome as the default only when the Browserbase key is unset.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/docs/v4/integrations/fx.mdx, line 44:

<comment>When `BROWSERBASE_API_KEY` is exported without `STAGEHAND_BROWSER`, the facade selects Browserbase, so this default statement is incorrect. Describe local Chrome as the default only when the Browserbase key is unset.</comment>

<file context>
@@ -1,162 +1,110 @@
-- `mcp_stagehand_run`
-- `mcp_stagehand_snapshot`
-- `mcp_stagehand_screenshot`
+Local Chrome is the default. To use Browserbase, export its credential before starting fx:
 
-fx v0.0.3 may return no matches for this server from `mcp_search_tools`. The integration's `AGENTS.md` and Stagehand skill tell fx to select these exact names directly. Run fx from `packages/integrations/fx` so it loads that guidance.
</file context>
Suggested change
Local Chrome is the default. To use Browserbase, export its credential before starting fx:
Local Chrome is used when `BROWSERBASE_API_KEY` is unset. To use Browserbase, export its credential before starting fx:

This branch has not been deployed

No deployments
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