directory
Version:
v0.0.2
Opens a new window with list of versions in this module.
Published: Dec 19, 2025
License: Apache-2.0
Opens a new window with license information.
README
¶
Stdio Service Example
This example demonstrates how to expose a command-line tool as an MCP tool using the stdio service type.
The my-tool is a simple Go program that reads a JSON object from stdin, extracts the name field, and writes a JSON object with a greeting to stdout.
2. The mcpany Configuration
The config.yaml file tells mcpany how to register the my-tool program as a tool.
# examples/demo/stdio/config.yaml
upstreamServices:
- name: "my-stdio-service"
stdioService:
command: "./examples/demo/stdio/my-tool-bin"
calls:
- operationId: "greet"
description: "A simple tool that greets the user."
3. Running the Example
-
Run the mcpany Server
In a terminal, start the mcpany server using the provided shell script from the examples/demo/stdio directory:
./start.sh
The mcpany server will start and listen for JSON-RPC requests on port 50050.
-
Interact with the Tool
You can now interact with the tool using a JSON-RPC client.
List Tools Request:
curl -X POST -H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "tools/list", "id": 1}' \
http://localhost:50050
Call Tool Request:
curl -X POST -H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "params": {"name": "my-stdio-service/-/greet", "arguments": {"name": "world"}}, "id": 2}' \
http://localhost:50050
Directories
¶
Package main implements a demo tool.
|
Package main implements a demo tool. |
Click to show internal directories.
Click to hide internal directories.