Dev.to WebDev πŸ›  Dev πŸ‘ 0 πŸ“– 5 min read

What Does the MCP Apps 2.1 WebMCP Bridge Actually Expose Or Not? Let's Talk About That

An embedded MCP App now interacts with two separate tool surfaces: tools registered directly through the MCP Apps SDK and tools exposed by the surrounding document via WebMCP. Connecting those two surfaces through a brid

An embedded MCP App now interacts with two separate tool surfaces: tools registered directly through the MCP Apps SDK and tools exposed by the surrounding document via WebMCP. Connecting those two surfaces through a bridge reduces boilerplate, yet simply calling them β€œbridged” leaves critical runtime details unclear.

Which tools actually show up on each side? How are duplicate names resolved? Do tool metadata annotations carry over intact? And when a bridged tool returns structured data, does the caller get a clean object or a protocol-wrapped payload?

With the release of MCP Apps 2.1.0, answering these questions directly in code becomes straightforward. By pairing the published SDK with an in-memory MCP transport and a lightweight page-API double, we can verify exact SDK behavior in isolation before testing full browser or host environments.

Treat both bridge directions as separate responsibilities
The bridge operates in two directions: tools registered by the app can be mirrored onto the document’s WebMCP interface, while tools already registered on the page can be surfaced through the app’s tool interface.

Each direction belongs to a different lifecycle owner. The app manages its own tool registrations and teardown, whereas the page manages whatever tools it already exposes. Crucially, the bridge must avoid re-importing the very mirrors it just published.

In the current SDK release, that boundary is handled explicitly. It also scopes page tool descriptors to the active document context rather than pulling in every tool across every frame inside a host application.

In practice, the MCP host talks to the app SDK, which imports native page tools and projects app tools outward without looping back onto its own mirrors.

Lock the exact package version under test
The verification setup installs @modelcontextprotocol/[email protected] explicitly. As of November 22, 2026, the npm latest dist-tag still pointed to 2.0.4 even though 2.1.0 had already shippedβ€”showing why relying on moving dist-tags is unreliable when documenting behavior.

The package also locks compatible MCP dependencies and ships with a lockfile, ensuring bridge tests stay reproducible even after registry tags change.

You can see the bridge toggle directly in the app constructor:

JavaScript

const app = new App(
  { name: "event-review", version: "1.0.0" },
  { tools: { listChanged: true } },
  { autoResize: false, webMcpBridge: true },
);

Although webMcpBridge defaults to true, passing it explicitly makes the test intent obvious. A companion test switches the flag to false to verify how tool discovery changes when bridging is turned off.

Verify discovery using distinct tool names
Assign unique tool names to each surfaceβ€”for instance, read_page_status on the page and read_event_review on the app. If both sides register an identical name during initial checks, a passing test can hide which side actually served the call.

When bridging is active, the test verifies that the host-facing app interface discovers the page tool and the document discovers the app tool. When bridging is turned off, the app’s own tool stays reachable over its MCP connection, while the page tool is no longer imported across the bridge.

Understanding that split matters before disabling automatic bridging: turning it off does not shut down the app’s native toolsβ€”it only stops cross-surface mirroring.

If two tools share a name, the SDK gives precedence to the app’s registration. Treat that rule as a predictable tie-breaker rather than an excuse to use vague names; descriptive identifiers like read_event_review make ownership and intent unmistakable compared to generic names like get_data.

Check how results cross the execution boundary
MCP tool responses can include both content blocks and structured payloads, whereas WebMCP callers expect a direct page-level return value. Translating between those two formats is one of the bridge's core jobs.

In version 2.1.0, if an app tool returns structured content, that structured payload takes priority when called through its WebMCP mirror. If the tool returns an error result, the WebMCP boundary rejects the call. When no structured payload is present, the bridge falls back to the standard content representation.

To test this thoroughly, the fixture tool emits both formats at once, and the assertion checks that the mirrored call resolves to the exact structured event-review object. That prevents false-positive tests that only check whether a promise resolved without inspecting the payload shape.

Inspecting both the app code and the bridge source alongside test assertions creates a complete technical recordβ€”filling in translation details that high-level release notes rarely cover.

Verify metadata annotations rather than assuming parity
In the test fixture, the page tool defines readOnlyHint alongside an additional hint. The test confirms what 2.1.0 actually forwards: readOnlyHint is preserved across the bridge path, without assuming every WebMCP annotation maps one-to-one to an MCP Apps equivalent.

That distinction should be noted during any integration audit. If a host UI relies on an annotation that the bridge drops, it may render or categorize the tool differently than the underlying page intended.

Even when hints do transfer, they are never a substitute for real security controls. Applications must still validate incoming arguments, enforce resource boundaries, and require explicit user confirmation for high-impact actions. Metadata translation cannot replace authorization checks.

Test tool teardown and cleanup
Every tool registration has a finite lifespan. The fourth check in the suite examines what happens when the app unregisters its tool, confirming that removing the app tool also removes its mirror from the page.

In UI frameworks like Reactβ€”where an event-review drawer might unmount or switch to a different recordβ€”stale mirrors can advertise actions whose backing handler is gone. Testing tool discovery after teardown ensures cleanup actually works rather than only checking initial mount state.

Together, the four tests validate two-way discovery, disabled bridging, mirror cleanup on removal, and annotation forwarding against the real released SDK and its in-memory transport. Because the page API is simulated via a test double, these checks do not cover browser permission prompts, host iframe policies, or full end-to-end browser execution.

Choose carefully what crosses the bridge
In a workflow like event review, start by exposing narrow read operations and a preparatory action, while keeping final submission gated behind the application’s existing review and authorization flow. From there, deliberately separate which tools belong on the host surface and which should stay private to the page.

Bridging eliminates manual wiring, but it does not replace intentional API design. Reliable tool surfaces still depend on clear naming, strict input validation, predictable return types, and lifecycles bound to the components that own them.

πŸ“° Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.