Skip to main content
Glama

clarity-api-mcp

Clarity AI アップスケーラー用の Bun MCP サーバー。1 つの POST エンドポイントで、公式の全モードに対応します。

特徴

  • ツール: clarity_list_models、clarity_upscale

  • モード: crystal、crystal-video、clarity (creative エイリアス)、clarity-pro

  • ローカルファイル: Clarity POST の前に raw 公開 URL (uguu、litterbox、または Tailscale Funnel) に公開

  • Dropbox 共有ページと tmpfiles.org HTML ページを直接ファイル URL に書き換え

  • Bun ネイティブ: コンパイル不要の TypeScript、自動 .env、Bun.file / Bun.write、Bun Shell curl

  • 構造化された MCP 出力とテキストフォールバック

Related MCP server: imagine-mcp

要件

セットアップ

git clone https://github.com/thomastraum/clarity-api-mcp.git
cd clarity-api-mcp
bun install
cp .env.example .env

.env にキーを入れてください(このファイルは決してコミットしないこと):

CLARITY_API_KEY=your-key-here

Bun は .env を自動的に読み込みます。このサーバーは、コーディングエージェントが別のディレクトリから起動した場合も、このパッケージの .env を読み取ります。

MCP クライアント設定

パスを自分のクローンに置き換えてください:

{
  "mcpServers": {
    "clarity-api": {
      "command": "bun",
      "args": ["/absolute/path/to/clarity-api-mcp/src/index.ts"]
    }
  }
}

キーは .env または MCP の env ブロックに置けます。Claude、Cursor、Codex、Grok のスニペットは docs/INSTALL.md を参照してください。

ツール

clarity_list_models

公式 API ページからすべてのモード、パラメータ一覧、およびリクエストボディの例を返します。

clarity_upscale

Authorization: Bearer … を付けて POST https://api-upscale.clarityai.co に送信します。

入力(共通)

フィールド

備考

mode

crystal | crystal-video | clarity | creative | clarity-pro

image

公開画像 URL またはローカルファイル(全イメージモード)

video

公開ビデオ URL またはローカルファイル(crystal-video)

publish

uguu (デフォルト) | litterbox | funnel | none — ローカルファイルを raw バイトとして公開する方法

webhook

任意。結果は返さずにここへ POST されます

output_path

任意。結果を保存するローカルファイルまたはディレクトリ

include_raw_response

任意のデバッグフラグ

Crystal — scale_factor 1–200、creativity 0–10、output_format jpg/png、target_megapixels 0.001–1500

Crystal Video — scale_factor 1–200

Clarity — creativity / resemblance / dynamic / fractality −10–10、scale_factor 2–16、style default/portrait/anime、postprocessing none/sharpen、prompt

Clarity Pro — creativity −10–10、scale_factor 2/4/8/16、output_format png/jpg。出力 1 MP あたり $0.03、最大 64 MP。

出力

{
  "mode": "crystal",
  "requested_mode": "crystal",
  "url": "https://…",
  "credit_cost": 3,
  "cost_usd": 0.03,
  "balance": 97,
  "webhook": null,
  "saved_to": "/path/to/out.jpg",
  "published_url": "https://a.uguu.se/…",
  "published_via": "uguu",
  "note": null
}

Clarity は 1 クレジット = $0.01 です。ローカルファイルは、Clarity が raw バイトを取得できるように、最初に公開されます。ファイルをこのマシン上に置いたままにする場合は publish: "funnel" を使用してください(Tailscale Funnel であり、Serve ではありません)。

環境変数

名前

デフォルト

目的

CLARITY_API_KEY

—

必須(CAI_API_KEY でも可)

CLARITY_BASE_URL

https://api-upscale.clarityai.co

エンドポイントを上書き

CLARITY_TIMEOUT

300000

curl のタイムアウト(ms)

CLARITY_OUTPUT_DIR

—

output_path が省略された場合に結果を自動保存

CLARITY_PUBLISH

uguu

ローカルファイルのデフォルトの公開方法

CLARITY_LITTERBOX_TIME

1h

litterbox の TTL(1h / 12h / 24h / 72h)

スクリプト

bun start
bun test
bun run smoke-test
bun run smoke-test -- --live

--live は実際の API を呼び出し、クレジットを消費します。

注意事項

  • MCP トランスポート以外では、このプロセスから stdout に書き込まないでください。診断情報は stderr に出力されます。

  • HTTP クライアントは Bun Shell の curl で、公式の例に合わせ、Response ボディを stdin として使用します。

ライセンス

MIT

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers