npx skills add ...
npx skills add mcp-use/skills --skill mcp-builder
Build Model Context Protocol (MCP) servers with mcp-use framework. Use when creating MCP servers, defining tools/resources/prompts, working with mcp-use, bootstrapping MCP projects, deploying MCP servers, or when user mentions MCP development, MCP tools, MCP resources, or MCP prompts.
npx skills add mcp-use/skills --skill mcp-builder
Build production-ready MCP servers with the mcp-use framework. This Skill provides quick-start instructions and best practices for creating MCP servers.
Always bootstrap with npx create-mcp-use-app:
Choose template based on needs:
--template starter - Full-featured with all MCP primitives (tools, resources, prompts) + example widgets--template mcp-apps - Optimized for ChatGPT widgets with product search example--template blank - Minimal starting point for custom implementationTemplate Details:
The mcp-apps and starter templates automatically discover and register React widgets from the resources/ folder:
Single-file widget pattern:
Folder-based widget pattern:
What happens automatically:
resources/ folder at startup.tsx files or widget.tsx in folderswidgetMetadata from each componentweather-display)ui://widget/weather-display.html)No manual registration needed! Just export widgetMetadata and a default component.
Tools are executable functions that AI models can call:
Key points:
.describe() to all parametersResources expose data that clients can read:
Response helpers available:
text(string) - Plain textobject(data) - JSON objectsmarkdown(string) - Markdown contenthtml(string) - HTML contentimage(buffer, mimeType) - Binary imagesaudio(buffer, mimeType) - Audio filesbinary(buffer, mimeType) - Binary datamix(...contents) - Combine multiple content typesAdvanced response examples:
Prompts are reusable templates for AI interactions:
Development mode (hot reload):
Production mode:
Inspector UI:
Access at http://localhost:3000/inspector to test tools, view resources, and try prompts.
Tunneling (test with ChatGPT before deploying):
Option 1 - Auto-tunnel:
Option 2 - Separate tunnel:
You'll get a public URL like https://happy-cat.local.mcp-use.run/mcp
Tunnel details:
Learn more: https://mcp-use.com/docs/tunneling
Deploy to mcp-use Cloud (recommended):
If authentication error:
After deployment:
https://your-server.mcp-use.com/mcp)Tool Design:
.describe() on all Zod fieldsResource Design:
Prompt Design:
Testing:
Deployment:
npx mcp-use login if deploy failsWhen using the mcp-apps or starter template, widgets in the resources/ folder are automatically registered:
Widget automatically becomes available as:
weather-displayui://widget/weather-display.htmlControl what external resources widgets can access:
Alternatively, set at server level:
mcp-use supports the MCP Apps standard (SEP-1865) with automatic dual-protocol support:
What happens automatically:
text/html;profile=mcp-app with _meta.ui.*text/html+skybridge with _meta.openai/*Need ChatGPT-specific features? Combine both metadata fields:
Tool with dual-protocol widget:
Resource template (parameterized):
Error handling:
For comprehensive examples and advanced patterns, connect to the mcp-use MCP server which provides:
Commands:
npx create-mcp-use-app my-server - Bootstrapyarn dev - Development modeyarn build - Build for productionyarn start - Run production servermcp-use start --tunnel - Start with tunnelnpx mcp-use login - Authenticateyarn deploy - Deploy to cloudResponse helpers:
text(str), object(data), markdown(str), html(str)image(buf, mime), audio(buf, mime), binary(buf, mime)mix(...) - Combine multiple content typeswidget({ props, output }) - Return widget with dataServer methods:
server.tool() - Define executable toolserver.resource() - Define static/dynamic resourceserver.resourceTemplate() - Define parameterized resourceserver.prompt() - Define prompt templateserver.uiResource() - Define widget resourceserver.listen() - Start serverWidget metadata fields:
description - Widget descriptionprops - Zod schema for widget propsmetadata - Unified config (dual-protocol)metadata.csp - Content Security PolicyappsSdkMetadata - ChatGPT-specific overridesAvailable templates:
starter - Full-featured (tools, resources, prompts, widgets)mcp-apps - ChatGPT-optimized with product exampleblank - Minimal boilerplate