Communitygithub.com

MCPサーバー開発ガイド

LLMが外部サービスとやり取りできるようにする、高品質なMCP(Model Context Protocol)サーバーを作成するためのガイドです。Python(FastMCP)またはNode/TypeScript(MCP SDK)を使用してMCPサーバーを構築し、外部APIやサービスを統合する際に使用します。

MCPサーバー開発ガイド とは?

このスキルは、高品質なMCP(Model Context Protocol)サーバーを開発するための包括的なガイドです。MCPサーバーは、LLMが外部サービスと連携し、適切に設計されたツールを通じて実世界のタスクを実行できるようにします。このスキルは、TypeScriptまたはPythonを使用した実装に焦点を当て、調査・計画、実装、レビュー・テスト、評価作成の4つのフェーズで構成されています。TypeScript SDKまたはPython SDKの読み込み、ツール名の命名規則、入力スキーマ(Zod / Pydantic)、エラーハンドリング、ページネーション、アノテーション、そしてMCP Inspectorを使ったテスト方法など、詳細なベストプラクティスを提供します。また、LLMがサーバーを効果的に使用できるかを検証するための10問の評価質問を作成するプロセスも含まれています。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/aiskillstore/marketplace/tree/HEAD/skills/mcp-builder

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

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

その後、.md サフィックスを付けて特定のページを取得します(例:https://modelcontextprotocol.io/specification/draft.md)。

確認すべき主要ページ:

  • 仕様の概要とアーキテクチャ
  • トランスポートメカニズム(Streamable HTTP、stdio)
  • ツール、リソース、プロンプトの定義

1.3 フレームワークドキュメントを学習する

推奨スタック:

  • 言語: TypeScript(高品質なSDKサポート、多くの実行環境(例:MCPB)での互換性が良好。さらに、AIモデルはTypeScriptコードの生成に優れており、広範な使用、静的型付け、優れたリンティングツールの恩恵を受けられます)
  • トランスポート: リモートサーバーにはStreamable HTTP(ステートレスJSONを使用。ステートフルセッションやストリーミング応答よりもスケールと保守が容易)、ローカルサーバーにはstdio

フレームワークドキュメントを読み込む:

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 プロジェクト構造を設定する

プロジェクト設定については、言語固有のガイドを参照してください:

2.2 コア基盤を実装する

共有ユーティリティを作成します:

  • 認証付きAPIクライアント
  • エラーハンドリングヘルパー
  • 応答フォーマット(JSON/Markdown)
  • ページネーションサポート

2.3 ツールを実装する

各ツールについて:

入力スキーマ:

  • Zod(TypeScript)またはPydantic(Python)を使用
  • 制約と明確な説明を含める
  • フィールドの説明に例を追加

出力スキーマ:

  • 構造化データには可能な限り outputSchema を定義
  • ツール応答で structuredContent を使用(TypeScript SDK機能)
  • クライアントがツール出力を理解・処理するのに役立ちます

ツール説明:

  • 機能の簡潔な要約
  • パラメータ説明
  • 戻り値型スキーマ

実装:

  • I/O操作には非同期/待機(async/await)を使用
  • 実用的なメッセージを含む適切なエラーハンドリング
  • 該当する場合はページネーションをサポート
  • 最新SDK使用時はテキストコンテンツと構造化データの両方を返す

アノテーション:

  • readOnlyHint: true/false
  • destructiveHint: true/false
  • idempotentHint: true/false
  • openWorldHint: 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問の評価質問を作成する

効果的な評価を作成するには、評価ガイドに記載されているプロセスに従います:

  1. ツールの調査: 利用可能なツールをリストアップし、その機能を理解する
  2. コンテンツの探索: 読み取り専用操作を使用して利用可能なデータを探索する
  3. 質問の生成: 10個の複雑で現実的な質問を作成する
  4. 回答の確認: 各質問を自分で解いて回答を確認する

4.3 評価要件

各質問が以下の条件を満たしていることを確認します:

  • 独立: 他の質問に依存しない
  • 読み取り専用: 非破壊的な操作のみが必要
  • 複雑: 複数のツール呼び出しと深い探索が必要
  • 現実的: 人間が関心を持つ実際のユースケースに基づく
  • 検証可能: 文字列比較で検証できる単一の明確な回答
  • 安定: 回答が時間とともに変化しない

4.4 出力形式

この構造を持つXMLファイルを作成します:

<evaluation>
  <qa_pair>
    <question>動物のコードネームを持つAIモデルのローンチに関する議論を見つけてください。特定の安全性指定「ASL-X」という形式が必要なモデルがありました。斑点のある野生のネコにちなんで名付けられたモデルについて、Xの数値はいくつでしたか?</question>
    <answer>3</answer>
  </qa_pair>
<!-- さらにqa_pair... -->
</evaluation>

参考ファイル

📚 ドキュメントライブラリ

開発中に必要に応じてこれらのリソースを読み込んでください:

コアMCPドキュメント(最初に読み込み)

  • MCPプロトコル: サイトマップ https://modelcontextprotocol.io/sitemap.xml から開始し、.md サフィックスを付けて特定のページを取得
  • 📋 MCPベストプラクティス - 汎用MCPガイドライン(以下を含む):
    • サーバーとツールの命名規則
    • 応答フォーマットガイドライン(JSON vs Markdown)
    • ページネーションのベストプラクティス
    • トランスポート選択(Streamable HTTP vs stdio)
    • セキュリティおよびエラーハンドリング標準

SDKドキュメント(フェーズ1/2で読み込み)

  • Python SDK: https://raw.githubusercontent.com/modelcontextprotocol/python-sdk/main/README.md から取得
  • TypeScript SDK: https://raw.githubusercontent.com/modelcontextprotocol/typescript-sdk/main/README.md から取得

言語固有の実装ガイド(フェーズ2で読み込み)

  • 🐍 Python実装ガイド - 完全なPython/FastMCPガイド(以下を含む):

    • サーバー初期化パターン
    • Pydanticモデルの例
    • @mcp.tool によるツール登録
    • 完全な動作例
    • 品質チェックリスト
  • ⚡ TypeScript実装ガイド - 完全なTypeScriptガイド(以下を含む):

    • プロジェクト構造
    • Zodスキーマパターン
    • server.registerTool によるツール登録
    • 完全な動作例
    • 品質チェックリスト

評価ガイド(フェーズ4で読み込み)

  • ✅ 評価ガイド - 完全な評価作成ガイド(以下を含む):
    • 質問作成ガイドライン
    • 回答確認戦略
    • XML形式仕様
    • 質問と回答の例
    • 提供スクリプトを使用した評価の実行

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

aiskillstore/marketplace

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

aiskillstore/marketplace

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

aiskillstore/marketplace

Use when the user asks to "pre-launch check the landing page", "run a Quality-Score preflight", or "verify ad-to-page message match before launch"; produces an ad↔page continuity report — message-match gaps, above-the-fold check, page-speed read, form-friction count, mobile-render flags — as a pass/fix punch list. Not for redesigning or rewriting the page — use landing-optimizer; not for scoring the account or the RQS — use ad-account-auditor. 落地页体验预检/广告落地页一致性检查

aiskillstore/marketplace

Use when the user asks to "optimize our landing page for influencer traffic", "fix our promo-code landing page", or "improve conversion from a creator campaign"; produces a message-match audit, page-structure and social-proof recommendations, a promo-code/CTA conversion plan, and an A/B test roadmap. Not for measuring campaign results after launch — use performance-analyzer.

aiskillstore/marketplace

Audit a landing page, sales page or checkout page for conversion leaks and return a fix list ordered by expected revenue impact. Use when asked to review, critique or improve a landing page, sales page, opt-in page, product page or checkout flow, when conversion rate is low, when paid traffic is not converting, or when someone asks "why isn't this page converting" or wants a CRO / landing page review.

aiskillstore/marketplace

This skill helps users extract GitHub repository project details and contributor contact information using keywords, stars, and update dates. Agent should proactively apply this skill when users express needs like search for GitHub projects by keywords, find top open-source contributors in specific domains, extract developer contacts from GitHub repositories, discover trending repositories with high stars, gather contributor profiles and social links for tech recruiting, retrieve GitHub project descriptions and metrics, build developer communities by finding active contributors, search for repositories updated recently, collect personal website and Twitter links of developers, generate targeted leads for developer tools, or track active open-source contributors for collaboration.

aiskillstore/marketplace

Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.

aiskillstore/marketplace

Using the Wonda CLI to generate images, videos, music, and audio from the terminal — plus LinkedIn, Reddit, and X/Twitter research and automation

aiskillstore/marketplace

Comprehensive document creation, editing, and analysis with support for tracked changes, comments, formatting preservation, and text extraction. When Claude needs to work with professional documents (.docx files) for: (1) Creating new documents, (2) Modifying or editing content, (3) Working with tracked changes, (4) Adding comments, or any other document tasks

aiskillstore/marketplace

Generates creative domain name ideas for your project and checks availability across multiple TLDs (.com, .io, .dev, .ai, etc.). Saves hours of brainstorming and manual checking.

aiskillstore/marketplace

Process video files with audio extraction, format conversion (mp4, webm), and Whisper transcription. Use when user mentions video conversion, audio extraction, transcription, mp4, webm, ffmpeg, or whisper transcription.

aiskillstore/marketplace

Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output should be a bitmap asset rather than repo-native code or vector. Do not use when the task is better handled by editing existing SVG/vector/code-native assets, extending an established icon or logo system, or building the visual directly in HTML/CSS/canvas.

aiskillstore/marketplace

A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).

aiskillstore/marketplace

Router skill for LLMQuant portfolio workflows. Use when the user needs company profiles, thesis tracking, theme research, watchlist monitoring, or alert management.

aiskillstore/marketplace

Account assets, equity and fund positions, P&L, cash flow records, account statements, margin ratios, buy-power estimates, order management, and DCA recurring investments via Longbridge (most require Trade permission). Frameworks: portfolio diagnosis, rebalancing, asset allocation, risk analysis (VaR/CVaR), performance attribution, and tax-loss harvesting. Triggers: "持仓", "账户", "盈亏", "资产", "对账单", "下单", "买入", "卖出", "撤单", "定投", "组合诊断", "再平衡", "资产配置", "风险分析", "绩效归因", "税损收割", "持倉", "賬戶", "盈虧", "對賬單", "下單", "買入", "賣出", "組合診斷", "再平衡", "稅損收割", "positions", "portfolio", "P&L", "order", "buy", "sell", "DCA", "statement", "risk analysis", "rebalancing", "tax harvesting", "我的风险", "持仓风险", "风险敞口", "資產", "資產配置", "風險分析", "績效歸因", "撤單

aiskillstore/marketplace

Use for Codex models/pricing, scheduled tasks, skills, settings, setup, troubleshooting, customization, automations, and self-knowledge—including 'you,' 'your,' 'this app,' or 'this coding agent' when they refer to Codex—and for OpenAI APIs/products and ChatGPT Work. Also use for model choice/migration, prompting, SDKs, Responses, Realtime, agents, evals, and Chat/Work/Codex comparisons. Do not use for generic app/software tasks that merely mention Codex.

aiskillstore/marketplace

Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms. When Claude needs to fill in a PDF form or programmatically process, generate, or analyze PDF documents at scale.

aiskillstore/marketplace

Presentation creation, editing, and analysis. When Claude needs to work with presentations (.pptx files) for: (1) Creating new presentations, (2) Modifying or editing content, (3) Working with layouts, (4) Adding comments or speaker notes, or any other presentation tasks

aiskillstore/marketplace

Perform a read-only, defect-first review of a specified code change and return every actionable finding. Use when another agent delegates review of uncommitted changes, a base-branch diff, a commit, or custom review instructions.

aiskillstore/marketplace

Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences. Covers developer portfolios, designer portfolios, creative portfolios, and portfolios that convert visitors into opportunities.

関連スキル