ext-apps/examples/basic-server-react
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jonathan Hefner 8b8ecbea64 Restore educational comments in basic-server-* examples
PR #184 accidentally removed/reverted educational comments from
`basic-server-react` and `basic-server-vanillajs` that were established
in PR #182. This restores consistency with the other basic-server
examples (Vue, Svelte, Preact, Solid).

Changes:
- Add back the three-comment pattern explaining two-part registration
- Restore full tool description ("as an ISO 8601 string")
- Change vanillajs to return plain text instead of JSON (matching #182)
- Use local `resourceUri` variable instead of top-level constant

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 11:57:46 -06:00
..
src feat: publish example servers to npm (#184) 2026-01-08 20:08:50 +00:00
mcp-app.html Add color-scheme meta tag to all example apps 2025-12-15 11:42:18 -08:00
package.json chore: release 0.3.1 (#224) 2026-01-09 18:22:27 +00:00
README.md refactor: rename request methods to remove send prefix (#161) 2025-12-16 22:07:06 +00:00
server-utils.ts fix: add error handling for server startup failures (#236) 2026-01-11 16:52:55 +00:00
server.ts Restore educational comments in basic-server-* examples 2026-01-12 11:57:46 -06:00
tsconfig.json Add basic-host and basic-server-react examples 2025-12-04 14:28:27 -06:00
vite.config.ts Add basic-host and basic-server-react examples 2025-12-04 14:28:27 -06:00

Example: Basic Server (React)

An MCP App example with a React UI.

Tip

Looking for a vanilla JavaScript example? See basic-server-vanillajs!

Overview

Key Files

Getting Started

npm install
npm run dev

How It Works

  1. The server registers a get-time tool with metadata linking it to a UI HTML resource (ui://get-time/mcp-app.html).
  2. When the tool is invoked, the Host renders the UI from the resource.
  3. The UI uses the MCP App SDK API to communicate with the host and call server tools.