Random Value MCP Server

Random Value MCP Server

Generates random integers within a specified range and random alphanumeric strings of specified length through MCP protocol integration.

Category
Visit Server

README

ランダム値生成MCPサーバー

ランダムな数値と文字列を生成するModel Context Protocol (MCP) サーバーです。

機能

  • ランダム数値生成: 指定した範囲内のランダムな整数を生成
  • ランダム文字列生成: 指定した長さのランダムな英数字文字列を生成
  • 入力値検証: 包括的なエラーハンドリングと検証
  • MCP準拠: MCPプロトコル仕様との完全な互換性

ツール

generate_random_number

指定した範囲内のランダムな整数を生成します。

パラメータ:

  • min (number): 最小値(含む)
  • max (number): 最大値(含む)

例:

{
  "name": "generate_random_number",
  "arguments": {
    "min": 1,
    "max": 100
  }
}

generate_random_string

英数字(A-Z, a-z, 0-9)を使用して指定した長さのランダム文字列を生成します。

パラメータ:

  • length (number): 生成する文字列の長さ(最小: 1)

例:

{
  "name": "generate_random_string",
  "arguments": {
    "length": 10
  }
}

インストール

  1. リポジトリをクローン
  2. 依存関係をインストール:
    npm install
    
  3. プロジェクトをビルド:
    npm run build
    

使用方法

直接実行

node dist/index.js

起動スクリプト使用

./bin/start.sh

MCPクライアント設定

MCPクライアントの設定に追加:

{
  "mcpServers": {
    "random-value-server": {
      "command": "node",
      "args": ["dist/index.js"],
      "cwd": "/path/to/random-value-mcp-server"
    }
  }
}

Claude Code統合

このMCPサーバーをClaude Codeで使用するには:

  1. サーバーがビルドされ準備完了していることを確認:

    npm run build
    
  2. Claude Codeの設定にサーバー設定を追加。MCP設定ファイル(通常は ~/.config/claude-code/mcp.json 、devcontainer内であれば claude mcp add random-value-generator node /workspace/dist/index.js など)を作成または編集:

    {
      "mcpServers": {
        "random-value-server": {
          "command": "node",
          "args": ["dist/index.js"],
          "cwd": "/absolute/path/to/random-value-mcp-server"
        }
      }
    }
    
  3. 新しいMCPサーバーを読み込むためClaude Codeを再起動

  4. サーバーがClaude Codeセッションで利用可能になります。以下のようにして使用できます:

    • generate_random_number with min and max パラメータ
    • generate_random_string with length パラメータ

Claude Codeでの使用例:

1から100の間のランダムな数値を生成してください。
8文字のランダムな文字列を生成してください。

Claude Codeが自動的にMCPサーバーを使用してこれらのリクエストを処理します。

テスト

テストスイートを実行:

node test/test-server.js

以下をテストします:

  • サーバー初期化
  • ツール一覧
  • ランダム数値生成(有効・無効なケース)
  • ランダム文字列生成(有効・無効なケース)
  • エラーハンドリング

開発

  • npm run build: TypeScriptコードをビルド
  • npm run dev: 変更を監視して再ビルド
  • npm run clean: ビルドアーティファクトをクリーン

技術詳細

  • プロトコル: MCP (Model Context Protocol)
  • トランスポート: STDIO
  • 言語: TypeScript/Node.js
  • SDK: @modelcontextprotocol/sdk

エラーハンドリング

サーバーには包括的なエラーハンドリングが含まれています:

  • 無効なパラメータ範囲(数値でmin > max)
  • 無効な文字列長(< 1)
  • 必須パラメータの欠如
  • 未知のツール名

すべてのエラーは適切なMCPエラーレスポンスとして説明的なメッセージと共に返されます。

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured