Interactive Model Context Protocol (MCP) Tutorial
1. Resources
Resources are data exposed by the server. They can be text or binary, and are identified by URIs.
- resources/list: Discover available resources.
- resources/list_templates: Discover dynamic resources generated from URI templates.
- resources/read: Read resource content.
- notifications/resources/list_changed: Real-time updates on available resources.
- resources/subscribe: Subscribe to changes in resource content.
2. Prompts
Prompts are reusable templates exposed by servers. They allow for dynamic arguments and context inclusion.
- prompts/list: Discover available prompts.
- prompts/get: Retrieve a prompt with arguments.
3. Tools
Tools are executable functions on the server, allowing LLMs to interact with external systems.
- tools/list: Discover available tools.
- tools/call: Execute a tool with specified arguments.
4. Sampling (Optional)
Sampling allows servers to request LLM completions. Note: not all clients support sampling.
- sampling/createMessage: Send conversation history and parameters to the LLM for completion.
5. Transports
Transports handle communication between clients and servers.
- stdio: Standard input/output for local connections.
- SSE: Server-Sent Events over HTTP.
- Custom Transports: Implement custom transports using the Transport interface.
All transports use JSON-RPC 2.0 for message exchange.
6. Clients
Various clients implement the MCP, including:
- Claude Desktop
- Zed
- Sourcegraph Cody
Each client's MCP support varies. Consult their documentation for specifics.