In this article, you will learn what the Model Context Protocol (MCP)
is, why it exists, and how it standardizes connecting language models
to external data and tools.
Topics we will cover include:
- The integration problem MCP is designed to solve.
- MCP’s client–server architecture and communication model.
- The core primitives (resources, prompts, and tools) and how they work together.
Let’s not waste any more time.

The Complete Guide to Model Context Protocol
Image by Editor
Introducing Model Context Protocol
Language models can generate text and reason impressively, yet they
remain isolated by default. Out of the box, they can’t access your
files, query databases, or call APIs without additional integration
work. Each new data source means more custom code, more maintenance
burden, and more fragmentation.
Model Context Protocol (MCP) solves this by providing an open-source standard for connecting language models to external systems.
Instead of building one-off integrations for every data source, MCP
provides a shared protocol that lets models communicate with tools,
APIs, and data.
This article takes a closer look at what MCP is, why it matters, and
how it changes the way we connect language models to real-world systems.
Here’s what we’ll cover:
- The core problem MCP is designed to solve
- An overview of MCP’s architecture
- The three core primitives: tools, prompts, and resources
- How the protocol flow works in practice
- When to use MCP (and when not to)
By the end, you’ll have a solid understanding of how MCP fits into
the modern AI stack and how to decide if it’s right for your projects.
The Problem That Model Context Protocol Solves
Before MCP, integrating AI into enterprise systems was messy and
inefficient because tying language models to real systems quickly runs
into a scalability problem. Each new model and each new data source need
custom integration code — connectors, adapters, and API bridges — that
don’t generalize.
If you have M models and N data sources, you end up maintaining M × N
unique integrations. Every new model or data source multiplies the
complexity, adding more maintenance overhead.
The MCP solves this by introducing a shared standard for
communication between models and external resources. Instead of each
model integrating directly with every data source, both models and
resources speak a common protocol. This turns an M × N problem into an M + N one. Each model implements MCP once, each resource implements MCP once, and everything can interoperate smoothly.

From M × N integrations to M + N with MCP
Image by Author
In short, MCP decouples language models from the specifics of
external integrations. In doing so, it enables scalable, maintainable,
and reusable connections that link AI systems to real-world data and
functionality.
Understanding MCP’s Architecture
MCP implements a client-server architecture with specific terminology that’s important to understand.
The Three Key Components
MCP Hosts are applications that want to use MCP capabilities.
These are typically LLM applications like Claude Desktop, IDEs with AI
features, or custom applications you’ve built. Hosts contain or
interface with language models and initiate connections to MCP servers.
MCP Clients are the protocol clients created and managed by
the host application. When a host wants to connect to an MCP server, it
creates a client instance to handle that specific connection. A single
host application can maintain multiple clients, each connecting to
different servers. The client handles the protocol-level communication,
managing requests and responses according to the MCP specification.
MCP Servers expose specific capabilities to clients: database
access, filesystem operations, API integrations, or computational tools.
Servers implement the server side of the protocol, responding to client
requests and providing resources, tools, and prompts.

MCP Architecture
Image by Author
This architecture provides a clean separation of concerns:
- Hosts focus on orchestrating AI workflows without concerning themselves with data source specifics
- Servers expose capabilities without knowing how models will use them
- The protocol handles communication details transparently
A single host can connect to multiple servers simultaneously through
separate clients. For example, an AI assistant might maintain
connections to filesystem, database, GitHub, and Slack servers
concurrently. The host presents the model with a unified capability set,
abstracting away whether data comes from local files or remote APIs.
Communication Protocol
MCP uses JSON-RPC 2.0
for message exchange. This lightweight remote procedure call protocol
provides a structured request/response format and is simple to inspect
and debug.
MCP supports two transport mechanisms:
- stdio (Standard Input/Output): For
local server processes running on the same machine. The host spawns the
server process and communicates through its standard streams.
- HTTP: For networked communication. Uses HTTP POST for requests and, optionally, Server-Sent Events for streaming.
This flexibility lets MCP servers run locally or remotely while keeping communication consistent.
The Three Core Primitives
MCP relies on three core primitives that servers expose. They provide
enough structure to enable complex interactions without limiting
flexibility.
Resources
Resources represent any data a model can read. This includes file
contents, database records, API responses, live sensor data, or cached
computations. Each resource uses a URI scheme, which makes it easy to
identify and access different types of data.
Here are some examples:
- Filesystem:
file:///home/user/projects/api/README.md - Database:
postgres://localhost/customers/table/users - Weather API:
weather://current/san-francisco
The URI scheme identifies the resource type. The rest of the path
points to the specific data. Resources can be static, such as files with
fixed URIs, or dynamic, like the latest entries in a continuously
updating log. Servers list available resources through the resources/list endpoint, and hosts retrieve them via resources/read.
Each resource includes metadata, such as MIME type, which helps hosts handle content correctly — text/markdown is processed differently than application/json — and descriptions provide context that helps both users and models understand the resource.
Prompts
Prompts provide reusable templates for common tasks. They encode expert knowledge and simplify complex instructions.
For example, a database MCP server can offer prompts like analyze-schema, debug-slow-query, or generate-migration. Each prompt includes the context necessary for the task.
Prompts accept arguments. An analyze-table prompt can
take a table name and include schema details, indexes, foreign key
relationships, and recent query patterns. Domain-specific systems
benefit most from specialized prompts. A Kubernetes MCP server can offer
prompts for troubleshooting cluster issues. A code review server can
provide prompts aligned with team style guides. Prompts let MCP servers
carry expertise, not just data.
Tools
Tools are functions a model can invoke to perform actions or
computations. Unlike resources, which are read-only, or prompts, which
provide guidance, tools modify state. Tools allow models to act, not
just observe.
Each tool defines parameters, types, and constraints using a JSON
schema. The model sends a JSON object that matches the schema. The
server validates it, executes the action, and returns results.
A GitHub MCP server might include create_issue, merge_pull_request, add_comment, and search_code. Each tool has a clear contract. It specifies what parameters it expects, what it returns, and what side effects it produces.
Tool execution requires careful control, as tools can modify data or
trigger external actions. The host mediates all calls. It can enforce
confirmation, logging, and access control. MCP provides the framework
for these safeguards while leaving implementation flexible.
Protocol Communication Flow
Understanding how MCP hosts and servers communicate shows why the
protocol is both practical and effective. All interactions follow
predictable patterns built on JSON-RPC foundations.
Initialization Handshake
Communication between a host and an MCP server begins with a
handshake that establishes the connection and negotiates supported
features. The MCP client on the host starts by sending an initialize
request. This request includes its protocol version and a declaration of
the capabilities it can handle.
The server responds with its own capabilities, along with identifying
information such as its name, version, and the MCP primitives it
supports (tools, resources, prompts). This exchange allows both sides to
discover what the other can do and ensures compatibility across
protocol versions. If the client and server do not share a compatible
version, the connection should be terminated to prevent errors.
Once the initialization is complete, the server can advertise
resources, prompts, and tools. This two-step handshake ensures both
sides are ready before any substantive communication begins.
Discovering Capabilities
Once initialization completes, the host can query the server for available capabilities.
- For resources, it calls
resources/list to get a catalog of accessible URIs. - For prompts,
prompts/list returns available templates and arguments. - For tools,
tools/list provides all functions with their JSON schemas.
These discovery mechanisms make MCP servers self-documenting. Hosts
can connect to unfamiliar servers and automatically learn what they can
access. There is no need for manual setup or configuration files.
Discovery can also be dynamic. A filesystem server might list
different files as directory contents change. A database server could
expose different tables depending on user permissions. This ensures the
protocol adapts to real-world state.
Executing Operations
With MCP, accessing resources is straightforward. The client sends a resources/read request with the resource URI. The server returns the contents, MIME type, and relevant metadata.
Tool calls follow a similar pattern. The model constructs a JSON object with the tool name and parameters. The client sends a tools/call
request. The server validates, executes, and returns results. If
execution fails, it returns a structured error explaining the issue.
Prompts work slightly differently. To retrieve a prompt, the client calls prompts/get
with the prompt name and any arguments. The server returns the expanded
prompt text, which incorporates arguments and dynamic context. The host
can then send this as input to the model.

Protocol Communication Flow
Image by Author
Error Handling and Edge Cases
MCP defines standard error codes
based on JSON-RPC conventions. Parse errors, invalid requests, method
not found, and invalid parameters each have a specific code. Servers
return these consistently, making error handling predictable for hosts.
The protocol also handles timeouts and cancellations. Long-running
operations can be canceled if conditions change or the user loses
interest. Servers should perform cleanup when cancellations occur to
prevent resource leaks and maintain a consistent state.
When (Not) to Use MCP
MCP provides a standard way for AI applications to connect with external data and tools, but it is not always the right choice.
Use Cases
MCP works best when AI applications require structured access to
external capabilities. Applications that read data, invoke tools, or
interact with multiple systems benefit from its clean abstraction.
Systems with many integrations see the greatest advantage. Instead of
writing custom code for each service, you implement MCP once and
connect to standard servers. This moves complexity from individual
applications to reusable infrastructure.
Applications that require audit trails also benefit from MCP. Every
operation flows through defined messages, making logging, analysis, and
compliance simpler.
Where MCP Is Less Useful
For simple prompt-and-response applications, MCP adds unnecessary
overhead. If the system only sends text to a model and displays replies,
direct interaction is easier.
Single-purpose tools with a single integration may not justify MCP. A
project that only accesses GitHub can call its API directly. MCP is
most useful when multiple integrations require standardization.
Applications requiring ultra-low latency may find MCP’s JSON-RPC
layer slightly heavier than direct APIs. For millisecond-critical
workflows, a direct connection can be faster.
To sum up: Use MCP when structured access, multiple
integrations, and clear communication flows outweigh its overhead. Avoid
it for simple or highly constrained applications.
Conclusion
MCP facilitates the connection of AI capabilities to the information
and tools that make them truly useful. MCP helps move from isolated
applications to integrated, capable systems. Models are no longer
limited to their training data; they gain new abilities through
connections. The same base model can act as a coding assistant, data
analyst, or customer service agent depending on which MCP servers it can
access.
For developers, MCP provides a clear path to building more powerful
AI applications. For organizations, it standardizes AI integration
without vendor lock-in. For the broader AI community, it establishes
common ground for interoperable systems.
See the resources section for detailed guides, examples, and references to help you understand and implement MCP effectively.
References & Further Reading