|
| 1 | +# Unit1 recap |
| 2 | + |
| 3 | +## Model Context Protocol (MCP) |
| 4 | + |
| 5 | +The MCP is a standardized protocol designed to connect AI models with external tools, data sources, and environments. It addresses the limitations of existing AI systems by enabling interoperability and access to real-time information. |
| 6 | + |
| 7 | +## Key Concepts |
| 8 | + |
| 9 | +### Client-Server Architecture |
| 10 | +MCP follows a client-server model where clients manage communication between users and servers. This architecture promotes modularity, allowing for easy addition of new servers without requiring changes to existing hosts. |
| 11 | + |
| 12 | +### Components |
| 13 | +#### Host |
| 14 | +The user-facing AI application that serves as the interface for end-users. |
| 15 | + |
| 16 | +##### Client |
| 17 | +A component within the host application responsible for managing communication with a specific MCP server. Clients maintain 1:1 connections with servers and handle protocol-level details. |
| 18 | + |
| 19 | +#### Server |
| 20 | +An external program or service that provides access to tools, data sources, or services via the MCP protocol. Servers act as lightweight wrappers around existing functionalities. |
| 21 | + |
| 22 | +### Capabilities |
| 23 | +#### Tools |
| 24 | +Executable functions that can perform actions (e.g., sending messages, querying APIs). Tools are typically model-controlled and require user approval due to their ability to perform actions with side effects. |
| 25 | + |
| 26 | +#### Resources |
| 27 | +Read-only data sources for context retrieval without significant computation. Resources are application-controlled and designed for data retrieval similar to GET endpoints in REST APIs. |
| 28 | + |
| 29 | +#### Prompts |
| 30 | +Pre-defined templates or workflows that guide interactions between users, AI models, and available capabilities. Prompts are user-controlled and set the context for interactions. |
| 31 | + |
| 32 | +#### Sampling |
| 33 | +Server-initiated requests for LLM processing, enabling server-driven agentic behaviors and potentially recursive or multi-step interactions. Sampling operations typically require user approval. |
| 34 | + |
| 35 | +### Communication Protocol |
| 36 | +The MCP protocol uses JSON-RPC 2.0 as the message format for communication between clients and servers. Two primary transport mechanisms are supported: stdio (for local communication) and HTTP+SSE (for remote communication). Messages include requests, responses, and notifications. |
| 37 | + |
| 38 | +### Discovery Process |
| 39 | +MCP allows clients to dynamically discover available tools, resources, and prompts through list methods (e.g., `tools/list`). This dynamic discovery mechanism enables clients to adapt to the specific capabilities each server offers without requiring hardcoded knowledge of server functionality. |
| 40 | + |
| 41 | +### MCP SDKs |
| 42 | +Official SDKs are available in various programming languages for implementing MCP clients and servers. These SDKs handle protocol-level communication, capability registration, and error handling, simplifying the development process. |
| 43 | + |
| 44 | +### Gradio Integration |
| 45 | +Gradio allows easy creation of web interfaces that expose capabilities to the MCP protocol, making it accessible for both humans and AI models. This integration provides a human-friendly interface alongside AI-accessible tools with minimal code. |
0 commit comments