- Home
- MCP servers
- Baidu iRAG
Baidu iRAG
- typescript
0
GitHub Stars
typescript
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"kuai0901-irag-mcp-server": {
"command": "node",
"args": [
"/path/to/irag-mcp-server/dist/index.js"
],
"env": {
"MODEL": "irag-1.0",
"LOG_FILE": "logs/server.log",
"BASE_PATH": "<BASE_PATH>",
"LOG_LEVEL": "info",
"API_TIMEOUT": "30000",
"MAX_RETRIES": "3",
"SERVER_NAME": "irag-mcp-server",
"BAIDU_API_KEY": "bce-v3/ALTAK-your-access-key/your-secret-key",
"RESOURCE_MODE": "local",
"SERVER_VERSION": "1.0.0"
}
}
}
}You have a dedicated MCP server that lets MCP clients call Baidu iRAG image generation through a standardized interface. It supports multiple models, flexible image sizes, automatic retries, and thorough validation to help you build reliable image generation workflows with clients like Claude Desktop.
How to use
Start the MCP server locally and connect your MCP client to it. You will deploy the server, configure your API key, and then issue image-generation requests from your client. The server handles model selection, parameter validation, image generation, and returns results in a structured format along with useful metadata.
How to install
Prerequisites: ensure Node.js is installed (version 18.0.0 or newer) and you have either npm or yarn available.
Clone the project and install dependencies.
git clone <repository-url>
cd irag-mcp-server
npm install
Build the project and prepare to run.
npm run build
Then start in development or production mode depending on your environment.
## Configuration
API key and runtime behavior are configured through environment variables and options inside the configuration templates.
Environment variables you will configure in the .env file include the Baidu API key and several optional controls for how images are saved and which model is used.
Sample environment setup you can adapt directly in your .env file:
必需配置
BAIDU_API_KEY=bce-v3/ALTAK-your-access-key/your-secret-key
图片资源配置
RESOURCE_MODE=local # local: 保存到本地文件 | url: 仅返回URL和base64 BASE_PATH= # 自定义保存路径(可选,默认为桌面/irag-images) MODEL=irag-1.0 # 默认模型: irag-1.0 | flux.1-schnell
可选配置
SERVER_NAME=irag-mcp-server SERVER_VERSION=1.0.0 LOG_LEVEL=info LOG_FILE=logs/server.log API_TIMEOUT=30000 MAX_RETRIES=3
配置说明:
- RESOURCE_MODE controls whether images are saved locally or only returned as URLs.
- BASE_PATH sets where local images are saved.
- MODEL selects the default image generation model (irag-1.0 or flux.1-schnell).
Claude Desktop MCP client configuration
To connect Claude Desktop to your MCP server, add a server entry that points to your local or remote MCP, and provide the necessary environment variable for authentication.
{
"mcpServers": {
"irag-image-generator": {
"command": "node",
"args": ["/path/to/irag-mcp-server/dist/index.js"],
"env": {
"BAIDU_API_KEY": "bce-v3/ALTAK-your-access-key/your-secret-key"
}
}
}
}
API reference: generate_image tool
The MCP tool generate_image lets you create images using Baidu iRAG models with a configurable set of parameters. The server validates inputs and routes them to the selected model.
Supported image sizes include 512x512, 768x768, 1024x768, and 1024x1024. You can adjust the prompt, number of images, and additional parameters depending on the model.
Development and tests
You should run tests and maintain code quality while developing. The project uses typical Node.js tooling for build, test, lint, and clean tasks.
npm run dev
npm start
npm test
npm run test:watch
npm run lint
npm run lint:fix
npm run clean
Troubleshooting
If you encounter API key issues, verify the format of your BAIDU_API_KEY and ensure it is configured as shown in the environment. If you experience timeouts, increase API_TIMEOUT and confirm network connectivity. For image generation failures, check prompts and model configuration. If Base64 data cannot be validated, the server will report the URL and error details so you can diagnose network or resource access problems.
Available tools
generate_image
MCP tool to generate images using Baidu iRAG models with configurable parameters and validation.