use-mcp  by modelcontextprotocol

React hook for Model Context Protocol (MCP)

Created 5 months ago
992 stars

Top 37.5% on SourcePulse

GitHubView on GitHub
Project Summary

A lightweight React hook for connecting to Model Context Protocol (MCP) servers, simplifying authentication and tool calling for AI systems. It targets React developers building AI-powered applications that adhere to the MCP standard, offering automatic connection management and OAuth flow handling.

How It Works

The hook manages connections to MCP servers using HTTP and Server-Sent Events (SSE) transports. It implements an OAuth authentication flow, supporting both popup windows and fallback mechanisms. The core advantage lies in its simplified React hook interface, abstracting away the complexities of connection state management, tool discovery, and execution, while providing robust logging and TypeScript support for enhanced developer experience.

Quick Start & Requirements

  • Install: npm install use-mcp or pnpm add use-mcp or yarn add use-mcp
  • Prerequisites: React environment. OAuth callback endpoint setup required for authentication.
  • Documentation: MCP Inspector, Cloudflare Workers AI Playground

Highlighted Details

  • Automatic connection management with reconnection and retries.
  • OAuth authentication flow handling with popup and fallback support.
  • Simple React hook interface for MCP integration.
  • TypeScript types for editor assistance and type checking.
  • Supports both HTTP and SSE transports.

Maintenance & Community

The project is part of the modelcontextprotocol organization. Further community and maintenance details are not explicitly provided in the README.

Licensing & Compatibility

  • License: MIT
  • Compatibility: Permissive MIT license allows for commercial use and integration into closed-source applications.

Limitations & Caveats

The README does not detail specific limitations, unsupported platforms, or known bugs. The OAuth callback setup is a mandatory step for authentication, which may require additional configuration depending on the application's routing setup.

Health Check
Last Commit

3 months ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
0
Star History
8 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.