Skip to main content

FrontMcpProvider

The provider manages the MCP client lifecycle and populates the shared ServerRegistry.

Props

Lifecycle

  1. On mount, registers the primary server (and any servers) in ServerRegistry
  2. If autoConnect is true, calls server.connect() and discovers tools/resources/prompts
  3. Updates registry entry with status: 'connected' and populates tool/resource/prompt lists
  4. Also auto-connects additional servers from servers prop
  5. On unmount, unregisters all servers from the registry

FrontMcpContext

The React context carries a slim value — no state, just pointers:
All state (status, tools, etc.) lives in ServerRegistry and is accessed via hooks.

ServerRegistry

A singleton that stores all server entries and notifies subscribers on change.

ServerEntry

useFrontMcp

The primary hook for reading the resolved server state:
Pass a server name to target a specific server: