Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kie-mcp

A Model Context Protocol (MCP) server for kie.ai — one API for the best AI models. Plug in your kie.ai API key and give Claude (or any MCP client) the ability to generate images, video, music, and text across 100+ models: Veo, Runway, Kling, Seedance, Flux, Nano Banana, Seedream, Ideogram, Qwen, Hailuo, Wan, Suno, GPT, Gemini, Claude, and more.

Built on kie.ai's unified jobs API plus its dedicated Veo / Runway / Suno / Flux Kontext / GPT‑4o endpoints, with a bundled catalog of every market model (exact model IDs + input schemas) so the assistant can discover and run anything.


Features

  • kie_generate — run any of 100+ image/video/music models end‑to‑end (submit + wait for the result URL).
  • Model discoverykie_list_models and kie_get_model_schema let the assistant find the right model and learn its exact inputs (no guesswork).
  • Dedicated helpers for the big APIs with extra features: Veo (1080p/4K, extend), Runway (+ Aleph video‑to‑video), Suno (music, extend, lyrics), Flux Kontext, GPT‑4o images.
  • kie_chat — chat with GPT, Gemini, and Claude text models.
  • Utilities — credit balance, download links, and file upload (turn a local/base64 image into a hosted URL for image‑to‑video etc.).
  • Robust polling, timeouts, and clean error messages. Your API key stays in your environment.

The bundled catalog currently covers 112 market models (41 image, 67 video, 4 music) — see src/catalog-data.ts.


Prerequisites


Install

Option A — via npx from GitHub (no clone)

npx github:neomorrison/kie-mcp

(The first run builds automatically.)

Option B — clone and build

git clone https://github.com/neomorrison/kie-mcp.git
cd kie-mcp
npm install        # builds automatically via the prepare script

The server entry point is dist/index.js.


Configure your MCP client

The server reads your key from the KIE_API_KEY environment variable.

Claude Desktop

Edit your claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "kie": {
      "command": "node",
      "args": ["/absolute/path/to/kie-mcp/dist/index.js"],
      "env": { "KIE_API_KEY": "your_kie_api_key_here" }
    }
  }
}

Or, without cloning:

{
  "mcpServers": {
    "kie": {
      "command": "npx",
      "args": ["-y", "github:neomorrison/kie-mcp"],
      "env": { "KIE_API_KEY": "your_kie_api_key_here" }
    }
  }
}

Restart Claude Desktop afterward.

Claude Code (CLI)

# from a cloned + built checkout
claude mcp add kie --env KIE_API_KEY=your_kie_api_key_here -- node /absolute/path/to/kie-mcp/dist/index.js

# or via npx
claude mcp add kie --env KIE_API_KEY=your_kie_api_key_here -- npx -y github:neomorrison/kie-mcp

Any other MCP client

Run node dist/index.js (or npx -y github:neomorrison/kie-mcp) over stdio with KIE_API_KEY set in the environment.


How it works (recommended flow)

kie.ai has hundreds of models. The assistant doesn't need to memorize them — it discovers them:

  1. Find a modelkie_list_models (filter by category and search).
  2. Learn its inputskie_get_model_schema (exact field names, types, defaults, allowed values).
  3. Run itkie_generate with the modelId and an input object. It submits the job and polls until the output URL(s) are ready.

Example (what the assistant does under the hood):

// 1) discover
kie_list_models { "category": "image", "search": "nano banana" }
// 2) schema
kie_get_model_schema { "model": "google/nano-banana" }
// 3) generate
kie_generate {
  "model": "google/nano-banana",
  "input": { "prompt": "a corgi astronaut on the moon, studio lighting", "output_format": "png" }
}

Most image jobs finish in seconds; video/music can take a few minutes. If a job exceeds the wait budget, the tool returns a taskId you can poll with kie_get_task (or the matching *_get tool).


Tools

Core (works for every market model)

Tool Description
kie_list_models Search the catalog of image/video/music models.
kie_get_model_schema Get a model's input fields + example (bundled, or fresh from live docs).
kie_generate Submit a job to any model and wait for the output URL(s). Primary tool.
kie_create_task Submit a job and return the taskId immediately (no waiting).
kie_get_task Poll a job's status/result.

Text / chat

Tool Description
kie_chat Chat with GPT / Gemini / Claude text models.

Account & files

Tool Description
kie_get_credits Remaining credit balance.
kie_get_download_url Convert a kie.ai file URL into a direct download link.
kie_upload_file Host a remote URL or base64 file and get a public URL (for image/video inputs).

Dedicated model APIs (extra features beyond kie_generate)

Tool Description
kie_veo_generate / kie_veo_get / kie_veo_extend Google Veo 3.1 video (text/image‑to‑video, extend).
kie_veo_get_1080p / kie_veo_get_4k Fetch higher‑resolution Veo renders.
kie_runway_generate / kie_runway_get / kie_runway_extend Runway video generation & extension.
kie_runway_aleph_generate / kie_runway_aleph_get Runway Aleph video‑to‑video.
kie_suno_generate / kie_suno_get / kie_suno_extend Suno music generation & extension.
kie_suno_lyrics / kie_suno_lyrics_get Suno lyric generation.
kie_flux_kontext_generate / kie_flux_kontext_get Flux Kontext image generation & editing.
kie_4o_image_generate / kie_4o_image_get / kie_4o_image_download_url GPT‑4o image generation & editing.

Configuration (environment variables)

Variable Default Purpose
KIE_API_KEY (required) Your kie.ai API key.
KIE_BASE_URL https://api.kie.ai API base URL.
KIE_UPLOAD_BASE https://kieai.redpandaai.co File‑upload host.
KIE_TIMEOUT_MS 60000 Per‑request timeout.
KIE_POLL_TIMEOUT_MS 300000 Max time a *_generate tool waits for a job (5 min).
KIE_POLL_INTERVAL_MS 5000 Delay between polls.

See .env.example.


Notes

  • Async by design. Generation is a job: create → poll → result. The *_generate / kie_generate tools do this for you; raise waitSeconds for long video/music renders, or set wait: false to return immediately and poll later.
  • Credits. Each generation consumes kie.ai credits; check kie_get_credits.
  • File lifetimes. Generated URLs typically expire after ~24 hours (some sooner). Download what you need, or use kie_get_download_url.
  • Keep your key secret. It lives in your MCP client's environment, never in this repo. .env is git‑ignored.

Development

npm install        # install deps (also builds via prepare)
npm run build      # compile TypeScript -> dist/
npm run typecheck  # type-check only
npm run watch      # rebuild on change

Source layout:

src/
  index.ts          server bootstrap (stdio)
  config.ts         env config
  client.ts         HTTP client (auth, timeouts, {code,msg,data} envelope)
  poll.ts           generic async-job poller
  catalog.ts        catalog types + search/lookup helpers
  catalog-data.ts   generated catalog of market models (ids + input schemas)
  util.ts           result/error helpers
  tools/            one module per tool group (market, chat, veo, runway, suno, flux, image4o, account)

Regenerating the model catalog

src/catalog-data.ts is generated from the kie.ai docs index (https://docs.kie.ai/llms.txt) and each model's doc page. Re‑extract it when kie.ai adds models.


Disclaimer

This is an unofficial, community-built integration and is not affiliated with or endorsed by kie.ai. Model availability, parameters, and pricing are controlled by kie.ai and may change; see the official docs.

License

MIT © neomorrison

About

MCP server for kie.ai — give Claude access to 100+ AI models (Veo, Runway, Kling, Flux, Nano Banana, Suno, GPT, Gemini, Claude) via your kie.ai API key.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages