Claude認定 対策ノート

講座 › 分野8 ツールとMCP

8.2 MCPサーバーの開発

配点 2.1%MCP Server Development

MCPは、ホスト(Claude Codeなど)がサーバーにつなぐ共通の規格。サーバーはツール・リソース・プロンプトを提供し、stdioかStreamable HTTPで通信する。

未読

ホスト・クライアント・サーバー

図解:ホスト・クライアント・サーバー

MCPは、クライアントとサーバーの作りです。Claude CodeやClaude DesktopのようなAIアプリがMCPのホストで、1つ以上のMCPサーバーにつなぎます。ホストは、サーバーごとにMCPのクライアントを作って管理します。

出典:MCP architecture
MCP follows a client-server architecture where an MCP host
https://modelcontextprotocol.io/docs/2026-07-28/learn/architecture.md(取得 2026-11-17)
出典:MCP architecture
The AI application that coordinates and manages one or multiple MCP clients
https://modelcontextprotocol.io/docs/2026-07-28/learn/architecture.md(取得 2026-11-17)

ツール・リソース・プロンプト

図解:ツール・リソース・プロンプト

MCPのサーバーは3種類のものを提供します。ツールは、モデルが自分で呼ぶかどうかを決める関数で、データベースへの書き込みや外部APIの呼び出しができます。リソースは、ファイルの中身やデータベースの構造のような、読み取り専用の情報源で、アプリが管理します。プロンプトは、ツールやリソースを使う作業の型で、利用者が選びます。

出典:MCP server concepts
Functions that your LLM can actively call, and decides when to use them based on user requests.
https://modelcontextprotocol.io/docs/2026-07-28/learn/server-concepts.…(取得 2026-11-17)
出典:MCP server concepts
Passive data sources that provide read-only access to information for context
https://modelcontextprotocol.io/docs/2026-07-28/learn/server-concepts.…(取得 2026-11-17)
出典:MCP server concepts
Pre-built instruction templates that tell the model to work with specific tools and resources.
https://modelcontextprotocol.io/docs/2026-07-28/learn/server-concepts.…(取得 2026-11-17)

通信の方式:stdioとStreamable HTTP

図解:通信の方式:stdioとStreamable HTTP

MCPのメッセージはJSON-RPCで表します。標準の通信方式は2つです。stdioは、クライアントが起動した子プロセスの標準入出力でやり取りし、通常1つのクライアントに仕えます。Streamable HTTPは、リモートのサーバーで使い、多くのクライアントに仕えます。stdioのサーバーでは、標準出力にログを書くとメッセージが壊れるので、ログは別の出力に書きます。

出典:MCP transports
MCP uses JSON-RPC to encode messages.
https://modelcontextprotocol.io/specification/2026-07-28/basic/transpo…(取得 2026-11-17)
出典:MCP architecture
Local MCP servers that use the STDIO transport typically serve a single MCP client, whereas remote MCP servers that use the Streamable HTTP transport will typically serve many MCP clients.
https://modelcontextprotocol.io/docs/2026-07-28/learn/architecture.md(取得 2026-11-17)
出典:Build an MCP server
Never write to stdout. Writing to stdout will corrupt the JSON-RPC messages and break your server.
https://modelcontextprotocol.io/docs/2026-07-28/develop/build-server.m…(取得 2026-11-17)

Claudeアプリとの統合

図解:Claudeアプリとの統合

Claude Codeでは、プロジェクトの .mcp.json などでMCPサーバーを設定できます。Messages APIでは、MCPコネクターを使って、リモートのMCPサーバーにAPIから直接つなげます。1つのMCPサーバーを作れば、複数のClaudeアプリから再利用でき、アプリと切り離して保守できます。

出典:Claude Code MCP
When configuring MCP servers via JSON in `.mcp.json`
https://code.claude.com/docs/en/mcp.md(取得 2026-11-17)
出典:Claude Certified Developer – Foundations 試験ガイド v1.0(日本語)
MCPサーバーは、複数のClaudeアプリケーションで共有でき、独立して保守できる再利用可能なツールを公開します
https://everpath-course-content.s3-accelerate.amazonaws.com/instructor…(取得 2026-11-17)
試験のポイント