An MCP client is the component inside an AI application that maintains a dedicated connection to one MCP server under the Model Context Protocol, negotiating capabilities and exchanging JSON-RPC messages on behalf of the application. In the field of AI agents within artificial intelligence, the Model Context Protocol client is the piece that lets a language model discover and call external tools, read resources and use prompt templates that a server exposes, without custom integration code for each service.
The client never stands alone. It lives inside a host application, such as a desktop assistant, an IDE or an agent framework, and the host typically runs one client per connected server. The client handles protocol mechanics, while the host decides what the model sees and what the user must approve.
How an MCP client fits the host and server model
The Model Context Protocol defines three roles: host, client and server. The host is the user-facing application that owns the model and the conversation. Each MCP client is a stateful session object created by the host, and each MCP server is a separate program or service that offers capabilities such as database queries, file access or issue tracking.
The relationship between client and server is strictly one to one. A host that connects to a file system server, a Git server and a ticketing server therefore runs three clients, which keeps security boundaries and failures isolated: one server cannot read another server’s messages through the shared client.
The following table separates the responsibilities of the three roles.
| Role | Main responsibility | Typical example |
|---|---|---|
| Host | Runs the model, manages consent and aggregates context | Desktop assistant or coding IDE |
| MCP client | Holds one session with one server and routes messages | Connection object inside the host |
| MCP server | Exposes tools, resources and prompts | Local file server or remote SaaS connector |
The MCP client session lifecycle
Every MCP client session follows a defined lifecycle of initialization, operation and shutdown. Messages use JSON-RPC 2.0, with requests that expect responses and notifications that do not.
During initialization the client sends an initialize request containing its protocol version, its capabilities and client information. The server answers with its own version and capabilities, and the client confirms with an initialized notification. Capability negotiation at this stage decides which features both sides may use for the rest of the session.
| Phase | Client action | Purpose |
|---|---|---|
| Initialization | Sends initialize, then initialized | Agree on version and capabilities |
| Discovery | Calls tools/list, resources/list, prompts/list | Learn what the server offers |
| Operation | Sends tools/call or resources/read requests | Execute actions and fetch context |
| Change handling | Processes list-changed notifications | Refresh tools or resources that changed |
| Shutdown | Closes the transport | End the session cleanly |
The client also handles transport selection. Local servers usually run as subprocesses over standard input and output (stdio), while remote servers use Streamable HTTP, which replaced the earlier HTTP with server-sent events transport. For remote servers the specification relies on OAuth 2.1-based authorization, with the client obtaining and presenting access tokens.
Capabilities an MCP client consumes and offers
An MCP client both consumes server primitives and offers client features back to the server. The server side provides tools, resources and prompts; the client side can provide sampling, roots and elicitation when it declares them during initialization.
| Primitive | Direction | Who controls it | What it does |
|---|---|---|---|
| Tools | Server to client | Model, with host approval | Executable functions with JSON Schema inputs |
| Resources | Server to client | Application | Readable data such as files or records |
| Prompts | Server to client | User | Reusable prompt templates with arguments |
| Sampling | Client to server | Host and user | Lets a server request a model completion |
| Roots | Client to server | Host | Tells a server which directories or URIs are in scope |
| Elicitation | Client to server | User | Lets a server ask the user for structured input |
Sampling is significant because it allows a server to use a model without holding its own API keys, while the host keeps control over which model runs and whether the user reviews the request.
MCP client compared with related agent components
An MCP client is a protocol endpoint, not an agent. It does not plan, reason or choose tools; the model and the host do that. Confusing the client with the agent loop or with the tool calling feature of a model API is a frequent misunderstanding.
| Concept | What it is | Relation to the MCP client |
|---|---|---|
| Tool calling | Model API feature for emitting structured calls | The host maps those calls to client tools/call requests |
| MCP server | Provider of capabilities | The single peer of each client |
| Agent loop | Cycle of reasoning, acting and observing | Uses clients to act on external systems |
| Agent framework | Library for building agents | Often embeds an MCP client implementation |
| Agent2Agent protocol | Protocol for agents talking to agents | Addresses peer agents, not tool servers |
Security responsibilities and common mistakes
Because a client connects a model to real systems, security largely rests on the host and its clients. The specification expects explicit user consent for tool invocations and data access, and it treats tool descriptions from servers as untrusted unless the server itself is trusted.
- Auto-approving every tool call removes the human check that guards against destructive or data-leaking actions.
- Trusting tool descriptions blindly exposes the model to prompt injection hidden in server metadata.
- Connecting too many servers floods the context window with tool definitions and degrades tool selection.
- Ignoring list-changed notifications leaves the model calling tools that no longer exist or have changed schemas.
- Storing OAuth tokens insecurely turns a client compromise into access to every connected service.
Well-built hosts show which server provides each tool, scope roots narrowly and keep a log of calls, which also supports agent observability and later review.
In everyday language
Think of an AI assistant as a person who needs to use many different services, such as a calendar, a file cabinet and a ticket system. An MCP client is like a dedicated phone line to one of those services. The assistant has one line per service, and each line follows the same calling rules.
Because every line speaks the same language, a new service can be plugged in without rebuilding the assistant. The phone line does not decide what to say; the assistant does. The line simply carries requests and answers reliably and keeps each conversation separate.
Seen in the real world
A developer works in a coding editor that acts as an MCP host. The editor connects to three servers: a local file system server over stdio, a Git server over stdio and a remote issue tracker over Streamable HTTP. The editor creates three MCP clients, one for each server, and each performs its own initialization and tool discovery.
The developer asks the assistant to fix the bug described in a specific ticket. The model requests the ticket, so the host routes a tools/call through the issue tracker client, which presents an OAuth access token obtained earlier. The model then reads the affected source files through the file system client and proposes a change.
Before the Git client creates a branch and commits, the host shows an approval prompt naming the tool and its server. The developer approves, and the whole task completes without any custom integration code between the editor and the three services.