CarouselMCP

CarouselMCP

Generates ready-to-post Instagram carousel PNGs from a topic string, using AI (Gemini or Claude) for content and storing images in S3.

Category
访问服务器

README

CarouselMCP

An MCP server that generates a ready-to-post Instagram carousel — a "notebook paper" style set of PNG slides — from nothing but a topic string. Deployed as a single AWS Lambda function behind a public Function URL, with generated images stored in S3.

What it does

One tool, generate_skill_carousel, takes a topic and returns a finished carousel:

{
  "name": "generate_skill_carousel",
  "arguments": { "topic": "python libraries every data engineer should know" }
}

A single AI call — Gemini or Claude, whichever key is available — does all the creative work at once:

  • Picks the layout itself. Most topics get the default list layout: a hook slide, four grid pages of items, and a closing slide (6 slides, up to 32 items total). A genuine two-sided topic ("Claude pros and cons", "remote work advantages and disadvantages") is automatically routed to the pros_cons layout instead — hook, a green PROS slide, a red CONS slide, a verdict slide, a recap slide, and closing. This is a semantic decision by the model, not keyword matching on the topic string.
  • Decides how many items the topic actually supports — it won't pad a thin topic out to a fixed count.
  • Grounds the content in a real web search (Google Search via Gemini, or Claude's built-in web_search tool) instead of writing from the model's own unverified memory.

Every icon is a built-in flat vector glyph — there's no AI image generation anywhere in the pipeline, and none is needed. No background image, hero photo, reference image, or custom theme/colors are accepted as input; the paper-texture background, fonts, and doodle accents are all fixed. That's a deliberate trim, not a missing feature — topic (plus an optional API key override) is the entire input surface.

Requirements

  • One of GEMINI_API_KEY or ANTHROPIC_API_KEY (env var, or pass geminiApiKey / claudeApiKey per call to override). Gemini is tried first if both are present. If neither is available or both fail, it falls back to placeholder text rather than failing the whole call.
    • Note: Claude has no image-generation API and isn't used for one here — it's only ever used for the text content, same as Gemini's role in this pipeline.
  • OUTPUT_BUCKET — an S3 bucket the function can write PNGs to (defaults to my-custom-mcp in code; override for your own bucket).
  • MCP_API_KEY — shared secret every caller must send. Fails closed: a missing or wrong key is rejected with 401 before any model call or S3 write happens, so a bad key never costs anything.
  • Bundled fonts. Lambda has no system fonts, and image rendering needs real font files — fonts/NotoSans-Regular.ttf, fonts/NotoSans-Bold.ttf, and fonts/fonts.conf are committed in this repo and must ship inside the deployment package, with FONTCONFIG_PATH=/var/task/fonts set as an environment variable.

Deploying

Option A — one command, via AWS SAM

sam build --use-container
sam deploy --guided

--use-container matters here — sharp (the image library this uses) ships a native binary compiled for a specific OS/architecture. Building without a container compiles against whatever machine you're running sam build on; building in a container cross-compiles against Lambda's actual Linux runtime, avoiding a broken/mismatched native binary at runtime.

--guided prompts for the stack name, region, and the two parameters (GeminiApiKey / AnthropicApiKey — provide at least one; both are NoEcho) on first run, then remembers your answers in samconfig.toml.

Option B — manual, via the Lambda console

  1. npm install.
  2. Zip the folder's contents (not the folder itself) — index.mjs, node_modules, package.json, package-lock.json, and the fonts/ folder all need to sit at the zip's top level.
  3. Create function → author from scratch → Node.js 22+ → upload the zip.
  4. Configuration → General configuration: raise Timeout (this one's deployed at ~2 minutes) and Memory (deployed at 256 MB — image compositing needs more headroom than plain text generation).
  5. Configuration → Environment variables: MCP_API_KEY, OUTPUT_BUCKET, FONTCONFIG_PATH (/var/task/fonts), and at least one of GEMINI_API_KEY / ANTHROPIC_API_KEY.
  6. Permissions: attach s3:GetObject, s3:PutObject, s3:PutObjectAcl, and s3:DeleteObject on your output bucket — the function reads, writes, and can clean up its own generated objects.
  7. Configuration → Function URL: create one with Auth type NONE. MCP_API_KEY, checked inside the handler, is the real gate — NONE here only means AWS isn't checking IAM signatures.

Testing it directly

curl -s https://<your-function-url> \
  -H "x-api-key: <MCP_API_KEY>" \
  -H "content-type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

curl -s https://<your-function-url> \
  -H "x-api-key: <MCP_API_KEY>" \
  -H "content-type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"generate_skill_carousel","arguments":{"topic":"python libraries every data engineer should know"}}}'

The response includes both a text summary and structuredContent with the topic, slide count, and the direct S3 URLs for each generated PNG.

Connecting an MCP client

claude mcp add --transport http carousel https://<your-function-url> \
  --header "x-api-key: <MCP_API_KEY>"

Project structure

index.mjs   — everything: carousel generation, image rendering, S3 I/O, JSON-RPC dispatch
fonts/      — fonts bundled into the deployment package (no system fonts on Lambda)
package.json

Security note

MCP_API_KEY, GEMINI_API_KEY, and ANTHROPIC_API_KEY are all plain environment variables — never hardcode them in index.mjs. Rotate all three if this function's configuration was ever shown on screen (a demo, a screen recording).

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选