MCP Calculator Service
MCP 計算サービス
Claude AI を使用して自然言語リクエストを処理し、数学計算を実行する計算機サービスのモデル コンテキスト プロトコル (MCP) 実装。
建築
このサービスは、次の 3 つの主要コンポーネントで構成されています。
Calculator API (
calculator-api.js): 基本的な数学演算を処理しますMCP サーバー(
mcp-server.js): LLM 統合とツール オーケストレーションを管理します。MCP クライアント(
mcp-client.js): サービスと対話するためのユーザー インターフェースを提供します。
Related MCP server: Calculator MCP
設定
依存関係をインストールします:
npm install次の変数を含む
.envファイルをルート ディレクトリに作成します。
ANTHROPIC_API_KEY=your_api_key_here
PORT=3000
MCP_PORT=3001サービスの実行
すべてのコンポーネントを同時に実行できます。
npm startまたは個別に実行します。
# Calculator API
npm run start:calculator
# MCP Server
npm run start:mcp
# MCP Client
npm run start:client使用法
サービスが起動したら、クライアントインターフェースを介してサービスとやり取りできます。以下にコマンドの例を示します。
「5と3を足す」
「10 に 20 を足すといくらですか?」
「7.5 + 2.25を計算してください」
「4を6倍する」
「8 を 3 倍すると何になりますか?」
さらに例を表示するには「help」と入力し、終了するには「exit」と入力してください。
APIエンドポイント
計算機API(ポート3000)
POST /:operation- 数学演算(加算、減算、乗算、除算、累乗)を実行しますGET /health- ヘルスチェックエンドポイント
MCP サーバー (ポート 3001)
GET /tools- 利用可能なツールの一覧を取得するPOST /execute/:toolId- 特定のツールを実行するPOST /agent- 自然言語リクエストを処理するGET /health- ヘルスチェックエンドポイント
エラー処理
このサービスには、次のような包括的なエラー処理が含まれています。
無効な数学演算
ゼロ除算
無効なパラメータタイプ
LLM応答解析エラー
ネットワークエラー
依存関係
@anthropic-ai/sdk: ^0.51.0
アクシオス: ^1.6.7
ボディパーサー: ^1.20.2
コア: ^2.8.5
ドテンヴ: ^16.4.5
エクスプレス: ^4.18.3
同時実行: ^8.2.2 (開発依存)
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
Hosted DataForSEO MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Hosted WordPress MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Claude makes real phone calls for you — in many languages, with transcript and outcome back in chat.
Related MCP Servers
- AlicenseAqualityCmaintenanceA Model Context Protocol server that provides basic mathematical and statistical functions to LLMs, enabling them to perform accurate numerical calculations through a simple API.1334 npm190MIT
- AlicenseBqualityCmaintenanceA Model Context Protocol server that provides basic calculator functionality for LLMs, enabling them to perform mathematical operations like addition, subtraction, multiplication, division, modulo, and square root.6235 npm15MIT
- AlicenseNot gradedqualityDmaintenanceA backend service that provides accurate arithmetic calculation capabilities to AI models via the Model Context Protocol, allowing LLMs to offload mathematical computations for numerical queries.1MIT
- AlicenseBqualityDmaintenanceA simple Model Context Protocol (MCP) server that provides basic calculation functions to Claude. It enables users to perform mathematical operations like addition directly through natural language commands.1MIT