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 分