Skip to content

React Widgets

An MCP server with interactive React component widgets

Categories
ChatGPT
React
Widgets
HTTP
Share
Post on X

Build interactive ChatGPT widgets using React and xmcp.

Features

  • React component tools rendered as interactive widgets in ChatGPT
  • Server-side rendering automatically enabled for React tools
  • TypeScript support with Zod schema validation
  • HTTP transport
  • Example tools: counter (state management) and weather (external API)

Getting Started

1. Create the project

Shell

2. Install & run

Shell

Requires Node.js 22.12 or newer. pnpm install also installs @xmcp-dev/compiler, the dev dependency that runs xmcp dev and xmcp build.

The MCP server will start with HTTP transport at http://localhost:3001.

Project Structure

Text

Creating Widget Tools

Create a .tsx file in src/tools/ that exports a React component as the default:

TSX

The tool is automatically discovered and rendered as a widget in ChatGPT.

Deploy

Shell

Learn More

Other templates

One framework to rule them all