MCP Server Framework
mcp-use is the complete MCP server framework for TypeScript. It combines the official Model Context Protocol SDK with Express.js and React to enable both MCP protocol communication and HTTP endpoints for UI widgets and custom routes. You can expose UI components to chat clients like ChatGPT, Claude, and MCP-UI compatible ones.Key Features
- Full MCP compatibility: MCP servers built with mcp-use are 100% compatible with the MCP specs.
- UI Widgets in React: mcp-use automatically registers all React components in your
resources/folder as MCP tools and resources. - Apps SDK & MCP-UI support: UI widgets are compatible with Apps SDK for ChatGPT and MCP-UI resources. UI Widgets.
- Express Integration: Built-in Express server for HTTP endpoints, static file serving, and custom routes.
- Built-in Inspector: An handy MCP inspector is launched for you to test you MCP server.
- One command to get started: Use
npx create-mcp-use-appcommand to scaffold a complete MCP server.
Installation
Using create-mcp-use-app (recommended)
The easiest way to get started is to use thecreate-mcp-use-app command, which scaffolds a complete MCP server project with all necessary configuration:
- A complete TypeScript MCP server project structure.
- Example MCP Tools and Resources to get you started.
- Example UI Widgets React components in
resources/folder exposed as tools and resources in Apps SDK for ChatGPT and MCP-UI format. - Pre-configured build tools and dev server.
- All necessary dependencies installed.
- MCP Inspector to test your server.
Project Structure
After creation, your project will have this structure:Running Your MCP Server
Commands:- MCP Endpoint:
http://localhost:3000/mcp- For MCP client connections - MCP Inspector:
http://localhost:3000/inspector- It will automatically launch an MCP Inspector for you to test you MCP server.
Deploy Your MCP Server
You can deploy your MCP server on any platform. Build your MCP server withnpm run build and start the production server with npm run start.
Or you can deploy it on mcp-use Cloud.
Next Steps
- Core features: Learn how to create MCP tools, prompts and resources.
- UI Widgets: Expose UI components to chat clients compatible with ChatGPT Apps SDK and MCP-UI.
- Configuration: Advanced configuration and deployment options.
Manual Installation
If you prefer to set up manually or add mcp-use to an existing project, install the package via npm:Quick Start
The easiest way to start is withcreate-mcp-use-app, which provides a working example. After running the scaffold command above, your server is ready to go!
For manual setup, here’s a minimal example:
- MCP Endpoint:
http://localhost:3000/mcp- For MCP client connections - Inspector UI:
http://localhost:3000/inspector- Development and testing interface (if @mcp-use/inspector is installed)
Architecture Overview
The MCP server framework is built on several core concepts:1. Server Instance
The main server object created viacreateMCPServer(). It manages all MCP functionality and HTTP endpoints.
2. Tools
Functions that MCP clients can invoke with parameters. Tools perform actions and return results.3. Resources
Static or dynamic content that clients can read. Resources can be simple files or complex data structures.4. Prompts
Template-based prompt generation for AI models, accepting parameters to create structured prompts.5. UI Resources
Interactive widgets that can be embedded in web applications, supporting both MCP-UI and OpenAI Apps SDK formats.6. Express Integration
Full access to Express.js functionality for adding custom routes, middleware, and static file serving.Core Components
McpServer Class
The main server class that orchestrates all functionality:Type System
The framework provides comprehensive TypeScript types for all components:ServerConfig- Server configurationToolDefinition- Tool configuration and callbacksResourceDefinition- Resource configuration and read callbacksPromptDefinition- Prompt template configurationUIResourceDefinition- UI widget configurationInputDefinition- Parameter definitions for tools and prompts
MCP Protocol Support
The server fully implements the MCP protocol specification:- Transport: HTTP with Server-Sent Events (SSE) for streaming
- Tools: Function execution with typed parameters
- Resources: Content serving with MIME types and annotations
- Prompts: Template-based prompt generation
- Resource Templates: Dynamic resource generation with URI parameters
UI Widget System
The framework supports multiple UI widget formats:MCP-UI Widgets
- External URL widgets (iframe-based)
- Raw HTML widgets
- Remote DOM scripting
OpenAI Apps SDK
- Text/HTML+Skybridge format
- Widget CSP configuration
- Tool output templates
Next Steps
- Getting Started Guide - Detailed setup and first server
- API Reference - Complete API documentation
- Tools Guide - Building and configuring tools
- Deploy Your Server - Deploy to production with one command
- Resources Guide - Static and dynamic resources
- UI Widgets - Creating interactive widgets
- Examples - Real-world implementation examples