Let's write a MCP server in Dart. I'd like to make a tool that knows how to roll dice. This way, an LLM can get access to a real source of randomnes.
There's no ready-to-use Dart package, but there's a specification that details how to create such a server.
In its easiest form, the server reads JSON RPC requests from stdin
and writes responses to stdout
. It is allowed to use stderr
for logging. All streams are UTF-8 encoded and adhere to the JSONL format, that is, each request must be a single line.