Model Context Protocol.
MCPとは
A protocol for seamless integration between LLM applications and external data sources.
- 2024年11月に、Anthropicが発表したクライアント-サーバー間通信のプロトコル.
- 通信プロトコルを定め、LLMにコンテキストを渡す方法を標準化することが目的.
- 自然言語で指示できるLLMのための🔌API.
- AIアプリケーション用のUSB-Cポートのようなもの
- AI がシステムにアクセスする時の「接続のしかた」をルール化したもの
https://github.com/modelcontextprotocol
できること
- ファイルアクセス
- Webアクセス/ブラウザ操作
Core Architecture
- Hosts are LLM applications (like Claude Desktop or IDEs) that initiate connections
- Clients maintain 1:1 connections with servers, inside the host application
- Servers provide context, tools, and prompts to clients
- Local Data Sources: Your computer’s files, databases, and services that MCP servers can securely access
- Remote Services: External systems available over the internet (e.g., through APIs) that MCP servers can connect to
ref. Core architecture - Model Context Protocol
Core components
- プロトコル層(Protocol layer): メッセージのフレーミング、リクエスト/レスポンスの関連付け、高レベルな通信パターンを扱う
- トランスポート層(Transport layer): クライアントとサーバー間の実際の通信を扱う
- メッセージタイプ: リクエスト(Request): 応答を期待するメッセージ。method とオプションの params を含む
Transport Layer
- JSON-RPC 2.0
MCP Servers
データソース側
Functions
3つの主要機能.
- Model(AI モデルのための)
- Context(提示されるサービスの情報・利用方法などの)
- Protocol(共通ルール)
Index
https://github.com/modelcontextprotocol/servers
- Filesystem MCP Server: ローカルファイルシステムアクセス.
- desktop-commander: WSLやLinuxなどのファイルシステムアクセス.
- blender MCP: https://github.com/ahujasid/blender-mcp
- Youtube MCP:
- https://github.com/anaisbetts/mcp-youtube, API_KEY不要.
- https://github.com/ZubeidHendricks/youtube-mcp-server, 多機能、API準拠.
dev
- github: https://github.com/github/github-mcp-server
- context7: versionごとのドキュメント参照
Smithery
- https://smithery.ai/: ホスティングサイト.
Docker MCP(Docker Desktop/AI Tools)
これはdockerの操作というよりも、dockerをつかったローカルMCP server構築.
Refs
MCP Hosts
LLM applications that initiate connections.
現状ではこの3つが三強.
- 🖥Claude for Desktop
- 🗒Cursor
- Windsurf
MCP Client
Specs
Topics
npx vs npm install
基本方針はnpx.
- npx
- 自動アップデート. 定期的なupdate不要.
- ネットが必要.
- 数秒起動が遅い.
- npm i
- オフラインで利用できる
- 数秒npxよりも早い.