Jahanzaib
Tools & Function Calling

MCP Client

A connector inside the Host that maintains a 1:1 stateful session with exactly one MCP Server.

Last updated: April 26, 2026

Definition

An MCP Client is a software component instantiated by the Host. It opens and maintains a single stateful session with one MCP Server, handles the protocol handshake, negotiates capabilities, routes JSON-RPC messages bidirectionally, and manages subscriptions and notifications for that session. Per the spec, the relationship is exactly 1:1: each Client connects to one Server, and a Host typically creates one Client per Server it wants to use. If the Host wants to connect to five different Servers, it spins up five Clients.

The 1:1 design is a security boundary. Each Client sees only its own Server, so a malicious or compromised Server cannot read messages destined for other Servers in the same Host. Clients also handle reconnection, error recovery, and capability negotiation, which is why most MCP integrations import the official MCP SDK rather than implementing the protocol from scratch. As an example: when Visual Studio Code connects to the Sentry MCP server, the VS Code runtime instantiates one MCP Client object that maintains that connection.

Code Example

typescript
// Host code that creates a Client, connects to a Server, and lists tools
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";

const transport = new StdioClientTransport({
  command: "node",
  args: ["./weather-server.js"],
});
const client = new Client({ name: "my-host", version: "1.0.0" });
await client.connect(transport);
const { tools } = await client.listTools();

A single Client object owns one session. The Host creates as many Clients as it has Servers.

When To Use

You instantiate a Client whenever you need to talk to a new Server from inside your Host. The Client lifecycle (connect, listTools, callTool, close) is the standard pattern.

Sources

Related Terms

Building with MCP Client?

I've shipped this pattern in real production systems. If you want a second pair of eyes on your architecture, that's what I do.