AI Gateway MCP
io.github.Armulee由 GitHub 帳號 Armulee 發布v0.1.0更新於 Oct 24, 2026
Pictures, video, voice and transcripts from any Vercel AI Gateway model, on your own Vercel copy.
概覽
自架的 Vercel 連接器,讓聊天應用透過 Vercel AI Gateway 模型產生圖片、影片、語音與轉錄,費用由你自己的額度支付。
- 可以做什麼
- 產生與編輯圖片、放大圖片,並列出先前製作的媒體檔案
- 啟動、編輯、延長、放大與取得影片工作,包括把參考影片中的動作套用到角色上
- 將文字轉為語音,並轉錄音訊或影片檔案,可選擇附上時間戳
- 列出 AI Gateway 模型與目錄價格、用另一個模型產生文字、查看額度與花費
- 在實際執行前估算圖片或影片呼叫的價格
- 適用情境
- 適合希望助理在聊天中直接產出媒體內容(圖片、短片、旁白、轉錄)的情境,可挑選多種模型,並依供應商標價透過自己的 Vercel AI Gateway 額度付費,而非訂閱制。
- 執行需求
- 需要 Vercel 帳號以及 GitHub、GitLab 或 Bitbucket 帳號來部署自己的副本;影片與檔案連結需要私有 Blob 儲存空間;連接器密鑰以 MCP_SECRET_SHA256(或 MCP_SECRET)形式放在 URL 路徑中;需要 Vercel AI Gateway 額度;本機使用可選 AI_GATEWAY_API_KEY。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 AI Gateway MCP,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
[Deploy your own copy on Vercel, in one click]
One click, and you are done.
Vercel copies this repo to your account, makes your private storage and asks for one secret. Your copy then walks you through the rest.
[MIT license] [MCP over Streamable HTTP] [Next.js 16] [AI SDK with Vercel AI Gateway]
What you can make · How it works · Get started · What it costs · Tools · Keep it safe
The provider's own price, right inside your chat. No markup, no subscription, no API key. Add this connector to Claude, ChatGPT or any MCP app and it can make pictures, video and voice with 400+ models on Vercel AI Gateway: Veo, Kling, Seedance, Nano Banana, GPT Image, FLUX and more. You run your own copy on your own Vercel account, so every call is paid from your own Gateway credits at the price the provider sets.
[A chat on claude.ai: asked to paint a little fox collecting stars in watercolour the cheapest way, Claude compares prices, picks Recraft v4.1 Flash and shows the picture for $0.007. Asked to turn it into a short video the cheapest way, it picks HeyGen Video 1 and the five-second video plays in the chat, for $0.09.] A real chat on claude.ai, October 2026: a picture for $0.007, then a five-second video for $0.09 (HeyGen Video 1). Waiting while models work is sped up. See the demo.
What you can make
Ask in plain words. Your chat does the thinking and the writing with everything it already knows about you; the connector makes the pictures, the video and the voice.
Costs are AI Gateway catalog prices from October 2026, for the example quantities shown. They are examples, not quotes: the provider's bill can differ from the catalog (see What it costs), and each call reports what it actually cost. Ask list_models for today's catalog.
How it works
- You ask in chat. Claude, ChatGPT or any app that speaks MCP picks the right tool.
- Your own copy answers. It runs on your Vercel account and checks your secret link.
- AI Gateway runs the model, billed to your own credits at the provider's price. No API key: your copy signs in with Vercel's own token.
What is MCP? The Model Context Protocol is how chat apps plug in outside tools. This project is one of those tools: once you add its link, your chat app can make things with any model on AI Gateway.
Get started
You need a Vercel account and a GitHub, GitLab or Bitbucket account.
[Deploy your own copy on Vercel, in one click]
Then set a spend budget in the Vercel dashboard (AI Gateway → Budgets). It is the real limit on what your link can ever spend.
Your copy comes with its own setup page
Open your copy and it shows where you are: an arch of six stones, one per step. Set stones glow, the next one breathes, and clicking a stone opens its step.
Once every step is done, the guide steps aside for good. From then on your page opens on the brand and goes straight to your usage. If anything comes undone later (say MCP_SECRET_SHA256 is removed), the guide comes back by itself.
[Your usage, shown with sample numbers: $19.48 spent through this connector in the last 30 days, and spend per day as columns of light.]
Your usage, unlocked with your secret (shown here with sample numbers): what this connector spent, day by day, by model and by chat app.
What it costs
Nothing from this project: it is free and MIT licensed, with no plan and no fee. You pay what each provider charges, with no markup, through your own AI Gateway credits, and every Vercel team gets free monthly credits for a set of models. In Vercel's words (AI Gateway pricing):
AI Gateway charges no markup and no platform fee on tokens. You pay the provider's list price on a pay-as-you-go basis.
From the AI Gateway catalog, October 2026. The catalog is a guide, not the bill: the provider's charge can differ. In October 2026 bfl/flux-3-image was listed at $0.024 for a 1024x1024 picture while Black Forest Labs billed $0.048 (passed on with no surcharge); the catalog has since been corrected. Each call reports its actual cost; ask list_models for today's catalog.
This project is not made by or affiliated with Vercel. Version 1 means you run your own copy, so setup is as short as I could make it: the goal is for everyone to use AI at the price providers actually set.
Tools
Your chat app picks these for you; you never have to name them. Every tool returns readable errors that name the model: unknown model, not enough credits, video not on your plan, provider errors.
Every tool and its inputs
Inline viewer. In chat apps that support MCP Apps (Claude on the web, desktop and phone), generate_image, edit_image, upscale_image, get_video and list_files show their result right in the conversation: a picture grid, a video player and audio players, with Download, Upscale and Extend. Upscale and Extend ask the chat to run the tool, so nothing is spent behind your back. Other apps get the same pictures and links as plain content. If the Claude desktop app shows "Unable to reach AI Gateway" where the viewer should be after you change the connector URL (for example after rotating the secret), quit it fully (Cmd+Q on a Mac) and open it again.
Keep it safe
- Your link works like a password that spends money. Anyone who has it can use your AI Gateway credits. Keep it private.
- Set an AI Gateway budget. Only Vercel's budget limits your total spend.
- If the link leaks, make a new secret on your setup page, put its fingerprint in Project Settings → Environment Variables and redeploy. The old link stops working at once.
- Your usage is yours. Anyone can open your setup page, but the numbers only appear for someone who has your secret.
More on security and costs
- Your connector URL works like a password that spends money. Anyone who has it can use your AI Gateway credits and generate content under your Vercel account.
- Set an AI Gateway budget. This server caps each call (
MAX_VIDEO_SECONDS,MAX_IMAGES_PER_CALL,MAX_SPEECH_CHARACTERS,ALLOWED_MODELS), but only Vercel's budget limits your total spend. Tools that start from your own video (motion_control,upscale_video,edit_video) follow its length, which the per-call caps cannot see. - Rotate the secret if the URL leaks. Set a new fingerprint (or
MCP_SECRET) and redeploy. The old URL stops working right away, and any unfinished video jobs are abandoned. - Optional: rate-limit the endpoint. Guessing is hopeless, but every wrong request still counts toward your project's usage. If your plan includes Vercel Firewall rate limiting, add a rule for paths starting with
/mcp/(for example, by IP). Do not turn on Attack Challenge Mode for it: Claude's and ChatGPT's servers cannot solve the challenge, so your connector would stop working. - Files are private, but links are not. Pictures, videos and audio are stored in a private Blob store. Anyone who holds one of the links returned in chat can open that file until the link expires (
SIGNED_URL_TTL_HOURS). - Usage stats need the secret.
POST /api/statschecks it in constant time and answers 404 otherwise. Remembering the secret in a browser lets anyone using that browser see your usage; "Forget" removes it. - Logs: this app never logs the secret or request URLs. Vercel's own request logs record request paths, so members of your Vercel team can see the secret there.
- Generated media is stored exactly as the provider returns it. Watermarks and metadata are never removed.
Reference
Your secret
Your connector link is your deployment's address plus the secret. The setup page builds it in your browser:
The secret is a random value of at least 32 characters. The Deploy button doesn't ask for it: a fresh copy starts with the endpoint off, and its setup page makes one in your browser and remembers it there, so your link is filled in after the redeploy.
Vercel never gets the secret itself, only its SHA-256 fingerprint as MCP_SECRET_SHA256. A fingerprint can't be turned back into the secret, so anyone who can read your environment variables, or the chat you pasted the setup prompt into, still can't use your connector. The other side of this: Vercel can't show you your secret either. If you lose the browser that holds it (and it isn't in your phone or your chat app's connector settings), make a new one and redeploy.
To do it yourself: make a secret with openssl rand -hex 32, and set MCP_SECRET_SHA256 to the output of printf %s '<your-secret>' | shasum -a 256 (the hex part). For local development a plain MCP_SECRET=<your-secret> is simpler; the fingerprint wins when both are set. Use URL-safe characters only; hex is ideal.
A random 64-character hex secret holds 256 bits: guessing it over the network is not possible in practice, and every wrong guess gets the same 404 as any unknown URL, compared in constant time. Secrets typed by hand are the weak spot, so the endpoint also stays off when the secret has fewer than 8 different characters or repeats one short block (aaaa…, passwordpassword…).
claude.ai custom connectors only support OAuth or no auth, and they can't send custom headers, so the secret goes in the URL path. If no secret is set (or a plain MCP_SECRET is shorter than 32 characters, or the fingerprint isn't 64 hex characters), the MCP endpoint is disabled. A wrong secret gets the same 404 page as any unknown URL.
Configuration
Vercel sets the Blob variables (BLOB_STORE_ID, plus BLOB_READ_WRITE_TOKEN as a fallback) and VERCEL_OIDC_TOKEN automatically when the store is connected. Without a Blob store, text, pictures and voice still work inline; video and file links need one. Create a private Blob store under the project's Storage tab, connect it and redeploy. The setup page links there.
Local development
Test the server with the MCP Inspector:
Choose Streamable HTTP and connect to http://localhost:3000/mcp/<MCP_SECRET>.
The same tools also run over stdio, for local MCP clients and for directories that start the server to list its tools (Glama does this). Your deployment does not use it.
A stdio server is a process you start yourself, so it has no secret check: it spends whatever Gateway key it is given. MCP_SECRET only signs video job ids there. Listing the tools needs no variables at all.
Two development-only addresses preview states you cannot reach without a deployment: /?preview-open shows the page as it looks once setup is done, and /?sample-stats fills the usage with sample numbers.
How it works inside
- Setup page:
/checks the deployment live and guides each step, then hides the guide once every required step is done (agateway-opencookie, ignored whenever a server check fails). Black and white, drawn in code, with motion that rests finished under reduced motion./setupredirects there. - Usage stats: every call from this server carries AI Gateway tags (
ai-gateway-mcp,tool:<name>,client:<app>, the app guessed from its User-Agent). The setup page reads AI Gateway's own spend report filtered by those tags, so there is no database. The report is a paid-plan feature: on Hobby, Vercel answers 403 and the page says so instead (credits still show). Keeping our own log in Blob was ruled out: Hobby includes 2,000 Blob advanced operations a month, and going over blocks Blob for 30 days. - Inline viewer: one MCP Apps resource,
ui://gateway-mcp/media.html, built fromui/byscripts/build-ui.mjs(esbuild, beforedev,buildandtypecheck). Its CSP allowshttps://*.blob.vercel-storage.comfor images and media. - Stack: Next.js (App Router) and TypeScript. MCP is served over Streamable HTTP using
mcp-handlerv2, and model calls go through the AI SDK with the AI Gateway provider. - Secret check:
proxy.tsrejects a wrong secret before routing by rewriting it to the standard 404 page. The route handler then checks the secret again, in constant time. - Media in, media out: files you give a tool are downloaded by the server (https only, size-capped), so this server's own private links work as input. Video jobs send theirs as links, since AI Gateway keeps a job's start request small.
- Video jobs: no database. Each
job_idholds the model and the AI Gateway job id, signed with a key derived from the fingerprint (orMCP_SECRET) and only accepted from callers holding the secret, so it can't be forged.
License
MIT
來源:README.md,提交 ebef21f
工具
0版本歷史
1- v0.1.0最新Oct 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通必需25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式必需10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分