教程 / MCP

通过 MCP 在 Claude Code 中端到端运行广告活动

你无需打开编辑器。你只需告诉 Claude Code 广告活动的需求,它会调用 NOLGIA 工具,生成的创意素材将存入一个项目,你可以在网站上打开查看。

  • 8 分钟阅读
  • 更新于

本文由英文自动翻译。阅读原文

主视觉图创意素材项目

按顺序列出你制作的内容。点按任一项即可跳到对应步骤。

你可以通过将 Claude Code 连接到 NOLGIA 的 MCP 服务器,并用通俗语言描述需求,来运行一个小型广告活动。Claude Code 会创建一个项目,打开你批准的英雄图,使用图生图工具基于该英雄图制作每个创意素材,按你指定的尺寸渲染所有创意素材,并将结果归档到项目中。你可以在项目页面或素材库中查看图片,整个流程无需打开编辑器。

以下内容展示了一个真实会话,针对一款虚构产品:带橙色光环的哑光黑色耳机。工具调用按 Claude Code 生成的原样打印,图片是返回的结果,价格来自页面加载时的实时目录。连接设置已在 通过 MCP 从 Claude Code 或 Cursor 生成 中介绍;本指南从设置完成后开始。

常见问题及修正方法

错误负面影响修正
在一行中要求生成全部六张图片代理在产品确认前就开始生成,导致你为六张错误的图片付费先批准英雄图,再扩展生成
为每个创意素材重新描述产品每次描述都会产生偏差,导致产品形状发生变化使用图生图功能,基于已批准的主体图制作创意素材,确保参考图贯穿始终
跳过项目六个素材散落在素材库中,彼此之间没有任何关联先创建项目,并在每次生成时传入其 ID
将钱包余额当作收据来读取在多人共用的账户上,余额会因会话之外的原因发生变动,因此据此推断的价格可能会高出数倍提前告知代理上限和单张图片费率,并读取账本而非余额
重试超时的调用第一次调用通常已在服务器端完成;盲目重试会生成第二张图片五分钟内对同一请求的重试会返回 409 状态码,且不会重复计费;使用 assets 工具查找结果

开始之前

  • 按照 MCP 指南,使用个人访问令牌将 Claude Code 连接到 NOLGIA。
  • 充值余额中有积分:令牌仅消耗充值积分。
  • 素材库中有一张已批准的产品主体图。我们使用的是虚构产品,由 GPT Image 2.5 Flare 生成。
  • 一份简短的简报,包含模型、尺寸和积分上限。我们的简报:三个创意素材,1:1 和 9:16,最多八十积分,并说明单张图片的积分费率。
一副哑光黑色头戴式耳机,每个耳罩上有一圈细窄的发光橙色光环,放置在傍晚窗边的旧橡木桌上。
已批准的主视觉图。 在会话开始前使用 GPT Image 2.5 Flare 制作。以下所有创意素材均基于此图制作。

向 Claude Code 发送简报

一条消息包含整个任务:产品、主视觉图的素材 ID、模型、三个创意素材、两种尺寸、归档规则、积分上限及单张图片费率,以及允许同时运行的调用次数。我们还指定了要使用的工具,并要求不要修改模型列表,因为我们要自行指定模型。

发送的简报
You are running a small ad campaign for me on NOLGIA through the nolgia MCP tools. Work only with those tools; do not run shell commands and do not call nolgia_list_models (I am telling you the model).

The product is fictional: matte black over-ear headphones with a thin glowing orange light ring on each ear cup. The approved hero image already exists in my library as asset 74391fde-9c67-44aa-a298-aa090f8d7949.

Do this, in order, and tell me each tool call you make and what came back (ids, sizes, credits):
1. Create a project named "Orange Ring campaign 2" with a one-line description.
2. Open the hero asset with nolgia_get_asset so you know what it looks like, and file it into the project.
3. Make three creatives from the hero with nolgia_image_to_image on the model gpt-image-2.5-flare, using the hero as the reference image so the product stays the same, each in two sizes, aspect ratio 1:1 and 9:16, so six images in total, every one filed into the project by passing the project id:
   Creative A "Morning desk": the headphones on a worn oak desk in a shaft of morning window light, dust drifting in the beam, soft shadows, premium ad look.
   Creative B "Night rain": the headphones in close-up with fine rain droplets on the matte shells and warm amber streetlight reflections, soft city bokeh behind, music-video look.
   Creative C "Silhouette": a young dancer in a long dark coat seen from behind wearing the headphones, under one warm practical lamp in a dark rehearsal room with haze, the orange rings glowing, fashion-film look, no face visible.
4. Spend at most eighty credits in total; each image on this model bills eight credits. Run at most three image calls at once. If a call fails, report it and continue with the next; do not retry more than once.
5. Finish with a short table: creative, size, asset id, and the project id.

提示:指定模型和参考图. nolgia_list_models 返回整个目录,远超单次会话所需。请在简报中说明模型 ID。主视觉图作为参考图用于每次图生图调用,这能确保产品在不同创意素材中保持一致。

会话记录(逐字)

Claude Code 加载了所需的四个工具,创建了项目,打开并归档了主视觉图,然后分三批生成了六张图片,每批不超过三次调用,并在每批后报告其运行花费。签名 URL 已缩短,JSON 结果以键值对行形式打印,每个提示词共用的开头部分仅打印一次;其他内容未作编辑。

工具、项目和主视觉图(参数和结果以键值对行形式显示)
CALL ToolSearch
  query: select:mcp__nolgia__nolgia_create_project,mcp__nolgia__nolgia_get_asset,mcp__nolgia__nolgia_add_project_assets,mcp__nolgia__nolgia_image_to_image
  max_results: 4

CALL nolgia_create_project
  name: Orange Ring campaign 2
  description: Ad creatives for matte black over-ear headphones with glowing orange light rings, built from the approved hero image.
CALL nolgia_get_asset
  asset_id: 74391fde-9c67-44aa-a298-aa090f8d7949
RESULT id: b73d2c7d-4a86-4785-8fb5-ddfb98da7b9d, name: Orange Ring campaign 2, asset_count: 0
RESULT status: ready, kind: image, name: Premium product photograph of fictional, asset_id: 74391fde-..., mime_type: image/png, model: gpt-image-2.5-flare, url: (signed url)

CALL nolgia_add_project_assets
  project_id: b73d2c7d-4a86-4785-8fb5-ddfb98da7b9d
  asset_ids: 74391fde-9c67-44aa-a298-aa090f8d7949
RESULT added: true
分三批生成的六张图片(积分数字以文字形式写出)
CALL nolgia_image_to_image
  model: gpt-image-2.5-flare
  aspect_ratio: 1:1
  project_id: b73d2c7d-...
  image_url: (signed url of the hero)
  prompt: Keep the exact same headphones from the reference image: matte black over-ear headphones with a thin glowing orange light ring on each ear cup, identical shape and details. Scene: the headphones resting on a worn oak desk in a shaft of morning window light, fine dust drifting visibly in the light beam, soft shadows, cool-to-warm morning tones, shallow depth of field, premium advertising product photography, photoreal. No text, no letters, no logos, no brand names, no watermark.
CALL nolgia_image_to_image
  (the same, with "vertical composition" added) aspect_ratio: 9:16
RESULT status: ready, kind: image, asset_id: fa93b7aa-cba8-427f-8920-38281358a39c
RESULT status: ready, kind: image, asset_id: 96429e72-73a9-4e00-b7c5-297cd426883a
TEXT: Sixteen credits spent so far. Next I'll run Creative B in both sizes and Creative C at 1:1, which is three calls at once.

CALL nolgia_image_to_image
  model: gpt-image-2.5-flare, aspect_ratio: 1:1, project_id: b73d2c7d-..., image_url: (signed url of the hero)
  prompt: Keep the exact same headphones from the reference image: (as above). Scene: night close-up of the headphones with fine rain droplets beaded on the matte shells, warm amber streetlight reflections gliding across the surfaces, the orange rings glowing, soft out-of-focus city bokeh behind, moody cinematic music-video look, photoreal. No text, no letters, no logos, no brand names, no watermark.
CALL nolgia_image_to_image
  (the same, with "vertical composition" added) aspect_ratio: 9:16
CALL nolgia_image_to_image
  model: gpt-image-2.5-flare, aspect_ratio: 1:1, project_id: b73d2c7d-..., image_url: (signed url of the hero)
  prompt: Keep the exact same headphones from the reference image: (as above). Scene: a young dancer in a long dark coat seen from behind, wearing the headphones, standing in a dark rehearsal room filled with light haze, lit by a single warm practical lamp, the orange rings glowing clearly, face not visible, fashion-film look, cinematic, photoreal. No text, no letters, no logos, no brand names, no watermark.
RESULT status: ready, kind: image, asset_id: 067eb5f3-76fd-4bb7-a513-44936650ed79
RESULT status: ready, kind: image, asset_id: 24b9247e-ce62-41fc-869b-a954c814e599
RESULT status: ready, kind: image, asset_id: 38521354-d302-4b3f-9081-3fe3ad253c52
TEXT: Forty credits spent so far. One image left.

CALL nolgia_image_to_image
  (Creative C again, with "vertical full-figure composition" added) aspect_ratio: 9:16
RESULT status: ready, kind: image, asset_id: e34a8f78-1872-4d3b-b6a4-dd9d4ab1e9d9

它运行顺利:六张图片,四十八积分,在我们设定的八十积分以内,没有停止,没有超时,也没有重试。因为简报中说明了单张图片的费率,它自行计算花费,而不是读取钱包余额。

其结束消息(积分数字以文字形式写出)
All six images were made and filed into the project, for forty-eight credits in total (under your eighty limit). No calls failed and none were retried.

Tool calls, in order
1. nolgia_create_project with the name "Orange Ring campaign 2" and the description "Ad creatives for matte black over-ear headphones with glowing orange light rings, built from the approved hero image." It returned project b73d2c7d-4a86-4785-8fb5-ddfb98da7b9d, with 0 assets.
2. nolgia_get_asset on 74391fde-9c67-44aa-a298-aa090f8d7949 returned a ready PNG image made with gpt-image-2.5-flare. I didn't see the picture itself, only its details and the prompt it was made from. The prompt describes the headphones on a worn oak desk by a window in late-afternoon daylight, with a long warm shadow and shallow depth of field. I used its signed link as the reference image in every call below.
3. nolgia_add_project_assets filed the hero into the project and returned added: true.
4. nolgia_image_to_image ran six times on gpt-image-2.5-flare, with the hero as the reference and the project id passed each time. Every prompt starts by telling the model to keep the exact same headphones, and every one includes "no text, no logos, no watermark":
   - First batch (2 calls at once): Creative A at 1:1 and 9:16. Both came back ready, eight credits each, sixteen so far.
   - Second batch (3 calls at once): Creative B at 1:1 and 9:16, and Creative C at 1:1. All came back ready, eight credits each, forty so far.
   - Third batch (1 call): Creative C at 9:16. It came back ready for eight credits, forty-eight in total.

Results
Creative | Size | Asset id | Project id
A "Morning desk" | 1:1 | fa93b7aa-cba8-427f-8920-38281358a39c | b73d2c7d-4a86-4785-8fb5-ddfb98da7b9d
A "Morning desk" | 9:16 | 96429e72-73a9-4e00-b7c5-297cd426883a | b73d2c7d-...
B "Night rain" | 1:1 | 067eb5f3-76fd-4bb7-a513-44936650ed79 | b73d2c7d-...
B "Night rain" | 9:16 | 24b9247e-ce62-41fc-869b-a954c814e599 | b73d2c7d-...
C "Silhouette" | 1:1 | 38521354-d302-4b3f-9081-3fe3ad253c52 | b73d2c7d-...
C "Silhouette" | 9:16 | e34a8f78-1872-4d3b-b6a4-dd9d4ab1e9d9 | b73d2c7d-...

The project now holds 7 assets: the hero plus the six new images. I haven't looked at any of the new images. Before you use them, check that the headphones match the hero and that no face shows in the Silhouette images.

它从未看到图片,只看到了细节,这就是为什么它最后的几行要求你去检查:打开项目,以全尺寸查看每一张图片。每个提示词中的“No text, no letters, no logos, no brand names, no watermark”这一行是 Claude Code 自己添加的;简报中并没有要求这一点。如果你想在创意素材中加入标牌或你的 Logo,请在简报中明确说明或附上确切的 Logo 图片,如果文字出现乱码,请重新生成。

广告活动

六张图片,全部源自同一个主视觉,全部使用 GPT Image 2.5 Flare 生成,每张均按该模型的费率计费。由于每次调用都使用主视觉作为参考,因此产品在所有图片中都是同一个物体。

一副耳机放在橡木桌上,沐浴在清晨透过窗户射入的一束光线中,光束中尘埃飘浮,方形构图。
创意素材 A,1:1。 清晨书桌。
一副耳机放在橡木桌上,沐浴在清晨透过窗户射入的一束光线中,光束中尘埃飘浮,竖构图。
创意素材 A,9:16。
耳机特写,表面布满雨珠,背景是琥珀色路灯的反光和城市散景,方形构图。
创意素材 B,1:1。 夜雨,雨滴中映出温暖的路灯光。
耳机特写,表面布满雨珠,背景是琥珀色路灯的反光和城市散景,竖构图。
创意 B,9:16。
一位身穿深色长外套的年轻舞者背对镜头,在朦胧的排练室中戴着耳机,一盏暖灯,橙色光环发光,方形构图。
创意 C,1:1。 一盏暖灯下的剪影。
一位身穿深色长外套的年轻舞者背对镜头,在朦胧的排练室中戴着耳机,一盏暖灯,橙色光环发光,垂直构图。
创意 C,9:16。

成果在站点上的位置

打开 项目 和该活动的项目。主视觉和六个创意素材位于其媒体中,如果下一轮需要固定演员、地点或你的调色板和标志,项目的演员阵容、地点和品牌套件槽位已准备就绪。从这里你可以下载整套素材或在 Studio 中打开任意图片。

Orange Ring 活动 2 的项目媒体网格:主视觉和六个创意素材,方形和垂直,带有尺寸
项目的媒体。 七个素材,按会话归档。

同一会话可以在 活动 页面使用 nolgia_run_preset 运行活动预设:四种尺寸的海报,文字设置为真实文本,静态广告包,广告牌和发布影片。我们这里保留了原始图像工具,以便转录显示每个参数。

三种运行方式

路径方法适用场景
最快使用 Claude Code 中的 nolgia_run_preset 为每种格式运行一个预设,或在网站上的 Campaigns 中运行你需要经过验证的版式,并在海报上设置真实文字
全自动在聊天中向 NOLGIA Agent 提供简报;它会处理各种格式并归档文件你不在终端前
控制力最强使用 Claude Code 配合原始图像工具,如本指南所示你想指导每个创意并保留参考

会话之外的事项

  • 发布。 NOLGIA 不会发布到广告平台或安排日程。你下载整套素材,并上传到广告投放的地方。
  • 图像上的文案。 原始图像工具不会设置真实文字;海报预设会。
  • 视频创意。 同一会话可以调用 nolgia_text_to_video 和 nolgia_image_to_video;本指南仅涉及静态图像。
  • 结果中的价格。 图像结果返回的是素材,而非消耗的积分。你的 billing page 上的账本记录了每张图像的扣费。
  • ChatGPT。 在 MCP 页面上标记为即将推出;本指南仅适用于 Claude Code。

费用说明

阅读是免费的:列出模型、创建项目、打开素材以及归档素材均不消耗积分。每张图像按其对应模型的费率计费。本指南中模型的实时费率以及 Campaigns 页面运行的预设如下:

  • GPT Image 2.5 FlareEvery plan

    Per image

    Native 8 积分 · 2K 21 积分 · 4K 58 积分

页面加载时从目录实时读取。 所有价格都会在生成前显示。 查看所有费率.

亲自尝试

主视觉图与简报

  • 耳机主视觉图,2048x2048 WebPWebP 图片 · 2048x2048 · 233 KB下载
将主视觉图上传到你的素材库,把它的素材 id 填入上面的简报中替换我们的 id,然后在连接了 NOLGIA 的情况下将简报发送给 Claude Code。同时允许使用 jobs 工具。你的创意素材会与我们不同;但产品本身不应不同,因为主视觉图是每次调用时的参考基准。

检查清单

  1. Token 已连接;nolgia_get_account 有响应。
  2. 在任何创意生成之前已批准主视觉图;其素材 id 已填入简报。
  3. 项目已创建;其 id 已用于每次生成。
  4. 简报中指定了模型;模型列表保持不变。
  5. 简报中包含了积分上限和单张图像费率;已允许使用 jobs 工具。
  6. 超时情况需检查,而不是盲目重试。
  7. 在网站上打开项目,并以全尺寸查看每一张图像。

常见问题

Claude Code 能一次性完成整个广告活动吗?
它可以串联调用,但请先批准主视觉图:每个创意都是基于它生成的,所以错误的主视觉图会导致六张错误的图像。
会话花费多少积分?
仅生成操作收费。创建项目、打开和归档素材均免费;每张图像按其模型公布的费率计费。图像调用的结果不包含价格信息,因此请查看账单记录。
调用超时了。我会被重复扣费吗?
不会。五分钟内的相同请求会返回 409 错误,并指明现有任务,仅首次请求计费。请使用 jobs 或 assets 工具查找图像。
它能把我的标题添加到创意素材上吗?
原始图像工具无法实现。Social 和 poster pack 以及静态广告预设会将你的文字设为真实文本;请通过 nolgia_run_preset 或在 Campaigns 页面运行它们。
这支持从 ChatGPT 使用吗?
暂不支持。MCP 页面上 ChatGPT 标记为即将推出。目前支持 Claude Code 和 Cursor。

从终端运行你的第一个广告活动

连接 Claude Code

MCP

使用 MCP 从 Claude Code 或 Cursor 生成

只需一个令牌和一条命令或配置项,即可将 NOLGIA 连接到 Claude Code 或 Cursor,然后用自然语言请求图像、视频和音频。

· 5 分钟阅读

产品视频

无需拍摄的产品视频:选择格式

七种产品视频格式,从教程片段到开箱视频再到仅展示手部动作,每种格式都配有真实示例、用途说明及选择建议。

· 8 分钟阅读