# MCP uses JSON-RPC 2.0 for all messages

> Every MCP message is a JSON-RPC 2.0 object — request, response, notification, or error — sent newline-delimited over the transport.

## Answer

MCP messages are JSON-RPC 2.0 objects exchanged newline-delimited over stdio or HTTP. Four types exist: **request** (has `id`), **response** (matches `id`), **notification** (no `id`), and **error** (failure response with `id`).

## Details

### Lifecycle handshake

1. Client sends `initialize` with protocol version and capabilities
2. Server responds with `InitializeResult` (server capabilities)
3. Client sends `initialized` notification
4. Normal tool/resource operations proceed
5. Either side closes the transport to shut down

### Example request shape

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/list",
  "params": {}
}
```

Notifications omit `id`. Errors return an `error` object with `code` and `message`.

## See also

- [[what-is-mcp]]
- [[mcp-tools-resources-prompts]]

## Sources

- [MCP Specification](https://spec.modelcontextprotocol.io/specification/2024-11-05/)

## Sources

- [MCP Specification 2024-11-05](https://spec.modelcontextprotocol.io/specification/2024-11-05/)