跳到正文
cccskills
免费在 GitHub 公开中文介绍

mcp-apps-builder

使用mcp-use设计和实现MCP服务器,让AI调用外部操作与数据。指南涵盖认证、交互界面、错误处理及部署,并引导查阅各功能的配套资料。

原文查看原文说明

**MANDATORY for ALL MCP server work** - mcp-use framework best practices and patterns. **READ THIS FIRST** before any MCP server work, including: - Creating new MCP servers - Modifying existing MCP servers (adding/updating tools, resources, prompts, widgets) - Debugging MCP server issues or errors - Reviewing MCP server code for quality, security, or performance - Answering questions about MCP development or mcp-use patterns - Making ANY changes to server.tool(), server.resource(), server.prompt(), or widgets This skill contains critical architecture decisions, security patterns, and common pitfalls. Always consult the relevant reference files BEFORE implementing MCP features.

集成工具SupabaseDocker
AI 评分70分/ 100查看安装方法

适用场景

  • 新建MCP服务器
  • 添加操作、数据及可复用提示词
  • 构建浏览与选择数据的React界面
  • 审查认证、错误处理及部署设置

中文介绍

功能

mcp-apps-builder是使用mcp-use设计和实现MCP服务器的指南。MCP让AI能够使用外部操作与数据。指南说明如何区分执行操作的Tool、提供只读数据的Resource、保存可复用文本的Prompt,以及使用React构建交互界面的Widget。内容还涵盖输入验证、响应格式、错误处理、身份认证、界面状态管理、主题适配和部署方法。

适用场景

适合新建服务器或为现有mcp-use项目添加功能。需要制作数据列表、比较和选择界面,或检查代码安全性与性能时,也可参考。

使用示例

  • “用mcp-use创建一个MCP服务器。”
  • “为现有工具添加可比较并选择条目的Widget。”
  • “审查身份认证、输入验证和错误处理。”

注意事项

正文用于引导查阅资料,实现功能时还需使用对应的配套资料。新项目以npx create-mcp-use-app为创建方式。Widget示例使用React,输入验证示例使用Zod,凭据通过环境变量管理。

本介绍由 AI(OpenAI Codex)根据公开的 SKILL.md 撰写。准确的规格请查看下方原文。

客观评估

AI 仅根据 SKILL.md 的内容,从 4 个方面进行了评估。星标数和热度不计入评估。

指令清晰度能否看出何时使用、做什么
A良好明确列出新建服务器、添加功能及审查等场景,并按功能指向参考资料。
步骤具体性步骤、输入输出和示例是否具体
B部分不足项目检测方法和创建命令具体,但功能实现细节位于其他参考资料中。
安全性发送数据、删除文件、执行命令等是否有说明
B部分不足要求检查项目创建位置,但正文未说明部署和认证操作的范围及确认步骤。
安装难易度所需工具和 API 密钥是否少且有说明
B部分不足提供创建和启动命令,但运行环境要求及认证配置细节位于其他资料中。

总分按每项 A=25 分、B=15 分、C=5 分相加。 由 AI(OpenAI Codex)于 2026年10月20日 评估。仅供参考,安装前请同时查看原文。

如果您认为评估有误,请申请复核

请写明哪一项有误以及原因。无需登录。我们会对照 SKILL.md 重新评估,并在此处更新结果。

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

包含的文件(20)

  • SKILL.md12.5 KB
  • LICENSE.txt8.9 KB
  • references/authentication/custom.md7.3 KB
  • references/authentication/overview.md6.8 KB
  • references/authentication/supabase.md5.6 KB
  • references/authentication/workos.md6.7 KB
  • references/foundations/architecture.md6.5 KB
  • references/foundations/concepts.md3.4 KB
  • references/foundations/deployment.md3.1 KB
  • references/foundations/quickstart.md6.4 KB
  • references/patterns/common-patterns.md21.5 KB
  • references/server/prompts.md16.9 KB
  • references/server/resources.md11.5 KB
  • references/server/response-helpers.md12.9 KB
  • references/server/tools.md10.3 KB
  • references/widgets/advanced.md20.2 KB
  • references/widgets/basics.md18.4 KB
  • references/widgets/interactivity.md24.2 KB
  • references/widgets/state.md15.9 KB
  • references/widgets/ui-guidelines.md16.5 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

IMPORTANT: How to Use This Skill

This file provides a NAVIGATION GUIDE ONLY. Before implementing any MCP server features, you MUST:

  1. Read this overview to understand which reference files are relevant
  2. ALWAYS read the specific reference file(s) for the features you're implementing
  3. Apply the detailed patterns from those files to your implementation

Do NOT rely solely on the quick reference examples in this file - they are minimal examples only. The reference files contain critical best practices, security considerations, and advanced patterns.


MCP Server Best Practices

Comprehensive guide for building production-ready MCP servers with tools, resources, prompts, and widgets using mcp-use.

⚠️ FIRST: New Project or Existing Project?

Before doing anything else, determine whether you are inside an existing mcp-use project.

Detection: Check the workspace for a package.json that lists "mcp-use" as a dependency, OR any .ts file that imports from "mcp-use/server".

├─ mcp-use project FOUND → Do NOT scaffold. You are already in a project.
│  └─ Skip to "Quick Navigation" below to add features.
│
├─ NO mcp-use project (empty dir, unrelated project, or greenfield)
│  └─ Scaffold first with npx create-mcp-use-app, then add features.
│     See "Scaffolding a New Project" below.
│
└─ Inside an UNRELATED project (e.g. Next.js app) and user wants an MCP server
   └─ Ask the user where to create it, then scaffold in that directory.
      Do NOT scaffold inside an existing unrelated project root.

NEVER manually create MCPServer boilerplate, package.json, or project structure by hand. The CLI sets up TypeScript config, dev scripts, inspector integration, hot reload, and widget compilation that are difficult to replicate manually.


Scaffolding a New Project

npx create-mcp-use-app my-server
cd my-server
npm run dev

For full scaffolding details and CLI flags, see quickstart.md.


Quick Navigation

Choose your path based on what you're building:

🚀 Foundations

When: ALWAYS read these first when starting MCP work in a new conversation. Reference later for architecture/concept clarification.

  1. concepts.md - MCP primitives (Tool, Resource, Prompt, Widget) and when to use each
  2. architecture.md - Server structure (Hono-based), middleware system, server.use() vs server.app
  3. quickstart.md - Scaffolding, setup, and first tool example
  4. deployment.md - Deploying to Manufact Cloud, self-hosting, Docker, managing deployments

Load these before diving into tools/resources/widgets sections.


🔐 Adding Authentication?

When: Protecting your server with OAuth (WorkOS, Supabase, or custom)

  • overview.md

    • When: First time adding auth, understanding ctx.auth, or choosing a provider
    • Covers: oauth config, user context shape, provider comparison, common mistakes
  • workos.md

    • When: Using WorkOS AuthKit for authentication
    • Covers: Setup, env vars, DCR vs pre-registered, roles/permissions, WorkOS API calls
  • supabase.md

    • When: Using Supabase for authentication
    • Covers: Setup, env vars, HS256 vs ES256, RLS-aware API calls
  • custom.md

    • When: Using any other identity provider (GitHub, Okta, Azure AD, Google, etc.)
    • Covers: Custom verification, user info extraction, provider examples

🔧 Building Server Backend (No UI)?

When: Implementing MCP features (actions, data, templates). Read the specific file for the primitive you're building.

  • tools.md

    • When: Creating backend actions the AI can call (send-email, fetch-data, create-user)
    • Covers: Tool definition, schemas, annotations, context, error handling
  • resources.md

    • When: Exposing read-only data clients can fetch (config, user profiles, documentation)
    • Covers: Static resources, dynamic resources, parameterized resource templates, URI completion
  • prompts.md

    • When: Creating reusable message templates for AI interactions (code-review, summarize)
    • Covers: Prompt definition, parameterization, argument completion, prompt best practices
  • response-helpers.md

    • When: Formatting responses from tools/resources (text, JSON, markdown, images, errors)
    • Covers: text(), object(), markdown(), image(), error(), mix()

🎨 Building Visual Widgets (Interactive UI)?

When: Creating React-based visual interfaces for browsing, comparing, or selecting data

  • basics.md

    • When: Creating your first widget or adding UI to an existing tool
    • Covers: Widget setup, useWidget() hook, isPending checks, props handling
  • state.md

    • When: Managing UI state (selections, filters, tabs) within widgets
    • Covers: useState, setState, state persistence, when to use tool vs widget state
  • interactivity.md

    • When: Adding buttons, forms, or calling tools from within widgets
    • Covers: useCallTool(), form handling, action buttons, optimistic updates
  • ui-guidelines.md

    • When: Styling widgets to support themes, responsive layouts, or accessibility
    • Covers: useWidgetTheme(), light/dark mode, autoSize, layout patterns, CSS best practices
  • advanced.md

    • When: Building complex widgets with async data, error boundaries, or performance optimizations
    • Covers: Loading states, error handling, memoization, code splitting

📚 Need Complete Examples?

When: You want to see full implementations of common use cases

  • common-patterns.md
    • End-to-end examples: weather app, todo list, recipe browser
    • Shows: Server code + widget code + best practices in context

Decision Tree

What do you need?

├─ New project from scratch
│  └─> quickstart.md (scaffolding + setup)
│
├─ OAuth / user authentication
│  └─> authentication/overview.md → provider-specific guide
│
├─ Simple backend action (no UI)
│  └─> Use Tool: server/tools.md
│
├─ Read-only data for clients
│  └─> Use Resource: server/resources.md
│
├─ Reusable prompt template
│  └─> Use Prompt: server/prompts.md
│
├─ Visual/interactive UI
│  └─> Use Widget: widgets/basics.md
│
└─ Deploy to production
   └─> deployment.md (cloud deploy, self-hosting, Docker)

Core Principles

  1. Tools for actions - Backend operations with input/output
  2. Resources for data - Read-only data clients can fetch
  3. Prompts for templates - Reusable message templates
  4. Widgets for UI - Visual interfaces when helpful
  5. Mock data first - Prototype quickly, connect APIs later

❌ Common Mistakes

Avoid these anti-patterns found in production MCP servers:

Tool Definition

  • ❌ Returning raw objects instead of using response helpers
    • ✅ Use text(), object(), widget(), error() helpers
  • ❌ Skipping Zod schema .describe() on every field
    • ✅ Add descriptions to all schema fields for better AI understanding
  • ❌ No input validation or sanitization
    • ✅ Validate inputs with Zod, sanitize user-provided data
  • ❌ Throwing errors instead of returning error() helper
    • ✅ Use error("message") for graceful error responses

Widget Development

  • ❌ Accessing props without checking isPending
    • ✅ Always check if (isPending) return <Loading/>
  • ❌ Widget handles server state (filters, selections)
    • ✅ Widgets manage their own UI state with useState
  • ❌ Missing McpUseProvider wrapper or autoSize
    • ✅ Wrap root component: <McpUseProvider autoSize>
  • ❌ Inline styles without theme awareness
    • ✅ Use useWidgetTheme() for light/dark mode support

Security & Production

  • ❌ Hardcoded API keys or secrets in code
    • ✅ Use process.env.API_KEY, document in .env.example
  • ❌ No error handling in tool handlers
    • ✅ Wrap in try/catch, return error() on failure
  • ❌ Expensive operations without caching
    • ✅ Cache API calls, computations with TTL
  • ❌ Missing CORS configuration
    • ✅ Configure CORS for production deployments

🔒 Golden Rules

Opinionated architectural guidelines:

1. One Tool = One Capability

Split broad actions into focused tools:

  • ❌ manage-users (too vague)
  • ✅ create-user, delete-user, list-users

2. Return Complete Data Upfront

Tool calls are expensive. Avoid lazy-loading:

  • ❌ list-products + get-product-details (2 calls)
  • ✅ list-products returns full data including details

3. Widgets Own Their State

UI state lives in the widget, not in separate tools:

  • ❌ select-item tool, set-filter tool
  • ✅ Widget manages with useState or setState

4. exposeAsTool Defaults to false

Widgets are registered as resources only by default. Use a custom tool (recommended) or set exposeAsTool: true to expose a widget to the model:

// ✅ ALL 4 STEPS REQUIRED for proper type inference:

// Step 1: Define schema separately
const propsSchema = z.object({
  title: z.string(),
  items: z.array(z.string()),
});

// Step 2: Reference schema variable in metadata
export const widgetMetadata: WidgetMetadata = {
  description: "...",
  props: propsSchema, // ← NOT inline z.object()
  exposeAsTool: false,
};

// Step 3: Infer Props type from schema variable
type Props = z.infer<typeof propsSchema>;

// Step 4: Use typed Props with useWidget
export default function MyWidget() {
  const { props, isPending } = useWidget<Props>(); // ← Add <Props>
  // ...
}

⚠️ Common mistake: Only doing steps 1-2 but skipping 3-4 (loses type safety)

5. Validate at Boundaries Only

  • Trust internal code and framework guarantees
  • Validate user input, external API responses
  • Don't add error handling for scenarios that can't happen

6. Prefer Widgets for Browsing/Comparing

When in doubt, add a widget. Visual UI improves:

  • Browsing multiple items
  • Comparing data side-by-side
  • Interactive selection workflows

Quick Reference

Minimal Server

import { MCPServer, text } from "mcp-use/server";
import { z } from "zod";

const server = new MCPServer({
  name: "my-server",
  title: "My Server",
  version: "1.0.0",
});

server.tool(
  {
    name: "greet",
    description: "Greet a user",
    schema: z.object({ name: z.string().describe("User's name") }),
  },
  async ({ name }) => text("Hello " + name + "!"),
);

server.listen();

Response Helpers

HelperUse WhenExample
text()Simple string responsetext("Success!")
object()Structured dataobject({ status: "ok" })
markdown()Formatted textmarkdown("# Title\nContent")
widget()Visual UIwidget({ props: {...}, output: text(...) })
mix()Multiple contentsmix(text("Hi"), image(url))
error()Error responseserror("Failed to fetch data")
resource()Embed resource refsresource("docs://guide", "text/markdown")

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

advisor-orchestrator-worker

免费有简介AI 评分 80分

将大型调研或生成任务分配给多个AI模型,完成计划评审、并行执行、成果验证与整合,并记录各负责角色的进度和重试情况。

  • 并行调研多个竞争对手
  • 分担大型内容生成任务
  • 让顾问评审计划或草稿
Shubhamsaboo/awesome-llm-apps14.3万2026年10月22日 更新

chatgpt-app-builder

免费有简介AI 评分 70分

指导开发可在ChatGPT内操作的应用,涵盖功能规划、React组件及状态共享的实现。该技能已弃用,并指引用户转向后续技能。

  • 梳理ChatGPT应用功能
  • 实现与服务器联动的界面
  • 与ChatGPT共享界面状态
Shubhamsaboo/awesome-llm-apps14.3万2026年10月22日 更新

commit-archaeologist

免费有简介AI 评分 100分

通过本地Git历史调查代码的引入背景与修改意图,追溯最初提交及反复同时修改的文件,整理改动前需要检查的事项。

  • 了解陌生函数存在的原因
  • 改动前检查历史约束
  • 调查临时变通方案为何仍被保留
Shubhamsaboo/awesome-llm-apps14.3万2026年10月22日 更新

dependency-doctor

免费有简介AI 评分 100分

检查Python和JavaScript依赖文件中的版本约束缺失、重复条目、固定版本冲突及过时兼容包,用易懂的语言说明影响并提出便于核对的修改建议。

  • 安装失败深入排查前的初步检查
  • 检查过时的Python兼容包
  • 检查重复条目和固定版本冲突
Shubhamsaboo/awesome-llm-apps14.3万2026年10月22日 更新

first-reader

免费有简介AI 评分 100分

从目标读者的角度试读发布前的文稿,检查是否愿意打开、在哪里失去兴趣,以及读后记住什么。它报告模拟读者的反应,不改写文章。

  • 检查帖子是否会被读完
  • 找出读者停止阅读的位置
  • 比较修改前后的读者反应
Shubhamsaboo/awesome-llm-apps14.3万2026年10月22日 更新

mcp-builder

免费有简介AI 评分 80分

这是使用mcp-use设计MCP服务器操作、数据资源、可复用提示词及交互界面的旧指南。该技能已弃用,并指引用户迁移至mcp-app-builder。

  • 理解现有mcp-use服务器结构
  • 查阅Tool、Resource和Prompt示例
  • 查看交互式Widget设计
Shubhamsaboo/awesome-llm-apps14.3万2026年10月22日 更新

查看 Shubhamsaboo 的全部技能

报告此技能的问题