MCP Calculator Service

by amandhunna
Integrations
  • 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 つの主要コンポーネントで構成されています。

  1. Calculator API ( calculator-api.js ): 基本的な数学演算を処理します
  2. MCP サーバー( mcp-server.js ): LLM 統合とツール オーケストレーションを管理します。
  3. MCP クライアント( mcp-client.js ): サービスと対話するためのユーザー インターフェースを提供します。

設定

  1. 依存関係をインストールします:
npm install
  1. 次の変数を含む.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 (開発依存)
-
security - not tested
F
license - not found
-
quality - not tested

モデルコンテキストプロトコル アーキテクチャを通じて Claude AI と計算機 API を統合し、自然言語リクエストを処理して数学計算を実行するサービス。

  1. 建築
    1. 設定
      1. サービスの実行
        1. 使用法
          1. APIエンドポイント
            1. 計算機API(ポート3000)
            2. MCP サーバー (ポート 3001)
          2. エラー処理
            1. 依存関係

              Related MCP Servers

              • -
                security
                F
                license
                -
                quality
                A Node.js server that processes mathematical calculations and natural language math queries through RESTful API endpoints.
                Last updated -
                JavaScript
              • A
                security
                F
                license
                A
                quality
                A 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 -
                4
                JavaScript
              • -
                security
                A
                license
                -
                quality
                A 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 -
                408
                2
                TypeScript
                MIT License
              • A
                security
                A
                license
                A
                quality
                A 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 -
                1
                75
                3
                TypeScript
                MIT License

              View all related MCP servers

              MCP directory API

              We provide all the information about MCP servers via our MCP API.

              curl -X GET 'https://glama.ai/api/mcp/v1/servers/amandhunna/mcpserver'

              If you have feedback or need assistance with the MCP directory API, please join our Discord server