From 6de5468c8bb38b74057d7330639205449867bf10 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Tue, 3 Jun 2025 02:51:10 +0900 Subject: [PATCH] [Doc] Tweak stdio transport example code in the README The example code is located at `./examples/stdio_server.rb`. Also, the content provided as input via stdio has been updated to avoid returning an error data. Using ping pong as an example, here's the difference: ## Before An error data is returned. ```console $ ./examples/stdio_server.rb {"jsonrpc":"2.0","id":"1","result":"pong"} {"jsonrpc":"2.0","id":null,"error":{"code":-32600,"message":"Invalid Request","data":"Method name must be a string and not start with \"rpc.\""}} ``` This error message is generated in the following location: https://github.com/Shopify/json-rpc-handler/blob/v0.1.1/lib/json_rpc_handler.rb#L70 ## After The expected result is returned without error data. ```console $ ./examples/stdio_server.rb {"jsonrpc":"2.0","id":"1","method":"ping"} {"jsonrpc":"2.0","id":"1","result":{}} ``` The other stdin example has been updated to use data that does not cause errors. With this document update, users can verify the behavior of the MCP server via stdin without using an MCP client. --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3291df62..679df73a 100644 --- a/README.md +++ b/README.md @@ -121,11 +121,10 @@ transport.open You can run this script and then type in requests to the server at the command line. -``` -$ ./stdio_server.rb -{"jsonrpc":"2.0","id":"1","result":"pong"} -{"jsonrpc":"2.0","id":"2","result":["ExampleTool"]} -{"jsonrpc":"2.0","id":"3","result":["ExampleTool"]} +```bash +$ ./examples/stdio_server.rb +{"jsonrpc":"2.0","id":"1","method":"ping"} +{"jsonrpc":"2.0","id":"2","method":"tools/list"} ``` ## Configuration