Skip to main content
Glama

バージョン: 1.0.0

AIが見たものを語る。 生成型画像ディスクライバー — Florence-2 (MIT) をラップする MCP サーバー + CLI。散文による説明、OCR、LoRA データセット用キャプションサイドカーを提供する。ローカルで動作し、デフォルトで決定論的。

ai-eyes-mcp の兄弟ツールです:

ai-eyes-mcp

plain-sight

役割

画像を判定する

画像を説明する

モデル

SigLIP2 (識別型)

Florence-2 (生成型)

出力

較正されたスコア

散文 / OCR / キャプションファイル

失敗モード

説明できない

詳細を幻覚することがある

使うべき場面

「この画像にXは含まれるか?」

「この画像には何が写っているか?」

誠実性の契約

説明は生成的です。流暢で、通常は正確で、詳細を捏造し得ます。plain-sight は出力を再現可能にします(決定論的デコード——同じ画像は同じキャプションを生成する)が、真実であることを保証するものではありません。画像に関する特定の主張を検証するには、ai-eyes-mcp の image_verify を使ってください。これは測定するものであり、語るものではありません。この2つのツールは設計上異なるモデルファミリーなので、互いに検証し合うことができます。

Related MCP server: fm-mcp-comfyui-bridge

ツール (MCP)

ツール

機能

describe_image

1枚の画像 → 散文による説明(3段階の詳細度)

describe_batch

N枚の画像 → .txt キャプションサイドカー(データセット用途)

read_text

OCR — 画像から可視テキストを抽出する

sight_status

ヘルスチェック: モデル、デバイス、ロード状態

sight_selftest

同梱の参照画像を説明し、出力の健全性を確認する

クイックスタート

pip install -e .
plain-sight-mcp   # starts the STDIO MCP server

またはモジュールとして実行: python -m plain_sight

CLI

# One image, full paragraph
plain-sight describe hero.png

# One short sentence
plain-sight describe hero.png --detail low

# OCR
plain-sight ocr screenshot.png

# The dataset lane: caption a directory into .txt sidecars with a trigger token
plain-sight batch ./dataset --prefix "mcpt_style, " --detail high

# Re-runs are idempotent — existing sidecars are skipped unless you --overwrite
plain-sight batch ./dataset --prefix "mcpt_style, " --overwrite

Claude Code 設定

{
  "mcpServers": {
    "plain-sight": {
      "command": "plain-sight-mcp",
      "env": {
        "PLAIN_SIGHT_MODEL_DIR": "/path/to/model/cache"
      }
    }
  }
}

キャプション契約(データセットレーン)

LoRA トレーニングセット(style-dataset-lab など)向けに設計されています:

  • 正確なベースネームのペアリング: img_0042.png → img_0042.txt。カウンター サフィックスなし——ComfyUI の SaveText ノード(_00001 を追加する)とは異なります。

  • そのままの連結: サイドカーには prefix + caption + suffix が 区切り文字を挿入されずに含まれます。"mcpt_style, <caption>" にしたい場合は、 カンマ+スペースをプレフィックスに入れてください。

  • 冪等な再実行: 既存のサイドカーはスキップされます(コストもかかりません)。 --overwrite / overwrite=true を指定した場合のみ上書きされます。

  • 決定論的: do_sample=false + ビームサーチ——変更されていない画像を 再キャプションすると同じテキストが再現されるため、差分に意味があります。

詳細度の段階

Florence-2 のネイティブなタスクラダー:

段階

タストークン

出力

low

<CAPTION>

短い文1つ

medium

<DETAILED_CAPTION>

数文

high (デフォルト)

<MORE_DETAILED_CAPTION>

完全な段落

high は段落であって、エッセイではありません——Florence-2 はコンパクトな (0.77B) モデルです。 その強みはスループットとライセンスであり、美術評論の深さではありません。キャプションが 途中で切れているように見える場合は、max_new_tokens(デフォルト 1024、最大 4096)を上げてください。

設定

環境変数

デフォルト

目的

PLAIN_SIGHT_MODEL_ID

florence-community/Florence-2-large

HuggingFace モデル

PLAIN_SIGHT_MODEL_DIR

HF デフォルトキャッシュ

モデルキャッシュディレクトリ

PLAIN_SIGHT_DEVICE

auto (cuda があれば cuda、なければ cpu)

torch デバイス

PLAIN_SIGHT_DTYPE

CUDA では float16、CPU ではフル精度

float16 / bfloat16 / float32

PLAIN_SIGHT_MAX_NEW_TOKENS

1024

デフォルトの生成上限

PLAIN_SIGHT_NUM_BEAMS

3

ビーム幅(決定論的デコード)

PLAIN_SIGHT_LOG_LEVEL

WARNING

DEBUG / INFO / WARNING / ERROR

PLAIN_SIGHT_EAGER_LOAD

未設定

真値ならサーバー起動時にモデルをロード

ログ: stderr のみ(stdout は MCP プロトコルチャネル)、ロガー名は plain_sight。

初回呼び出し: モデルは遅延ロードされます——最初の describe/OCR 呼び出しで Florence-2 をロードします(GPU で約10〜20秒; 初回の呼び出しでは約1.5 GBをダウンロード)。 以降の呼び出しは、最新の GPU で high 詳細度の場合、画像1枚あたり約1〜2秒です。

ライセンスの姿勢

  • このツール: MIT。

  • モデル: florence-community/Florence-2-large に固定——Microsoft の Florence-2 リリースの 公式ネイティブ transformers 変換版です。MIT(ハブのライセンスタグは 2026-08-19 に確認済み)。 商用利用も問題ありません。

  • microsoft/Florence-2-large を使わない理由: 同じ重み、同じ MIT ライセンスですが、 元のリポジトリにはネイティブ以前の設定が同梱されており、trust_remote_code 経由でしか ロードできません——このツールはその方式を原則として拒否します。コミュニティ変換版は transformers の組み込み Florence-2 クラスでロードできます。

  • 意図的に提供しないもの: Florence-2 のファインチューン群(MiaoshouAI PromptGen、CogFlorence、SD3/Flux キャプショナー、Castollux)。これらのライセンスは 未検証であり、確認が取れるまで対象外です。PLAIN_SIGHT_MODEL_ID をそれらのいずれかに 上書きすることは可能ですが、ライセンスの責任はあなたにあります。

  • リモートコードなし: エンジンは transformers のネイティブ Florence-2 サポートのみを使用します——trust_remote_code は決して渡されないため、ハブから取得した Python が実行されることはありません。これには transformers >= 4.51 が必要です。

セキュリティと信頼

このツールはローカルのみで動作します。

  • 触れるデータ: ローカル画像ファイル(読み取り専用); HuggingFace モデルキャッシュ (初回ダウンロード時に一度だけ書き込み); .txt キャプションサイドカー——書き込むのは これだけであり、呼び出し元が指定した場所(out_dir または画像の隣)にのみ書き込み、 既存のサイドカーは明示的な --overwrite でのみ置き換えられます。

  • 実行時のネットワーク送信なし——モデルは初回使用時に一度だけダウンロードされ、 以降の推論はすべてローカルです。

  • リモートコード実行なし——ネイティブ transformers クラスのみ; trust_remote_code は決して渡されないため、ハブから取得した Python が実行されることはありません。

  • シークレット処理なし、テレメトリなし——どこからも読み取らず、どこにも送信しません。

  • 構造化エラーのみ——生のスタックトレースが MCP クライアントや CLI ユーザーに 届くことはありません。CLI 終了コード: 0 正常 · 1 ユーザーエラー · 2 ランタイムエラー · 3 部分成功。

完全なポリシー: SECURITY.md。積極的にメンテナンスされており、 サポート対象バージョンはそこに記載されています。

要件

  • Python >= 3.10

  • transformers >= 4.51(ネイティブ Florence-2)

  • CUDA GPU 推奨(FP16 で約2GB VRAM); CPU フォールバックも動作します(遅い)

  • 初回使用時にモデルを約1.5GBダウンロード

開発

# Install in editable mode with dev dependencies
pip install -e ".[dev]"

# CI-safe tests (no model, no GPU)
pytest tests/test_edge_cases.py -v

# Dogfood tests (real model + GPU)
pytest tests/test_dogfood.py -v

# Full verify: imports, edge tests, build
bash verify.sh

アーキテクチャ

engine.py    Standalone Florence-2 wrapper — no MCP dependency.
             Lazy-loads the model; validation runs BEFORE the load.
             Importable directly: from plain_sight.engine import Florence2Engine

sidecars.py  The training-data contract, pure stdlib: basename pairing,
             bare concatenation, directory expansion. Testable without torch.

server.py    FastMCP wrapper exposing engine methods as MCP tools.
             Thin layer: validation, error shaping, tool metadata.

cli.py       argparse CLI over the same engine (describe / ocr / batch /
             status / selftest). Structured errors, meaningful exit codes.

アーキテクチャは意図的に ai-eyes-mcp から借用しています——同じ エンジン/サーバー分割、同じエラー整形、同じセルフテストパターン。同じ契約のクラウド版は Comfy Cloud で caption-florence2-v1 ワークフローとして動作しています(ジョブごとに 1枚の画像というメタデータライダー; このツールはバルクレーンです)。

ライセンス

MIT


MCP Tool Shop によって構築されました。

Available Tools

5 tools
describe_batchDescribe BatchA

Blocks until every image completes -- roughly 1-2 s per image plus ~10-20 s if the model is not yet loaded. Chunk large sets. Existing sidecars are skipped unless overwrite=true, so a retry is cheap.

Caption a batch of images, writing .txt sidecars -- the dataset lane. The training-data contract: EXACT basename pairing (img_0042.png -> img_0042.txt, no counter suffix) and BARE prefix+caption+suffix concatenation (no delimiter injected).

Inputs: image_paths (required), detail, prefix, suffix, +5 more. Returns: object

describe_imageDescribe ImageA

Describe an image in prose — an AI says what it sees.

Uses Florence-2 (MIT-licensed, runs locally) with deterministic decoding: the same image at the same tier reproduces the same description.

Descriptions are generative and can hallucinate detail — for verifying a specific claim about the image, prefer ai-eyes-mcp's image_verify.

Inputs: image_path (required), detail, max_new_tokens. Returns: object

read_textRead TextA

Extract visible text from an image (Florence-2 task).

Returns the text the model reads off the pixels — signage, UI labels, documents. Like all generative output it can misread; treat low-stakes.

Inputs: image_path (required), max_new_tokens. Returns: object

sight_selftestSight SelftestA

Self-test: describe the bundled reference images and confirm the outputs are sane (non-trivial, on-subject, tier ordering holds) — proves the install loaded correctly. Loads the model if it isn't already.

Returns {passed, checks: [{name, expected, measured, ok}], model_id, device, torch_version, transformers_version}.

Inputs: no named parameters. Returns: object

sight_statusSight StatusA

Check plain-sight server status.

Returns model info, device, and whether the model is currently loaded. The model loads lazily on first tool call — this tool does NOT trigger loading.

Inputs: no named parameters. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 5 tools

    Disambiguation4/5

    Tools have distinct purposes: single image description, batch captioning with sidecars, OCR, status check, and self-test. The only mild overlap is between describe_image and describe_batch, but the sidecar/dataset contract and blocking behavior make them clearly separable.

    Naming Consistency3/5

    Three tools follow verb_noun (describe_image, describe_batch, read_text) while two follow noun_noun with a sight_ prefix (sight_status, sight_selftest). The split is readable but not a single consistent pattern.

    Tool Count5/5

    Five tools is well within the ideal range for a focused image description/OCR server; each tool has a clear role and none feels redundant.

    Completeness4/5

    Core workflows are covered: single and batch description, OCR, status, and self-test. Minor gaps exist, such as no explicit tier selection tool or a way to get batch captions without writing sidecars, but these are workable.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers