SuperAPIAI Directory

runcomfy-mcp

github.com · AI developer platforms

🎖️ 🐍 ☁️ - Manage RunComfy ComfyUI serverless deployments, hosted model inference and LoRA training jobs.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)

About this tool

RunComfy MCP is a remote MCP (Model Context Protocol) server provided by the RunComfy platform, used to let AI assistants directly operate three types of RunComfy APIs: Serverless API (ComfyUI), Model API, and Trainer API. It targets MCP-supporting clients such as Claude, Cursor, and Windsurf, and provides a total of 31 tools, corresponding one-to-one with the official RunComfy documentation, and additionally covering account balance queries.

Main capabilities

Serverless API (ComfyUI): Run your own ComfyUI workflows on a dedicated endpoint.

Model API: Call models in the hosted catalog on demand, without managing deployments yourself, billed per request. Among these, list_models can browse the model catalog by keyword or capability (for example category=image-to-video); get_model returns the input schema of a single model, including property types, default values, enums, and value ranges; run_model is responsible for execution. In this way, the assistant can directly generate a valid request from "help me make a video," without leaving the tool or guessing parameters. Model entries also carry a description, base_price_usd measured by price_unit, and model_url pointing to the model page. model_id is the identifier displayed on the model page (runcomfy.com/models), contains a slash, for example blackforestlabs/flux-1-kontext/pro/edit. File inputs must be public HTTPS URLs.

Trainer API: Datasets and AI Toolkit LoRA training. The typical flow is: create a dataset → upload media and matching .txt captions → poll until READY → submit a job with an AI Toolkit YAML configuration → poll status → pull checkpoints from the results. Because the server runs remotely, it cannot read local files: you can upload media it can access via HTTP through upload_dataset_file_from_url, and write captions inline with upload_dataset_text_file; for local filesor files larger than 150 MB, use get_dataset_upload_urls and PUT the bytes yourself to the signed URL.

Account balance: The three product types share one wallet. get_balance reports the remaining quota, balance_usd is for reading, and balance_microdollars (one millionth of a dollar) is for precise threshold checks. This interface is provided by api.runcomfy.net, rather than mirrored per product, because there is only one value to report.

Connection between products: A trained LoRA can run without any deployment—pass the model_id of its base model to run_model, and pass the LoRA as input, for example {"lora": {"path": "my_first_lora_3000.safetensors"}}. The path can be a name in LoRA Assets, or a public URL (for example a checkpoint from get_training_job_result). If you need a dedicated endpoint with selected hardware, then deploy instead and use the Serverless tools.

How to use

Every client authenticates using the API token from the RunComfy profile page, provided in two ways:

API token request header: Suitable for any Streamable HTTP client, the simplest, and the only available way for clients without a browser OAuth flow.

Browser OAuth: The configuration file does not contain a token. Supported by Claude.ai, Cursor, and local clients that register a loopback callback (such as Claude Code).

The token request header method requires only one command. The browser OAuth method omits the request header, then run /mcp in Claude Code and choose Authenticate. Note that --transport http is the Streamable HTTP transport; streamable-http is not a value accepted by Claude Code, and single-dash -transport / -header are also not accepted; both forms will fail before contacting the server. You can check with claude mcp list, which should show runcomfy: connected.

In Claude: In Settings → Connectors → Add custom connector add https://mcp.runcomfy.com/mcp,然后选择 Connect. Claude discovers RunComfy's OAuth 2.1 endpoints, opens the RunComfy consent page, and asks for one of the API tokens shown in the RunComfy profile. The token is verified by RunComfy and stored encrypted in the MCP authorization grant, and is never returned to Claude.

Cursor uses .cursor/mcp.json; VS Code (Copilot) uses .vscode/mcp.json; other clients configure it in Settings → MCP.

Any other client: the URL is https://mcp.runcomfy.com/mcp,传输为 Streamable HTTP, authenticated by carrying Authorization: Bearer <token> on each request, or using OAuth 2.1 with a loopback redirect URI or an exact supported client callback.

Troubleshooting: regenerating the token in the RunComfy profile revokes access, which invalidates the token request header and any OAuth grant based on it, because every MCP request re-verifies the token upstream. One RunComfy token can authenticate all three product categories, so the same credential resolution covers all tools. Both credentials converge into the same request-scoped identity request header before reaching the container, distinguished by shape: an OAuth access token is always userId:grantId:secret, while a RunComfy API token never contains a colon.

Architecture and Deployment

Cloudflare Worker (src/index.ts): OAuth 2.1 authorization server and protected resource boundary. Missing, invalid, expired, or wrong-audience credentials are rejected before MCP initialization or tool discovery.

Direct API token (src/index.ts): a RunComfy profile token presented as Authorization: Bearer is re-verified against api.runcomfy.net on every request, rate-limited by source IP, and never forwarded as-is.

OAuth consent (src/oauth-bridge.ts): verifies an existing RunComfy profile token, stores it only in encrypted OAuth grant data, and issues a separate, audience-bound MCP access token. Dynamic client registration accepts loopback callbacks (Claude Code and other local clients), an exact allowlist of hosted client callbacks, and Cursor's exact legacy app callback. Cursor registers both cursor://anysphere.cursor-mcp/oauth/callback,https://www.cursor.com/agents/mcp/oauth/callback and http://localhost:8787/callback,即使当前重定向使用 localhost, and all three must also be accepted. Arbitrary custom protocols and callback variants are still rejected, and S256 PKCE is required.

Python container (server.py): a FastMCP application containing 31 tools across the Serverless, Model, and Trainer APIs. It has no shared/operator credentials and fails closed unless the authenticated edge provides the current user's request-scoped RunComfy token.

The Cloudflare Container starts automatically on the first request and sleeps after 10 minutes of idleness.

Local Development

Local endpoint:http://127.0.0.1:8000/healthz and http://127.0.0.1:8000/mcp。本地 The Python endpoint intentionally has no shared fallback credentials, and protected tool calls must go through the authenticated Worker boundary.

Pushing to main automatically deploys via .github/workflows/deploy.yml: type checking, Worker tests, and container tests must pass, then wrangler deploy --containers-rollout immediate releases the Worker together with the Python container. Pull requests run the same checks but do not deploy. The workflow can also be run manually from the Actions tab. One repository secret must be configured. Manual deployment requires a paid Cloudflare Workers plan with Containers enabled. The MCP endpoint is live at https://mcp.runcomfy.com/mcp(自定义域名在 configured in wrangler.jsonc).

Environment variables and bindings: intentionally no shared RunComfy API key is set. OAuth state is stored in the OAUTH_KV binding, and every upstream request is bound to the user who authorized that OAuth grant. Worker variables are configured in wrangler.jsonc, and local Python development uses a .env file.

Applicable scenarios and limitations

Suitable for users who want to manage ComfyUI serverless deployments, invoke hosted models on demand, train LoRA, and obtain results through an AI assistant. Limitations include: the server runs remotely and cannot read local files; local files or files larger than 150 MB must be uploaded by the user via a signed URL; file inputs must be public HTTPS URLs; manual deployment requires a paid Cloudflare Workers plan with Containers enabled; and authentication methods are constrained by client support.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools