MCP (Model Context Protocol) is an open protocol proposed by Anthropic, aiming to standardize the interaction between AI models and external data sources/tools. It defines the following core concepts:
1. Resources
Resources are contextual data that models can read, such as file contents, database records, API responses, etc. MCP allows servers to expose resources, and clients to obtain them on demand.
2. Tools
Tools are functions that models can call, such as sending emails, querying weather, executing code, etc. MCP standardizes the tool description format (input parameters, return values) and calling mechanism.
3. Prompts
Prompts are reusable instruction templates. MCP supports servers to provide predefined prompts, which clients can use after injecting variables.
4. Sampling
Sampling is the reverse capability of MCP, allowing servers to request clients (i.e., LLMs) to complete generation tasks and achieve bidirectional communication.