Skip to main content
Glama

Utility MCP Server

ユーティリティツール、リソース、プロンプトを提供するフル機能のModel Context Protocol (MCP) サーバーです。TypeScriptと最新のMCP SDKを使用して構築されています。

📁 プロジェクト構造

プロジェクトは拡張性と可読性を考慮して構成されています:

.
├── index.ts              # Entry point: Initializes server and registers modules
├── src/
│   ├── tools.ts          # Tool handlers (Arithmetic, Randomness, Sampling)
│   ├── prompts.ts        # Prompt templates (Math Tutoring)
│   └── resources.ts      # Resource definitions (System Status)
├── tests/
│   └── utility.test.ts   # Comprehensive unit tests
├── package.json          # Dependencies and scripts
├── tsconfig.json         # TypeScript configuration
└── jest.config.js        # Testing configuration

Related MCP server: MCP Server TypeScript

🚀 機能

1. ツール

  • random_number: 指定された範囲内で乱数を生成します。

  • calculator: 基本的な算術演算(add(加算)、subtract(減算)、multiply(乗算)、divide(除算))を実行します。

  • suggest_arithmetic_task: クライアント/LLMに創造的な数学の問題を生成させることで、LLMサンプリングを実演します。

2. リソース

  • system_status (utility://system/status): サーバーの健全性と機能数に関するリアルタイムのステータス更新を提供します。

3. プロンプト

  • math_tutor: LLMが数学教師として振る舞うようガイドするテンプレートで、特定のトピックに焦点を当てることも可能です。


📡 APIの呼び出し (Postman / JSON-RPC)

Model Context ProtocolはJSON-RPC 2.0を使用します。このサーバーは現在stdio(標準入出力)経由で動作していますが、HTTP/SSEブリッジ経由で公開するか、デバッガーを使用することで、これらのメッセージ形式を使用して対話できます。

🛠 ツール

ツールの一覧表示

リクエスト:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/list"
}

calculator の呼び出し

リクエスト:

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "calculator",
    "arguments": {
      "operation": "multiply",
      "a": 5,
      "b": 10
    }
  }
}

📖 リソース

リソースの一覧表示

リクエスト:

{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "resources/list"
}

system_status の読み取り

リクエスト:

{
  "jsonrpc": "2.0",
  "id": 4,
  "method": "resources/read",
  "params": {
    "uri": "utility://system/status"
  }
}

📝 プロンプト

プロンプトの一覧表示

リクエスト:

{
  "jsonrpc": "2.0",
  "id": 5,
  "method": "prompts/list"
}

math_tutor プロンプトの取得

リクエスト:

{
  "jsonrpc": "2.0",
  "id": 6,
  "method": "prompts/get",
  "params": {
    "name": "math_tutor",
    "arguments": {
      "topic": "algebra"
    }
  }
}

🛠 開発

セットアップ

npm install

サーバーの実行

npm start

テストの実行

npm test

🤖 カスタムクライアントの使用

プログラムによる接続方法を確認できるよう、組み込みのクライアント例を含めています:

npm run client

このスクリプトは以下の処理を行います:

  1. サーバーを子プロセスとして起動します。

  2. Stdio経由で接続します。

  3. ツールの一覧表示、計算機の呼び出し、リソースの読み取りを自動的に実演します。

🔍 MCP Inspectorによるテスト

サーバーを視覚的に操作するには:

npx @modelcontextprotocol/inspector npx tsx index.ts

[!IMPORTANT] このサーバーはStdioトランスポートを使用します。stdinとstdoutを介して通信します。PostmanでHTTP経由で動作させるには、サーバー構成にSSE(Server-Sent Events)トランスポート層を追加する必要があります。

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    A TypeScript MCP server implementation using Express.js that provides basic tools like echo, time retrieval, and calculator functionality. Features session management, RESTful API endpoints, and Server-Sent Events for streamable communication.
    -
  • -
    license
    Not graded
    quality
    Not graded
    maintenance
    A production-ready TypeScript MCP server providing basic tools (add, echo, timestamp), resources (server info, greetings, data access), and prompt templates (analyze, code-review, summarize). Serves as a foundation for building custom MCP servers with extensible architecture.
    284 npm
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    A lightweight TypeScript-based MCP server that demonstrates how to build custom MCP tools by implementing a simple addition calculator. Serves as a starting point for building MCP-compatible tools.
    2,859 npm
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    A calculator-focused MCP server with TypeScript and Zod validation, providing tools, resources, and prompts for basic arithmetic operations.
    -