Skip to main content

Overview

MCP messages define the communication format between clients and servers. This reference documents all message types, their structure, and usage patterns.
MCP follows a request-response pattern similar to JSON-RPC 2.0 with extensions for streaming and bidirectional communication.

Protocol Transport Architecture

The MCP protocol supports multiple transport layers for communication between clients and servers. The diagram below illustrates how messages flow through the system:

Transport Options

Process-based communication using stdin/stdout. Best for local CLI integrations.
HTTP-based one-way streaming from server to client. Ideal for web applications.
Full-duplex bidirectional communication. Best for real-time interactive applications.

Message Structure

All MCP messages follow this base structure:
string
required
Protocol version, always "2.0"
string | number
required
Unique request identifier for matching responses
string
required
The method to invoke (e.g., "tools/call", "resources/read")
object
Method-specific parameters

Response Messages

Success Response

Error Response

Error Codes

Message Types

Initialize

Request:
Response:

Tools/List

Request:
Response:

Tools/Call

Request:
Response:

Resources/List

Request:
Response:

Resources/Read

Request:
Response:

Prompts/List

Request:
Response:

Prompts/Get

Request:
Response:

Content Types

Text Content

Image Content

Resource Content

Notifications

Notifications are messages sent without expecting a response (no id field):

Tools/ListChanged

Resources/ListChanged

Resources/Updated

Streaming Messages

For streaming responses, the server sends multiple messages:

Content Start

Content Delta

Content End

Progress Updates

For long-running operations:

Example Flows

Complete Chat Interaction

Batch Requests

Send multiple requests in a single HTTP call:
Response:

Validation

Request Validation

All requests must:
  • Include jsonrpc: "2.0"
  • Have a unique id (except notifications)
  • Specify a valid method
  • Provide required params for the method

Response Validation

Clients should validate:
  • Response id matches request id
  • Either result or error is present (not both)
  • Content types match expected formats

Best Practices

Always use unique IDs for requests to prevent confusion:
Always check for error responses:
Set reasonable timeouts for requests:
Combine multiple requests to reduce latency:

Next Steps

MCP Endpoints

Available endpoints

MCP Tools

Tool reference

MCP Resources

Resource types

Authentication

Get auth tokens

MCP Messages: Standardized communication protocol for AI applications!