building-mcp-servers
Guides creation of 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). Covers tool design, authentication, Docker deployment, and evaluation creation. NOT when consuming existing MCP servers (use the server directly).
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o building-mcp-servers.zip https://jpskill.com/download/17287.zip && unzip -o building-mcp-servers.zip && rm building-mcp-servers.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/17287.zip -OutFile "$d\building-mcp-servers.zip"; Expand-Archive "$d\building-mcp-servers.zip" -DestinationPath $d -Force; ri "$d\building-mcp-servers.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
building-mcp-servers.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
building-mcp-serversフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 この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-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 11
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
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プロトコルのドキュメントを調査する
まず、サイトマップから始めます:https://modelcontextprotocol.io/sitemap.xml
.mdサフィックスの付いたページを取得します(例:https://modelcontextprotocol.io/specification/draft.md)。
主要なページ:仕様の概要、トランスポートメカニズム、ツール/リソース/プロンプトの定義。
1.3 フレームワークのドキュメントを調査する
推奨スタック:
- 言語: TypeScript (高品質なSDK、優れたAIコード生成)
- トランスポート: リモートサーバーにはStreamable HTTP、ローカルサーバーにはstdio
フレームワークのドキュメントをロード:
- MCP Best Practices - コアガイドライン
- TypeScript Guide - TypeScriptパターン
- Python Guide - Python/FastMCPパターン
SDKドキュメント:
- TypeScript:
https://raw.githubusercontent.com/modelcontextprotocol/typescript-sdk/main/README.md - Python:
https://raw.githubusercontent.com/modelcontextprotocol/python-sdk/main/README.md
1.4 実装を計画する
サービスのAPIドキュメントを確認します。実装するエンドポイントを、最も一般的な操作から順にリストアップします。
フェーズ2:実装
2.1 プロジェクト構造をセットアップする
言語固有のガイドを参照してください:
- TypeScript Guide - プロジェクト構造、package.json、tsconfig.json
- Python Guide - モジュール構成、依存関係
2.2 コアインフラストラクチャを実装する
共有ユーティリティを作成します:
- 認証付きAPIクライアント
- エラー処理ヘルパー
- レスポンスのフォーマット(JSON/Markdown)
- ページネーションのサポート
2.3 ツールを実装する
各ツールについて:
入力スキーマ:
- Zod (TypeScript) または Pydantic (Python) を使用します
- 制約と明確な説明を含めます
出力スキーマ:
- 可能であれば
outputSchemaを定義します - レスポンスで
structuredContentを使用します
ツールの説明:
- 簡潔な概要、パラメータの説明、戻り値の型
アノテーション:
readOnlyHint、destructiveHint、idempotentHint、openWorldHint
フェーズ3:レビューとテスト
3.1 コード品質
レビューのポイント:DRY原則、一貫したエラー処理、完全な型カバレッジ、明確な説明。
3.2 ビルドとテスト
TypeScript:
npm run build
npx @modelcontextprotocol/inspector
Python:
python -m py_compile your_server.py
# Test with MCP Inspector
フェーズ4:評価を作成する
サーバーを使用したLLMの有効性をテストするための評価質問を10個作成します。
各質問の要件:
- 独立性、読み取り専用、複雑性、現実性、検証可能性、安定性
出力形式:
<evaluation>
<qa_pair>
<question>Your question here</question>
<answer>Expected answer</answer>
</qa_pair>
</evaluation>
完全なガイドラインについては、Evaluation Guideを参照してください。
Docker/コンテナ化
トランスポートセキュリティ (allowed_hosts)
FastMCPはHostヘッダーを検証します。Dockerの場合は、以下のように構成します。
from mcp.server.fastmcp import FastMCP
from mcp.server.transport_security import TransportSecuritySettings
transport_security = TransportSecuritySettings(
allowed_hosts=[
"127.0.0.1:*", "localhost:*", "[::1]:*",
"mcp-server:*", # Dockerコンテナ名
"0.0.0.0:*",
],
)
mcp = FastMCP("my_server", transport_security=transport_security)
ヘルスチェックエンドポイント
ミドルウェアを介して /health エンドポイントを追加します(完全な例については、参考文献を参照してください)。
検証
実行: python3 scripts/verify.py
期待される結果: ✓ building-mcp-servers skill ready
検証に失敗した場合
- 診断を実行: references/ フォルダが存在するか確認
- 確認: すべての参照ファイルが存在するか確認
- それでも失敗する場合は停止して報告
参考文献
- MCP Best Practices - 普遍的なガイドライン
- Python Guide - Python/FastMCPパターン
- TypeScript Guide - TypeScriptパターン
- TaskFlow Patterns - 内部サーバーパターン
- Evaluation Guide - 評価の作成
📜 原文 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.
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. When uncertain, prioritize comprehensive API coverage.
Tool Naming and Discoverability:
Use consistent prefixes (e.g., github_create_issue, github_list_repos) and action-oriented naming.
Context Management: Design tools that return focused, relevant data. Support filtering/pagination.
Actionable Error Messages: Error messages should guide agents toward solutions with specific suggestions.
1.2 Study MCP Protocol Documentation
Start with the sitemap: https://modelcontextprotocol.io/sitemap.xml
Fetch pages with .md suffix (e.g., https://modelcontextprotocol.io/specification/draft.md).
Key pages: Specification overview, transport mechanisms, tool/resource/prompt definitions.
1.3 Study Framework Documentation
Recommended stack:
- Language: TypeScript (high-quality SDK, good AI code generation)
- Transport: Streamable HTTP for remote servers, stdio for local servers
Load framework documentation:
- MCP Best Practices - Core guidelines
- TypeScript Guide - TypeScript patterns
- Python Guide - Python/FastMCP patterns
SDK Documentation:
- TypeScript:
https://raw.githubusercontent.com/modelcontextprotocol/typescript-sdk/main/README.md - Python:
https://raw.githubusercontent.com/modelcontextprotocol/python-sdk/main/README.md
1.4 Plan Your Implementation
Review the service's API documentation. List endpoints to implement, starting with most common operations.
Phase 2: Implementation
2.1 Set Up Project Structure
See language-specific guides:
- 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
Output Schema:
- Define
outputSchemawhere possible - Use
structuredContentin responses
Tool Description:
- Concise summary, parameter descriptions, return type
Annotations:
readOnlyHint,destructiveHint,idempotentHint,openWorldHint
Phase 3: Review and Test
3.1 Code Quality
Review for: DRY principle, consistent error handling, full type coverage, clear descriptions.
3.2 Build and Test
TypeScript:
npm run build
npx @modelcontextprotocol/inspector
Python:
python -m py_compile your_server.py
# Test with MCP Inspector
Phase 4: Create Evaluations
Create 10 evaluation questions to test LLM effectiveness with your server.
Requirements for each question:
- Independent, read-only, complex, realistic, verifiable, stable
Output Format:
<evaluation>
<qa_pair>
<question>Your question here</question>
<answer>Expected answer</answer>
</qa_pair>
</evaluation>
See Evaluation Guide for complete guidelines.
Docker/Containerization
Transport Security (allowed_hosts)
FastMCP validates Host headers. For Docker, configure:
from mcp.server.fastmcp import FastMCP
from mcp.server.transport_security import TransportSecuritySettings
transport_security = TransportSecuritySettings(
allowed_hosts=[
"127.0.0.1:*", "localhost:*", "[::1]:*",
"mcp-server:*", # Docker container name
"0.0.0.0:*",
],
)
mcp = FastMCP("my_server", transport_security=transport_security)
Health Check Endpoint
Add /health endpoint via middleware (see references for full example).
Verification
Run: python3 scripts/verify.py
Expected: ✓ building-mcp-servers skill ready
If Verification Fails
- Run diagnostic: Check references/ folder exists
- Check: All reference files present
- Stop and report if still failing
References
- MCP Best Practices - Universal guidelines
- Python Guide - Python/FastMCP patterns
- TypeScript Guide - TypeScript patterns
- TaskFlow Patterns - Internal server patterns
- Evaluation Guide - Creating evaluations
同梱ファイル
※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。
- 📄 SKILL.md (5,739 bytes)
- 📎 references/evaluation.md (22,264 bytes)
- 📎 references/mcp_best_practices.md (7,577 bytes)
- 📎 references/node_mcp_server.md (29,519 bytes)
- 📎 references/python_mcp_server.md (25,817 bytes)
- 📎 references/taskflow_patterns.md (9,195 bytes)
- 📎 scripts/connections.py (5,024 bytes)
- 📎 scripts/evaluation.py (12,950 bytes)
- 📎 scripts/example_evaluation.xml (1,214 bytes)
- 📎 scripts/requirements.txt (29 bytes)
- 📎 scripts/verify.py (705 bytes)