Skip to main content
Glama

MCP Prompt Tester

by rt96-hub

MCPプロンプトテスター

エージェントがさまざまなプロバイダーで LLM プロンプトをテストできるようにするシンプルな MCP サーバー。

特徴

  • OpenAIとAnthropicモデルによるテストプロンプト
  • システムプロンプト、ユーザープロンプト、その他のパラメータを構成する
  • フォーマットされた応答またはエラーメッセージを取得する
  • .env ファイルのサポートによる簡単な環境設定

インストール

# Install with pip pip install -e . # Or with uv uv install -e .

APIキーの設定

サーバーには、使用するプロバイダーのAPIキーが必要です。APIキーは2つの方法で設定できます。

オプション1: 環境変数

次の環境変数を設定します。

  • OPENAI_API_KEY - OpenAI API キー
  • ANTHROPIC_API_KEY - Anthropic APIキー

オプション 2: .env ファイル (推奨)

  1. プロジェクトディレクトリまたはホームディレクトリに.envという名前のファイルを作成します。
  2. 次の形式で API キーを追加します。
OPENAI_API_KEY=your-openai-api-key-here ANTHROPIC_API_KEY=your-anthropic-api-key-here
  1. サーバーはこれらのキーを自動的に検出して読み込みます

便宜上、サンプル テンプレートが.env.exampleとして含まれています。

使用法

stdio (デフォルト) または SSE トランスポートを使用してサーバーを起動します。

# Using stdio transport (default) prompt-tester # Using SSE transport on custom port prompt-tester --transport sse --port 8000

利用可能なツール

サーバーは、MCP 対応エージェントに対���て次のツールを公開します。

1. list_providers

利用可能な LLM プロバイダーとそのデフォルト モデルを取得します。

パラメータ:

  • 不要

応答例:

{ "providers": { "openai": [ { "type": "gpt-4", "name": "gpt-4", "input_cost": 0.03, "output_cost": 0.06, "description": "Most capable GPT-4 model" }, // ... other models ... ], "anthropic": [ // ... models ... ] } }
2. テスト比較

複数のプロンプトを並べて比較し、さまざまなプロバイダー、モデル、パラメータを同時にテストできます。

パラメータ:

  • comparisons (配列): 1 ~ 4 個の比較構成のリスト。各比較構成には次の内容が含まれます。
    • provider (文字列): 使用する LLM プロバイダー ("openai" または "anthropic")
    • model (文字列): モデル名
    • system_prompt (文字列): システムプロンプト(モデルの指示)
    • user_prompt (文字列): ユーザーのメッセージ/プロンプト
    • temperature (数値、オプション): ランダム性を制御する
    • max_tokens (整数、オプション): 生成するトークンの最大数
    • top_p (数値、オプション):核サンプリングによる多様性の制御

使用例:

{ "comparisons": [ { "provider": "openai", "model": "gpt-4", "system_prompt": "You are a helpful assistant.", "user_prompt": "Explain quantum computing in simple terms.", "temperature": 0.7 }, { "provider": "anthropic", "model": "claude-3-opus-20240229", "system_prompt": "You are a helpful assistant.", "user_prompt": "Explain quantum computing in simple terms.", "temperature": 0.7 } ] }
3. マルチターン会話のテスト

LLM プロバイダーとのマルチターン会話を管理し、ステートフル会話の作成と維持を可能にします。

モード:

  • start : 新しい会話を開始します
  • continue : 既存の会話を継続します
  • get : 会話履歴を取得する
  • list : すべてのアクティブな会話を一覧表示します
  • close : 会話を閉じる

パラメータ:

  • mode (文字列): 操作モード ("start"、"continue"、"get"、"list"、または "close")
  • conversation_id (文字列): 会話の一意のID (続行、取得、終了モードで必要)
  • provider (文字列): LLM プロバイダー (開始モードに必須)
  • model (文字列): モデル名(開始モードに必須)
  • system_prompt (文字列): システムプロンプト(開始モードに必須)
  • user_prompt (文字列): ユーザーメッセージ(開始モードと継続モードで使用)
  • temperature (数値、オプション):モデルの温度パラメータ
  • max_tokens (整数、オプション): 生成するトークンの最大数
  • top_p (数値、オプション): Top-pサンプリングパラメータ

使用例(会話を始める):

{ "mode": "start", "provider": "openai", "model": "gpt-4", "system_prompt": "You are a helpful assistant specializing in physics.", "user_prompt": "Can you explain what dark matter is?" }

使用例(会話を続ける):

{ "mode": "continue", "conversation_id": "conv_12345", "user_prompt": "How does that relate to dark energy?" }

エージェントの使用例

MCP クライアントを使用すると、エージェントは次のようなツールを使用できます。

import asyncio import json from mcp.client.session import ClientSession from mcp.client.stdio import StdioServerParameters, stdio_client async def main(): async with stdio_client( StdioServerParameters(command="prompt-tester") ) as (read, write): async with ClientSession(read, write) as session: await session.initialize() # 1. List available providers and models providers_result = await session.call_tool("list_providers", {}) print("Available providers and models:", providers_result) # 2. Run a basic test with a single model and prompt comparison_result = await session.call_tool("test_comparison", { "comparisons": [ { "provider": "openai", "model": "gpt-4", "system_prompt": "You are a helpful assistant.", "user_prompt": "Explain quantum computing in simple terms.", "temperature": 0.7, "max_tokens": 500 } ] }) print("Single model test result:", comparison_result) # 3. Compare multiple prompts/models side by side comparison_result = await session.call_tool("test_comparison", { "comparisons": [ { "provider": "openai", "model": "gpt-4", "system_prompt": "You are a helpful assistant.", "user_prompt": "Explain quantum computing in simple terms.", "temperature": 0.7 }, { "provider": "anthropic", "model": "claude-3-opus-20240229", "system_prompt": "You are a helpful assistant.", "user_prompt": "Explain quantum computing in simple terms.", "temperature": 0.7 } ] }) print("Comparison result:", comparison_result) # 4. Start a multi-turn conversation conversation_start = await session.call_tool("test_multiturn_conversation", { "mode": "start", "provider": "openai", "model": "gpt-4", "system_prompt": "You are a helpful assistant specializing in physics.", "user_prompt": "Can you explain what dark matter is?" }) print("Conversation started:", conversation_start) # Get the conversation ID from the response response_data = json.loads(conversation_start.text) conversation_id = response_data.get("conversation_id") # Continue the conversation if conversation_id: conversation_continue = await session.call_tool("test_multiturn_conversation", { "mode": "continue", "conversation_id": conversation_id, "user_prompt": "How does that relate to dark energy?" }) print("Conversation continued:", conversation_continue) # Get the conversation history conversation_history = await session.call_tool("test_multiturn_conversation", { "mode": "get", "conversation_id": conversation_id }) print("Conversation history:", conversation_history) asyncio.run(main())

MCPエージェント統合

MCP 権限を持つエージェントの場合、統合は簡単です。エージェントが LLM プロンプトをテストする必要がある場合は、次の手順に従ってください。

  1. 検出: エージェントはlist_providersを使用して利用可能なモデルとその機能を検出できます。
  2. シンプルなテスト: 簡単なテストには、単一の構成でtest_comparisonツールを使用します。
  3. 比較:エージェントが異なるプロンプトやモデルを評価する必要がある場合、複数の構成でtest_comparison使用できます。
  4. ステートフルインタラクション: マルチターンの会話の場合、エージェントはtest_multiturn_conversationツールを使用して会話を管理できます。

これにより、エージェントは次のことが可能になります。

  • プロンプトのバリエーションをテストして、最も効果的なフレーズを見つけます
  • 特定のタスクのさまざまなモデルを比較する
  • 複数ターンの会話でコンテキストを維持する
  • 温度やmax_tokensなどのパラメータを最適化する
  • 開発中のトークンの使用状況とコストを追跡する

構成

環境変数を使用して、API キーとオプションのトレース構成を設定できます。

必要なAPIキー

  • OPENAI_API_KEY - OpenAI API キー
  • ANTHROPIC_API_KEY - Anthropic APIキー

オプションのLangfuseトレース

サーバーは、LLM呼び出しのトレースと監視のためにLangfuseをサポートしています。以下の設定はオプションです。

  • LANGFUSE_SECRET_KEY - Langfuse の秘密鍵
  • LANGFUSE_PUBLIC_KEY - Langfuseの公開鍵
  • LANGFUSE_HOST - LangfuseインスタンスのURL

Langfuse トレースを使用しない場合は、これらの設定を空のままにしておきます。

-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

エージェントが OpenAI および Anthropic モデル間で LLM プロンプトをテストおよび比較できるようにする MCP サーバー。単一のテスト、並べて比較、および複数ターンの会話をサポートします。

  1. 特徴
    1. インストール
      1. APIキーの設定
        1. オプション1: 環境変数
        2. オプション 2: .env ファイル (推奨)
      2. 使用法
        1. 利用可能なツール
      3. エージェントの使用例
        1. MCPエージェント統合
          1. 構成
            1. 必要なAPIキー
            2. オプションのLangfuseトレース

          Related MCP Servers

          • -
            security
            A
            license
            -
            quality
            A simple MCP server for interacting with OpenAI assistants. This server allows other tools (like Claude Desktop) to create and interact with OpenAI assistants through the Model Context Protocol.
            Last updated -
            26
            Python
            MIT License
            • Apple
          • A
            security
            F
            license
            A
            quality
            A lightweight MCP server that provides a unified interface to various LLM providers including OpenAI, Anthropic, Google Gemini, Groq, DeepSeek, and Ollama.
            Last updated -
            6
            218
            Python
          • -
            security
            -
            license
            -
            quality
            An MCP server that provides tools for interacting with Anthropic's prompt engineering APIs, allowing users to generate, improve, and templatize prompts based on task descriptions and feedback.
            Last updated -
            1
            TypeScript
            ISC License
          • -
            security
            -
            license
            -
            quality
            An MCP server that enables LLMs to interact with Agent-to-Agent (A2A) protocol compatible agents, allowing for sending messages, tracking tasks, and receiving streaming responses.
            Last updated -
            3
            TypeScript

          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/rt96-hub/prompt-tester'

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