🛠️ MCPサーバー構築ガイド
外部 API を Claude から使えるようにする MCP サーバーを構築するSkill。Python / TypeScript 両対応。
📺 まず動画で見る(YouTube)
▶ The Ultimate Claude Code Guide | MCP, Skills & More ↗
※ jpskill.com 編集部が参考用に選んだ動画です。動画の内容と Skill の挙動は厳密には一致しないことがあります。
📜 元の英語説明(参考)
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
🇯🇵 日本人クリエイター向け解説
外部 API を Claude から使えるようにする MCP サーバーを構築するSkill。Python / TypeScript 両対応。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-17
- 取得日時
- 2026-05-17
- 同梱ファイル
- 6
💬 こう話しかけるだけ — サンプルプロンプト
- › MCPサーバー構築ガイド を使って、最小構成のサンプルコードを示して
- › MCPサーバー構築ガイド の主な使い方と注意点を教えて
- › MCPサーバー構築ガイド を既存プロジェクトに組み込む方法を教えて
これをClaude Code に貼るだけで、このSkillが自動発動します。
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
[スキル名] mcp-builder
MCPサーバー開発ガイド
概要
LLMが適切に設計されたツールを通じて外部サービスと対話できるようにするMCP(Model Context Protocol)サーバーを作成します。MCPサーバーの品質は、LLMが現実世界のタスクをどれだけうまく達成できるかによって測られます。
プロセス
🚀 大まかなワークフロー
高品質なMCPサーバーを作成するには、主に4つのフェーズがあります。
フェーズ1:詳細な調査と計画
1.1 最新のMCP設計を理解する
APIカバレッジ vs. ワークフローツール: 包括的なAPIエンドポイントのカバレッジと、専門的なワークフローツールのバランスを取ります。ワークフローツールは特定のタスクにはより便利ですが、包括的なカバレッジはエージェントに操作を構成する柔軟性を与えます。パフォーマンスはクライアントによって異なり、一部のクライアントは基本的なツールを組み合わせたコード実行から恩恵を受けますが、他のクライアントはより高レベルのワークフローでより効果的に機能します。不明な場合は、包括的なAPIカバレッジを優先してください。
ツール命名と発見可能性:
明確で記述的なツール名は、エージェントが適切なツールを素早く見つけるのに役立ちます。一貫したプレフィックス(例:github_create_issue、github_list_repos)とアクション指向の命名を使用してください。
コンテキスト管理: エージェントは、簡潔なツール説明と、結果をフィルタリング/ページネーションする機能から恩恵を受けます。焦点を絞った関連性の高いデータを返すツールを設計してください。一部のクライアントは、エージェントがデータを効率的にフィルタリングおよび処理するのに役立つコード実行をサポートしています。
実用的なエラーメッセージ: エラーメッセージは、具体的な提案と次のステップでエージェントを解決策に導く必要があります。
1.2 MCPプロトコルドキュメントを学習する
MCP仕様をナビゲートする:
関連ページを見つけるには、まずサイトマップから始めます:https://modelcontextprotocol.io/sitemap.xml
次に、Markdown形式の特定のページを.mdサフィックスで取得します(例:https://modelcontextprotocol.io/specification/draft.md)。
確認すべき主要なページ:
- 仕様の概要とアーキテクチャ
- トランスポートメカニズム(ストリーマブルHTTP、stdio)
- ツール、リソース、プロンプトの定義
1.3 フレームワークドキュメントを学習する
推奨スタック:
- 言語: TypeScript(高品質なSDKサポートと、MCPBなど多くの実行環境での良好な互換性。さらに、AIモデルはTypeScriptコードの生成に優れており、その幅広い使用、静的型付け、優れたリンティングツールから恩恵を受けます)
- トランスポート: リモートサーバーにはストリーマブルHTTPを使用し、ステートレスJSONを使用します(ステートフルセッションやストリーミング応答とは対照的に、スケーリングと保守がより簡単です)。ローカルサーバーにはstdioを使用します。
フレームワークドキュメントを読み込む:
- MCPベストプラクティス: 📋 ベストプラクティスを見る - コアガイドライン
TypeScript(推奨)の場合:
- TypeScript SDK: WebFetchを使用して
https://raw.githubusercontent.com/modelcontextprotocol/typescript-sdk/main/README.mdを読み込みます - ⚡ TypeScriptガイド - TypeScriptのパターンと例
Pythonの場合:
- Python SDK: WebFetchを使用して
https://raw.githubusercontent.com/modelcontextprotocol/python-sdk/main/README.mdを読み込みます - 🐍 Pythonガイド - Pythonのパターンと例
1.4 実装計画を立てる
APIを理解する: サービスのAPIドキュメントを確認し、主要なエンドポイント、認証要件、データモデルを特定します。必要に応じてウェブ検索とWebFetchを使用します。
ツール選択: 包括的なAPIカバレッジを優先します。最も一般的な操作から始めて、実装するエンドポイントをリストアップします。
フェーズ2:実装
2.1 プロジェクト構造を設定する
プロジェクトのセットアップについては、言語固有のガイドを参照してください。
- ⚡ TypeScriptガイド - プロジェクト構造、package.json、tsconfig.json
- 🐍 Pythonガイド - モジュール構成、依存関係
2.2 コアインフラストラクチャを実装する
共有ユーティリティを作成します。
- 認証付きAPIクライアント
- エラー処理ヘルパー
- 応答フォーマット(JSON/Markdown)
- ページネーションサポート
2.3 ツールを実装する
各ツールについて:
入力スキーマ:
- Zod(TypeScript)またはPydantic(Python)を使用します
- 制約と明確な説明を含めます
- フィールドの説明に例を追加します
出力スキーマ:
- 構造化データのために可能な限り
outputSchemaを定義します - ツール応答で
structuredContentを使用します(TypeScript SDK機能) - クライアントがツールの出力を理解し、処理するのに役立ちます
ツール説明:
- 機能の簡潔な要約
- パラメータの説明
- 戻り値の型スキーマ
実装:
- I/O操作にはAsync/awaitを使用します
- 実用的なメッセージを含む適切なエラー処理
- 該当する場合はページネーションをサポートします
- 最新のSDKを使用する場合は、テキストコンテンツと構造化データの両方を返します
アノテーション:
readOnlyHint: true/falsedestructiveHint: true/falseidempotentHint: true/falseopenWorldHint: true/false
フェーズ3:レビューとテスト
3.1 コード品質
以下を確認します。
- 重複コードがないこと(DRY原則)
- 一貫したエラー処理
- 完全な型カバレッジ
- 明確なツール説明
3.2 ビルドとテスト
TypeScript:
npm run buildを実行してコンパイルを確認します- MCP Inspectorでテストします:
npx @modelcontextprotocol/inspector
Python:
- 構文を確認します:
python -m py_compile your_server.py - MCP Inspectorでテストします
詳細なテストアプローチと品質チェックリストについては、言語固有のガイドを参照してください。
フェーズ4:評価を作成する
MCPサーバーを実装した後、その有効性をテストするための包括的な評価を作成します。
完全な評価ガイドラインについては、✅ 評価ガイドを読み込んでください。
4.1 評価の目的を理解する
評価を使用して、LLMがMCPサーバーを効果的に使用して現実的で複雑な質問に答えられるかどうかをテストします。
4.2 10個の評価質問を作成する
効果的な評価を作成するには、評価ガイドに概説されているプロセスに従ってください。
- ツール検査: 利用可能なツールをリストアップし、その機能を理解します
- コンテンツ探索: 読み取り専用操作を使用して利用可能なデータを探索します
- 質問生成: 10個の複雑で現実的な質問を作成します
(原文がここで切り詰められています)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
MCP Server Development Guide
Overview
Create MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. The quality of an MCP server is measured by how well it enables LLMs to accomplish real-world tasks.
Process
🚀 High-Level Workflow
Creating a high-quality MCP server involves four main phases:
Phase 1: Deep Research and Planning
1.1 Understand Modern MCP Design
API Coverage vs. Workflow Tools: Balance comprehensive API endpoint coverage with specialized workflow tools. Workflow tools can be more convenient for specific tasks, while comprehensive coverage gives agents flexibility to compose operations. Performance varies by client—some clients benefit from code execution that combines basic tools, while others work better with higher-level workflows. When uncertain, prioritize comprehensive API coverage.
Tool Naming and Discoverability:
Clear, descriptive tool names help agents find the right tools quickly. Use consistent prefixes (e.g., github_create_issue, github_list_repos) and action-oriented naming.
Context Management: Agents benefit from concise tool descriptions and the ability to filter/paginate results. Design tools that return focused, relevant data. Some clients support code execution which can help agents filter and process data efficiently.
Actionable Error Messages: Error messages should guide agents toward solutions with specific suggestions and next steps.
1.2 Study MCP Protocol Documentation
Navigate the MCP specification:
Start with the sitemap to find relevant pages: https://modelcontextprotocol.io/sitemap.xml
Then fetch specific pages with .md suffix for markdown format (e.g., https://modelcontextprotocol.io/specification/draft.md).
Key pages to review:
- Specification overview and architecture
- Transport mechanisms (streamable HTTP, stdio)
- Tool, resource, and prompt definitions
1.3 Study Framework Documentation
Recommended stack:
- Language: TypeScript (high-quality SDK support and good compatibility in many execution environments e.g. MCPB. Plus AI models are good at generating TypeScript code, benefiting from its broad usage, static typing and good linting tools)
- Transport: Streamable HTTP for remote servers, using stateless JSON (simpler to scale and maintain, as opposed to stateful sessions and streaming responses). stdio for local servers.
Load framework documentation:
- MCP Best Practices: 📋 View Best Practices - Core guidelines
For TypeScript (recommended):
- TypeScript SDK: Use WebFetch to load
https://raw.githubusercontent.com/modelcontextprotocol/typescript-sdk/main/README.md - ⚡ TypeScript Guide - TypeScript patterns and examples
For Python:
- Python SDK: Use WebFetch to load
https://raw.githubusercontent.com/modelcontextprotocol/python-sdk/main/README.md - 🐍 Python Guide - Python patterns and examples
1.4 Plan Your Implementation
Understand the API: Review the service's API documentation to identify key endpoints, authentication requirements, and data models. Use web search and WebFetch as needed.
Tool Selection: Prioritize comprehensive API coverage. List endpoints to implement, starting with the most common operations.
Phase 2: Implementation
2.1 Set Up Project Structure
See language-specific guides for project setup:
- ⚡ TypeScript Guide - Project structure, package.json, tsconfig.json
- 🐍 Python Guide - Module organization, dependencies
2.2 Implement Core Infrastructure
Create shared utilities:
- API client with authentication
- Error handling helpers
- Response formatting (JSON/Markdown)
- Pagination support
2.3 Implement Tools
For each tool:
Input Schema:
- Use Zod (TypeScript) or Pydantic (Python)
- Include constraints and clear descriptions
- Add examples in field descriptions
Output Schema:
- Define
outputSchemawhere possible for structured data - Use
structuredContentin tool responses (TypeScript SDK feature) - Helps clients understand and process tool outputs
Tool Description:
- Concise summary of functionality
- Parameter descriptions
- Return type schema
Implementation:
- Async/await for I/O operations
- Proper error handling with actionable messages
- Support pagination where applicable
- Return both text content and structured data when using modern SDKs
Annotations:
readOnlyHint: true/falsedestructiveHint: true/falseidempotentHint: true/falseopenWorldHint: true/false
Phase 3: Review and Test
3.1 Code Quality
Review for:
- No duplicated code (DRY principle)
- Consistent error handling
- Full type coverage
- Clear tool descriptions
3.2 Build and Test
TypeScript:
- Run
npm run buildto verify compilation - Test with MCP Inspector:
npx @modelcontextprotocol/inspector
Python:
- Verify syntax:
python -m py_compile your_server.py - Test with MCP Inspector
See language-specific guides for detailed testing approaches and quality checklists.
Phase 4: Create Evaluations
After implementing your MCP server, create comprehensive evaluations to test its effectiveness.
Load ✅ Evaluation Guide for complete evaluation guidelines.
4.1 Understand Evaluation Purpose
Use evaluations to test whether LLMs can effectively use your MCP server to answer realistic, complex questions.
4.2 Create 10 Evaluation Questions
To create effective evaluations, follow the process outlined in the evaluation guide:
- Tool Inspection: List available tools and understand their capabilities
- Content Exploration: Use READ-ONLY operations to explore available data
- Question Generation: Create 10 complex, realistic questions
- Answer Verification: Solve each question yourself to verify answers
4.3 Evaluation Requirements
Ensure each question is:
- Independent: Not dependent on other questions
- Read-only: Only non-destructive operations required
- Complex: Requiring multiple tool calls and deep exploration
- Realistic: Based on real use cases humans would care about
- Verifiable: Single, clear answer that can be verified by string comparison
- Stable: Answer won't change over time
4.4 Output Format
Create an XML file with this structure:
<evaluation>
<qa_pair>
<question>Find discussions about AI model launches with animal codenames. One model needed a specific safety designation that uses the format ASL-X. What number X was being determined for the model named after a spotted wild cat?</question>
<answer>3</answer>
</qa_pair>
<!-- More qa_pairs... -->
</evaluation>
Reference Files
📚 Documentation Library
Load these resources as needed during development:
Core MCP Documentation (Load First)
- MCP Protocol: Start with sitemap at
https://modelcontextprotocol.io/sitemap.xml, then fetch specific pages with.mdsuffix - 📋 MCP Best Practices - Universal MCP guidelines including:
- Server and tool naming conventions
- Response format guidelines (JSON vs Markdown)
- Pagination best practices
- Transport selection (streamable HTTP vs stdio)
- Security and error handling standards
SDK Documentation (Load During Phase 1/2)
- Python SDK: Fetch from
https://raw.githubusercontent.com/modelcontextprotocol/python-sdk/main/README.md - TypeScript SDK: Fetch from
https://raw.githubusercontent.com/modelcontextprotocol/typescript-sdk/main/README.md
Language-Specific Implementation Guides (Load During Phase 2)
-
🐍 Python Implementation Guide - Complete Python/FastMCP guide with:
- Server initialization patterns
- Pydantic model examples
- Tool registration with
@mcp.tool - Complete working examples
- Quality checklist
-
⚡ TypeScript Implementation Guide - Complete TypeScript guide with:
- Project structure
- Zod schema patterns
- Tool registration with
server.registerTool - Complete working examples
- Quality checklist
Evaluation Guide (Load During Phase 4)
- ✅ Evaluation Guide - Complete evaluation creation guide with:
- Question creation guidelines
- Answer verification strategies
- XML format specifications
- Example questions and answers
- Running an evaluation with the provided scripts
同梱ファイル
※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。
- 📄 SKILL.md (9,092 bytes)
- 📎 LICENSE.txt (11,345 bytes)
- 📎 scripts/connections.py (4,875 bytes)
- 📎 scripts/evaluation.py (12,579 bytes)
- 📎 scripts/example_evaluation.xml (1,194 bytes)
- 📎 scripts/requirements.txt (29 bytes)