All chapters
  1. Start hereA protocol standardizes the call. It does not grant the permission
  2. Foundations · 1The primitive: a function, its arguments, its result, its side effects
  3. Foundations · 2Function calling: the model asks, your application executes
  4. Foundations · 3Client and server: process boundaries, JSON-RPC, errors and trust
  5. Foundations · 4What MCP is: host, client, server and what the protocol promises
  6. Protocol · 5Three surfaces: tools act, resources inform, prompts guide
  7. Protocol · 6A first MCP server: typed input, deterministic data, the raw exchange
  8. Protocol · 7Java and the SDKs: typed DTOs, validation and interoperability
  9. Protocol · 8Local or remote: stdio, HTTP, stateless requests and availability
  10. Platform · 9The database decision: direct SQL, a service boundary or an MCP adapter
  11. Platform · 10Sharing across teams: ownership, catalogs, contracts and versions
  12. Platform · 11Who gets access: users, agents, delegation and least privilege
  13. Platform · 12Enterprise authorization: tokens, audiences, gateways and no passthrough
  14. Platform · 13The threat model: injection, poisoned tools, confused deputies and egress
  15. Platform · 14Governance: who may publish, who approves, who answers the page
  16. Operations · 15Observability and audit: what was called, by whom, and why it was allowed
  17. Operations · 16Resilience: timeouts, retries, idempotency and overload at a shared server
  18. Operations · 17Testing and evaluation: contracts, authorization matrices and injection
  19. Reference · 18Advanced MCP: long tasks, large catalogs, tenants and evolving versions
  20. Reference · 19The ecosystem: SDKs, registries, gateways, identity and telemetry
  21. Reference · 20Enterprise reference architecture: one assessment platform, four teams
  22. Reference · 21Decision playbooks: function, API or MCP, and the records that explain why
  23. ReferenceGlossary
  24. AboutAbout this site and its sources
Foundations · 3

Client and server: process boundaries, JSON-RPC, errors and trust

Moving a function into another process adds serialization, a transport, partial failure and a trust boundary. JSON-RPC from zero, and what changes the moment the caller is not your own code.

You will understand
What a process boundary adds: serialization, a transport, and failures a local call never has.
You will be able to read
A JSON-RPC 2.0 exchange: method, params, id, result, error, notification.
You will know
Why a reply that never arrives and a caller that is not your code change the design.

For a year the roof lookup lived inside the underwriting agent's application. Then the support desk asked for it. Their ticketing system is written in Java and runs on other machines; it cannot import a Python class. The assessment team does what teams have done for decades: it puts the same service behind an endpoint in its own process and lets other programs send it requests.

The first week goes well. Then, on an afternoon when the network between two data centers is slow, the underwriting workbench (now also calling over the network) sends record_recommendation for SUB-1004 and waits. Its timeout fires. On the other side, the service may have stored the recommendation and the reply is still on its way. Or the request never arrived. Or the service crashed halfway. The workbench cannot tell which, and each answer calls for a different next step.

In the same week, a security reviewer asks a question nobody asked while the function was local: "Who exactly is allowed to send this endpoint a request?" Inside one process, every caller was the team's own code. Across a process boundary, the caller is whatever program can reach the port.

This page is about those two changes, and about the small, old protocol that MCP uses to carry requests across the boundary: JSON-RPC 2.0. It stays general on purpose. What MCP adds on top is the subject of What MCP is; its transports in detail are on Local or remote.

What changes when the function moves to another process#

A process boundary is the line between two running programs that do not share memory. Inside one process, a call passes a reference to an object and the callee reads it directly; it can fail only by raising an exception the caller catches. Across a boundary, nothing is shared. The caller must turn its request into bytes, hand the bytes to something that carries them, and wait for bytes to come back.

Three things follow, and each is a new source of failure.

The request and the result must be turned into bytes and back. That is serialization: writing a value as a sequence of bytes that another program can read and rebuild. The PropertyAssessment becomes a line of JSON text on the way out and a dictionary or a Java record on the way in. Types that a language knows do not always survive: JSON has no date type (so assessed_at travels as a string), no difference between an integer and a float on the wire, and None in Python becomes null. The DTO's validation on The primitive is what catches a record that did not survive the trip.

The bytes need a carrier. That is the transport: the mechanism that moves bytes from one process to another, such as a pipe between a parent and a child process, or an HTTP connection over a network. The transport decides how a message is framed (where one ends and the next begins), how long the caller waits, and what "the other side went away" looks like.

The caller and callee can now fail separately. A local call either returns or raises. A remote call can also leave the caller with no answer at all, while the callee did some or all of the work. That is partial failure, and it is the hardest of the three.

Before AI. A backend engineer has crossed this boundary many times: Java RMI, SOAP, a REST controller in front of a Spring service, gRPC between microservices, a JDBC call to a database server. Every one of them adds a serialization format, a transport and a way to fail halfway. Remote procedure call frameworks tried for years to make a remote call look like a local one; the lesson most teams drew is that it should not look local, because it does not fail like one.

The smallest message: JSON-RPC 2.0 from zero#

Two programs that exchange requests need to agree on what a request looks like, what a reply looks like, how a reply is matched to its request, and how an error is reported. JSON-RPC is a small standard that fixes exactly those four things, using JSON. Version 2.0 is dated 2010-03-26 and was last updated 2013-01-04 (read on 2026-11-18). It describes itself as transport agnostic: the same messages can be used "within the same process, over sockets, over http". MCP builds its messages on it.

A request is a JSON object with four members. jsonrpc must be exactly "2.0". method names what to do. params holds the arguments as an object (by name) or an array (by position), and may be left out. id is chosen by the client and links the reply to this request. Here is a real request from the example's stdio transcript (out/mcp_transcript_stdio.json, message 5), with its _meta block trimmed for width:

{"jsonrpc": "2.0", "id": 3, "method": "tools/call",
 "params": {"name": "get_roof_assessment", "arguments": {"submission_id": "SUB-1004"}}}

A response carries the same id and exactly one of two members. On success it has result; on failure it has error; never both. The real reply to the request above (message 6, trimmed):

{"jsonrpc": "2.0", "id": 3,
 "result": {"resultType": "complete",
            "content": [{"type": "text", "text": "{\"submission_id\": \"SUB-1004\", \"property_id\": \"PROP-2207\", \"roof_age_years\": 22}"}],
            "isError": false}}

An error object has an integer code, a short message that should be a single sentence, and an optional data member with anything the server wants to add. A real one from the same transcript (message 10), for a tool name the server does not have:

{"jsonrpc": "2.0", "id": 5, "error": {"code": -32602, "message": "Unknown tool: get_roof_report"}}

A notification is a request without an id. The client does not want an answer, and the server must not send one. The transcript's last message is a notification; the server stays silent:

{"jsonrpc": "2.0", "method": "notifications/cancelled", "params": {"requestId": 99, "reason": "user pressed stop"}}

The standard reserves a range of error codes for problems with the messages themselves:

CodeNameMeaning
-32700Parse errorThe bytes were not valid JSON
-32600Invalid RequestValid JSON, but not a valid request object
-32601Method not foundNo such method
-32602Invalid paramsThe method exists; its parameters are wrong
-32603Internal errorSomething broke inside the JSON-RPC handling
-32000 to -32099Server errorReserved for implementation-defined server errors

The whole range from -32768 to -32000 is reserved; applications pick their codes outside it. Method names starting with rpc. are reserved too. Batches (an array of requests answered by an array of responses, in any order, matched by id) exist in JSON-RPC; the MCP documentation read for this site on 2026-11-18 does not mention them, so this site does not use them.

That is the entire protocol. It says nothing about who may call which method, how to find out which methods exist, or what the methods mean. Those are left to whatever is built on top of it.

Request ids: matching answers to questions#

On a connection, a client may send a second request before the first answer arrives. Answers can then come back in a different order, for example when the second request is quicker. The request id is what makes this safe: a value the client picks for each request, which the server copies into the response, so the client can match each answer to its question.

JSON-RPC lets the id be a string, a number or null, and advises against null and against fractional numbers. Normative (MCP specification 2026-07-28): MCP narrows this: an id must be a string or an integer, must not be null, and must not repeat an id the sender still has outstanding. If a server cannot even read the id (the bytes were not JSON), its error response carries "id": null, because there is nothing else to copy.

Common confusion. A JSON-RPC id identifies one request on one wire. It is not an idempotency key. When a client retries a write after a timeout, the retry is a new request and gets a new id; what tells the server "this is the same intent again" is the idempotency key inside the arguments (SUB-1004:run-7f3a:recommendation). Reusing the old JSON-RPC id would be wrong on MCP if the first request is still outstanding, and it would prove nothing to the domain service anyway. Neither is the id a trace or correlation id; this site keeps all three separate.

Two kinds of failure in one reply#

A remote call can fail at two levels, and a good design keeps them apart because different readers handle them.

The first level is the protocol: the message was not JSON, the method does not exist, the parameters do not fit the method. These come back as a JSON-RPC error object. The reader is the client program, which can fix its own bug or give up; there is usually nothing useful for a model to learn from "Parse error".

The second level is the operation: the message was fine, the method ran, and the business outcome was a failure. The submission was not found, the arguments failed the tool's schema, the caller's permission did not cover this record, the downstream service timed out. These come back as a successful JSON-RPC result whose content reports the failure. The reader is often a model, which can correct an honest mistake on its next turn.

Normative (MCP specification 2026-07-28): MCP draws exactly this line for tools. An unknown tool name is a protocol error (-32602); a failure while running a known tool, including invalid input, goes in the result with isError true. The example's transcript shows both, one message apart. Message 10 is the protocol error above. Message 12 is a request the server understood and refused:

{"jsonrpc": "2.0", "id": 6,
 "result": {"resultType": "complete",
            "content": [{"type": "text", "text": "{\"error\": {\"code\": \"not_authorized\", \"message\": \"record_underwriter_decision needs scope uw.decide\", \"retryable\": false, \"check\": \"scope\"}}"}],
            "isError": true}}

The JSON-RPC layer says "success: here is your result". The result says "your operation was refused". A client that only checks for the error member will think this call worked. A first server reads both shapes field by field.

Transports: a pipe or a network#

The same JSON-RPC messages can travel over very different carriers. Two matter on this site.

A pipe connects a parent process to a child it started. The parent writes to the child's standard input and reads the child's standard output. There is no network, no port and no address: only the two processes, on one machine, usually run by the same operating-system user. Messages need framing on a byte stream; a common choice, and the one the example uses, is one JSON message per line. Anything else written to standard output, a stray debug print for example, corrupts the stream, which is why such servers log to standard error.

HTTP carries each request as an HTTP request to a URL on a server process, possibly on another continent. It brings what HTTP brings: status codes, headers (including an Authorization header for a credential), proxies, load balancers and timeouts at every hop. The server is a long-running service that answers many clients.

Diagram: One lookup across a process boundary · same messages, two carriers

Rows are the parties, columns run left to right in time. The client serializes the request and frames it; the transport carries bytes, either over a pipe to a child process or over an HTTP connection; the server parses, checks and calls the same assessment service. The trust boundary is the line between the transport row and the server row. Click a box for what happens there.

  1. Client process
    1. JSON-RPC request: The request becomes one JSON object with jsonrpc, id, method and params, written as bytes.
    2. match id, rebuild DTO: The client matches the reply to its request by id and rebuilds the PropertyAssessment. If nothing comes back, it cannot tell what happened.
  2. Transport
    1. pipe: one line: On a pipe the message is one line on the child's standard input; the reply is one line on its standard output. Same machine, same OS user.
    2. HTTP request: Over HTTP the message is the body of a request to a URL, with an Authorization header carrying a credential.
  3. Server process
    1. parse, frame check, credential, validate: The server reads the bytes as untrusted input: is it JSON, is it a valid request, who is the caller, may they do this.
    2. assessment service: The adapter calls the same AssessmentService; the domain's rules do not change because a boundary was added.
    3. response, same id: The reply copies the request's id and carries exactly one of result or error.

The diagram follows one lookup across the boundary on both carriers. The rows are the parties; the columns are the steps in time. What changes between the two carriers is the middle row. The client and server rows are the same: serialize, frame, parse, validate, execute, reply.

What this is not. This page does not teach MCP's own rules for its two transports (how the stdio binding frames and shuts down, which headers Streamable HTTP requires, what a stateless request carries). Those are on Local or remote and, from the tool author's angle, on Tools Engineering: MCP transports.

Run it: the same lookup over HTTP and over a pipe#

The example offers the roof lookup over both carriers. Stage 3 (stages.py, stage_http_api) runs a private REST endpoint on 127.0.0.1 for one run, with a REST controller as the adapter around the same AssessmentService, and a client that sends one request with a toy bearer token and one without. The stdio transcript in out/ comes from mcp_client.py, which starts mcp_server.py as a child process and talks JSON-RPC over its pipes. A successful run shows that the DTO survives both trips unchanged and that each layer refuses what it should. It does not measure anything about networks: the HTTP server listens on the loopback address of one laptop, so a timing would describe the laptop.

The REST controller's handler, quoted from make_rest_handler (shown at the top level so it stands alone):

def do_GET(self) -> None:      # noqa: N802
    auth = self.headers.get("Authorization", "")
    token = auth[7:] if auth.startswith("Bearer ") else None
    v = identity.validate(token, clock.epoch_s(), identity.SERVICE_AUDIENCE)
    if not v["valid"]:
        return self._send(401, {"error": "invalid_token", "failed": v["failed"]},
                          {"WWW-Authenticate": 'Bearer error="invalid_token"'})
    if "assessment.read" not in v["effective_scopes"]:
        return self._send(403, {"error": "insufficient_scope", "scope": "assessment.read"})
    m = ROUTE.match(self.path)
    if not m:
        return self._send(404, {"error": "not_found"})
    try:
        self._send(200, service.get_roof_assessment(m.group(1)).to_dict())
    except NotFound:
        self._send(404, {"error": "not_found"})

Run on 2026-11-18 in a scratch copy of examples/uw-mcp (a short driver printed these fields of the stage 3 evidence):

HTTP request: {"method": "GET", "path": "/v2/submissions/SUB-1004/roof-assessment", "headers": {"Authorization": "Bearer <toy token jti-38c74a75>", "Accept": "application/json"}}
HTTP status: 200 | without token: 401
HTTP body: {"submission_id": "SUB-1004", "property_id": "PROP-2207", "roof_age_years": 22, "roof_material": "modified bitumen", "evidence_source": "roof-data provider (stand-in)", "evidence_id": "EV-ROOF-0412", "assessed_at": "2026-08-03T14:20:00Z", "policy_version": "2026.2", "assessment_status": "complete"}

The body is byte for byte the DTO from stage 1. What the boundary added is the first five lines of the handler: before the service is reached, the controller checks a credential, its audience and its scope. The same request without a token gets 401. Inside one process none of those lines existed, because none were needed.

On the pipe, the JSON-RPC layer does the framing work itself. McpServer.handle in mcp_server.py is the first thing every message meets. Quoted (top level for the excerpt):

def handle(self, msg: Any, ctx: dict[str, Any]) -> tuple[dict[str, Any] | None, int, dict[str, str]]:
    """One message in; (reply or None, HTTP status, extra headers) out. stdio ignores the last two."""
    if not isinstance(msg, dict) or msg.get("jsonrpc") != "2.0" or "method" not in msg:
        if isinstance(msg, dict) and "method" not in msg and ("result" in msg or "error" in msg):
            return None, 400, {}                    # a client must not send responses
        mid = msg.get("id") if isinstance(msg, dict) else None
        return {"jsonrpc": "2.0", "id": mid, "error": {"code": -32600, "message": "Invalid Request"}}, 400, {}
    if "id" not in msg:
        return None, 202, {}                        # notifications get no reply
    if msg["id"] is None:
        return {"jsonrpc": "2.0", "id": None, "error": {"code": -32600, "message": "Invalid Request: id must "
                                                        "not be null"}}, 400, {}
    # ... then dispatch to the method, and turn exceptions into JSON-RPC errors

Feeding it three malformed lines through handle_line (which adds the parse step) gives:

{"jsonrpc": "2.0", "id": null, "error": {"code": -32700, "message": "Parse error"}}
{"jsonrpc": "2.0", "id": 8, "error": {"code": -32600, "message": "Invalid Request"}}
null

The first input was cut off mid-JSON, so the server cannot read an id and answers with null. The second said "jsonrpc": "1.0", so it is valid JSON but not a valid request. The third was a notification, and null here means the server produced no reply at all. In the recorded stdio session, 17 messages go to the server and 16 replies come back: the notification is the one without an answer.

Partial failure: the reply that never arrives#

Return to the slow afternoon. The workbench sent record_recommendation and its timeout fired. From the caller's side there are three possibilities, and nothing in the silence distinguishes them: the request never reached the service; the service received it and failed before storing anything; or the service stored the recommendation and the reply was lost or late.

A local call never leaves you here. A remote one always can, and no transport removes the possibility, because the last message of any exchange can be the one that is lost. What a design can do is make the next step safe whatever happened.

For a read the next step is easy: retry, within a deadline. Repeating a read changes nothing. For a write the next step is safe only if the server can recognize the repeat. That is why the idempotency key from The primitive exists: the caller retries the write with a new JSON-RPC id and the same key, and the service either writes it once or returns the row it already wrote.

This site's own case UW-M08 runs the scenario with a simulated clock. The read times out three times inside its 3000 ms deadline (attempts at 0, 1200 and 2600 ms, simulated) and ends with a controlled timeout error. The write is attempted once, not retried by the server, and times out. The client then retries with the same key: the write succeeds. The client retries once more, as if that reply had been lost too: the service answers with the stored row (idempotent_replay true). At the end there is one row. In this example the first write's fault fires before the service runs, so nothing was stored; the client could not know that, and it did not need to.

Diagram: The reply that never arrives · three causes, one safe next step

Read each column top to bottom. The client sends a write and its timeout fires. Three different things may have happened on the server, and the client sees the same silence in all three. The last row is the same in every column: retry with a new request id and the same idempotency key. That retry is correct whichever cause was real, which is the whole point of the key.

  1. A · Request lost
    1. request never arrives: The bytes were dropped before the server read them.
    2. client: timeout: The client's timer fires; it has no reply.
    3. retry: new id, same key: The retry is the first write the server sees; it stores one row.
  2. B · Failed before storing
    1. server fails early: The server received the request but failed before the transaction committed.
    2. client: timeout: No reply, or an error that never reached the client.
    3. retry: new id, same key: The service finds no row for the key and stores one.
  3. C · Stored, reply lost
    1. row committed: The work is done; only the answer is missing.
    2. client: timeout: The client cannot see that the row exists.
    3. retry: new id, same key: The service recognizes the key and returns the stored row with idempotent_replay true. Still one row.

The diagram puts the three possibilities side by side. The point to take from it is the last row: the same client action, a retry with the same key and a new id, is correct in all three.

Production pitfall. A client timeout does not stop the server. If the client gives up after 2 seconds and the server keeps working for 5, the work completes with nobody waiting for it. Retrying a write in that window without a key is how duplicates happen. Deadlines that travel with the request, cancellation, and retry budgets per consumer are the subject of Resilience.

The trust boundary: once the caller is not your code#

Inside one process, the adapter, the policy and the service were all written and deployed by one team. A call from one to the other did not need to prove anything. Across a process boundary that assumption ends. Any program that can reach the endpoint can send it bytes. The bytes may come from the support desk's ticketing system, from an agent another team built, from a script someone ran on a laptop, or from an attacker.

The line where this happens is a trust boundary: a point in a system where data or requests arrive from a party the receiver does not control, so everything that crosses it must be checked. Stage 3 has two of them: from the agent application to the assessment API, and from the API to its database.

Four consequences follow for the receiving side.

Identity comes from a credential, not from the message. In stage 3 the caller's identity is a token in the Authorization header, issued by an identity provider for this API's audience and checked on every request. A field in the body saying "caller": "underwriting-agent" would prove nothing. On a pipe the situation is different: the child process was started by the host, so its caller is whoever started it, and the example takes the principal from the environment the host set. That is a much smaller boundary (same machine, same user), not no boundary.

Every request is validated as if it were hostile. The schema check, the authorization check and the tenant check from Function calling move to the server side of the boundary, and they run there even if the client claims it already ran them. A client's checks are a convenience for the client.

What you show is not what you allow. A server that lists only some methods to a caller still receives any method name the caller types. The example's transcript shows it: the underwriting agent's list does not contain record_underwriter_decision, the client calls it anyway (message 11), and the server refuses it at execution (message 12).

The boundary runs both ways. The client should not trust the server blindly either. A tool result can carry text that looks like an instruction, such as the guidance passage P-NOTE-17 in case UW-M09. The client treats results as data. A server the client has never verified may not be the server it thinks it is; Threat model covers spoofed servers.

Security note. A protocol standardizes the call. It does not grant the permission. JSON-RPC makes a request readable by any program; it carries no identity and no authorization. Everything that decides whether a request may succeed is built around the protocol: the token, its audience, the scope check, the tenant check, the audit event. Who gets access and Enterprise authorization build them for the remote server.
Governance note. The moment a capability crosses a process boundary, someone operates the receiving process: deploys it, watches it, gets paged when it fails, and answers for who could reach it. In stage 3 that is the assessment domain. Name the operator and the reachable network before the first external caller arrives.

What goes wrong without these ideas#

A team that treats the remote call as a local one makes predictable mistakes. It retries writes on timeout with no key, and the underwriter sees two recommendations. It checks only for a JSON-RPC error member and reports a refused write as a success. It reads the caller's identity from the request body because "only our services call this". It prints a debug line to standard output in a stdio server and breaks every message after it. It lets a client time out at 2 seconds while the server works for 10, and retries into work still in progress. Each mistake is the local-call habit applied across a boundary where it no longer holds.

In a coding agent. A coding agent starts a local repository server as a child process and talks to it over a pipe; the server runs with the developer's own rights, and the boundary is small. The same agent reaches the company's code review system through a remote server over HTTP; there a token decides which repositories the developer may open a pull request in, and a lost reply to open_pull_request raises the same question as a lost recommendation. Same messages, two very different trust boundaries.

Checklist for Monday#

Exercises#

  1. A client sends request id 7, times out, and resends the same message with id 7 while the first is still outstanding. What is wrong, and what should it send instead?
  2. A server answers a call for a submission in another business unit with a JSON-RPC error -32602. Is that the right level for the failure?
  3. A team says their local stdio server needs no authorization at all because "there is no network". Where does the trust boundary sit, and what still crosses it?
AnswersOne line each
  1. Reusing an outstanding id breaks response matching (and is forbidden on MCP); send a new id, and if it is a write, the same idempotency key in the arguments.
  2. No: the method and its parameters were valid, so it is an operation failure (a result with isError true and not_found, worded like a missing submission), not a protocol error.
  3. Between the host and the child process: the server runs with the user's rights, and the requests it receives were written by a model that may have read injected text, so it still validates arguments and limits what it can reach.
HTTP status codes and JSON-RPC errors: two vocabularies in one replyWhich layer says what, and where the specifications stop

Over HTTP a reply has two status channels: the HTTP status line and the JSON-RPC body. They can disagree, and specifications do not always say how they should relate. JSON-RPC itself is transport agnostic and says nothing about HTTP status codes.

The example has to choose, and its README lists the choices. A missing or invalid token gets HTTP 401 before any JSON-RPC handling, because the authorization specification it follows requires it. A missing scope gets HTTP 403 with a WWW-Authenticate challenge, and the body carries a JSON-RPC error with code -31403, an application code chosen outside the reserved range. An unknown tool is a JSON-RPC error with HTTP 200, because the documentation read does not define another status for it. Other refusals (principal type, tenant) are results with isError true and HTTP 200.

Competing designs exist in practice. Some services map every JSON-RPC error to an HTTP 4xx or 5xx so that load balancers and dashboards see failures. Others always answer 200 for any message they could parse, so that HTTP means "transport worked" and the body means "operation outcome". The first is easier to monitor; the second keeps the two layers cleanly apart. This site's recommendation: use HTTP status for what HTTP infrastructure must act on (authentication, rate limits, overload, a broken request), keep operation outcomes in the body, and write the mapping down in the service contract so every consumer reads it the same way. Monitoring then counts isError results from the body, not only HTTP failures.

Timeouts at two ends of a wireClient timeouts, server deadlines, cancellation, and work nobody waits for

A timeout is set by one party and is invisible to the other. The client decides how long it will wait; the server decides how long it will work. If the two numbers are unrelated, three bad things happen. The client gives up while the server continues, so work completes with nobody to receive it. The client retries while the first attempt is still running, so the server does the same work twice in parallel. And a server that waits on a slower service downstream may hold resources for requests whose callers left long ago.

Three tools address this. A deadline that travels with the request (an absolute time, or a remaining budget) lets the server stop work that can no longer be useful; the example's server uses a 3000 ms deadline on its own retries to the assessment service (UW-M08). Cancellation lets the client say "stop" explicitly; JSON-RPC has no built-in cancellation, but a notification can carry one, and the example's transcript ends with notifications/cancelled for request id 99. And idempotency keys make the overlap harmless for writes even when the first two fail.

None of these removes the uncertainty of the lost reply; they reduce how often it happens and how much it costs. Their design at a server shared by four teams, where one team's slow calls must not exhaust another team's budget, is on Resilience; system-wide recovery belongs to https://reliable.sammuthu.com.

Why JSON-RPC and not REST, gRPC or a queue?Four ways to cross a boundary, compared on what this site cares about

JSON-RPC is one of several ways to carry requests between processes. Each solves a different problem well. The comparison below is qualitative; it states properties of each style, not measurements, and it does not claim why MCP's authors chose JSON-RPC (the documentation read here does not say).

StyleUnit of meaningStrong atWeak at
REST over HTTPA resource at a URL, with HTTP verbsCaching, gateways, browser and tooling support, verbs that say read or writeOperations that are not naturally resources; a different shape per service
JSON-RPC 2.0A method name with paramsVery small, transport agnostic, same shape over a pipe or HTTPNo schema, discovery, identity or streaming of its own; all added on top
gRPCA method in a typed service definition (Protocol Buffers by default)Strong typing, generated code, streaming in either direction, deadlines and cancellation built inNeeds generated code on both sides; binary messages are harder to read on the wire
Message queueA message on a topicDecoupling in time, buffering bursts, many consumersNo immediate answer; request and reply need correlation by hand

For this site the relevant property is the second row's middle column: the same messages over a pipe to a child process and over HTTP to a shared service. A host can talk to a local and a remote server with one message format. Everything JSON-RPC leaves out (what methods exist, what they mean, who may call them) has to be specified by the protocol on top, and that is precisely what What MCP is examines next.

In one breath#

Moving a function into another process turns a call into bytes on a transport, so the request and the result must be serialized, framed, matched by a request id, and checked at two levels: a JSON-RPC error for a broken message, a result that reports failure for a refused or failed operation. A remote call can also end in silence after the work was done, so reads are retried within a deadline and writes only with an idempotency key. And the receiving process can no longer trust its caller: identity comes from a credential, and every request is validated and authorized on the server's side of the boundary.

JSON-RPC gave the two processes a shared message shape, and nothing more: no way to learn which methods a server offers, no agreement on what a tool is, no version negotiation, no notion of who the client works for. When many agent hosts need to discover and call many servers, each pair would have to agree on all of that separately. The protocol that standardizes those agreements is What MCP is.