What is MCP? A Comprehensive Guide - AI Encyclopedia
The Model Context Protocol (MCP) is an open protocol introduced by Anthropic that standardizes communication between large language models (LLMs) and external data sources and tools. By providing a unified interface, it enables LLMs to be flexible...
Model Context Protocol (MCP) isartificialintelligentAnthropic, a company that launched an open protocol in November 2024, standardizes large-scale language models.LLMMCP is used for communication with external data sources and tools. It is often likened to... AI The application's USB-C interface provides a unified interface, enabling... LLM It enables flexible access to and interaction with various data and services, promoting... AI Its widespread application and ecosystem development. The protocol's introduction resolves the complexity and security vulnerabilities of traditional integration methods, improves development efficiency and data security, and has been adopted by Microsoft, Open...AICompanies like Google adopted it. The emergence of MCP marked... AI A significant advancement in how models interact with the external world, enabling the construction of more...powerful,Evenintelligentof AI The application provides a solid foundation and is expected to drive the entire AI The industry is undergoing standardization. By simplifying the integration process, MCP lowers the development barrier, enabling more developers to utilize it. LLM ofpowerfulThe ability to create more valuable applications.
What is MCP?
Model Context Protocol (MCP) is an open protocol introduced by Anthropic that standardizes large-scale language models.LLMCommunication with external data sources and tools. This is achieved by providing a unified interface. LLM It allows for flexible access to and interaction with various data and services.
background
With the development of large language models (LLM)existartificialintelligentBreakthrough progress has been made in the field, demonstrating its effectiveness in various complex tasks.powerfulThe capabilities include natural language understanding, text generation, coding, and solving complex problems. However,LLM The knowledge it possesses primarily comes from its training data, which is static and confined to a specific point in time. This means... LLM They lack awareness of real-time events and cannot directly access or manipulate external private data sources or tools. To overcome these limitations, LLM To better serve real-world application scenarios, developers need to... LLM Integration with various external data sources (such as databases, APIs, and file systems) and tools (such as calculators, code execution environments, and specialized software) is crucial. Traditional integration methods require customized interface development for each specific data source or tool, a process that is not only tedious and time-consuming but also costly.
For example, if an application needs LLM Simultaneously accessing a database, calling an external API, and reading local files might require developers to write three different sets of interface code, handling different authentication and authorization mechanisms, data formats, and communication protocols. This "point-to-point" integration model leads to the so-called "..."M×N problemThis means that M models need to be integrated with N tools, which theoretically requires M×N connectors, making the system complex and difficult to maintain.
This customized integration approach also introduces security risks, such as data breaches, unauthorized access, and malicious code execution, because each new integration may introduce a new attack surface. Therefore, the industry urgently needs a standardized, unified protocol to simplify... LLM Connecting with the outside world reduces integration complexity and cost, and improves system security and maintainability.
origin
Anthropic designed MCP as an open standard, actively promoting it as an industry standard and encouraging community participation and contributions, rather than limiting it to a single vendor's technology stack. From its initial release, MCP has provided detailed specification documentation, a software development kit (SDK), and a series of reference implementations to help developers.fastAnthropic's move to get involved in and participate in the development of the MCP ecosystem has been met with a positive response from the industry. Companies including Block (formerly Square) and Apollo integrated it into their systems early on, while developer tool providers such as Zed, Replit, Codeium, and Sourcegraph began collaborating with MCP to enhance their platform's functionality. The launch of MCP marks a significant step forward in the development of the MCP ecosystem. LLM Application development has entered a new phase, greatly simplifying the process by providing a universal "language" and "interface". AI The interaction between the model and the external environment enables the construction of more...powerful,EvenintelligentEasier to integrate AI The application has laid a solid foundation.
The core objective of MCP
Reduce integration complexity
By using a unified protocol specification, the amount of customized code that developers need to write is reduced, and the integration process is simplified.
Improve development efficiency
Developers can reuse existing MCP server implementations or base them on standards.fastDevelop new MCP servers to speed up AI Application development cycle.
Enhance securityThe MCP specification includes security-related considerations, such as an OAuth 2.1-based authorization mechanism, which helps to build a more secure system. AI application.
Promote ecological development
Through open standards and community collaboration, we encourage more developers and organizations to participate in building the MCP ecosystem, developing more feature-rich and versatile MCP servers, thus enriching the ecosystem. AI The capability boundaries of the model drive AI The widespread application and innovation of technology.
The metaphor of MCP—"AI Application's USB-C interface
Model Context Protocol (MCP) is widely regarded by its creator Anthropic and the industry as... “AI Application's USB-C interfaceThis vividly illustrates the role of MCP in... AI Its core role and value within the ecosystem. Just as the USB-C interface, through its standardized, reversible, and multifunctional characteristics, has greatly simplified various electronic devices (such as laptops, etc.),intelligentThis technology enables seamless connection and data transfer between mobile phones, tablets, and peripheral devices, replacing the previous variety of incompatible interfaces (such as USB-A, Micro-USB, HDMI, VGA, etc.).
Before the advent of MCP,AI The connection between models (especially large language models) and the outside world is often fragmented and customized. Each new integration requires the development of specific adapters and interfaces, which is as inconvenient as users needing to prepare different cables and converters for different devices before the widespread adoption of USB-C.
The emergence of MCP is like... AI The world has adopted the USB-C standard, which allows... AI The model uses a universal protocol to access various MCP servers (which encapsulate access to specific data or tools) in a "plug-and-play" manner. Just as the USB-C interface supports data transfer, video output, power delivery, and other functions, MCP also supports core functions such as resource access, tool invocation, prompt management, and heuristic interaction, adapting to diverse needs. AI Application scenarios. This vividly illustrates the role of MCP in driving... AI The potential for technological popularization and application innovation is expected to become a link AI A crucial bridge between models and the real world.
MCP core components
Host
Host is the user and AI The user interface or application through which the model interacts. It is responsible for receiving user input (such as questions or instructions) and passing this input to... AI The model is processed. The host is also responsible for the display. AI The model generates responses or executes results to provide to the user. In the MCP interaction flow, the Host acts as a coordinator, understanding the user's intent and deciding when and how to invoke the MCP Client to obtain external data or execute tool operations.
A typical example of a host is Claude Desktop An application in which users can directly interact with Claude The model allows dialogue, accessing local file systems or network resources via MCP. The host needs to be able to manage the lifecycle of the MCP client and handle logic related to user interaction, such as permission requests and error messages.
Client
The MCP Client acts as a bridge between the Host and the MCP Server. It is responsible for establishing connections with one or more MCP Servers. AI The model's requests (e.g., retrieving a specific resource or invoking a tool) are encapsulated into request messages conforming to the MCP specification and sent to the corresponding server. The client is also responsible for receiving response messages from the server and returning the results to the host or directly passing them to the server. AI Model. The MCP Client needs to implement the MCP protocol specification, including message encoding and decoding, handling of transport protocols (such as HTTP, WebSockets, gRPC, or stdio), and necessary security mechanisms (such as OAuth 2.1 authentication). In some implementations, the MCP Client may be built into the Host application or called by the Host as a standalone library.
Server
An MCP Server is the component that actually provides data or performs tool operations. Each MCP Server encapsulates access capabilities to a specific data source (such as a database, file system, or API) or tool (such as a code interpreter, calculator, or specialized software). When an MCP Server receives a request from a Client, it performs the corresponding operation (e.g., querying a database, reading a file, or calling an external API) based on the request type and parameters, and encapsulates the result into a response message conforming to the MCP specification before returning it to the Client. An MCP Server also needs to implement the MCP protocol specification, exposing its supported capabilities, such as which resources, tools, and prompt templates are provided. Developers can develop custom MCP Servers based on the MCP specification to extend its functionality. AI The capabilities of the model.
This three-component architecture clearly separates user interaction, protocol communication, and specific function implementation, giving the MCP system excellent modularity and scalability. The Host focuses on the user interface and experience, the Client handles protocol-level communication, and the Server provides specific business logic and data access capabilities.
MCP Interaction Flow Example
To better understand how the three components—Host, Client, and Server—work together in the MCP architecture, we can illustrate this with a specific interaction example.
Assuming the user is Claude DesktopThe host raised a question:What documents are on my desktop?The following is a typical MCP interaction flow for handling this request:
- User InputUsers Claude In the Desktop interface, type the question "What documents are on my desktop?" and send it. Host (Claude Desktop received this user request.
- Host ProcessingThe host passes the user's original question to its internal system. AI Model (e.g.) Claude The model is used for analysis and understanding.AI The model needs to determine whether the problem requires access to external resources or tools to obtain the answer.
- Model Analysis:AI After analyzing the problem, the model identifies that the user's intent is to obtain local file system information. The model determines that an external tool capable of accessing the file system needs to be invoked. In the MCP framework, this means that the model will generate a request indicating that a specific MCP Tool needs to be invoked (e.g., a tool provided by an MCP Server that encapsulates file system browsing capabilities).
- Client RequestThe MCP Client inside the Host receives AI The model issues instructions to invoke external tools. The MCP Client, based on these instructions, locates a pre-configured MCP Server that can provide file system access services. Then, the Client encapsulates the model's request (e.g., a request to list files on the user's desktop) into a standard MCP request message according to the MCP protocol specifications and sends it to the target MCP Server via a specified transport method (e.g., HTTP, WebSockets, or stdio).
- Server ExecutionThe target MCP server (e.g., a dedicated file system MCP server) receives a request from the client. The server parses the request, verifies permissions (if necessary), and then performs the corresponding operation—in this example, scanning the user-specified desktop directory to obtain a list of files. After execution, the MCP server encapsulates the obtained list of documents (e.g., a JSON object containing filenames, paths, etc.) into a standard MCP response message and returns it to the MCP client using the same transmission method.
- Model ResponseThe MCP Client receives the response from the MCP Server, extracts the resulting data (i.e., the list of desktop documents), and passes it to... AI Model.AI After receiving this contextual information, the model combines it with the original question to generate a natural language response, such as "You have the following documents on your desktop: report.docx, budget.xlsx, image.png".
- Host DisplayHost (Claude Desktop received AI The final response generated by the model is then displayed to the user on the user interface.
MCP's core functions
Resource
The Resource function allows the MCP Server to... AI The model provides read-only contextual information or data. These resources can be static or dynamically generated data. For example, an MCP Server can provide access to a company's internal knowledge base or provide real-time stock quotes.AI The model can request these resources through the MCP Client to obtain the information needed to complete the task.
The resource design emphasizes read-only access, ensuring the security of the data source and preventing... AI The model unexpectedly modifies the original data. The MCP specification defines mechanisms such as resource discovery, subscription, and notification, enabling the model to effectively acquire and utilize this external information.
Prompt(hint)
Prompt This feature allows MCP Server to provide pre-defined prompt templates. These templates can help... AI The model generates output in a specific format or with specific content, or guides the model to perform tasks in a specific way. For example, an MCP Server can provide prompt templates for generating specific types of emails, or templates for code generation.
By using standardized suggestion templates, the quality and consistency of model output can be improved, reducing the need for hard-coded suggestions in applications. MCP allows servers to declare the suggestion templates they provide, which clients can query and use.
Tool
The Tool functionality is one of the core features of MCP, allowing... AI The model calls external APIs or tools to perform specific operations. Tools can perform various tasks, such as performing calculations, querying databases, sending emails, and controlling external devices. The MCP Server can declare the tools provided, including the tool's name, description, parameter list, and expected output format.AI After analyzing a user request, if the model determines that a specific tool needs to be invoked, it can send a tool invocation request to the corresponding server via the MCP Client. The server executes the tool and returns the result, which the model then uses to generate a response. This tool functionality greatly expands the... AI The capabilities of the model are no longer limited to text generation; it can interact more deeply with the real world.
Elicitation (Inspiration)
Elicitation allows the MCP Server to proactively request more information from the user or clarify ambiguous input during the interaction. In traditional interaction models, if the model or tool needs additional information to continue performing a task, it can only return an error or prompt the user to ask again.
Elicitation provides a more structured way to handle this situation. When the server side (via...) LLM If the analysis reveals that the current request is missing necessary parameters or the intent is unclear, a response can be returned. elicitationRequestThis includes a description or form that requires information from the user. Upon receiving this request, the host can display the corresponding interface to the user (e.g., a form with input fields), collect the user input, and then... continueElicitation The request sends information back to the server. This makes the interaction more flexible and...intelligentIt can handle more complex tasks that require multiple rounds of dialogue, such as interactive form filling and clarifying user intent.
Structured Output
The Structured Output feature requires the MCP Server to return the results of tool calls in a structured format (such as JSON). Structured output is easier to understand and use compared to returning unstructured text. AI Model parsing and understanding. The MCP specification supports defining a JSON Schema for the tool's output, allowing the model to anticipate the structure and type of the returned data, enabling more accurate subsequent processing.
For example, a weather forecasting tool might return a JSON object containing fields such as temperature, humidity, and wind speed, rather than a piece of natural language text describing the weather.
This structured output improves the efficiency of model processing results and enhances the reliability and maintainability of the system.
up to dateThe MCP specification (such as the 2025-06-18 version) further enhances support for structured content and output schemas, introducing typed, validated results and a flexible schema philosophy and MIME type clarity.
Features of MCP
flexibility
MCP supportMultiple transmission protocols and communication methodsAlthough the MCP specification itself is independent of the transport layer, it explicitly supports including... Streamable HTTP,WebSockets,gRPC as well as stdioIt supports multiple communication mechanisms, including standard input/output (often used for local inter-process communication). This versatility allows MCP to adapt to different deployment environments and performance requirements.
For example, for scenarios requiring low-latency, bidirectional real-time communication, WebSockets or gRPC might be a better choice; forSimpleFor local tool calls, stdio is more lightweight and convenient. Streamable HTTP allows data to be transmitted in a streaming manner, suitable for scenarios that handle large amounts of data or require the results to be displayed step by step.
Scalability
The protocol itself defines a core set of message types and interaction patterns, but it also allows for the introduction of new functionalities or features through extensions. MCP uses a capability negotiation mechanism, where clients and servers declare their supported capabilities when initializing a connection. If both parties support a particular extended capability, then that capability can be used in the session. This mechanism ensures the protocol's forward and backward compatibility, allowing new features to be gradually introduced without breaking the existing implementation.
Modular design
MCP Server is a lightweight program; each server is responsible for exposing only specific functionality or data sources. This allows developers to develop and deploy MCP Server on demand, building a distributed, composable system. AI Capability network.
For example, one company might develop an MCP Server specifically for accessing its internal CRM system, while another team might develop an MCP Server that connects to a specific database.
AI Applications (Hosts) can dynamically discover and use the features provided by these servers through the MCP Client, assembling complex applications like building blocks.
Openness and community-driven
As an open protocol, MCP encourages community participation and contribution, meaning more developers will create new MCP Server and Client libraries, tools, and documentation. This will enable faster response to market demands and foster more innovative application scenarios.
MCP security mechanism
OAuth 2.1-based security mechanism
Model Context Protocol (MCP) adopts a security-based approach. OAuth 2.1 Authorization framework. OAuth 2.1 is an evolution of OAuth 2.0, integrating OAuth 2.0 best practices and security recommendations, providing more...powerfulA more user-friendly authorization solution. In the MCP interaction flow, when an MCP Client needs to access a protected MCP Server (i.e., the Server that provides sensitive data or performs sensitive operations), OAuth 2.1 authentication and authorization are required. This means that the Client needs to first obtain an Access Token from the Authorization Server and then include that token when making a request to the MCP Server. The MCP Server verifies the validity of the token (e.g., verifying the signature and validity period via the introspection endpoint or JWKS endpoint) and checks whether the token contains the scopes required to perform the requested operation.
The MCP specification specifically emphasizes some key security features in OAuth 2.1, such as PKCE (Proof Key for Code Exchange) Used to prevent authorization code interception attacks, and Token Audience Binding (RFC 8707) This ensures that access tokens can only be used by the intended MCP Server. It effectively prevents token abuse across servers and improves overall system security.
Security Best Practices
The Model Context Protocol (MCP) ecosystem emphasizes a set of security best practices to ensure security in increasingly complex environments. AI Maintaining data security, privacy, and system integrity in application scenarios.
- MCP Server Security Hardening and Deployment PracticesWhen deploying an MCP server, the principle of least privilege should be followed, opening only necessary services and ports. The operating system should be hardened, and security enhancement tools should be considered. All incoming input (such as user prompts and tool parameters) must be rigorously validated and sanitized to prevent common web attacks such as prompt injection and parameter poisoning. For locally running MCP servers, it is recommended to run them in containers (such as Docker, running as a non-root user) or virtual machines to achieve isolation from the host system. Network access control should also be strictly configured to avoid directly exposing the MCP server to the public internet; localhost or a private subnet should be used for binding.
- MCP Client-Tool Interaction SecurityThe MCP client should leverage MCP's support for OAuth 2.1, using short-lived, limited-scope tokens for authentication. All interactions should be authenticated. In terms of tool design, each tool should provide clear metadata, including its functional description, input parameters, expected output, and potential side effects. For tools that may modify data or have a significant impact, appropriate metadata should be used.
readOnlyHintanddestructiveHintSuch annotations provide explicit markings to help the runtime environment take appropriate safety measures. - Credential and Key Management:This is a fundamental requirement; hardcoding credentials or API keys in configuration files should be absolutely avoided. Environment variables or a dedicated key management service should be used to store and access sensitive information, and keys should be rotated regularly.
- Enable detailed logging and monitoring:This is crucial for post-incident auditing, anomaly detection, and security incident investigation. MCP servers and clients should be configured to log all operations, including requests, responses, errors, and user interactions. Specifically, all requests sent to… AI Model prompts can help detect and prevent prompt injection attacks.
- Establish MCP Server governance processOrganizations should establish a formal approval process for adding new MCP Servers to the environment, including security reviews and source code verification. Maintain a list of approved MCP Servers and consider establishing an internally reviewed MCP Server repository to reduce the risk of introducing malicious or vulnerable servers.
Industry adoption of MCP
Since its release, the Model Context Protocol (MCP) has quickly gained widespread attention and active adoption in the industry.Anthropic As the originator of MCP, it was the first to integrate and support MCP in its product line, for example, in its Claude Desktop applications and Claude In the model.
OpenAI Announced in early 2025 in its Agents SDK, ChatGPT MCP is supported in desktop applications and the Responses API.
Microsoft Actively participating in the MCP ecosystem, Playwright-MCP server was launched, enabling... AI Agents can browse web pages and interact with websites just like humans.
Google MCP is used in the product.
Docker The MCP Toolkit was launched, providing...One-clickFeatures such as deployment and a catalog containing over 100 secure MCP servers simplify the deployment and management of MCP servers.
Application Cases of MCP
Applications in the field of financial technology
- intelligentInvestment AdvisorMCP can make AI Real-time access to investment advisory systemsup to dateThe system uses information such as stock prices, financial news, and company financial reports (via the Resource function) to analyze clients' risk preferences and investment goals (potentially through interaction with users via the Elicitation function). It then calls upon the trading execution tool (Tool function) to provide clients with personalized investment advice and execute trades.
- Anti-fraud analysis:By connecting to various data sources (such as transaction records, user behavior logs, and blacklist databases).LLM It can help identify suspicious transaction patterns.
- Customer ServiceMCP enables chatbots to answer common questions, query user account information (with authorization), and process...SimpleFinancial institutions can provide personalized financial advice based on business requests (such as fund transfers and bill inquiries). Through MCP's standardized interface, financial institutions can utilize [the platform] more securely and conveniently. LLM ofpowerfulCapabilities to ensure data security and compliance.
Applications in the medical and health field
- Clinical decision supportDoctors can AI The assistant describes the patient's symptoms and medical history.AI The assistant queries relevant medical knowledge bases (Resources) through MCP.up to dateMCP provides clinical guidelines (Resource) and diagnostic aids (Tool) to offer doctors diagnostic suggestions and treatment options. Its Elicitation feature can be used to ask doctors for more details or confirm key information during the diagnostic process.
- Personalized medicine:MCP can help integrate patients' genomic data, lifestyle data, and other information to provide patients with customized health management advice and disease prevention plans.
- Medical researchMCP can accelerate the literature review process and help researchers.fastExtract key information from massive amounts of literature, or assist in the analysis of clinical trial data.
- Patient monitoring systemBy connecting wearable devices and sensor data, MCP can analyze patients' health status in real time and issue timely warnings when abnormalities occur. MCP's security mechanisms, especially its OAuth 2.1-based authorization, are crucial for handling sensitive medical data, ensuring that only authorized users and applications can access patient information.
Technology Industry Applications
- Software developmentIntegrated Development Environment (IDE) can be used with MCP. LLM ofpowerfulCoding capabilities are seamlessly integrated with local development environments, version control systems (such as Git MCP Server), debugging tools, API documentation, etc. Developers can use natural language commands to... AI The assistant writes and explains code, generates test cases, finds and fixes bugs, and deploys the application. For example, a developer might ask, "Run the test on my current branch and summarize why it failed."AI The assistant can use MCP to call Git tools to obtain code, call testing tools to execute tests, and then analyze logs and generate reports.
- IT Operations and Support:AI The operations and maintenance assistant can connect to monitoring systems, log servers, configuration management databases (CMDBs), etc., and help operations and maintenance personnel diagnose problems and perform maintenance tasks through natural language interaction.automaticStreamline the troubleshooting process. For example,AI The assistant can, based on the alarm information,automaticQuery the logs of the relevant servers (using the log query tool provided by MCP Server), analyze the cause of the error, and suggest a repair solution.
- Technical Documentation Assistant:Help usersfastFind the necessary technical information, or generate code snippets and configuration examples based on user needs. Technology companies can use MCP to encapsulate their internal knowledge base, API services, etc., into an MCP Server, allowing internal employees or external developers to access them. LLM Convenient access and use enhance work efficiency and innovation.
MCPup to dateProtocol update log
-
Remove JSON-RPC batch processing supportTo simplify specifications and avoid ambiguity, especially in implementation
Streamable HTTPDuring transmission, no actual need for batch processing was found, and the JSON-RPC notification/response model could not meet the requirements for real-time and concurrent calls, so this feature was removed. -
Enhanced tool call results, added structured output functionality: Introduced
outputSchemaandstructuredContentThis improvement is designed not to break existing fields.contentUnder the premise of structure, forSimpleThe JSON output provides a lightweight, verifiable formatted channel. This is especially important for improving data security and reliability when interacting with untrusted servers, allowing clients to more accurately parse and verify responses from tools. For example, a network device status retrieval tool can define an output schema that includes fields such as device ID, status, and runtime, ensuring the structured and verifiable nature of the returned data. -
Classify the MCP server as an OAuth resource serverIt also adds protected resource metadata (following RFC 9728) to help discover the corresponding authorization server. This is helpful for clients.automaticDiscover authorized servers to prevent the abuse of access tokens and improve overall security and deployment consistency.
-
MCP clients are required to implement Resource Indicators that comply with RFC 8707.This is to prevent malicious servers from obtaining access tokens. This is achieved by including the authorization request and token request...
resourceThe parameters allow the client to explicitly specify the target MCP server for the token, enhancing the security of OAuth 2.0 authorization. -
Supports the “Elicitation” feature.Elicitation allows the server to dynamically request additional information from the user during the interaction. Previously, MCP lacked a standardized way to support this runtime interaction, often requiring developers to rely on multi-step tool calls or custom protocols. The introduction of the Elicitation mechanism provides a structured input mechanism for scenarios such as confirmation, clarification, and login redirection in the workflow, perfecting the two-way interaction loop between the model, user, and server. For example, before performing a deletion operation, the server can request user confirmation via elicitation; or dynamically send a request to the client when specific user information (such as time zone or organization name) is needed.
-
The tool's results now include a new "Resource Links" type.To support tools returning references to external or large resources, rather than directly embedding their content, a new [mechanism/mechanism] has been introduced.
ResourceLinkTypes. Addresses scenarios where directly embedding content into interactive flows is impractical or inefficient, such as lazy loading, handling large files, or temporary resources. -
Clarify safety precautions and best practicesThe authorization guidelines have been updated with relevant explanations, and a new "Security Best Practices" page has been added to guide developers in building more secure MCP applications.
The Development Prospects of MCP
Model Context Protocol (MCP) as a standard AI The open protocol for model interaction with external systems and data sources will focus on promoting broader industry standardization, continuously enhancing core functionality and security, and constantly expanding its ecosystem and improving interoperability in the future.artificialintelligentWith the rapid development of technology and the continuous deepening of application scenarios, MCP is committed to solving current problems. AI Integration faces challenges such as fragmentation, complexity, and security vulnerabilities, necessitating the construction of more...powerfulMore reliable and easier to integrate AI Applications provide a solid foundation. The community and developers are actively driving the evolution of MCP to adapt to growing demands and the ever-changing technological landscape.