Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
DEPRECATED: Replaced by mcp-app-builder. Previously used to build ChatGPT apps with interactive React widgets via mcp-use.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/foundations/quickstart.md
1# Quick Start23Build your first MCP server tool in 5 minutes.45## Setup67### Scaffolding a New Project89```bash10npx create-mcp-use-app my-server11cd my-server12npm run dev13```1415This installs dependencies, starts the server on port 3000, and opens the inspector at `http://localhost:3000/inspector`.1617### Choosing a Template1819Pick the template that matches what the user is building:2021| Template | Command | Use When |22|----------|---------|----------|23| **starter** (default) | `npx create-mcp-use-app my-server` | Full-featured server with tools, resources, prompts, and widget examples |24| **mcp-apps** | `npx create-mcp-use-app my-server --template mcp-apps` | Widget-focused for ChatGPT, Claude, and other MCP Apps-compatible clients |25| **blank** | `npx create-mcp-use-app my-server --template blank` | Clean slate — bare server with commented-out examples |26| **GitHub repo** | `npx create-mcp-use-app my-server --template owner/repo` | Custom or community templates from any GitHub repository |2728**When unsure, use `mcp-apps`.** It's the recommended default with widget support for ChatGPT, Claude, and other MCP Apps-compatible clients.2930### Common Flags3132```bash33# Choose package manager34npx create-mcp-use-app my-server --npm35npx create-mcp-use-app my-server --pnpm3637# Skip interactive prompts38npx create-mcp-use-app my-server --install --skills3940# List all available templates41npx create-mcp-use-app --list-templates42```4344### What Each Template Produces4546**starter:**47```48my-server/49├── index.ts # Server with example tool, resource, and prompt50├── resources/ # Widget directory (display-weather.tsx example)51├── public/ # Static assets (favicon, icon)52├── package.json # Pre-configured scripts: dev, build, start, deploy53└── tsconfig.json54```5556**mcp-apps:**57```58my-server/59├── index.ts # Server with widget-returning tools60├── resources/ # Widget directory (product-search-result/ example)61│ └── product-search-result/62│ ├── widget.tsx # React widget with carousel UI63│ └── components/ # Reusable widget components64├── public/65├── package.json66└── tsconfig.json67```6869**blank:**70```71my-server/72├── index.ts # Bare MCPServer with commented-out examples73├── public/74├── package.json75└── tsconfig.json76```7778### Development Workflow7980After scaffolding:81821. `npm run dev` — starts server with hot reload + inspector832. Edit `index.ts` to add tools, resources, prompts843. Add widgets as `.tsx` files in `resources/`854. Test everything at `http://localhost:3000/inspector`865. `npm run build` — production build876. `npm run deploy` — deploy to production8889---9091## Your First Tool9293Open `index.ts` and you'll see a basic server. Let's add a simple tool:9495```typescript96import { MCPServer, text } from "mcp-use/server";97import { z } from "zod";9899const server = new MCPServer({100name: "my-server",101title: "My Server",102version: "1.0.0",103baseUrl: process.env.MCP_URL || "http://localhost:3000"104});105106// Add this tool107server.tool(108{109name: "greet",110description: "Greet a user by name",111schema: z.object({112name: z.string().describe("User's name")113})114},115async ({ name }) => {116return text(`Hello, ${name}! Welcome to MCP.`);117}118);119120server.listen();121```122123**Save the file** - the server auto-reloads!124125**Test it:**1261. Open inspector (`http://localhost:3000/inspector`)1272. Click "List Tools"1283. Find "greet" tool1294. Click "Call Tool"1305. Enter `{"name": "Alice"}`1316. See response: "Hello, Alice! Welcome to MCP."132133---134135## Add Mock Data136137Let's build a weather tool with mock data:138139```typescript140// Mock weather data141const mockWeather: Record<string, { temp: number; conditions: string }> = {142"New York": { temp: 22, conditions: "Partly Cloudy" },143"London": { temp: 15, conditions: "Rainy" },144"Tokyo": { temp: 28, conditions: "Sunny" },145"Paris": { temp: 18, conditions: "Overcast" }146};147148server.tool(149{150name: "get-weather",151description: "Get current weather for a city",152schema: z.object({153city: z.string().describe("City name")154})155},156async ({ city }) => {157const weather = mockWeather[city];158159if (!weather) {160return text(`No weather data for ${city}`);161}162163return text(164`Weather in ${city}: ${weather.temp}°C, ${weather.conditions}`165);166}167);168```169170**Test it:**171- Call tool with `{"city": "Tokyo"}`172- Response: "Weather in Tokyo: 28°C, Sunny"173174---175176## Add Structure177178Return structured data with `object()`:179180```typescript181import { MCPServer, text, object } from "mcp-use/server";182183server.tool(184{185name: "get-weather-detailed",186description: "Get detailed weather information",187schema: z.object({188city: z.string().describe("City name")189})190},191async ({ city }) => {192const weather = mockWeather[city];193194if (!weather) {195return object({ error: `No data for ${city}` });196}197198return object({199city,200temperature: weather.temp,201conditions: weather.conditions,202unit: "celsius",203timestamp: new Date().toISOString()204});205}206);207```208209---210211## Add a Resource212213Resources provide read-only data:214215```typescript216server.resource(217{218name: "available_cities",219uri: "weather://available-cities",220title: "Available Cities",221description: "List of cities with weather data"222},223async () => object({224cities: Object.keys(mockWeather)225})226);227```228229**Test it:**2301. Inspector → "List Resources"2312. Find "Available Cities"2323. Click "Read Resource"2334. See: `{"cities": ["New York", "London", "Tokyo", "Paris"]}`234235---236237## Next Steps238239**Now that you have the basics:**2402411. **Learn response helpers** → [../server/response-helpers.md](../server/response-helpers.md)2422. **Build your first widget** → [../widgets/basics.md](../widgets/basics.md)2433. **See complete examples** → [../patterns/common-patterns.md](../patterns/common-patterns.md)244245**Want to add visual UI?** Continue to widgets:246- [Widget Basics](../widgets/basics.md) - Create your first interactive widget247