Skip to content

Conversation

@Pederzh
Copy link
Contributor

@Pederzh Pederzh commented Oct 8, 2025

Description

This PR adds browser support for the MCP client library and includes a comprehensive React example demonstrating its usage. The changes enable developers to use MCP in browser environments with WebSocket and HTTP/SSE transports, along with OAuth 2.0 authentication support.

Key additions:

  • Browser-compatible MCP client (src/browser.ts) - Entry point for browser usage
  • Refactored client architecture - Extracted base client logic to src/client/base.ts for code reuse
  • OAuth 2.0 helper (src/oauth-helper.ts) - Full OAuth flow implementation with dynamic client registration
  • React example - Complete working example in examples/react/ with Vite configuration and browser polyfills
  • Browser-safe logging - Updated logging to fall back to console in browser environments

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have added tests that prove my fix is effective or that my feature works
  • The title of my pull request follows the conventional commits standard
  • Changes have been documented in the README/documentation (if applicable)

@Pederzh Pederzh merged commit b6aa94e into main Oct 8, 2025
1 check failed
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.

3 participants