mcp-use 是一个全栈 MCP 框架,用于为 ChatGPT / Claude 构建 MCP 应用,以及为 AI 智能体构建 MCP 服务器。
访问我们的 文档 或跳转到快速入门指南 (TypeScript | Python)。
正在使用 Claude Code、Codex、Cursor 或其他 AI 编程智能体?
构建你的第一个 MCP 服务器或 MCP 应用:
npx create-mcp-use-app@latest
或者手动创建一个服务器:
import { MCPServer, text } from "mcp-use/server";
import { z } from "zod";
const server = new MCPServer({
name: "my-server",
version: "1.0.0",
});
server.tool({
name: "get_weather",
description: "Get weather for a city",
schema: z.object({ city: z.string() }),
}, async ({ city }) => {
return text(`Temperature: 72°F, Condition: sunny, City: ${city}`);
});
await server.listen(3000);
// 检查器地址:http://localhost:3000/inspector
MCP 应用让你可以构建交互式小组件,这些组件能在 Claude、ChatGPT 和其他 MCP 客户端中运行 —— 一次编写,随处运行。
服务器端:定义一个工具并指向一个小组件:
import { MCPServer, widget } from "mcp-use/server";
import { z } from "zod";
const server = new MCPServer({
name: "weather-app",
version: "1.0.0",
});
server.tool({
name: "get-weather",
description: "Get weather for a city",
schema: z.object({ city: z.string() }),
widget: "weather-display", // 引用 resources/weather-display/widget.tsx
}, async ({ city }) => {
return widget({
props: { city, temperature: 22, conditions: "Sunny" },
message: `Weather in ${city}: Sunny, 22°C`,
});
});
await server.listen(3000);
小组件:在 resources/weather-display/widget.tsx 中创建一个 React 组件:
import { useWidget, type WidgetMetadata } from "mcp-use/react";
import { z } from "zod";
const propSchema = z.object({
city: z.string(),
temperature: z.number(),
conditions: z.string(),
});
export const widgetMetadata: WidgetMetadata = {
description: "Display weather information",
props: propSchema,
};
const WeatherDisplay: React.FC = () => {
const { props, isPending, theme } = useWidget<z.infer<typeof propSchema>>();
const isDark = theme === "dark";
if (isPending) return <div>Loading...</div>;
return (
<div style={{
background: isDark ? "#1a1a2e" : "#f0f4ff",
borderRadius: 16, padding: 24,
}}>
<h2>{props.city}</h2>
<p>{props.temperature}° — {props.conditions}</p>
</div>
);
};
export default WeatherDisplay;
resources/ 目录下的小组件会被自动发现 —— 无需手动注册。
访问 MCP 应用文档
开箱即用的 MCP 应用,你可以一键部署或作为自己的项目进行修改。
| 预览 | 名称 | 工具 | 演示 URL | 仓库 | 部署 |
|---|---|---|---|---|---|
![]() |
图表构建器 | create-chart |
打开 URL | mcp-use/mcp-chart-builder | |
![]() |
图表构建器 | create-diagram, edit-diagram |
打开 URL | mcp-use/mcp-diagram-builder | |
![]() |
幻灯片 | create-slides, edit-slide |
打开 URL | mcp-use/mcp-slide-deck | |
![]() |
地图探索器 | show-map, get-place-details, add-markers |
打开 URL | mcp-use/mcp-maps-explorer | |
![]() |
Hugging Face Spaces | search-spaces, show-space, trending-spaces |
打开 URL | mcp-use/mcp-huggingface-spaces | |
![]() |
食谱查找器 | search-recipes, get-recipe, meal-plan, recipe-suggestion |
打开 URL | mcp-use/mcp-recipe-finder | |
![]() |
小组件画廊 | show-react-widget, html-greeting, mcp-ui-poll, programmatic-counter, detect-client |
打开 URL | mcp-use/mcp-widget-gallery | |
![]() |
多服务器中心 | hub-status, hub-config-example, audit-log |
打开 URL | mcp-use/mcp-multi-server-hub | |
![]() |
文件管理器 | open-vault, get-file, list-files |
打开 URL | mcp-use/mcp-file-manager | |
![]() |
进度演示 | process-data, fetch-report, delete-dataset, search-external, failing-tool |
打开 URL | mcp-use/mcp-progress-demo | |
![]() |
i18n 自适应 | show-context, detect-caller |
打开 URL | mcp-use/mcp-i18n-adaptive | |
![]() |
媒体混合器 | generate-image, generate-audio, generate-pdf, get-report, get-html-snippet, get-xml-config, get-stylesheet, get-script, get-data-array |
打开 URL | mcp-use/mcp-media-mixer | [ |