{{theTime}}

Search This Blog

Total Pageviews

MCP Architecture

  • Model Context Protocol (MCP) | GeeksforGeeks
  • Model Context Protocol (MCP) - GeeksforGeeks
  • Model Context Protocol (MCP) Guide: What It Is & How to Use It 2026

The Model Context Protocol (MCP) is a standardized, open protocol that lets AI models (like Claude, ChatGPT, or agent frameworks) connect to external tools, APIs, databases, and local resources in a secure, structured, and model‑agnostic way. At its core, MCP defines how an AI client discovers capabilities, sends requests, receives results, and manages context from external systems.

Below is a clear, structured explanation of the protocol, its architecture, and diagrams (including ASCII diagrams you can reuse).

🧩 What MCP Is — In One Sentence

MCP is a client–server protocol that allows AI models to safely access external tools and data sources through a standardized interface using JSON‑RPC 2.0 over transports like WebSockets, HTTP, or local processes.

🏛️ MCP Architecture (Explained Simply)

MCP has three major components:

1. MCP Client

The AI-side component (e.g., Claude Desktop, an IDE plugin, an agent runtime). It is responsible for:

  • Discovering server capabilities

  • Sending tool calls

  • Managing context

  • Displaying results to the user

2. MCP Server

A standalone service exposing:

  • Tools (functions the AI can call)

  • Resources (files, APIs, databases)

  • Prompts (predefined templates)

  • Events (notifications)

Servers can wrap:

  • Local files

  • Databases

  • Cloud APIs

  • Enterprise systems

3. MCP Protocol

The JSON‑RPC‑based communication layer defining:

  • Capability discovery

  • Request/response formats

  • Error handling

  • Resource streaming

  • Tool invocation

🖼️ High-Level Architecture Diagram (ASCII)

Code
                ┌──────────────────────────┐
                │        MCP Client        │
                │  (Claude, IDE, Agent)    │
                └────────────┬─────────────┘
                             │ JSON-RPC 2.0
                             ▼
                ┌──────────────────────────┐
                │       MCP Protocol       │
                │ (Transport + Semantics)  │
                └────────────┬─────────────┘
                             │
        ┌────────────────────┼────────────────────┐
        ▼                    ▼                    ▼
┌──────────────┐     ┌──────────────┐     ┌──────────────┐
│ MCP Server A │     │ MCP Server B │     │ MCP Server C │
│ (Local FS)   │     │ (DB / API)   │     │ (Cloud API)  │
└──────┬───────┘     └──────┬───────┘     └──────┬───────┘
       │                     │                     │
       ▼                     ▼                     ▼
 Local Files           SQL Database            Web Services

🔍 Detailed Architecture Breakdown

🧠 1. Client Layer

The client is the AI’s “gateway” to the outside world.

It handles:

  • Capability discovery

  • Tool invocation

  • Resource browsing

  • Prompt selection

  • Event subscription

Examples of clients:

  • Claude Desktop

  • VS Code MCP extension

  • Custom agent frameworks

🖥️ 2. Server Layer

Each MCP server exposes a set of capabilities:

Tools

Functions the AI can call, e.g.:

  • search_files

  • query_database

  • send_email

Resources

Structured data sources:

  • Files

  • API endpoints

  • Database tables

Prompts

Reusable templates the AI can request.

Events

Push notifications:

  • File changes

  • Database updates

🔗 3. Transport Layer

MCP supports multiple transports:

  • Local process pipes

  • WebSockets

  • HTTP(S)

All communication uses JSON‑RPC 2.0.

No comments:

MCP Architecture

The Model Context Protocol (MCP) is a standard...