Setting up your environment
Initialize the project
Install dependencies
Configure package.json
Add the following to yourpackage.json:
Create tsconfig.json
Create vite.config.ts
Creating your first View
Now let’s create the HTML file and React component that will be displayed when the MCP tool is called.Create reservation-app.html
First, create the HTML file that will serve as the entry point for your app:- A
rootdiv where React will mount your app - A module script that imports your React component
- Color scheme meta tag for light/dark mode support
Create src/reservation.tsx
Understanding the MCP App features
The useApp hook
The useApp hook is the foundation of your MCP App. It establishes the connection between your UI and the MCP host.
appInfo: Identifies your app with a name and versioncapabilities: Declares what features your app supports (empty for this simple example)app: The app instance you’ll use to interact with the MCP hosterror: Contains any connection errors
Sending messages with app.sendMessage()
The sendMessage method lets your app send follow-up messages to the LLM, enabling interactive conversations:
get-menu) to respond.
What else can your app do?
Theapp object provides several methods to interact with the MCP host:
app.sendMessage()- Send messages to the LLM (as shown above)app.callServerTool()- Call other MCP tools on your server directlyapp.sendLog()- Send log messages to the host for debuggingapp.openLink()- Request the host to open a URL (onlyhttpandhttpsURLs are allowed; other schemes resolve{ isError: true })app.getHostContext()- Get information about the host environment (safe area insets, theme, etc.)
Mounting the React app
Don’t forget to mount your app to the DOM:Setting up the MCP Server
Now let’s create the server that will register your tools and serve the UI.Create server.ts
Understanding the server components
Creating the MCP Server
Registering the App Resource
registerAppResource registers a resource with UI metadata so the host knows where the assets are.
Registering an App Tool (with UI)
resourceUri in the _meta field allowing us to have multiple tools to render different UI.
We can also return text content to the LLM as well to give it more context about our View.
Registering a Regular Tool (without UI)
Starting the Server
Building and Running Your App
Now that everything is set up, let’s build and run your MCP App!Build the app
The build process uses Vite to bundle your React component and the HTML file into a single, self-contained HTML file:dist/reservation-app.html file with all your JavaScript and CSS inlined - perfect for serving through MCP.
Run the server
Start your MCP server:Testing with MCPJam Inspector
The easiest way to test your app is using MCPJam Inspector:What’s next?
Now that your server is running, you can:- Test the flow - Call the
get-reservationtool to see your UI - Try the menu button - Click “What’s on the menu?” and watch the LLM call the
get-menutool - Iterate and expand - Add more tools, improve the UI, or build something completely new!

