Overview of AI MCP Protocol: What It Is and Why It Matters

Kevin
目录

Model Context Protocol (MCP) is an open standard that defines how AI applications provide context and tooling to Large Language Models (LLMs). Introduced by Anthropic in late 2024, MCP is often described as the "USB-C port for AI applications," providing a universal interface to connect AI models with various data sources and tools. By establishing common rules for context exchange, MCP allows any compliant LLM client to communicate with any server that offers data or actions, regardless of the underlying vendor or technology. This standardization eliminates the need for custom one-off integrations for each tool or data source. In essence, MCP's goal is to make AI agents more useful by easily giving them access to the external information and functions they need.

Why MCP? Goals and Key Benefits

Modern LLMs often need to retrieve knowledge, call APIs, or manipulate files as part of their reasoning. MCP was designed to streamline these integrations in a model-agnostic way. Some of the key goals and benefits include:

Core Benefits

  • Standardized Tool Access: MCP defines a single protocol for connecting any LLM to any external tool or data source, much like HTTP did for web resources. This unified integration means developers and enterprises can plug in new capabilities without redesigning their AI system for each tool.
  • Flexibility Across Providers: Applications using MCP can switch between different LLM providers or models without losing access to tools. The protocol abstracts the model interface from the tools, so you could use OpenAI's GPT today and another model tomorrow, and still use the same MCP servers.
  • Security and Compliance: MCP encourages best practices for securing data and controlling access. The host application (which embeds the LLM) mediates what the model can see or do, and users must grant consent for sensitive actions. Data remains within your infrastructure when using self-hosted MCP servers, helping maintain compliance.
  • Faster Development & Ecosystem Growth: A standard protocol reduces reinventing the wheel. Developers can build reusable MCP servers for common services (databases, Slack, etc.), and any MCP-enabled client (LLM app) can utilize them. This lowers integration effort and fosters a growing ecosystem of pre-built integrations. Indeed, there is already a gallery of MCP servers (for filesystems, databases, Git, Slack, etc.) maintained by the community and companies.
  • Separation of Concerns: MCP cleanly separates the concerns of LLM prompting/coordination (handled by the client/host) and data access or computations (handled by servers). This modularity makes systems more maintainable. For example, a server can focus on providing database queries, while the host worries about how the LLM uses those results in a conversation.

In summary, MCP brings interoperability and consistency to the otherwise fragmented world of LLM integrations. It's not reinventing AI capabilities, but it standardizes them – which can significantly accelerate building complex AI workflows.

Architecture and Core Components

MCP follows a client–server architecture with an intermediary host. At a high level, an MCP-enabled application (the host) can connect to multiple external servers through dedicated client connections. This design allows AI assistants to tap into various tools and data securely, while maintaining clear boundaries between different integrations.

[@portabletext/react] Unknown block type "image", specify a component for it in the `components.types` prop

Component Roles and Responsibilities

ComponentRole & Responsibilities
Host (LLM app)Coordinates the overall system and LLM integration. Manages multiple clients, handles user authorization for tool usage, and aggregates context from servers for the model. Enforces security boundaries between servers and ensures the AI only sees approved data.
Client (per server)Maintains a stateful connection to one server. Handles protocol negotiation (version & capabilities) on initialization, routes requests/responses and notifications between host and server, and manages subscriptions or streaming outputs. Acts as an isolation layer so that each server interacts only through the defined protocol.
Server (integration)Exposes specific data or functionality to the client via standardized MCP messages. Implements primitives like resource access or tool execution. Must respect security (only act within allowed scope) and cannot see other servers' data. Can be swapped out or combined easily thanks to the common protocol.

Client-Server Communication

Under the hood, MCP communication uses a request-response message pattern based on JSON-RPC 2.0. Unlike typical REST or GraphQL APIs which are stateless, MCP keeps a persistent connection between client and server for real-time, two-way interaction. This allows servers to send asynchronous notifications (for example, "file X has updated") and enables streaming of results.

Transport Options

Connections can be implemented over different transports:

  • Stdio (Standard I/O): Suitable for local servers, where the client and server processes communicate via stdin/stdout pipes. This is simple and efficient when running a tool on the same machine as the host.
  • HTTP + SSE: Ideal for remote servers. The client sends requests via HTTP POST, and the server pushes events or responses back via a Server-Sent Events stream. This enables firewall-friendly communication over HTTPS and allows multiple clients to interact with a hosted server.
  • Custom Transports: The protocol is transport-agnostic; new mechanisms (e.g. WebSockets, gRPC) can be added as needed, as long as they carry JSON-RPC messages.

Message Types

MCP defines a few fundamental message types in JSON format:

  • Request: a call from one side (client or server) to perform an operation, expecting a response. For example, a client might send a request { "method": "resources/list" } to ask a server for available data resources.
  • Result: a successful response to a request, containing the outcome. For instance, the server might reply with { "id": 5, "result": { "resources": [ ... ] } } when the resource list is ready.
  • Error: a response indicating the request failed, including an error code and message (e.g. method not found, invalid params). MCP adopts standard JSON-RPC error codes (like -32601 for Method Not Found) and allows custom error codes for application-specific issues.
  • Notification: a one-way message that does not expect any response. Notifications are used for events or updates. For example, a server can send a notification {"method": "notifications/resources/updated", "params": {...}} to inform the client that some resource's content has changed.

Session Lifecycle

Every client-server session goes through a defined lifecycle:

Initialization: The client opens the connection and sends an initialize request advertising its protocol version and capabilities (features it supports). The server replies with its own version and capabilities. They agree on any optional features to enable, then the client sends an initialized notification to confirm the setup. At this point, both sides know what the other is capable of (for example, whether the server supports certain tool types, or the client supports streaming responses).

Message Exchange: The client and server freely exchange requests and notifications as needed. The client might request data or invoke a tool; the server might send notifications (like resource update events) or even request something from the client if allowed (e.g. ask the client's LLM for help via sampling, discussed later). All interactions must conform to the capabilities negotiated – e.g. if a server didn't declare a "tools" capability, the client won't attempt tool invocation.

Termination: Either side can gracefully close the connection (e.g. the host application shuts down or user disables an integration). This might involve an explicit close message or simply disconnecting the transport. The protocol handles unexpected drops as errors, but the goal is to allow clean shutdown so servers can release resources.

Throughout the session, the capability negotiation step is critical. MCP uses capability flags to enable or disable chunks of functionality based on what both sides support. For example, a server that implements the "resources" feature will include a resources capability in its initialize response, and only then can the client start using resource-related requests with that server. Similarly, if a client doesn't support sampling, the server will know not to attempt those requests. This explicit negotiation makes each session self-describing and extensible – new capabilities can be added in future MCP versions without breaking older clients/servers, as unsupported features will simply not be advertised.

MCP Primitives and Functionality

Once an MCP client and server are connected, what can they actually do? MCP defines a set of primitives – standardized interactions that cover most needs of LLM-based agents. The core primitives are Resources, Tools, Prompts, and Sampling, along with the concept of Roots for scoping. These enable reading data, performing actions, using templated prompts, and even having the server request model completions. Below we dive into each:

Resources (Read-Only Context Data)

Resources in MCP represent pieces of data or content that a server makes available for the LLM's context. Think of resources as documents, files, database entries, or other chunks of information that the AI might read to better answer user queries. For example, a filesystem server might expose text files as resources, or a database server could expose query results as resources. Each resource is identified by a URI (a unique address) so that the client can request it.

Resource URI Examples

  • file:///home/user/documents/report.pdf – a file on the local disk
  • postgres://database/customers/schema – a database table or query result
  • screen://localhost/display1 – perhaps a screenshot image from the local screen

Resources are read-only from the LLM's perspective (the server may retrieve or update them from the source, but the LLM cannot directly modify them through MCP). They often contain text (code files, logs, articles) but can also be binary data (images, PDFs) encoded in base64. The client application usually requires user action to include a resource for the model: for instance, a user might click a file for the assistant to consider, or approve the assistant's request to open a document. This user-in-the-loop control ensures the model doesn't automatically read sensitive data without permission.

Key Resource Operations

  • Listing Resources: The client can ask the server for a list of available resources via a standardized request (resources/list). The server responds with a list of resources, each with a uri, a human-friendly name, and optionally a description, MIME type, size, etc. This allows the AI (or user) to discover what data is accessible. For example, a code repository server might list files or a summary of available logs.
  • Reading Resources: Given a resource URI, the client can request its content using resources/read. The server will fetch the data (e.g. read the file or perform the API call) and return the content in a response. Text content is returned as UTF-8 text, whereas binary content is base64-encoded. Notably, a single read request can return multiple related resources if appropriate (e.g. reading a directory URI could return a listing of files as multiple resource entries).
  • Resource Updates: MCP supports push notifications for changes in resources. A server can send a notifications/resources/list_changed when the overall set of resources has changed (e.g. a new file appeared). Moreover, a client can subscribe to a particular resource to be alerted of content changes: the client sends resources/subscribe {uri} and the server will notify via notifications/resources/updated whenever that resource's content updates. This is powerful for real-time scenarios like tailing logs or updating answers when underlying data changes.

Resources are meant to provide grounding context for the LLM. For example, in a customer support bot, an MCP server could expose knowledge base articles as resources; the AI can then read the relevant article to answer a question accurately. Because resources pass through the host, the application can implement caching, access control, or filtering as needed. Also, if an AI model itself is choosing which resources to read (some clients might allow this), they often do so by first seeing high-level resource info (name, description) and then the host gating the actual content read step. Overall, resources are the mechanism for retrieval-augmented generation in MCP – they deliver external knowledge to the model in a controlled way.

Tools (Executable Actions)

[@portabletext/react] Unknown block type "image", specify a component for it in the `components.types` prop

Tools are the way MCP enables an AI to perform actions or retrieve live results – essentially function calls that the LLM can invoke via the server. Each tool is like an API endpoint or function exposed by the server. For example, a weather server might have a get_forecast tool, or a Jira server might have a create_ticket tool. Tools go beyond static data: they do something (and often return a result).

Unlike resources which are user-triggered, tools are intended to be model-controlled (with user oversight). This means the AI itself can decide to call a tool as part of its reasoning process, and the host will execute it via MCP. To prevent abuse or mistakes, typically the user is asked to approve the tool call (especially if it's sensitive like sending an email), but the initiation comes from the AI's logic.

Key Tool Features

  • Discovery: The client can query what tools a server offers by sending tools/list. The server responds with a list of tools, each described by a name and a short description of what it does. For instance, a "Database" server might list a run_query tool.
  • Tool Schema: Every tool comes with an input schema that specifies what parameters it accepts. MCP uses JSON Schema for this. For example, a calculate_sum tool might require two numbers a and b as inputs, so its schema would declare those properties and their types. This schema is valuable because it lets the LLM or the host validate tool arguments and know exactly what format to provide. It's analogous to how OpenAI's function calling also uses JSON Schema to define parameters. Thanks to this, the AI can be prompted in such a way that it outputs a JSON object matching the schema when it wants to use the tool.
  • Invocation: To execute a tool, the client sends a tools/call request with the tool name and arguments. The server then performs the action and returns the result (if any) in the response. The result could be simple (e.g. a text answer, or a confirmation that "Email sent") or complex (structured data). For example, calling a search_web tool might return a JSON with search results that the AI will then summarize.
  • Tool Results to LLM: The host will typically inject the result of a tool call back into the LLM's context (often as a special "assistant" message indicating the tool's output). This way, the model can incorporate it into the conversation. MCP defines a standard content type for tool outputs (the content can be of type "text" or other, and tools can also return binary data in base64 if needed, similar to resources).

Tools can range from read-only queries to actions that change state. The MCP spec includes optional annotations for tools to hint their nature, such as readOnlyHint, destructiveHint, idempotentHint, etc. For instance, a delete_file tool might be marked destructive so the host could double-confirm with the user. These annotations aren't enforced by the protocol, but they inform the UI/host how to treat the tool (e.g. maybe disallow an autonomous agent from running destructive tools without human confirmation).

Tool Usage Example

Suppose a user asks an AI assistant, "Schedule a meeting with John next week." The assistant has access to a Calendar MCP server with a create_event tool. The flow might be:

The host (LLM app) receives the user request and knows from tools/list that the Calendar server provides create_event(title, date, invitees, ...).

The host passes the user query and tool info into the LLM. The LLM's response indicates it wants to call create_event with appropriate arguments (perhaps the model produces a structured output matching the schema).

The host sees this and issues a tools/call to the Calendar server via the MCP client.

The server creates the event in the calendar and returns details or confirmation.

The host injects that result back to the LLM as needed, and the LLM produces a final answer like "I've scheduled the meeting with John for next week at 10am." The host may also show a UI notification to the user that an event was created, etc.

Behind the scenes, MCP ensured the LLM's intent was carried out by a well-defined interface instead of the model having to manipulate a website or an API by raw text. This is more reliable and secure.

Comparatively, MCP's tools are similar in spirit to OpenAI's function calling, but with more flexibility. OpenAI's approach requires functions to be pre-defined in the prompt for that session and is tightly coupled to OpenAI's API. MCP moves this to a persistent, model-agnostic layer: any MCP client can invoke any server's tool at runtime, with a continuous session allowing multi-step tool use and stateful interactions.

Prompts (Reusable Templates & Workflows)

Prompts in MCP are predefined prompt templates or conversational workflows that servers can offer to the host. The idea is to standardize common interactions or tasks as selectable "canned" prompts, which can then be filled in or triggered by the user (or even suggested by the AI). For example, a project management server might provide a prompt template for "Summarize the project status," which when invoked will feed the LLM a structured set of instructions and context to generate a summary.

Prompt Characteristics

  • A prompt has a name, description, and optionally a list of arguments it accepts. Arguments allow some dynamic input to be inserted (e.g. a date range or a specific file name). They can be marked required or optional.
  • Clients discover available prompts via prompts/list similar to tools. The server returns a list of prompt definitions (name, description, arguments).
  • To use a prompt, the client sends prompts/get with the chosen prompt name and any argument values. The server responds with a payload containing the actual prompt content to inject, typically in the form of a list of message parts. Essentially, the server generates a structured set of chat messages or instructions which the client can then prepend or insert into the LLM's conversation.

Advanced Prompt Features

Prompts can do sophisticated things:

  • They may include static text (instructions, boilerplate) and also embedded resources. For example, a "Analyze Logs and Code" prompt might pull in the latest logs and a code file as part of the user message content automatically, so the LLM is presented with: "User: Analyze these logs [log text inserted] and this code [code text inserted] for issues." The prompt template defines that structure, so the server knows to fetch the relevant resources when preparing the prompt.
  • Prompts can also chain multiple interactions or set up a scenario. For instance, a prompt could guide the model through a multi-turn reasoning process or ensure that certain instructions are always provided (like a system message telling the model how to format its answer).

In practice, prompts serve as reusable skills or commands exposed by the server. Many UI clients surface prompts as shortcuts or slash-commands that the user can select. For the AI assistant, using a prompt is like executing a predefined playbook for a task. Because the templates reside on the server side, they can be updated or improved independent of the client/AI. And since they're user-triggered (the user chooses to run a prompt template), they help maintain user control – the model isn't deciding to run a prompt; it's the user or developer providing it as a tool for consistency.

Sampling (LLM-in-the-Loop from Server Side)

[@portabletext/react] Unknown block type "image", specify a component for it in the `components.types` prop

One of MCP's more advanced features is sampling, which essentially allows a server to ask the host's LLM to generate a completion. Normally, the host is the one sending requests to servers, but what if a server needs the model's help to complete its task? Sampling enables server-initiated calls to the LLM through the client, under controlled circumstances.

Use cases for sampling include complex agent behaviors. For example, imagine a server that implements a multi-step reasoning algorithm (like a solver that sometimes asks the AI to reflect or guess something). The server might not have its own ML model, so it wants to leverage the host's LLM partway through its work. With sampling, it can send a request to the client like "Please get the AI's completion for this intermediate prompt."

How Sampling Works

The server sends a sampling/createMessage request to the client, including a structured message or conversation it wants continued. This request contains a payload similar to what one would send to an LLM API: a list of messages (with roles like user/assistant), and can include parameters like desired model, temperature, max tokens, etc.

The client (host) reviews this request. Importantly, the host remains in control – it might modify the prompt for safety, filter it, or even ask the user for permission, depending on policy. For instance, if a server tried to get the AI to reveal something from another server's context that it shouldn't, the host can intervene.

The host's LLM is invoked with the provided context (the host will decide which model to use, possibly guided by the server's hints like "claude-2 preferred" or "speed over accuracy").

The raw completion from the LLM is again reviewed by the client (to mask any disallowed content or ensure it's proper to return), and then sent back to the server as the result of the sampling request.

This round-trip allows servers to incorporate dynamic AI-generated content into their operation. It's done in a privacy-preserving way: the server only sees what it sent and the model's answer, not any other user conversation context unless explicitly permitted. The protocol lets the server specify if it thinks the model should include broader context (e.g., "includeContext": "thisServer" meaning "include context related to this server's data that the host might have"), but the host has final say in what context is actually provided.

One can view sampling as the inverse of tools: where tools let the model reach out to the external world, sampling lets an external process reach into the model's capabilities in a controlled fashion. As of mid-2025, not all clients support sampling (Anthropic's Claude Desktop client did not yet support it), but it's a part of the MCP specification for more advanced agent designs.

Roots (Scoping Context for Servers)

[@portabletext/react] Unknown block type "image", specify a component for it in the `components.types` prop

MCP introduces the concept of Roots as a way to scope and organize the context for servers. A root is essentially a pointer to the portion of data the server should focus on. For example, a filesystem server might be given a root path (like file:///project-folder) so it knows to restrict file access to that directory. Or an API server might get a base URL root (https://api.example.com/v1) as the primary endpoint to work under.

Root Implementation

Roots are provided by the client/host when initiating the connection to a server:

  • During initialization, if the client supports roots, it declares them and sends a list of root URIs to the server.
  • The server is expected to use those roots as hints or boundaries for any resource listings or tool actions. They are not an enforced sandbox by the protocol (a server could technically still access beyond, but well-behaved servers treat roots as the relevant workspace).

Root Benefits

This mechanism serves several purposes:

  • Security/Privacy: It limits the server's view. If you only give a Git server the root of one repository, it shouldn't expose files from your whole computer.
  • Clarity for the AI and User: The AI knows which data is in scope via the server's outputs, and the user sees organized resources. For instance, if you have multiple roots (say two project folders), the server might list resources under each root separately. It's clear which "workspace" a file belongs to.
  • Multi-tenancy or Multi-source: A single server could potentially handle multiple roots concurrently (like two databases or two drives), and the host can manage these as separate contexts without running separate server instances.

In summary, roots are an opt-in feature that help MCP servers operate within defined context domains. They reinforce the idea that an AI agent could juggle multiple contexts (e.g., personal vs work files) in a structured way. The client can update roots during a session too (with a notification) if, say, a user changes the active project.

Context Management and Security Considerations

From the above, it's clear MCP is stateful and deals with potentially sensitive data and actions. The protocol is designed with a few principles to maintain security and good user control:

Security Principles

  • Isolation of Servers: Each MCP server only receives the minimum information necessary. A server cannot eavesdrop on the whole user conversation or on other servers' data. For example, a calendar server won't see files from a file server unless the host explicitly passes some text from a file to it. This isolation is enforced by the host, which acts as the gatekeeper.
  • User Consent and Control: The host (and ultimately the user) decides which tools and resources to allow. Clients typically require user approval for potentially dangerous tool calls (like sending an email or modifying data). Resources often need to be explicitly selected by the user before the model can read them. This prevents the AI from, say, just reading all your files without asking.
  • Authentication and Authorization: The MCP spec supports standard auth flows (for instance, OAuth 2.0 tokens for servers that connect to online services). Servers often need credentials to access APIs (like a GitHub token for a GitHub server), but these are handled outside the model's view, typically configured by the user or admin. The model just sees the resulting data, not the credentials.
  • Validation of Inputs/Outputs: Because MCP exchanges JSON, it allows robust validation. The use of JSON Schema for tools and structured formats for messages means both client and server can validate each other's messages. This reduces misinterpretation and guards against injection attacks (to some extent). However, prompt-injection (where malicious input could trick the model into unauthorized tool use) is an acknowledged risk area. Developers should ensure that user-provided content is sanitized or that the AI is trained not to blindly execute instructions from content without appropriate checks. The host can implement rules, e.g., "if the model tries to use a tool in response to user content, maybe require confirmation."
  • Rate Limiting and Access Control: While not mandated by the protocol, it's recommended that servers implement access controls (for example, a filesystem server should enforce directory permissions) and possibly rate-limit expensive operations. The host as well might limit how frequently a model can call certain tools or how much data it can pull in a short time.

In short, MCP's design acknowledges that with great power (letting AI execute actions) comes great responsibility. The protocol provides the structure to keep things safe – isolation, negotiation of features, and structured data exchange – but it's up to the implementation to use those properly. With a careful implementation, MCP allows integration of powerful tools in a way that keeps the human in control.

MCP is a new solution to a common problem, so it's helpful to compare it with other approaches that connect AI models to tools or data. Below we contrast MCP with OpenAI's function calling, LangChain-style agent frameworks, JSON Schema usage, and GraphQL/API integrations:

MCP vs. OpenAI Function Calling

OpenAI's function calling (introduced mid-2023) lets a model like GPT-4 call developer-defined functions by outputting a JSON snippet of the function name and arguments. In practice, a developer registers a function (with a JSON schema for params) in the OpenAI API call, and the model may choose to invoke it during the chat. This is conceptually similar to MCP's tools – both allow structured tool use – but there are key differences:

Key Differences

AspectOpenAI Function CallingMCP
Connection ModelOne-shot vs PersistentEach API call, the model can decide to call a function, then the developer executes it and passes the result back to the model in the next prompt. There's no persistent connection to a tool service; state has to be managed by the developer between calls.
Platform CouplingTight Coupling vs OpennessTied to OpenAI's platform and specific API. The functions must be predefined for each conversation and the model's ability to use them is limited to how it was trained to interpret the schema.
Tool DiscoveryStaticThe developer explicitly provides the functions up front.
ComposabilityManual OrchestrationA developer would have to manually orchestrate multiple functions and possibly chain them.

It's worth noting that these approaches can complement each other. One could even expose a generic MCP caller as an OpenAI function – the model would output which MCP tool to call as function arguments, and the function's implementation would forward that to an MCP server. This hybrid approach has been discussed to get the best of both worlds.

MCP vs. LangChain and Agent Frameworks

Prior to protocols like MCP, many developers used agent frameworks (e.g. LangChain, Microsoft's Semantic Kernel, etc.) to enable tool use. These frameworks often work by having the model output a text command (like "Action: search Google for X") which the framework's code parses and executes. They provide conventions for a loop of "thought -> action -> observation -> …" that the model follows.

AspectLangChain-style FrameworksMCP
StandardizationInformal vs StandardizedAgent frameworks were essentially ad-hoc solutions built on top of the model's text interface. Each tool might have a slightly different prompt format; the parsing of model output was brittle (string matching).
Integration EffortCustom Code RequiredIf you wanted the model to use a new tool, you'd typically write custom Python code and prompt templates for that tool's usage. There was no universal way to share tools across different applications.
Model CompatibilityModel-Specific vs Model-AgnosticMany agent libraries are tied to specific model behaviors or require fine-tuning the prompt for a particular model to get the desired action format.
EcosystemCode-centric ToolsLangChain and similar have built large collections of "tools", but these are code-centric and not standardized – essentially each is a custom integration function.

In summary, agent frameworks provided an early solution to connect LLMs to external functions, but they lack a common protocol. MCP formalizes and elevates tool use to the level of a protocol, enabling interoperability and reducing a lot of glue code.

MCP and JSON Schema

It's worth highlighting MCP's use of JSON Schema, since JSON Schema itself is not a tool integration method but a standard for describing data shapes. Both MCP and OpenAI's function calling rely on JSON Schema to define the structure of tool inputs (and in MCP's case, even certain message schemas). This commonality means skills built for one can often be described in terms of the other.

However, JSON Schema alone doesn't provide the runtime mechanism for calling functions or retrieving data. For example, one could have a JSON Schema for a weather query, but without something like MCP or OpenAI's API, that schema is just documentation. MCP uses JSON Schema as a component within its protocol – ensuring that when a server advertises a tool, any client (and even the LLM, through system prompts) knows the expected parameters and types.

To put it another way: JSON Schema is like the grammar for how a request should look; MCP is the conversation that lets two parties exchange those requests and fulfill them. By leveraging JSON Schema, MCP benefits from a widely-used standard for validation and clarity. Developers also find it easier since many languages have JSON Schema validation libraries. This reduces errors – e.g., the server can automatically validate that the model's provided arguments fit the schema, and return a clear error if not, instead of executing something nonsense.

For completeness, note that GraphQL (a query language for APIs) also has a schema concept (GraphQL SDL). Some in the community even envision using GraphQL within MCP – e.g., an MCP server that exposes a GraphQL API of a service, allowing an AI to formulate GraphQL queries. In fact, GraphQL's declarative nature can pair well with MCP tools (one could create a generic "graphql_query" tool and let the AI fill in the query). The difference is that GraphQL by itself requires the client (usually a human programmer) to form queries. MCP enables the LLM to figure out what actions or queries to perform, within a safe and structured protocol. A clever analogy by one observer: MCP is like GraphQL's AI-native cousin – instead of a human writing a precise query, the AI interprets the intent and MCP carries out the appropriate calls.

MCP vs. Traditional APIs (REST/GraphQL)

Many tasks that MCP tackles could also be done by simply calling REST endpoints or GraphQL queries behind the scenes. For instance, without MCP, one might build an AI agent that, upon a certain user request, triggers some Python code to call a REST API, then feeds the result back to the model. This direct API integration approach works, but doesn't scale well or generalize:

  • Each new API requires custom integration code and custom prompts to teach the model how to use it
  • There's no standard way to represent the results to the model (every API returns different JSON; the developer must decide how to inject that into the prompt)
  • Handling streaming, auth, errors, etc., all becomes bespoke logic for each tool
  • Critically, stateless HTTP calls mean the model can't maintain a long-running interaction or subscription easily (you'd have to poll or use custom websockets, etc., for real-time data)

MCP is different in that it establishes a uniform layer on top of those APIs. MCP servers can be thought of as adapters: one might wrap a REST API inside an MCP server so that it presents as a set of tools/resources in the MCP format. The benefit is any AI client that speaks MCP can then use that API without new custom code. The adapter (server) handles the specifics of REST or GraphQL, and the AI sees a consistent interface. It's similar to how in the early days developers wrote different database connectors, but eventually ODBC/JDBC provided a common interface.

Moreover, MCP maintains a persistent, real-time connection which is a stark contrast to the stateless nature of REST/GraphQL. This means features like subscriptions (server push) are built-in, and the overhead of re-authenticating or negotiating on every request is gone after initialization. It's more like a WebSocket connection, but with structure and multiple channels of info (tools, resources, etc.) all multiplexed through one channel.

To be clear, MCP is not "versus GraphQL" as in one must choose one or the other. They can complement: GraphQL excels at allowing clients to ask for exactly the data they need. In an MCP context, a GraphQL-based service could be exposed via a single tool that takes a GraphQL query string as input and returns the result. The LLM could generate the query (perhaps with the help of introspection from the schema) and call the tool. The difference is that MCP gives the AI the autonomy to decide when and how to call that GraphQL tool during a conversation, whereas in a traditional app a human developer would craft the query flows.

In summary, MCP abstracts and unifies API interactions in an AI-friendly way. It is to AI tools what REST/GraphQL are to web services – a standard interface. REST and GraphQL remain under the hood of many MCP servers, but MCP provides the additional conversational and contextual layer needed for seamless LLM integration.

Use Cases and Examples

MCP's flexibility opens up a wide range of use cases across industries. Essentially any scenario where an AI assistant needs to consult data or take actions can benefit from MCP's structured approach. Here are a few examples illustrating how MCP can be applied:

AI Agents with Multiple Tools

MCP was practically made for building AI agents that can do more than chat – they can act. For instance, imagine a customer support agent that, during a conversation, needs to fetch order information, check inventory, and create a return shipment. With MCP, the agent can have a CRM server, an inventory database server, and a shipping API server all connected. When the user asks a question or makes a request, the AI can seamlessly pull data from these sources and execute the needed actions in one flow. The agent doesn't have to be coded with all logic; it dynamically decides which MCP tools to call. This greatly improves the agent's usefulness (no more "I cannot do that" answers – it has the tools to act). Companies building autonomous agents or assistants (for research, personal use, or enterprise) are adopting MCP so that adding a new skill is as easy as plugging in a new server, rather than re-training or re-coding the AI.

Developer Tools and LLM Applications

A concrete example is integrating AI into IDEs and software development. Developers using an AI coding assistant want it to not only know code syntax but also have context of their specific project. With MCP, an IDE like VS Code can run an MCP host that connects to a Filesystem server (for reading the project's files), a Git server (for version control queries), maybe a Testing server (to run code or tests), etc. Suppose a developer asks, "Find any performance bottlenecks in this project and create a ticket for each one." An MCP-enabled assistant could do the following:

Use the filesystem server to read relevant code files

Use a profiling tool server to run performance analysis

Use a project management server (e.g., Jira) tool to create tickets

All these are done through the consistent MCP interface, orchestrated by the AI's reasoning. New integrations (say a new static analysis tool) can be added by simply introducing another MCP server. This use case is already being realized in products like Cursor IDE and Claude's programming assistant, which leverage MCP to let the AI access the user's codebase and development tools securely.

Enterprise Automation and Knowledge Work

Businesses are integrating LLMs to boost productivity, and MCP serves as the connective tissue for enterprise systems. Consider an enterprise assistant that a corporate employee might use. In a single day, the employee could ask: "Compile the Q3 sales report and email it to the team, then schedule a review meeting." An MCP-powered assistant could orchestrate this by:

ActionMCP Server UsedResult
Query sales dataSales DB serverRaw sales data for Q3
Generate reportAnalytics serverPDF report resource
Send emailEmail server toolReport sent to team
Schedule meetingCalendar server toolMeeting scheduled

All of these actions happen within one conversational session with the AI assistant. The assistant can also cross-reference information – e.g., pulling employee info from an HR database server to personalize the email or ensure it's sent to the right recipients. Thanks to MCP's standardized approach, the organization can integrate new data sources (CRM, SharePoint, etc.) by deploying or configuring the corresponding MCP servers, without retraining the AI or writing new bespoke code for integration. This drastically shortens development time for AI solutions in enterprise settings, and ensures governance because all data access goes through MCP where it can be logged and controlled.

Data Analysis and Business Intelligence

Another emerging use case is conversational BI dashboards. An analyst might ask a ChatGPT-like interface, "Give me a breakdown of our website traffic by region and month, and update the dashboard." Behind the scenes, the AI can use an MCP SQL server to run a query on the analytics database, get the results as a resource, maybe use a Visualization tool server to generate a chart image, and then return the answer with the chart. If the analyst says "drill down on Europe," the same servers are already connected and can quickly provide the filtered data. This is essentially Retrieval-Augmented Generation (RAG), but with live data and actions. MCP can complement RAG approaches: one could have a Vector Search server (for embedding-based document retrieval) alongside other structured data servers, giving the AI both unstructured and structured information access. In fact, RAG workflows can be implemented via MCP as a server asks the AI to vectorize a query or as the AI calls a vector search tool – it's a flexible interplay.

Creative and Other Domains

MCP isn't limited to business apps. It can be used wherever an AI might need external help. For example, in a creative writing app, an AI could use an Image Generation server to create illustrations for a story on the fly (there is an EverArt MCP server for AI image generation). In education, a tutoring agent might use a Code Execution server to run science simulations or a WolframAlpha server to solve equations. The open-ended nature of MCP means if you can wrap a service or function in a server, your AI can use it. Already, communities are building servers for everything from browsing the web to controlling IoT devices.

Each of these scenarios benefits from MCP's consistent interface and real-time, two-way communication. They demonstrate how MCP enables LLMs to go from static Q&A bots to active participants in digital workflows. Product managers and developers looking to integrate LLMs should see MCP as a way to future-proof their applications: it provides the scaffolding to add or swap integrations quickly and to leverage improvements in the ecosystem (like new servers) with minimal effort.

Conclusion

The Model Context Protocol is a significant development in bridging the gap between AI and the rich world of software tools and data. Technically, it offers a unified, JSON-based, stateful protocol where LLMs, via host applications, can interface with any number of services in a controlled manner. In practice, MCP allows AI systems to be more useful, flexible, and secure – from an AI that can read files and send emails on your command, to complex agents automating multi-step business processes.

While MCP is still evolving, it has gained rapid adoption in 2025, with support in various AI platforms (Anthropic's Claude, emerging IDE plugins, etc.) and a growing library of open-source MCP servers for popular APIs. It is not the only way to connect AI to tools, but by building on lessons from predecessors (function calling, plugins, custom agents) it provides a comprehensive framework that developers and organizations can rely on. As an open standard, MCP invites contributions and is likely to be shaped by its community – much like web protocols in the past.

For anyone building an AI-powered application, exploring MCP is highly recommended. It can simplify development by offloading integration logic to standardized components, and it can enhance the capability of your AI by giving it a broad, extensible toolbelt with minimal overhead. In the fast-moving landscape of AI, MCP stands out as an anchor of consistency – a common language for models and tools that unlocks real-world utility while maintaining safety and structure. By adopting MCP, developers can focus on innovation in their domain, confident that the AI can interface with whatever systems it needs to, through a protocol that was purpose-built for this new era of intelligent, context-aware applications.

References

分享

Overview of AI MCP Protocol: What It Is and Why It Matters