Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Browser-Based MCP Transport for Client-Server Communication within Browser Environments #219

Open
AdirD opened this issue Mar 24, 2025 · 6 comments
Labels
enhancement New feature or request

Comments

@AdirD
Copy link

AdirD commented Mar 24, 2025

Is your feature request related to a problem? Please describe.
Currently, MCP transport implementations (stdio, SSE) require separate processes or dedicated HTTP endpoints, making it impossible to run MCP client-server communications entirely within browser environments. This limitation prevents implementing MCP in use cases like browser extensions, static web applications, embedded web components, or isolated environments such as Web Workers or cross-domain iframes.

Describe the solution you'd like
Introduce a browser-based MCP transport implementation (BrowserContextTransport) that enables bidirectional client-server communication directly within the browser using the browser's built-in MessageChannel API. This would allow MCP servers to run in-browser alongside MCP clients, significantly simplifying the architecture and enabling new, previously unsupported scenarios.

Describe alternatives you've considered

  • Using existing transports (stdio, SSE), but these inherently rely on external processes or server-side endpoints, which are unsuitable for purely browser-based environments.
  • Utilizing WebSocket or other external messaging libraries, but they introduce unnecessary complexity, external dependencies, and still typically require external backend services.

Additional context
The proposed solution leverages the standard MessageChannel API, widely supported across browsers, ensuring compatibility and easy integration. This solution has been validated with basic scenarios and is structured to support additional use cases, including communication between the main thread and Web Workers, and cross-domain iframes for isolated or secure deployments.

@AdirD AdirD added the enhancement New feature or request label Mar 24, 2025
@AdirD AdirD mentioned this issue Mar 24, 2025
12 tasks
@AdirD
Copy link
Author

AdirD commented Mar 24, 2025

#206

@richieto
Copy link

richieto commented Mar 25, 2025

FYI

There is an update on the specification just merged modelcontextprotocol/modelcontextprotocol#206

and I just added #220 here, due to the timing I'm not sure if the was taken that into consideration?

@DennisNerush
Copy link

This is exactly what I'm looking for!

@netanelavr
Copy link

This will be very useful!

@shakhal
Copy link

shakhal commented Mar 31, 2025

Would love this!

@xianminx
Copy link

xianminx commented Apr 2, 2025

wanted!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants