Manages environment variables for the MCP server, including Anthropic API keys and port configurations.
Used for making HTTP requests to the calculator API endpoints, enabling the MCP server to perform mathematical operations like addition, subtraction, multiplication, division, and power calculations.
Powers the API endpoints for both the calculator service and MCP server, handling requests for mathematical operations and tool execution.
MCP 計算サービス
Claude AI を使用して自然言語リクエストを処理し、数学計算を実行する計算機サービスのモデル コンテキスト プロトコル (MCP) 実装。
建築
このサービスは、次の 3 つの主要コンポーネントで構成されています。
- Calculator API (
calculator-api.js
): 基本的な数学演算を処理します - MCP サーバー(
mcp-server.js
): LLM 統合とツール オーケストレーションを管理します。 - MCP クライアント(
mcp-client.js
): サービスと対話するためのユーザー インターフェースを提供します。
設定
- 依存関係をインストールします:
- 次の変数を含む
.env
ファイルをルート ディレクトリに作成します。
サービスの実行
すべてのコンポーネントを同時に実行できます。
または個別に実行します。
使用法
サービスが起動したら、クライアントインターフェースを介してサービスとやり取りできます。以下にコマンドの例を示します。
- 「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 installed
モデルコンテキストプロトコル アーキテクチャを通じて Claude AI と計算機 API を統合し、自然言語リクエストを処理して数学計算を実行するサービス。
Related MCP Servers
- -securityFlicense-qualityA Node.js server that processes mathematical calculations and natural language math queries through RESTful API endpoints.Last updated -JavaScript
- AsecurityFlicenseAqualityA simple server that provides basic arithmetic operations (addition, subtraction, multiplication, division) as tools that can be called by Large Language Models through the Model Context Protocol.Last updated -4JavaScript
- -securityAlicense-qualityA mathematical expression calculator that processes user-input expressions and returns computed results, supporting basic operations and built-in constants like PI and E.Last updated -4082TypeScriptMIT License
- AsecurityAlicenseAqualityA Model Context Protocol server implementation that enables AI assistants like Claude to perform Google searches and retrieve web data directly through natural language requests.Last updated -1753TypeScriptMIT License