use-mcp  by modelcontextprotocol

React hook for Model Context Protocol (MCP)

created 1 month ago
878 stars

Top 41.9% on sourcepulse

GitHubView on GitHub
1 Expert Loves This Project
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

1 week ago

Responsiveness

Inactive

Pull Requests (30d)
9
Issues (30d)
4
Star History
887 stars in the last 90 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Elie Bursztein Elie Bursztein(Cybersecurity Lead at Google DeepMind), and
2 more.

inspector by modelcontextprotocol

3.2%
5k
Debugging tool for Model Context Protocol (MCP) servers
created 10 months ago
updated 1 day ago
Feedback? Help us improve.