Skip to content

Model Context Protocol ​

Model Context Protocol (MCP) is an open interoperability protocol designed to let AI models securely access tools, data sources, and services through a standardized interface. It enables agents and LLM-powered applications to discover capabilities and invoke them dynamically, rather than relying on hard-coded integrations.

Originally introduced by Anthropic, MCP is gaining adoption as a way to standardize tool use and multi-agent collaboration.


What MCP Is ​

MCP defines a client–server protocol where:

  • MCP Server exposes tools, data, and capabilities.
  • MCP Client (agent/LLM app) discovers and invokes them.
  • Models use the returned context to perform tasks.

Conceptual flow:

Agent → Discover capabilities → Request tool → Server executes → Context returned → Model responds

It is analogous to:

  • REST for web services
  • USB for device connectivity
  • LSP (Language Server Protocol) for IDE tooling

…but for AI agents and tools.


What MCP Enables ​

Tool Interoperability ​

  • Access databases, APIs, files, or business logic
  • Invoke functions without custom integrations

Agent Ecosystems ​

  • Multiple agents share tools/services
  • Enables modular agent architectures

Secure Context Access ​

  • Fine-grained permissioning
  • Controlled data exposure

Real-time & Stateful Interactions ​

  • Streaming outputs
  • Persistent sessions & context updates

MCP Architecture ​

Core Components ​

MCP Server ​

Provides:

  • tools (functions)
  • resources (documents, data)
  • prompts/templates
  • streaming outputs

MCP Client ​

Used by:

  • AI agents
  • IDE assistants
  • automation systems

Handles:

  • capability discovery
  • tool invocation
  • context injection

Transport Layer ​

Defines how messages move between client and server.


Transport & Communication Methods ​

MCP is transport-agnostic and can operate over multiple protocols:

WebSockets (WS) ​

Use case: real-time, bidirectional communication

Benefits:

  • low latency
  • streaming responses
  • persistent sessions
  • live updates

Typical uses:

  • collaborative agents
  • live coding assistants
  • real-time monitoring

HTTP (REST-like) ​

Use case: request/response tool invocation

Benefits:

  • simple deployment
  • firewall-friendly
  • stateless operations

Typical uses:

  • cloud tool endpoints
  • microservice access
  • serverless functions

RPC (Remote Procedure Call) ​

Includes JSON-RPC, gRPC, or custom RPC layers.

Benefits:

  • structured function calls
  • strong typing & contracts
  • efficient binary transport (gRPC)

Typical uses:

  • internal microservices
  • high-performance tool calls
  • enterprise service buses

MCP Interaction Flow ​

Capability Discovery ​

Client asks server:

What tools/resources are available?

Server returns schemas & descriptions.


Tool Invocation ​

Agent sends structured request:

json
{
  "tool": "query_database",
  "arguments": {"customer_id": 123}
}

Execution & Context Return ​

Server executes and returns:

  • result data
  • metadata
  • optional streaming updates

Model Augmentation ​

Returned content is injected into model context for reasoning.


What MCP Servers Can Expose ​

Tools ​

  • database queries
  • CRM actions
  • DevOps tasks
  • automation workflows

Resources ​

  • documents & knowledge bases
  • logs & telemetry
  • structured datasets

Prompts & Templates ​

  • reusable prompt fragments
  • workflow scaffolding

MCP & Multi-Agent Systems ​

MCP enables agents to:

  • discover shared tools
  • delegate tasks to specialized services
  • chain tool calls across systems
  • maintain shared context streams

This makes MCP suitable for:

  • autonomous agent workflows
  • enterprise orchestration
  • developer copilots
  • AI operating systems

Comparison MCP vs Traditional Tool Integration ​

FeatureHard-coded APIsMCP
Dynamic discovery❌✅
Standard schema❌✅
Multi-agent interoperability❌✅
Streaming context❌✅
Plug-and-play tools❌✅

MCP vs Function Calling (LLM APIs) ​

Function calling:

  • model-specific
  • limited to one provider

MCP:

  • provider-neutral
  • external tool ecosystem
  • supports multiple agents & clients

Implementation Considerations ​

  • authentication & access control
  • latency & streaming needs
  • schema versioning
  • tool idempotency & error handling
  • audit logging & observability

Powered by VitePress