OA0
OA0 是一个探索 AI 的社区
现在注册
已注册用户请  登录
OA0  ›  代码  ›  MCP Use — 让模型更方便接入 MCP 工具生态的 Python 框架

MCP Use — 让模型更方便接入 MCP 工具生态的 Python 框架

 
  trillion ·  2026-04-06 11:00:24 · 6 次点击  · 0 条评论  

关于

mcp-use 是一个全栈 MCP 框架,用于为 ChatGPT / Claude 构建 MCP 应用,以及为 AI 智能体构建 MCP 服务器。

  • 构建:使用 mcp-use SDK (ts | py) 开发 MCP 服务器和 MCP 应用。
  • 预览:使用 mcp-use MCP 检查器 (在线版 | 开源版) 测试和调试你的 MCP 服务器和应用。
  • 部署:在 Manufact MCP 云平台 上部署:连接你的 GitHub 仓库,即可让你的 MCP 服务器和应用在生产环境中运行,并获得可观测性、指标、日志、分支部署等功能。

文档

访问我们的 文档 或跳转到快速入门指南 (TypeScript | Python)。

为编程智能体准备的技能

正在使用 Claude Code、Codex、Cursor 或其他 AI 编程智能体?

为 MCP 应用安装 mcp-use 技能

快速入门:MCP 服务器与 MCP 应用

TypeScript

构建你的第一个 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

→ 完整的 TypeScript 服务器文档

MCP 应用

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 仓库 部署
Chart Builder 图表构建器 create-chart 打开 URL mcp-use/mcp-chart-builder Deploy to mcp-use
Diagram Builder 图表构建器 create-diagram, edit-diagram 打开 URL mcp-use/mcp-diagram-builder Deploy to mcp-use
Slide Deck 幻灯片 create-slides, edit-slide 打开 URL mcp-use/mcp-slide-deck Deploy to mcp-use
Maps Explorer 地图探索器 show-map, get-place-details, add-markers 打开 URL mcp-use/mcp-maps-explorer Deploy to mcp-use
Hugging Face Spaces Hugging Face Spaces search-spaces, show-space, trending-spaces 打开 URL mcp-use/mcp-huggingface-spaces Deploy to mcp-use
Recipe Finder 食谱查找器 search-recipes, get-recipe, meal-plan, recipe-suggestion 打开 URL mcp-use/mcp-recipe-finder Deploy to mcp-use
Widget Gallery 小组件画廊 show-react-widget, html-greeting, mcp-ui-poll, programmatic-counter, detect-client 打开 URL mcp-use/mcp-widget-gallery Deploy to mcp-use
Multi Server Hub 多服务器中心 hub-status, hub-config-example, audit-log 打开 URL mcp-use/mcp-multi-server-hub Deploy to mcp-use
File Manager 文件管理器 open-vault, get-file, list-files 打开 URL mcp-use/mcp-file-manager Deploy to mcp-use
Progress Demo 进度演示 process-data, fetch-report, delete-dataset, search-external, failing-tool 打开 URL mcp-use/mcp-progress-demo Deploy to mcp-use
i18n Adaptive i18n 自适应 show-context, detect-caller 打开 URL mcp-use/mcp-i18n-adaptive Deploy to mcp-use
Media Mixer 媒体混合器 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 [Deploy to mcp-use](https://mcp-use.com/deploy/start?repository-url=https%3A%2F%2Fgithub.com%2Fmcp-use%2Fmcp-media-mixer&branch=main&project
6 次点击  ∙  0 人收藏  
登录后收藏  
0 条回复
关于 ·  帮助 ·  PING ·  隐私 ·  条款   
OA0 - Omni AI 0 一个探索 AI 的社区
沪ICP备2024103595号-2
耗时 25 ms
Developed with Cursor