-
Book Overview & Buying
-
Table Of Contents
Learn Model Context Protocol with TypeScript
By :
The MCP consists of many parts. In short, JavaScript Object Notation-Remote Procedure Call (JSON-RPC) messages are exchanged between the client and the server. A JSON-RPC message is a message following the JSON-RPC specification, which means it has the jsonrpc, id, method, and params fields, and the data type is JSON. An example could look like so:
{
"jsonrpc": "2.0",
"id": 1,
"method": "doSomething",
"params": {
"foo": "bar"
}
}
To make it easier to understand, and more interesting, this chapter attempts to explain the protocol by taking you through an implementation of it. For that reason, we hope this chapter is an easier read (not just architecture diagrams) and a glimpse into how things work. If you’re keen on getting started with building MCP servers, then jump straight to Chapter 3, but if you want to understand the MCP protocol...