// readme

jsonrpcserver takes a JSON-RPC 2.0 request, calls your Python function and gives you the response to send back. It leaves the networking to you, so it fits into whatever server you already have.

Features

  • Works with any framework or transport. The docs have tested examples for http.server, Flask, Werkzeug, Django, FastAPI, aiohttp, Sanic, Tornado, websockets, ZeroMQ and Socket.IO.
  • Sync and async: dispatch and async_dispatch. With async_dispatch, the requests in a batch run concurrently.
  • Follows the spec for batches, notifications and errors, and checks each request’s params against your function’s signature.
  • Keeps exception messages out of responses and in your logs, and limits batches to 100 requests by default (max_batch_size).
  • Typed: ships py.typed, and @method keeps your functions’ signatures for mypy and pyright.
  • Safe to call from several threads, and tested on Python 3.11 to 3.14, including free-threaded 3.14t.
  • No dependencies, from 6.0.

Install

pip install jsonrpcserver

If you’re on 5.0.9 or older, upgrade: those versions send exception messages to clients. Main is 6.0,…