YOLO MCP Server

by GongRzhe
Verified

local-only server

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

Integrations

  • Supports exporting YOLO models to ONNX format for compatibility with different runtime environments

  • Leverages YOLO (You Only Look Once) models for advanced computer vision tasks including object detection, segmentation, classification, and pose estimation with support for model training, validation, and export

YOLO MCPサービス

モデルコンテキストプロトコル(MCP)を介してClaude AIと統合された、強力なYOLO(You Only Look Once)コンピュータービジョンサービスです。このサービスにより、Claudeは最先端のYOLOモデルを用いて、物体検出、セグメンテーション、分類、リアルタイムカメラ分析を実行できます。

特徴

  • 物体検出、セグメンテーション、分類、姿勢推定
  • ライブオブジェクト検出のためのリアルタイムカメラ統合
  • モデルのトレーニング、検証、エクスポートのサポート
  • 複数のモデルを組み合わせた包括的な画像解析
  • ファイルパスとbase64エンコードされた画像の両方をサポート
  • Claude AIとのシームレスな統合

セットアップ手順

前提条件

  • Python 3.10以上
  • Git(オプション、リポジトリのクローン用)

環境設定

  1. プロジェクト用のディレクトリを作成し、そこに移動します。
    mkdir yolo-mcp-service cd yolo-mcp-service
  2. プロジェクト ファイルをダウンロードするか、リポジトリからクローンを作成します。
    # If you have the files, copy them to this directory # If using git: git clone https://github.com/GongRzhe/YOLO-MCP-Server.git .
  3. 仮想環境を作成します。
    # On Windows python -m venv .venv # On macOS/Linux python3 -m venv .venv
  4. 仮想環境をアクティブ化します。
    # On Windows .venv\Scripts\activate # On macOS/Linux source .venv/bin/activate
  5. セットアップ スクリプトを実行します。
    python setup.py
    セットアップ スクリプトは次の処理を実行します。
    • Pythonのバージョンを確認する
    • 仮想環境を作成する(まだ作成されていない場合)
    • 必要な依存関係をインストールする
    • MCP 構成ファイル (mcp-config.json) を生成します。
    • Claudeを含むさまざまなMCPクライアントの構成情報を出力します。
  6. セットアップ スクリプトからの出力は次のようになります。
    MCP configuration has been written to: /path/to/mcp-config.json MCP configuration for Cursor: /path/to/.venv/bin/python /path/to/server.py MCP configuration for Windsurf/Claude Desktop: { "mcpServers": { "yolo-service": { "command": "/path/to/.venv/bin/python", "args": [ "/path/to/server.py" ], "env": { "PYTHONPATH": "/path/to" } } } } To use with Claude Desktop, merge this configuration into: /path/to/claude_desktop_config.json

YOLOモデルのダウンロード

サービスをご利用になる前に、YOLOモデルをダウンロードする必要があります。サービスは以下のディレクトリでモデルを検索します。

  • サービスが実行されている現在のディレクトリ
  • modelsサブディレクトリ
  • server.pyのCONFIG["model_dirs"]変数で設定されたその他のディレクトリ

モデル ディレクトリを作成し、いくつかの一般的なモデルをダウンロードします。

# Create models directory mkdir models # Download YOLOv8n for basic object detection curl -L https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt -o models/yolov8n.pt # Download YOLOv8n-seg for segmentation curl -L https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n-seg.pt -o models/yolov8n-seg.pt # Download YOLOv8n-cls for classification curl -L https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n-cls.pt -o models/yolov8n-cls.pt # Download YOLOv8n-pose for pose estimation curl -L https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n-pose.pt -o models/yolov8n-pose.pt

Windows PowerShell ユーザーの場合:

# Create models directory mkdir models # Download models using Invoke-WebRequest Invoke-WebRequest -Uri "https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt" -OutFile "models/yolov8n.pt" Invoke-WebRequest -Uri "https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n-seg.pt" -OutFile "models/yolov8n-seg.pt" Invoke-WebRequest -Uri "https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n-cls.pt" -OutFile "models/yolov8n-cls.pt" Invoke-WebRequest -Uri "https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n-pose.pt" -OutFile "models/yolov8n-pose.pt"

クロードの設定

Claude でこのサービスを利用するには:

  1. Claude Web の場合: ローカル マシンでサービスをセットアップし、MCP クライアントのセットアップ スクリプトによって提供される構成を使用します。
  2. Claude Desktopの場合:
    • セットアップスクリプトを実行し、構成出力をメモします。
    • Claude Desktop 構成ファイルを見つけます (パスはセットアップ スクリプトの出力に示されています)
    • Claude Desktop 構成ファイルに構成を追加またはマージします。
    • Claudeデスクトップを再起動します

クロードでのYOLOツールの使用

1. まず利用可能なモデルを確認する

まず最初に、システムで使用可能なモデルを確認してください。

I'd like to use the YOLO tools. Can you first check which models are available on my system? <function_calls> <invoke name="list_available_models"> </invoke> </function_calls>

2. 画像内の物体検出

コンピュータ上の画像ファイルを分析するには:

Can you analyze this image file for objects? <function_calls> <invoke name="analyze_image_from_path"> <parameter name="image_path">/path/to/your/image.jpg</parameter> <parameter name="confidence">0.3</parameter> </invoke> </function_calls>

別のモデルを指定することもできます。

Can you analyze this image using a different model? <function_calls> <invoke name="analyze_image_from_path"> <parameter name="image_path">/path/to/your/image.jpg</parameter> <parameter name="model_name">yolov8n.pt</parameter> <parameter name="confidence">0.4</parameter> </invoke> </function_calls>

3. 包括的な画像解析の実行

オブジェクトの検出、分類などを組み合わせたより詳細な分析については、以下をご覧ください。

Can you perform a comprehensive analysis on this image? <function_calls> <invoke name="comprehensive_image_analysis"> <parameter name="image_path">/path/to/your/image.jpg</parameter> <parameter name="confidence">0.3</parameter> </invoke> </function_calls>

4. 画像セグメンテーション

オブジェクトの境界を識別し、セグメンテーション マスクを作成するには:

Can you perform image segmentation on this photo? <function_calls> <invoke name="segment_objects"> <parameter name="image_data">/path/to/your/image.jpg</parameter> <parameter name="is_path">true</parameter> <parameter name="model_name">yolov8n-seg.pt</parameter> </invoke> </function_calls>

5. 画像分類

画像コンテンツ全体を分類するには:

What does this image show? Can you classify it? <function_calls> <invoke name="classify_image"> <parameter name="image_data">/path/to/your/image.jpg</parameter> <parameter name="is_path">true</parameter> <parameter name="model_name">yolov8n-cls.pt</parameter> <parameter name="top_k">5</parameter> </invoke> </function_calls>

6. コンピュータのカメラを使用する

コンピューターのカメラを使用してリアルタイムのオブジェクト検出を開始します。

Can you turn on my camera and detect objects in real-time? <function_calls> <invoke name="start_camera_detection"> <parameter name="model_name">yolov8n.pt</parameter> <parameter name="confidence">0.3</parameter> </invoke> </function_calls>

最新のカメラ検出情報を入手:

What are you seeing through my camera right now? <function_calls> <invoke name="get_camera_detections"> </invoke> </function_calls>

終了したらカメラを停止します。

Please turn off the camera. <function_calls> <invoke name="stop_camera_detection"> </invoke> </function_calls>

7. 高度なモデル操作

カスタムモデルのトレーニング

I want to train a custom object detection model on my dataset. <function_calls> <invoke name="train_model"> <parameter name="dataset_path">/path/to/your/dataset</parameter> <parameter name="model_name">yolov8n.pt</parameter> <parameter name="epochs">50</parameter> </invoke> </function_calls>

モデルの検証

Can you validate the performance of my model on a test dataset? <function_calls> <invoke name="validate_model"> <parameter name="model_path">/path/to/your/trained/model.pt</parameter> <parameter name="data_path">/path/to/validation/dataset</parameter> </invoke> </function_calls>

モデルを異なる形式にエクスポートする

I need to export my YOLO model to ONNX format. <function_calls> <invoke name="export_model"> <parameter name="model_path">/path/to/your/model.pt</parameter> <parameter name="format">onnx</parameter> </invoke> </function_calls>

8. 接続テスト

YOLO サービスが正しく実行されているかどうかを確認します。

Is the YOLO service running correctly? <function_calls> <invoke name="test_connection"> </invoke> </function_calls>

トラブルシューティング

カメラの問題

カメラが動作しない場合は、別のカメラ ID を試してください。

<function_calls> <invoke name="start_camera_detection"> <parameter name="camera_id">1</parameter> <!-- Try 0, 1, or 2 --> </invoke> </function_calls>

モデルが見つかりません

モデルが見つからない場合は、設定されたディレクトリのいずれかにダウンロードしたことを確認してください。

<function_calls> <invoke name="get_model_directories"> </invoke> </function_calls>

パフォーマンスの問題

限られたリソースでより良いパフォーマンスを得るには、より小さなモデルを使用します(例:yolov8x.ptではなくyolov8n.pt)。

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

最先端の YOLO モデルを使用して、Claude がオブジェクトの検出、セグメンテーション、分類、およびリアルタイムのカメラ分析を実行できるようにするコンピューター ビジョン サービス。

  1. Features
    1. Setup Instructions
      1. Prerequisites
      2. Environment Setup
      3. Downloading YOLO Models
      4. Configuring Claude
    2. Using YOLO Tools in Claude
      1. 1. First Check Available Models
      2. 2. Detecting Objects in an Image
      3. 3. Running Comprehensive Image Analysis
      4. 4. Image Segmentation
      5. 5. Image Classification
      6. 6. Using Your Computer's Camera
      7. 7. Advanced Model Operations
      8. 8. Testing Connection
    3. Troubleshooting
      1. Camera Issues
      2. Model Not Found
      3. Performance Issues
    ID: 9zak16sjss