Logo Mediagen

Mediagen

Cộng đồng
Cripacx

AI image and video generation skill for Claude Code and other coding agents — Gemini, OpenAI and Kie AI behind one CLI and MCP server, with EU AI Act content marking.

Nhà phát hànhCripacx
Kho mãmediagen
Ngôn ngữTypeScript
Bản fork
0
Sao
52
Công cụ có sẵn
0
Phương thức truyền tảistdio
Danh mục
Giấy phépMIT
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    Mediagen cung cấp các khả năng MCP mà ứng dụng khách và tác nhân AI tương thích có thể sử dụng.

  • 0 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Cấu hình sẵn để sao chép

    Dùng các đoạn cấu hình cài đặt mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Chỉ số quan tâm đến mã nguồn mở

    52 sao và 0 bản fork từ kho mã được liên kết.

mediagen — an image and video generation skill for coding agents

npm CI node

Give your agent image and video generation across Google Gemini, OpenAI and Kie AI — one skill, one install, no API to learn.

Say roughly what you want and let it decide the rest:

You:   Make a hero image for the landing page, wide, something moody and industrial.

Agent: npx -y mediagen image "A disused loading dock at dusk, wet concrete…"
         --aspect-ratio 21:9 --json
       → ./output/image-20260823T094107Z.png

It wrote the prompt out in full, knew 21:9 rules OpenAI out, and read the path back from --json.

Or be exact, and it stops deciding:

You:   Same thing with gemini-3-pro-image, 21:9, 4K, marked as AI-generated,
       saved as hero.png.

Agent: npx -y mediagen image "A disused loading dock at dusk, wet concrete…"
         --model gemini-3-pro-image --aspect-ratio 21:9 --size 4K
         --output-name hero.png --json
       → ./output/hero.jpg

       [looks at the image]

       npx -y mediagen mark ./output/hero.jpg --visible-label
         --label-position top-right --json
       → ./output/hero.labelled.jpg

It marked in a second pass, after seeing where the subject ended up — and put the label on the flat roofline rather than over the loading bay.

Anything the CLI takes can be asked for in words — provider, model, aspect ratio, size, output name and directory, quality preset, video duration, an input image to edit, and whether to mark the result. Name any of them and the agent uses it as given; leave it out and it chooses, or falls back to what you configured.

Install

bash
npx -y skills add Cripacx/mediagen --skill mediagen

That is the whole installation. Nothing else to set up — the skill runs the CLI through npx, which fetches it on first use and caches it afterwards.

Then give it a key:

bash
npx -y mediagen init

An interactive wizard: pick providers, enter each key without it being echoed, verify each against the live API, choose a model per provider, and set a default. One key is enough to start.

Now just ask your agent for an image.

What your agent can do with it

  • Generate images and video from a description, or edit media you already have
  • Choose the right provider for the task — the skill knows Gemini handles 21:9 and video, that OpenAI cannot do 16:9 at all, and that Kie aggregates around thirty third-party models
  • Take your instructions literally when you give them. Name a model, a ratio, a size or a filename and it is used as stated. mediagen models is there when you want to see what is available before choosing
  • Write the prompt properly. The skill carries prompt-writing guidance, so "a hero image, moody and industrial" becomes a full description of subject, composition, light, camera and materials before anything is sent
  • Mark AI-generated output when it matters — the skill suggests it for anything photorealistic or destined for publication
  • Recover from failures on its own, because every error carries a machine-readable code and a next action

And what it will not do: ask you to paste an API key into the chat. On a configuration error the skill tells you to run mediagen init in your own terminal.

Prerequisites

  • At least one API key:
  • Node.js 20.11 or later

Configuration

mediagen init covers first-time setup. To change something later:

bash
npx -y mediagen config edit

A menu of every setting with its current value and where that value came from — provider, model, key, output directory, quality preset, and what mediagen mark does by default. Each change is written as you make it.

For CI and scripts, where there is no terminal, config set takes the same settings as arguments:

bash
echo "$GEMINI_API_KEY" | npx -y mediagen config set gemini --stdin
npx -y mediagen config set gemini-model gemini-3-pro-image

Which provider gets used

Set the order you prefer, most preferred first:

bash
npx -y mediagen config set provider-priority gemini,kie,openai

It is a preference, not a whitelist. A request with no --provider goes to the first provider in the order that has a key and can do the job — so a missing OpenAI key never stops something Gemini can do, and asking for video skips straight past the providers that do not make any. Naming --provider overrides all of it.

mediagen models shows the resulting order, which providers are usable, and what a request would get:

1. Google Gemini (gemini)  [preferred, key from config file]
  Would use: gemini-3.1-flash-image  (provider default)
2. Kie AI (kie)  [key from config file]
3. OpenAI (openai)  [preferred, no key]
  No key configured, so requests to it fail. Fix: mediagen config set openai

A request with no --provider uses gemini/gemini-3.1-flash-image.

With --json it adds wouldUse, usableProviders and providerPriority. That is what the skill has an agent read before generating, so it never picks a model from a provider you have no key for.

To check what is configured and whether the keys still work:

bash
npx -y mediagen doctor

doctor reports, per provider, whether a key is configured, which layer it came from, and whether the provider accepts it — keeping not configured, rejected, unreachable and no cheap way to check distinct, because they call for four different fixes.

[!WARNING] There is deliberately no flag that takes an API key as an argument. Arguments land in shell history and in the process list, where they outlive the command that used them.

Settings resolve from the environment first, then .env in the working directory, then the config file:

VariablePurpose
GEMINI_API_KEY, OPENAI_API_KEY, KIE_API_KEYcredentials; at least one
MEDIAGEN_PROVIDER_PRIORITYproviders in preference order
GEMINI_MODEL, OPENAI_MODEL, KIE_MODELdefault model per provider
MEDIAGEN_OUTPUT_DIRwhere media is saved
MEDIAGEN_QUALITYfast, balanced, quality
MEDIAGEN_MARKmark output by default
MEDIAGEN_VISIBLE_LABELadd a visible label by default

[!TIP] A stale environment variable shadowing the key you just configured is the most expensive failure this kind of tool has. mediagen config list marks every shadowed value, so you can see it rather than guess.

Providers

ProviderImagesVideoEditingKey verification
Google GeminiNano Banana family, up to 4Kyesyeslive probe
OpenAIgpt-image family, DALL·E—yeslive probe
Kie AI~30 models: Flux, Imagen, Grok—mostno cheap probe; reported as such

[!NOTE] OpenAI takes pixel dimensions rather than aspect ratios and genuinely cannot produce 16:9 — its widest image is 1536×1024, which is 3:2. Asking for 16:9 is refused by name rather than quietly served as something else. The skill knows this and routes wide shapes to Gemini.

A model absent from the listings is still sent to the provider, so a newly released model works before mediagen knows about it. Kie's catalogue is generated from Kie's own documentation rather than maintained by hand.

Content marking

The EU AI Act splits disclosure into two duties, so mediagen mark has two independent switches:

FlagDutyWhat it does
machine-readablemake it findable by toolswrites IPTC/XMP DigitalSourceType, on by default
--visible-labeldisclose it to peoplecomposites the EU's official AI-content label

Generating never marks. Marking is always a second command, run on the file afterwards:

bash
npx -y mediagen image "a wide banner" --aspect-ratio 21:9 --size 2K --json
npx -y mediagen mark ./output/image-….jpg --visible-label --label-position top-left

That is not ceremony. A visible label has to go where the subject is not, and only the finished image can say where that is. The machine-readable marker is not free either: adding metadata to a JPEG or WebP means decoding and re-encoding it, so marking costs a second lossy pass — worth paying deliberately, not as a side effect of asking for an image. mediagen re-encodes at high quality to keep that cost small, but it cannot make it zero.

To have mediagen mark draw the visible label without being asked each time:

bash
npx -y mediagen config edit      # "AI marking by default"

A configured default is still overridable per run with --no-mark or --no-visible-label.

The visible label is the European Commission's own icon, published with the Code of Practice on Transparency of AI-generated Content and free to use without attribution. Two of its three variants are used: AI GENERATED by default, AI MODIFIED with --modified, for media a person made and a model altered. The light or dark version is picked from what is actually under the corner it lands in, because a label nobody can read is not a disclosure.

It sits bottom-right by default. --label-position moves it to another corner, or auto puts it wherever the image has the least detail.

[!IMPORTANT] A visible label is never written over its source. mediagen mark photo.png --visible-label produces photo.labelled.png and leaves the pixels of photo.png exactly as they were, while writing the machine-readable marker into it — so whichever of the two you publish carries the disclosure. A label placed badly can be redone from an untouched original and from nothing else. --in-place overwrites if you really mean to.

Using it without an agent

The skill is a wrapper around a CLI, and the CLI stands on its own.

bash
npx -y mediagen image "a wide banner" --aspect-ratio 21:9 --size 2K
npx -y mediagen image "make the sky stormy" --input ./photo.jpg
npx -y mediagen mark ./output/image-….jpg --visible-label
npx -y mediagen video "a marble rolling down a wooden track" --duration 6
npx -y mediagen models

Install it globally if you use it often enough to want the shorter command:

bash
npm install -g mediagen

Options

Option
--provider <name>gemini, openai, kie
--model <id>see mediagen models
--input <path>source media to edit or transform
--aspect-ratio <ratio>1:1, 16:9, 9:16, …
--size <size>1K, 2K, 4K
--duration <seconds>video only
--output-name <name>the extension may select the format
--output-dir <dir>where to save
--quality <preset>fast, balanced, quality
--jsonexactly one JSON object on stdout
--verbose --quietdiagnostics on stderr

[!TIP] Without the skill, prompt writing is on you. mediagen sends the prompt exactly as written — it does not expand or rewrite it. Decide subject, composition, light, camera or medium, materials and atmosphere, and say what you want rather than what you do not.

Scripting

With --json, stdout carries exactly one JSON object and nothing else. Without it the saved path is the last line, and a failure writes nothing to stdout at all — so reading the last line can never hand you an error message where you expected a path.

json
{
  "success": true,
  "filePath": "./output/image-20260823T094107Z.png",
  "kind": "image",
  "provider": "gemini",
  "model": "gemini-3.1-flash-image",
  "mimeType": "image/png"
}
Exit codeMeaning
0success
2invalid input or usage
3configuration or credentials
4generation, network, or file I/O

A failure carries an errorCode — one of VALIDATION_ERROR, CONFIG_ERROR, API_ERROR, NETWORK_ERROR, FILE_ERROR, CONTENT_BLOCKED or TIMEOUT — and a hint naming a concrete next action.

Using it as an MCP server

For hosts that speak MCP rather than running skills. Same package, started with mediagen mcp, exposing generate_media, list_models and check_configuration.

bash
claude mcp add mediagen --env GEMINI_API_KEY=your-api-key-here -- npx -y mediagen mcp

The -- separates Claude's own flags from the command that starts the server. Add --scope project or --scope user to change where the entry is written.

Settings → Developer → Edit Config, or edit directly:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
json
{
  "mcpServers": {
    "mediagen": {
      "command": "npx",
      "args": ["-y", "mediagen", "mcp"],
      "env": {
        "GEMINI_API_KEY": "your-api-key-here"
      }
    }
  }
}

Restart Claude Desktop afterwards.

bash
code --add-mcp "{\"name\":\"mediagen\",\"command\":\"npx\",\"args\":[\"-y\",\"mediagen\",\"mcp\"]}"

Or create .vscode/mcp.json in your workspace — note that VS Code uses servers, not mcpServers:

json
{
  "servers": {
    "mediagen": {
      "command": "npx",
      "args": ["-y", "mediagen", "mcp"]
    }
  }
}

Cursor, Windsurf, Zed and most others take the same shape as Claude Desktop, in their own config file:

FieldValue
commandnpx
args["-y", "mediagen", "mcp"]
transportstdio

env can be omitted from any of these once mediagen init has run — the server reads the same configuration the CLI does.

How it works

One pipeline, three frontends. The skill drives the CLI; the MCP server is a second adapter over the same core. Neither contains behaviour of its own, so a capability cannot exist in one and be missing from the other.

      agent skill  ·  CLI  ·  MCP server
                     ↓
 request → model resolution → capability check → provider client
                     ↓
                save to disk → result

              mediagen mark → AI content marking

Each provider is one self-contained directory declaring what it supports. Adding one touches a single line outside its own folder. Provider manifests carry no vendor SDK imports, so doctor and config never pay to load one.

src/
├── types/          leaf types everything shares
├── core/           pipeline, errors, capability checks, file handling
├── config/         the three configuration layers, key verification
├── providers/      one directory per provider, plus the registry
│   ├── gemini/
│   ├── openai/
│   ├── kie/
│   └── shared/     polling for asynchronous providers
├── cli/            the command tree; output.ts owns stdout
├── mcp/            the MCP server
└── marking/        AI content marking
skills/mediagen/    the agent skill
scripts/            catalogue generation, version syncing

Contributing

See CONTRIBUTING.md for development setup, how to add a provider, and how releases are cut.

Cài đặt

TypingMind
{
  "mcpServers": {
    "mediagen": {
      "command": "npx",
      "args": [
        "-y",
        "mediagen"
      ]
    }
  }
}

Dùng MCP Mediagen với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối Mediagen, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. MCP này chạy cục bộ thông qua trình kết nối MCP của TypingMind trên thiết bị của bạn.

Hướng dẫn thiết lập để dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Cài trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Cài trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Giữ tiến trình chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Giữ tiến trình trong cửa sổ Terminal chạy trong khi dùng các công cụ MCP.
3

Thêm Mediagen làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của Mediagen.
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "mediagen": {
      "command": "npx",
      "args": [
        "-y",
        "mediagen"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của Mediagen, sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của Mediagen.
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng Mediagen giúp tôi làm việc này không?
Mediagen
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng Mediagen.

Câu hỏi thường gặp

Máy chủ MCP Mediagen dùng để làm gì?

Mediagen là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP Mediagen với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng Mediagen với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP Mediagen với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối Mediagen, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP Mediagen với TypingMind?

Mediagen hoạt động thông qua trình kết nối MCP cục bộ của TypingMind. Đây là lựa chọn phù hợp nhất khi máy chủ MCP cần truy cập tệp cục bộ, ứng dụng máy tính, công cụ dòng lệnh hoặc tài nguyên riêng trên máy tính của bạn.

MCP Mediagen cung cấp những công cụ nào trong TypingMind?

Mediagen cung cấp các chức năng MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP Mediagen không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu Mediagen yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇