Jahanzaib
Tools & Function Calling

MCP (Model Context Protocol)

An open standard from Anthropic for two-way connections between AI applications and external data sources, tools, and prompts.

Last updated: April 26, 2026

Definition

The Model Context Protocol is an open standard that lets developers build secure, two-way connections between data sources and AI-powered tools. It was introduced by Anthropic on November 25, 2024, and is now broadly adopted across Claude Desktop, Claude Code, Visual Studio Code, Cursor, and many third-party IDEs. MCP follows a client-host-server architecture where each Host runs multiple Client instances, and each Client maintains a 1:1 stateful session with one Server. The protocol uses JSON-RPC 2.0 as its message format and supports two transports: stdio for local servers and Streamable HTTP for remote servers. The current spec version is 2025-11-25.

MCP defines three server-exposed primitives: Prompts (user-controlled templates), Resources (application-controlled data the model can read), and Tools (model-controlled executable functions). The lifecycle is initialize → operate → shutdown, with capability negotiation during initialization. The win is interop: write one MCP server for your internal APIs, then any MCP-compatible client across any LLM provider can use it without per-client integration code. Gartner predicts that by the end of 2026, 75% of API gateway vendors will include MCP support in their offerings.

Architecture

Canonical MCP topology per the official spec. Hosts manage multiple Clients. Each Client has a 1:1 session with one Server, exchanging JSON-RPC 2.0 messages. Remote Servers can be shared across Clients.

Code Example

typescript
// Minimal MCP server exposing one tool primitive
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";

const server = new Server({ name: "weather", version: "1.0.0" });
server.setRequestHandler({ method: "tools/list" }, async () => ({
  tools: [{
    name: "get_weather",
    description: "Get current weather for a city",
    inputSchema: { type: "object", properties: { city: { type: "string" } } },
  }],
}));
await server.connect(new StdioServerTransport());

Local MCP server using stdio transport. Any MCP-compatible Host (Claude Desktop, Cursor, VS Code) can connect.

When To Use

When you want one tool/resource definition to work across multiple LLM clients, when exposing internal APIs to AI tools without per-client code, or when you need standardized agent-to-data connections that survive vendor changes.

Common Questions

Is MCP only for Anthropic models?

No. Anthropic created and open-sourced it, but MCP is provider-neutral. Any LLM application can implement an MCP Host and any service can run an MCP Server. Adoption now spans Claude, OpenAI Assistants, Cursor, Visual Studio Code, JetBrains IDEs, and more.

What is the difference between MCP and function calling?

Function calling is per-vendor: you define functions in the format each LLM provider expects. MCP is a wire protocol: define your server once and any MCP client can call it. Think USB-C versus a different proprietary cable for each device.

Sources

Related Terms

Building with MCP (Model Context Protocol)?

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.