MCTS MCP Server

Integrations

  • Enables integration with Ollama's local models to run MCTS analysis, allowing model selection, comparison between different Ollama models, and storing results organized by model name.

MCTS MCP サーバー

AI 支援による分析と推論のための高度なベイジアン モンテ カルロ ツリー検索 (MCTS) エンジンを公開するモデル コンテキスト プロトコル (MCP) サーバー。

概要

このMCPサーバーにより、クロードはモンテカルロ木探索(MCTS)アルゴリズムを用いて、トピック、質問、またはテキスト入力を深く探索的に分析することができます。MCTSアルゴリズムはベイズ的アプローチを用いて、様々な視点や解釈を体系的に探索し、複数の反復を通して進化する洞察に満ちた分析結果を生成します。

特徴

  • ベイジアンMCTS :分析中に探索と活用のバランスをとるために確率的アプローチを使用する
  • マルチ反復分析: 反復ごとに複数のシミュレーションを使用して、思考の複数の反復をサポートします。
  • 状態の持続性: 同じチャット内のターン間で、主要な結果、不適切なアプローチ、および事前情報を記憶します。
  • アプローチ分類法:生成された思考をさまざまな哲学的アプローチとファミリーに分類します
  • トンプソンサンプリング: ノード選択にトンプソンサンプリングまたはUCTを使用できる
  • サプライズ検出:分析の驚くべき、あるいは新しい方向性を特定する
  • 意図分類: ユーザーが新しい分析を開始するか、以前の分析を継続するかを理解する

使用法

サーバーは、システム プロンプトにコピー アンド ペースト可能な形式で、以下に詳述する多くのツールを LLM に公開します。

Claude にトピックまたは質問の詳細な分析を依頼すると、これらのツールが自動的に活用され、MCTS アルゴリズムと分析ツールを使用してさまざまな角度から調査されます。

仕組み

MCTS MCPサーバーは、LLMを直接呼び出すのではなく、ローカル推論アプローチを採用しています。これは、ツールがAIモデル自体を呼び出すのではなく、AIアシスタント(Claudeなど)から呼び出されるように設計されたMCPプロトコルと互換性があります。

クロードがサーバーに分析の実行を依頼すると、サーバーは次の処理を実行します。

  1. MCTSシステムを質問で初期化します
  2. MCTSアルゴリズムを使用して探索を複数回反復する
  3. さまざまな分析タスクに対して決定論的な応答を生成する
  4. 検索中に見つかった最良の分析を返します

インストール

リポジトリをクローンします。

このセットアップでは、依存関係の解決が改善された、pip よりも高速な代替手段である UV (Astral UV) を使用します。

  1. Python 3.10以降がインストールされていることを確認してください
  2. セットアップ スクリプトを実行します。
./setup.sh

これにより、次のようになります。

  • UVがインストールされていない場合はインストールしてください
  • UVで仮想環境を作成する
  • UVを使用して必要なパッケージをインストールする
  • 必要な状態ディレクトリを作成する

または、手動で設定することもできます。

# Install UV if not already installed curl -fsSL https://astral.sh/uv/install.sh | bash
# Create and activate a virtual environment uv venv .venv source .venv/bin/activate # Install dependencies uv pip install -r requirements.txt

クロードデスクトップ統合

Claude Desktop と統合するには:

  1. このリポジトリからclaude_desktop_config.jsonの内容をコピーします
  2. これを Claude Desktop 構成に追加します (通常は~/.claude/claude_desktop_config.jsonにあります)
  3. 設定ファイルがまだ存在しない場合は作成し、このプロジェクトのclaude_desktop_config.jsonの内容を追加します。
  4. Claudeデスクトップを再起動します

構成例:

{ "mcpServers": { "MCTSServer": { "command": "uv", "args": [ "run", "--directory", "/home/ty/Repositories/ai_workspace/mcts-mcp-server/src/mcts_mcp_server", "server.py" ], "env": { "PYTHONPATH": "/home/ty/Repositories/ai_workspace/mcts-mcp-server" } } } }

システム上の MCTS MCP サーバーの場所と一致するようにパスを更新してください

推奨されるシステム プロンプトと、Ollama 統合を含む更新されたツール、つまり、プロジェクト手順に次のブロックを配置します。


MCTS server and usage instructions: MCTS server and usage instructions: list_ollama_models() # Check what models are available set_ollama_model("cogito:latest") # Set the model you want to use initialize_mcts(question="Your question here", chat_id="unique_id") # Initialize analysis run_mcts(iterations=1, simulations_per_iteration=5) # Run the analysis After run_mcts is called it can take wuite a long time ie minutes to hours - so you may discuss any ideas or questions or await user confirmation of the process finishing, - then proceed to synthesis and analysis tools on resumption of chat. ## MCTS-MCP Tools Overview ### Core MCTS Tools: - `initialize_mcts`: Start a new MCTS analysis with a specific question - `run_mcts`: Run the MCTS algorithm for a set number of iterations/simulations - `generate_synthesis`: Generate a final summary of the MCTS results - `get_config`: View current MCTS configuration parameters - `update_config`: Update MCTS configuration parameters - `get_mcts_status`: Check the current status of the MCTS system Default configuration prioritizes speed and exploration, but you can customize parameters like exploration_weight, beta_prior_alpha/beta, surprise_threshold. ## Configuration You can customize the MCTS parameters in the config dictionary or through Claude's `update_config` tool. Key parameters include: - `max_iterations`: Number of MCTS iterations to run - `simulations_per_iteration`: Number of simulations per iteration - `exploration_weight`: Controls exploration vs. exploitation balance (in UCT) - `early_stopping`: Whether to stop early if a high-quality solution is found - `use_bayesian_evaluation`: Whether to use Bayesian evaluation for node scores - `use_thompson_sampling`: Whether to use Thompson sampling for selection Articulating Specific Pathways: Delving into the best_path nodes (using mcts_instance.get_best_path_nodes() if you have the instance) and examining the sequence of thought and content at each step can provide a fascinating micro-narrative of how the core insight evolved. Visualizing the tree (even a simplified version based on export_tree_summary) could also be illuminating and I will try to set up this feature. Modifying Parameters: This is a great way to test the robustness of the finding or explore different "cognitive biases" of the system. Increasing Exploration Weight: Might lead to more diverse, less obviously connected ideas. Decreasing Exploration Weight: Might lead to deeper refinement of the initial dominant pathways. Changing Priors (if Bayesian): You could bias the system towards certain approaches (e.g., increase alpha for 'pragmatic') to see how it influences the outcome. More Iterations/Simulations: Would allow for potentially deeper convergence or exploration of more niche pathways. ### Ollama Integration Tools: - `list_ollama_models`: Show all available local Ollama models - `set_ollama_model`: Select which Ollama model to use for MCTS - `run_model_comparison`: Run the same MCTS process across multiple models ### Results Collection: - Automatically stores results in `/home/ty/Repositories/ai_workspace/mcts-mcp-server/results` - Organizes by model name and run ID - Stores metrics, progress info, and final outputs # MCTS Analysis Tools This extension adds powerful analysis tools to the MCTS-MCP Server, making it easy to extract insights and understand results from your MCTS runs. The MCTS Analysis Tools provide a suite of integrated functions to: 1. List and browse MCTS runs 2. Extract key concepts, arguments, and conclusions 3. Generate comprehensive reports 4. Compare results across different runs 5. Suggest improvements for better performance ## Available Run Analysis Tools ### Browsing and Basic Information - `list_mcts_runs(count=10, model=None)`: List recent MCTS runs with key metadata - `get_mcts_run_details(run_id)`: Get detailed information about a specific run - `get_mcts_solution(run_id)`: Get the best solution from a run ### Analysis and Insights - `analyze_mcts_run(run_id)`: Perform a comprehensive analysis of a run - `get_mcts_insights(run_id, max_insights=5)`: Extract key insights from a run - `extract_mcts_conclusions(run_id)`: Extract conclusions from a run - `suggest_mcts_improvements(run_id)`: Get suggestions for improvement ### Reporting and Comparison - `get_mcts_report(run_id, format='markdown')`: Generate a comprehensive report (formats: 'markdown', 'text', 'html') - `get_best_mcts_runs(count=5, min_score=7.0)`: Get the best runs based on score - `compare_mcts_runs(run_ids)`: Compare multiple runs to identify similarities and differences ## Usage Examples # To list your recent MCTS runs: list_mcts_runs() # To get details about a specific run: get_mcts_run_details('cogito:latest_1745979984') ### Extracting Insights # To get key insights from a run: get_mcts_insights(run_id='cogito:latest_1745979984') ### Generating Reports # To generate a comprehensive markdown report: get_mcts_report(run_id='cogito:latest_1745979984', format='markdown') ### Improving Results # To get suggestions for improving a run: suggest_mcts_improvements(run_id='cogito:latest_1745979984') ### Comparing Runs To compare multiple runs: compare_mcts_runs(['cogito:latest_1745979984', 'qwen3:0.6b_1745979584']) ## Understanding the Results The analysis tools extract several key elements from MCTS runs: 1. **Key Concepts**: The core ideas and frameworks in the analysis 2. **Arguments For/Against**: The primary arguments on both sides of a question 3. **Conclusions**: The synthesized conclusions or insights from the analysis 4. **Tags**: Automatically generated topic tags from the content ## Troubleshooting If you encounter any issues with the analysis tools: 1. Check that your MCTS run completed successfully (status: "completed") 2. Verify that the run ID you're using exists and is correct 3. Try listing all runs to see what's available: `list_mcts_runs()` 4. Make sure the `.best_solution.txt` file exists in the run's directory ## Advanced Example Usage ### Customizing Reports You can generate reports in different formats: # Generate a markdown report report = get_mcts_report(run_id='cogito:latest_1745979984', format='markdown') # Generate a text report report = get_mcts_report(run_id='cogito:latest_1745979984', format='text') # Generate an HTML report report = get_mcts_report(run_id='cogito:latest_1745979984', format='html') ### Finding the Best Runs To find your best-performing runs: best_runs = get_best_mcts_runs(count=3, min_score=8.0) This returns the top 3 runs with a score of at least 8.0. ## Simple Usage Instructions 1. **Changing Models**: list_ollama_models() # See available models set_ollama_model("qwen3:0.6b") # Set to fast small model 2. **Starting a New Analysis**: initialize_mcts(question="Your question here", chat_id="unique_identifier") 3. **Running the Analysis**: run_mcts(iterations=3, simulations_per_iteration=10) 4. **Comparing Performance**: run_model_comparison(question="Your question", iterations=2) 5. **Getting Results**: generate_synthesis() # Final summary of results get_mcts_status() # Current status and metrics

プロンプトの例

  • 「人工知能が人間の創造性に与える影響を分析する」
  • 「このテーマの倫理的側面を探求し続ける」
  • 「前回の実行で見つかった最良の分析は何でしたか?」
  • 「この MCTS プロセスはどのように機能しますか?」
  • 「現在のMCTS構成を表示してください」

開発者向け

# Activate virtual environment source .venv/bin/activate # Run the server directly (for testing) uv run server.py # OR use the MCP CLI tools uv run -m mcp dev server.py

サーバーのテスト

サーバーが正しく動作しているかどうかをテストするには:

# Activate the virtual environment source .venv/bin/activate # Run the test script python test_server.py

これにより、LLM アダプターがテストされ、正常に動作しているかどうかが確認されます。

貢献

MCTS MCPサーバーの改善への貢献を歓迎します。改善の余地がある領域は以下のとおりです。

  • より洗練された分析のためのローカル推論アダプタの改良
  • より洗練された思考パターンと評価戦略を追加する
  • ツリーの視覚化と結果レポートの強化
  • MCTSアルゴリズムパラメータの最適化

ライセンス: MIT

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

local-only server

The server can only run on the client's local machine because it depends on local resources.

Claude がモンテカルロ ツリー検索アルゴリズムを使用して、トピック、質問、またはテキスト入力の詳細な探索的分析を実行できるようにするモデル コンテキスト プロトコル (MCP) サーバー。

  1. 概要
    1. 特徴
      1. 使用法
        1. 仕組み
          1. インストール
            1. クロードデスクトップ統合
              1. 推奨されるシステム プロンプトと、Ollama 統合を含む更新されたツール、つまり、プロジェクト手順に次のブロックを配置します。
                1. プロンプトの例
              2. 開発者向け
                1. サーバーのテスト
                  1. 貢献
                    1. ライセンス: MIT

                      Related MCP Servers

                      • A
                        security
                        A
                        license
                        A
                        quality
                        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.
                        Last updated -
                        1
                        2,806
                        1,458
                        TypeScript
                        MIT License
                        • Apple
                      • -
                        security
                        A
                        license
                        -
                        quality
                        A Model Context Protocol (MCP) server that exposes MiniZinc constraint solving capabilities to Large Language Models.
                        Last updated -
                        53
                        Python
                        MIT License
                        • Linux
                        • Apple
                      • -
                        security
                        A
                        license
                        -
                        quality
                        A Model Context Protocol (MCP) server that enables semantic search and retrieval of documentation using a vector database (Qdrant). This server allows you to add documentation from URLs or local files and then search through them using natural language queries.
                        Last updated -
                        14
                        74
                        JavaScript
                        Apache 2.0
                        • Apple
                      • A
                        security
                        F
                        license
                        A
                        quality
                        An MCP (Model Context Protocol) server that provides Google search capabilities and webpage content analysis tools. This server enables AI models to perform Google searches and analyze webpage content programmatically.
                        Last updated -
                        3
                        46
                        41
                        TypeScript

                      View all related MCP servers

                      ID: cz65nop4za