Skip to main content
Create a TypeScript MCP App, run it locally, and verify that a tool returns a React view in the Inspector.

What you’ll build

This guide creates a local server with:
  • an MCP endpoint at http://localhost:3000/mcp
  • an Inspector at http://localhost:3000/mcp/inspector
  • a search-fruits tool that returns a view
  • a React view at views/product-search-result/view.tsx

Prerequisites

  • Node.js 22.22.2 or higher
  • Basic TypeScript and React knowledge

Create the project

Run the MCP Apps template:
The template creates more files for assets, view components, and local tooling. These are the files you edit most often:

Run the server

Start the development server:
This starts the MCP server, view build pipeline, and Inspector. Keep the process running while you test the app.

Inspect the view tool

Open index.ts and find the search-fruits tool. The template includes server branding, 16 fruits, and a second get-fruit-details tool. This excerpt shows the view-bound path you need to understand first.
view.name must match the folder under views/. In this template, product-search-result maps to views/product-search-result/view.tsx. The structuredContent object becomes view rendering data via useToolContext(). The content array is the short text result the model can read.

Inspect the React view

Open views/product-search-result/view.tsx. The view reads the tool result with useToolContext(). The generated view includes a carousel, detail panel, display-mode controls, favorites, and tool calls. This excerpt shows the core data access pattern.
Views can render before the tool finishes. Check status === "pending" before reading toolOutput.

Verify in the Inspector

Use the Inspector to confirm that the server and view work.
  1. Open http://localhost:3000/mcp/inspector.
  2. Go to the Tools tab.
  3. Select search-fruits.
  4. Run the tool with { "query": "a" } or {}.
  5. Confirm that the view renders below the tool result.
If the tool runs but no view appears, check that view.name exactly matches the folder under views/ and that the handler returns structuredContent.

Next steps