jpskill.com
🛠️ 開発・MCP コミュニティ

mcp-apps-builder

**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.

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o mcp-apps-builder.zip https://jpskill.com/download/19641.zip && unzip -o mcp-apps-builder.zip && rm mcp-apps-builder.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/19641.zip -OutFile "$d\mcp-apps-builder.zip"; Expand-Archive "$d\mcp-apps-builder.zip" -DestinationPath $d -Force; ri "$d\mcp-apps-builder.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して mcp-apps-builder.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → mcp-apps-builder フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
20

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

重要: このスキルを使用する方法

このファイルはナビゲーションガイドのみを提供します。MCPサーバー機能を実装する前に、必ず以下を実行してください。

  1. どの参照ファイルが関連しているかを理解するために、この概要をお読みください。
  2. 実装する機能については、必ず特定の参照ファイルをお読みください
  3. それらのファイルの詳細なパターンを実装に適用してください。

このファイルのクイックリファレンス例のみに頼らないでください。これらは最小限の例にすぎません。参照ファイルには、重要なベストプラクティス、セキュリティに関する考慮事項、および高度なパターンが含まれています。


MCPサーバーのベストプラクティス

mcp-useを使用して、ツール、リソース、プロンプト、およびウィジェットを備えた本番環境対応のMCPサーバーを構築するための包括的なガイドです。

⚠️ まず: 新規プロジェクトですか、既存プロジェクトですか?

他のことをする前に、既存のmcp-useプロジェクト内にいるかどうかを判断してください。

検出: ワークスペースに"mcp-use"を依存関係としてリストしているpackage.jsonがあるか、または"mcp-use/server"からインポートしている.tsファイルがあるかを確認してください。

├─ mcp-useプロジェクトが見つかりました → スキャフォールドしないでください。すでにプロジェクト内にいます。
│  └─ 機能を追加するには、以下の「クイックナビゲーション」に進んでください。
│
├─ mcp-useプロジェクトがありません(空のディレクトリ、無関係なプロジェクト、またはグリーンフィールド)
│  └─ まずnpx create-mcp-use-appでスキャフォールドし、その後機能を追加してください。
│     以下の「新規プロジェクトのスキャフォールド」を参照してください。
│
└─ 無関係なプロジェクト(例: Next.jsアプリ)内にいて、ユーザーがMCPサーバーを望んでいる
   └─ どこに作成するかをユーザーに尋ね、そのディレクトリにスキャフォールドしてください。
      既存の無関係なプロジェクトのルート内にスキャフォールドしないでください。

MCPServerのボイラープレート、package.json、またはプロジェクト構造を手動で作成しないでください。 CLIは、TypeScript設定、開発スクリプト、インスペクター統合、ホットリロード、およびウィジェットコンパイルを設定しますが、これらを手動で再現するのは困難です。


新規プロジェクトのスキャフォールド

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

スキャフォールドの全詳細とCLIフラグについては、quickstart.mdを参照してください。


クイックナビゲーション

構築するものに基づいてパスを選択してください。

🚀 基本

いつ: 新しい会話でMCP作業を開始するときは、常にこれらを最初に読んでください。アーキテクチャ/概念の明確化のために後で参照してください。

  1. concepts.md - MCPプリミティブ(Tool、Resource、Prompt、Widget)とそれぞれの使用時期
  2. architecture.md - サーバー構造(Honoベース)、ミドルウェアシステム、server.use() vs server.app
  3. quickstart.md - スキャフォールド、セットアップ、および最初のツールの例
  4. deployment.md - Manufact Cloudへのデプロイ、セルフホスティング、Docker、デプロイの管理

ツール/リソース/ウィジェットのセクションに入る前に、これらを読み込んでください。


🔐 認証を追加しますか?

いつ: OAuth(WorkOS、Supabase、またはカスタム)でサーバーを保護する場合

  • overview.md

    • いつ: 初めて認証を追加する場合、ctx.authを理解する場合、またはプロバイダーを選択する場合
    • 内容: oauth設定、ユーザーコンテキストの形状、プロバイダーの比較、よくある間違い
  • workos.md

    • いつ: WorkOS AuthKitを認証に使用する場合
    • 内容: セットアップ、環境変数、DCR vs 事前登録、ロール/権限、WorkOS API呼び出し
  • supabase.md

    • いつ: Supabaseを認証に使用する場合
    • 内容: セットアップ、環境変数、HS256 vs ES256、RLS対応API呼び出し
  • custom.md

    • いつ: その他のIDプロバイダー(GitHub、Okta、Azure AD、Googleなど)を使用する場合
    • 内容: カスタム検証、ユーザー情報抽出、プロバイダーの例

🔧 サーバーバックエンドを構築しますか(UIなし)?

いつ: MCP機能(アクション、データ、テンプレート)を実装する場合。構築するプリミティブの特定のファイルを読んでください。

  • tools.md

    • いつ: AIが呼び出すことができるバックエンドアクション(メール送信、データ取得、ユーザー作成)を作成する場合
    • 内容: ツールの定義、スキーマ、アノテーション、コンテキスト、エラー処理
  • resources.md

    • いつ: クライアントが取得できる読み取り専用データ(設定、ユーザープロファイル、ドキュメント)を公開する場合
    • 内容: 静的リソース、動的リソース、パラメーター化されたリソーステンプレート、URI補完
  • prompts.md

    • いつ: AIインタラクション用の再利用可能なメッセージテンプレート(コードレビュー、要約)を作成する場合
    • 内容: プロンプトの定義、パラメーター化、引数補完、プロンプトのベストプラクティス
  • response-helpers.md

    • いつ: ツール/リソースからの応答をフォーマットする場合(テキスト、JSON、マークダウン、画像、エラー)
    • 内容: text()object()markdown()image()error()mix()

🎨 ビジュアルウィジェットを構築しますか(インタラクティブUI)?

いつ: データの閲覧、比較、選択のためのReactベースのビジュアルインターフェースを作成する場合

  • basics.md

    • いつ: 最初のウィジェットを作成する場合、または既存のツールにUIを追加する場合
    • 内容: ウィジェットのセットアップ、useWidget()フック、isPendingチェック、propsの処理
  • state.md

    • いつ: ウィジェット内でUIの状態(選択、フィルター、タブ)を管理する場合
    • 内容: useStatesetState、状態の永続化、ツールとウィジェットの状態をいつ使用するか
  • interactivity.md

    • いつ: ウィジェット内からボタン、フォームを追加したり、ツールを呼び出したりする場合
    • 内容: useCallTool()、フォーム処理、アクションボタン、楽観的更新
  • ui-guidelines.md

    • いつ: テーマ、レスポンシブレイアウト、またはアクセシビリティをサポートするようにウィジェットをスタイルする場合
    • 内容: useWidgetTheme()、ライト/ダークモード、autoSize、レイアウトパターン、CSSのベストプラクティス
  • advanced.md

    • いつ: 非同期データ、エラー境界、またはパフォーマンス最適化を備えた複雑なウィジェットを構築する場合
    • C
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

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

Helper Use When Example
text() Simple string response text("Success!")
object() Structured data object({ status: "ok" })
markdown() Formatted text markdown("# Title\nContent")
widget() Visual UI widget({ props: {...}, output: text(...) })
mix() Multiple contents mix(text("Hi"), image(url))
error() Error responses error("Failed to fetch data")
resource() Embed resource refs resource("docs://guide", "text/markdown")

同梱ファイル

※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。