The Model Context Protocol (MCP) is an open standard that defines how AI applications communicate with external tools and data sources. Before MCP, every AI integration required a bespoke adapter -- if you wanted Claude to query a database, you wrote one connector, and if you wanted it to search files, you wrote another. MCP eliminates this fragmentation by providing a single, well-defined protocol that any AI host can speak and any tool provider can implement. Think of it as USB-C for AI: one standard plug that connects any model to any capability. The protocol is built on JSON-RPC 2.0, supports multiple transport layers, and defines three core primitives -- tools, resources, and prompts -- that cover the vast majority of AI-to-world interactions.
The initialize handshake is the first exchange in every MCP session. The client declares its protocol version and capabilities, and the server responds with its own. This lets both sides know exactly what features are available -- for example, here the server supports tools with change notifications and resource subscriptions.
After initialization, the client can discover what tools are available by calling tools/list. Each tool includes a name, description, and a JSON Schema defining its inputs. This allows the AI model to understand what each tool does and what arguments it expects, enabling accurate tool selection.
Tool invocation follows a simple request-response pattern. The client sends the tool name and arguments, and the server returns a content array. Content can be text, images, or embedded resources. The content array structure allows tools to return rich, multi-part responses.
Resources are read-only data endpoints identified by URIs. The client requests a resource by its URI, and the server returns the contents with a MIME type. Unlike tools, resources do not perform side effects -- they simply expose data for the model to read and reason about.
MCP uses JSON-RPC notifications for one-way messages that do not require a response. The client sends notifications/initialized to signal it is ready, and the server can send notifications like tools/list_changed to inform the client that available tools have changed. Notifications are distinguished from requests by the absence of an id field.
Confusing MCP with function calling. Developers assume MCP is just another name for the tool-use or function-calling feature built into LLM APIs.
MCP is a transport and discovery protocol, not a model feature. Function calling tells the model how to structure a tool request; MCP defines how that request reaches the tool server, how the server is discovered, and how capabilities are negotiated. They are complementary layers.
Skipping the initialize handshake and sending tool calls immediately, resulting in errors or undefined behavior.
Always complete the full initialize / initialized sequence before sending any other requests. The handshake establishes the protocol version and declares capabilities that both sides depend on.
Assuming all MCP servers support all three primitives (tools, resources, and prompts) without checking the capabilities response.
Check the server's capabilities in the initialize response. A server may only support tools and not resources, or vice versa. Attempting to call an unsupported method will result in an error.
Hardcoding a specific transport mechanism (e.g., only stdio) instead of designing the server to be transport-agnostic.
Keep your server logic separate from the transport layer. The MCP SDKs make it easy to switch between stdio, SSE, and Streamable HTTP. A well-structured server can run in any mode without code changes.
Ignoring the JSON-RPC error responses and not implementing proper error handling for tool calls and resource reads.
Always handle the error field in JSON-RPC responses. MCP defines standard error codes (invalid params, method not found, internal error). Surface these errors to the model so it can retry or adjust its approach.
The Model Context Protocol (MCP) is the open standard for connecting AI applications to external tools and data. It uses JSON-RPC 2.0 over flexible transports (stdio, SSE, Streamable HTTP) and defines three primitives: tools for actions, resources for read-only data, and prompts for reusable templates. The initialization handshake negotiates capabilities so both client and server know exactly what is supported. By adopting MCP, developers write one integration that works with any compliant AI host, eliminating the fragmented adapter approach that preceded it.
Interactive lessons and challenges on Stanza, practice in VS Code, Cursor, or the web.
Interactive lessons and challenges, right in your code editor.
Check the free courses. No credit card.