An LLM agent can use tools provided by external systems instead of implementing every tool itself. Model Context Protocol (MCP) is an open standard for connecting AI applications to third-party tools and other resources, including data. It provides a shared way to access capabilities across an ecosystem of compatible servers and clients. section 1.5 section 5.0
An MCP host creates clients that connect to MCP servers. A server can expose multiple tools, each backed by a server-side definition. Clients send requests to the server, which executes the requested tool and returns its result. section 5.1.3
An MCP tool fits into the usual LLM tool-calling loop:
- The LLM generates a tool-call request, represented by a ToolCall object. section 5.1.2
- The MCP client forwards the request to the external server, where the tool executes. section 5.1.2 section 5.1.3
- The result returns as a ToolCallResult and is sent back to the LLM. section 5.1.2
Figure 5.3 The tool-calling process, seen in Chapters 1 and 2, now adapted for MCP tools. The tool-call request in the form of a ToolCall object is passed to the MCP tool for execution, yielding a ToolCallResult object at completion. The only difference is that tool execution occurs on the external MCP server.

Trace the familiar tool-call loop with execution moved to an MCP server. section 5.1.2
Servers can run locally or remotely. MCP supports standard IO (stdio), typically used for local servers, and streamable HTTP, typically used for remote servers. Supporting both transports lets an agent draw tools from both kinds of server. section 5.1.3
An agent framework can preserve its existing tool-calling infrastructure while adding an MCPTool for server-backed execution and an MCPToolProvider for managing server connections. The integration also needs to connect to servers and discover their tools. section 5.0 section 5.1.2 section 5.1.3
Session terminology depends on the protocol and library version. The 2026-07-28 MCP revision removes sessions from the protocol, making requests self-contained; the mcp Python library version 2.0 still represents connections through client sessions. section 5.1.3




















