# MCP Client

> The MCP Client is the part of an AI application that connects to MCP servers and uses their capabilities.

## What is an MCP client?

The component inside an AI application, such as a chat app, an IDE or a coding agent, that connects to MCP servers, lists their tools and passes tool calls from the model to the server.

- Topic: Model Context Protocol
- Type: concept

## Example

Wrong:

```ts
async function onToolCall(call: ToolCall) {
  return server.callTool(call.name, call.args);
}
```

Right:

```ts
async function onToolCall(call: ToolCall) {
  const tool = tools.get(call.name);
  if (!tool?.annotations?.readOnlyHint && !(await askUser(call))) {
    return { isError: true, content: [{ type: 'text', text: 'User declined' }] };
  }
  return withTimeout(server.callTool(call.name, call.args), 30_000);
}
```

The client asks before tools that may change data and adds a timeout, instead of running every call blindly.

## Common mistakes

- Trusting a tool description that contains hidden instructions.

## Key points

- The client asks the user before running tools that change data.
- Tool descriptions and results from servers are treated as untrusted.
- Each server connection has a timeout and handles server errors.

## Interview questions

### What is the difference between an MCP client and an MCP host?

The host is the AI application the user works in. It creates one MCP client per server connection, and each client talks to exactly one server.

### Can one MCP client connect to many servers?

Each client keeps one connection to one server. A host app that uses several servers runs several clients side by side.

### Should a client trust MCP tool annotations?

Only from trusted servers. Annotations like 'readOnlyHint' are hints from the server, not guarantees, so do not rely on them for security.

## Related cards

- [MCP](https://wonderium.dev/ai/mcp.md)
- [MCP Server](https://wonderium.dev/ai/mcp-server.md)
- [MCP Transport](https://wonderium.dev/ai/mcp-transport.md)
- [Agent Permissions](https://wonderium.dev/ai/agent-permissions.md)

---

- Level: [Artificial Intelligence](https://wonderium.dev/ai.md)
- HTML version: https://wonderium.dev/ai/mcp-client
- Last updated: 2026-11-25
