lil-shimon/Sarutahiko
If you are the rightful owner of Sarutahiko and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
Sarutahiko MCP 計算ツールは、Model Context Protocol (MCP) を使用した簡単な計算ツールのサンプル実装です。
Sarutahiko MCP 計算ツールは、Model Context Protocol (MCP) を活用して、基本的な算術演算を提供するサーバーです。このプロジェクトは、MCPの標準入出力(STDIO)を介して通信し、他のMCPクライアントと連携して動作します。主に加算、減算、乗算、除算、累乗といった基本的な計算機能を提供し、ゼロ除算エラーの処理も含まれています。TypeScriptで実装されており、簡単にインストール、ビルド、実行が可能です。新しい計算機能を追加することも容易で、カスタマイズ性に優れています。
Features
- 加算(add):2つの数値を足し算
- 減算(subtract):2つの数値を引き算
- 乗算(multiply):2つの数値を掛け算
- 除算(divide):2つの数値を割り算(ゼロ除算エラー処理あり)
- 累乗(power):基数を指数乗
Usages
usage with stdio
typescript import { Client } from "@modelcontextprotocol/sdk/client/index.js"; import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js"; const transport = new StdioClientTransport({ command: "node", args: ["dist/calculator-server.js"] }); const client = new Client({ name: "your-client", version: "1.0.0" }); await client.connect(transport); // 利用可能なツールを確認 const tools = await client.listTools(); console.log(tools); // 加算ツールの呼び出し例 const result = await client.callTool({ name: "add", arguments: { a: 5, b: 3 } }); console.log(result);