Labsco
MCP SERVER

Baidu iRAG MCP Server

by kuai0901

Generate images with Baidu's iRAG API from your client, saved locally or returned as base64.

Image Generation
Summary
Model choice lives in config, not in the call.

The README is explicit that `MODEL` is set in the environment and not passed per request, which means the advanced arguments — `steps`, `seed`, `guidance` — only do anything when the server was started on `flux.1-schnell`. Decide which model you want before you wire it in; switching means editing the config and restarting, not asking differently.

What it is

A Node server that exposes Baidu's iRAG image generation as a single tool. You describe the image, it calls Baidu, downloads the result and hands back base64 plus, if you want, a file on disk. Which model is used is a configuration decision rather than a per-call argument, so the client cannot switch models mid-conversation.

What you get
  • `generate_image` takes a `prompt` and returns the image
  • Optional `refer_image` to condition on a reference image URL
  • `n` generates 1 to 4 images per call; `size` accepts 512x512, 768x768, 1024x768 or 1024x1024
  • Two models chosen through the `MODEL` setting: `irag-1.0`, Baidu's own, and `flux.1-schnell`, which additionally accepts `steps`, `seed` and `guidance`
  • `RESOURCE_MODE=local` saves files to disk and returns base64 and the path; `RESOURCE_MODE=url` returns only the URL and base64
  • Automatic retries and logging, with the retry count set by `MAX_RETRIES` and the request timeout by `API_TIMEOUT`
Requirements

A Baidu API key from the Baidu Cloud console with Qianfan ModelBuilder selected, shaped `bce-v3/ALTAK-****/****`, passed as `BAIDU_API_KEY`. Node.js 18.0.0 or newer. Clone, `npm install`, `npm run build`, then point your client at `node` with `dist/index.js`. Package `irag-mcp-server`, version 1.0.0. `BASE_PATH` sets where images land in local mode; leave it empty and they go to a folder on your desktop.