clarity-api-mcp

clarity-api-mcp

MCP server for Clarity AI's upscaler, providing tools to list models and upscale images/videos via a single POST endpoint, with support for local files and multiple processing modes.

Category
访问服务器

README

clarity-api-mcp

Bun MCP server for the Clarity AI upscaler. One POST endpoint, every official mode.

Features

  • Tools: clarity_list_models, clarity_upscale
  • Modes: crystal, crystal-video, clarity (creative alias), clarity-pro
  • Local files: published to a raw public URL (uguu, litterbox, or Tailscale Funnel) before the Clarity POST
  • Dropbox share pages and tmpfiles.org HTML pages are rewritten to direct file URLs
  • Bun-native: TypeScript with no compile step, automatic .env, Bun.file / Bun.write, Bun Shell curl
  • Structured MCP output plus a text fallback

Requirements

  • Bun >= 1.1
  • A Clarity AI API key from https://clarityai.co/api

Setup

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

Put your key in .env (never commit this file):

CLARITY_API_KEY=your-key-here

Bun loads .env automatically. The server also reads this package's .env when a coding agent starts it from another directory.

MCP client config

Replace the path with your clone:

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

The key can live in .env or in the MCP env block. See docs/INSTALL.md for Claude, Cursor, Codex, and Grok snippets.

Tools

clarity_list_models

Returns every mode, parameter list, and example body from the official API page.

clarity_upscale

Sends POST https://api-upscale.clarityai.co with Authorization: Bearer ….

Input (common)

Field Notes
mode crystal | crystal-video | clarity | creative | clarity-pro
image Public image URL or local file (all image modes)
video Public video URL or local file (crystal-video)
publish uguu (default) | litterbox | funnel | none — how to expose a local file as raw bytes
webhook Optional. Result is POSTed here instead of returned
output_path Optional local file or directory to save the result
include_raw_response Optional debug flag

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. $0.03 per output MP, max 64 MP.

Output

{
  "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 charges 1 credit = $0.01. Local files are published first so Clarity can fetch raw bytes. Use publish: "funnel" if the file should stay on this machine (Tailscale Funnel, not Serve).

Environment variables

Name Default Purpose
CLARITY_API_KEY — Required (or CAI_API_KEY)
CLARITY_BASE_URL https://api-upscale.clarityai.co Override the endpoint
CLARITY_TIMEOUT 300000 curl timeout in ms
CLARITY_OUTPUT_DIR — Auto-save results when output_path is omitted
CLARITY_PUBLISH uguu Default publisher for local files
CLARITY_LITTERBOX_TIME 1h litterbox TTL (1h / 12h / 24h / 72h)

Scripts

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

--live calls the real API and spends credits.

Notes

  • Do not write to stdout from this process except the MCP transport. Diagnostics go to stderr.
  • The HTTP client is Bun Shell curl, matching the official examples, with a Response body as stdin.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选