@felores/kie-ai-mcp-server 1.7.2 → 1.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -1
- package/dist/index.js +181 -2
- package/dist/kie-ai-client.d.ts +2 -1
- package/dist/kie-ai-client.js +33 -1
- package/dist/types.d.ts +101 -1
- package/dist/types.js +51 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,6 +23,7 @@ Access the world's best AI models through a single, developer-friendly API. Gene
|
|
|
23
23
|
- **ElevenLabs**: Studio-quality text-to-speech and sound effects
|
|
24
24
|
- **ByteDance Seedance**: High-quality video with text-to-video and image-to-video
|
|
25
25
|
- **ByteDance Seedream V4**: Advanced image generation and editing with unified interface
|
|
26
|
+
- **Qwen**: Powerful image generation and editing with acceleration options
|
|
26
27
|
|
|
27
28
|
### 💰 **Affordable Pricing**
|
|
28
29
|
Pay-as-you-go credit system means you only pay for what you use. Good for startups and enterprises looking to reduce AI costs.
|
|
@@ -580,7 +581,79 @@ Multiple image editing:
|
|
|
580
581
|
|
|
581
582
|
**Note**: The `callBackUrl` is optional and will use the `KIE_AI_CALLBACK_URL` environment variable if not provided. Image generation typically takes 30-120 seconds depending on resolution and complexity.
|
|
582
583
|
|
|
583
|
-
### 14. `
|
|
584
|
+
### 14. `qwen_image`
|
|
585
|
+
Generate and edit images using Qwen models (unified tool for both text-to-image and image editing).
|
|
586
|
+
|
|
587
|
+
**Parameters:**
|
|
588
|
+
- `prompt` (string, required): Text prompt for image generation or editing
|
|
589
|
+
- `image_url` (string, optional): URL of image to edit (if not provided, uses text-to-image)
|
|
590
|
+
- `image_size` (string, optional): Image size (default: "square_hd")
|
|
591
|
+
- Options: `square`, `square_hd`, `portrait_4_3`, `portrait_16_9`, `landscape_4_3`, `landscape_16_9`
|
|
592
|
+
- `num_inference_steps` (integer, optional): Number of inference steps (default: 30 for text-to-image, 25 for edit)
|
|
593
|
+
- Text-to-image: 2-250, Edit: 2-49
|
|
594
|
+
- `guidance_scale` (number, optional): CFG scale (default: 2.5 for text-to-image, 4 for edit)
|
|
595
|
+
- Range: 0-20
|
|
596
|
+
- `enable_safety_checker` (boolean, optional): Enable safety checker (default: true)
|
|
597
|
+
- `output_format` (string, optional): Output format (default: "png")
|
|
598
|
+
- Options: `png`, `jpeg`
|
|
599
|
+
- `negative_prompt` (string, optional): Negative prompt (max 500 chars, default: " ")
|
|
600
|
+
- `acceleration` (string, optional): Acceleration level (default: "none")
|
|
601
|
+
- Options: `none`, `regular`, `high`
|
|
602
|
+
- `num_images` (string, optional): Number of images (edit mode only)
|
|
603
|
+
- Options: `1`, `2`, `3`, `4`
|
|
604
|
+
- `sync_mode` (boolean, optional): Sync mode (edit mode only, default: false)
|
|
605
|
+
- `seed` (number, optional): Random seed for reproducible results
|
|
606
|
+
- `callBackUrl` (string, optional): URL for task completion notifications
|
|
607
|
+
|
|
608
|
+
**Examples:**
|
|
609
|
+
|
|
610
|
+
Text-to-image generation:
|
|
611
|
+
```json
|
|
612
|
+
{
|
|
613
|
+
"prompt": "A beautiful landscape with mountains and a lake at sunset",
|
|
614
|
+
"image_size": "landscape_16_9",
|
|
615
|
+
"num_inference_steps": 30,
|
|
616
|
+
"guidance_scale": 2.5,
|
|
617
|
+
"output_format": "png",
|
|
618
|
+
"seed": 42
|
|
619
|
+
}
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
Image editing:
|
|
623
|
+
```json
|
|
624
|
+
{
|
|
625
|
+
"prompt": "Change the day scene to night with stars and moonlight",
|
|
626
|
+
"image_url": "https://example.com/day-landscape.jpg",
|
|
627
|
+
"image_size": "landscape_16_9",
|
|
628
|
+
"num_inference_steps": 25,
|
|
629
|
+
"guidance_scale": 4,
|
|
630
|
+
"num_images": "2",
|
|
631
|
+
"output_format": "png"
|
|
632
|
+
}
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
High-acceleration generation:
|
|
636
|
+
```json
|
|
637
|
+
{
|
|
638
|
+
"prompt": "A futuristic city with flying cars",
|
|
639
|
+
"image_size": "square_hd",
|
|
640
|
+
"acceleration": "high",
|
|
641
|
+
"enable_safety_checker": true,
|
|
642
|
+
"negative_prompt": "blurry, low quality"
|
|
643
|
+
}
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
**Key Features:**
|
|
647
|
+
- **Unified Interface**: Single tool for both text-to-image and image editing
|
|
648
|
+
- **Smart Mode Detection**: Automatically detects mode based on presence of `image_url`
|
|
649
|
+
- **Flexible Sizing**: Support for multiple aspect ratios and resolutions
|
|
650
|
+
- **Acceleration Options**: Speed up generation with acceleration levels
|
|
651
|
+
- **Batch Generation**: Generate multiple images in edit mode
|
|
652
|
+
- **Reproducible Results**: Seed control for consistent output
|
|
653
|
+
|
|
654
|
+
**Note**: The `callBackUrl` is optional and will use the `KIE_AI_CALLBACK_URL` environment variable if not provided. Image generation typically takes 10-60 seconds depending on settings and acceleration level.
|
|
655
|
+
|
|
656
|
+
### 15. `runway_aleph_video`
|
|
584
657
|
Transform videos using Runway Aleph video-to-video generation with AI-powered editing.
|
|
585
658
|
|
|
586
659
|
**Parameters:**
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { CallToolRequestSchema, ErrorCode, ListToolsRequestSchema, McpError, } f
|
|
|
5
5
|
import { KieAiClient } from './kie-ai-client.js';
|
|
6
6
|
import { TaskDatabase } from './database.js';
|
|
7
7
|
import { z } from 'zod';
|
|
8
|
-
import { NanoBananaGenerateSchema, NanoBananaEditSchema, NanoBananaUpscaleSchema, Veo3GenerateSchema, SunoGenerateSchema, ElevenLabsTTSSchema, ElevenLabsSoundEffectsSchema, ByteDanceSeedanceVideoSchema, ByteDanceSeedreamImageSchema, RunwayAlephVideoSchema, WanVideoSchema } from './types.js';
|
|
8
|
+
import { NanoBananaGenerateSchema, NanoBananaEditSchema, NanoBananaUpscaleSchema, Veo3GenerateSchema, SunoGenerateSchema, ElevenLabsTTSSchema, ElevenLabsSoundEffectsSchema, ByteDanceSeedanceVideoSchema, ByteDanceSeedreamImageSchema, QwenImageSchema, RunwayAlephVideoSchema, WanVideoSchema } from './types.js';
|
|
9
9
|
class KieAiMcpServer {
|
|
10
10
|
server;
|
|
11
11
|
client;
|
|
@@ -13,7 +13,7 @@ class KieAiMcpServer {
|
|
|
13
13
|
constructor() {
|
|
14
14
|
this.server = new Server({
|
|
15
15
|
name: 'kie-ai-mcp-server',
|
|
16
|
-
version: '1.7.
|
|
16
|
+
version: '1.7.3',
|
|
17
17
|
});
|
|
18
18
|
// Initialize client with config from environment
|
|
19
19
|
const config = {
|
|
@@ -606,6 +606,88 @@ class KieAiMcpServer {
|
|
|
606
606
|
required: ['prompt']
|
|
607
607
|
}
|
|
608
608
|
},
|
|
609
|
+
{
|
|
610
|
+
name: 'qwen_image',
|
|
611
|
+
description: 'Generate and edit images using Qwen models (unified tool for both text-to-image and image editing)',
|
|
612
|
+
inputSchema: {
|
|
613
|
+
type: 'object',
|
|
614
|
+
properties: {
|
|
615
|
+
prompt: {
|
|
616
|
+
type: 'string',
|
|
617
|
+
description: 'Text prompt for image generation or editing',
|
|
618
|
+
minLength: 1
|
|
619
|
+
},
|
|
620
|
+
image_url: {
|
|
621
|
+
type: 'string',
|
|
622
|
+
description: 'URL of image to edit (optional - if not provided, uses text-to-image)',
|
|
623
|
+
format: 'uri'
|
|
624
|
+
},
|
|
625
|
+
image_size: {
|
|
626
|
+
type: 'string',
|
|
627
|
+
description: 'Image size',
|
|
628
|
+
enum: ['square', 'square_hd', 'portrait_4_3', 'portrait_16_9', 'landscape_4_3', 'landscape_16_9'],
|
|
629
|
+
default: 'square_hd'
|
|
630
|
+
},
|
|
631
|
+
num_inference_steps: {
|
|
632
|
+
type: 'integer',
|
|
633
|
+
description: 'Number of inference steps (2-250 for text-to-image, 2-49 for edit)',
|
|
634
|
+
minimum: 2,
|
|
635
|
+
maximum: 250,
|
|
636
|
+
default: 30
|
|
637
|
+
},
|
|
638
|
+
guidance_scale: {
|
|
639
|
+
type: 'number',
|
|
640
|
+
description: 'CFG scale (0-20, default: 2.5 for text-to-image, 4 for edit)',
|
|
641
|
+
minimum: 0,
|
|
642
|
+
maximum: 20,
|
|
643
|
+
default: 2.5
|
|
644
|
+
},
|
|
645
|
+
enable_safety_checker: {
|
|
646
|
+
type: 'boolean',
|
|
647
|
+
description: 'Enable safety checker',
|
|
648
|
+
default: true
|
|
649
|
+
},
|
|
650
|
+
output_format: {
|
|
651
|
+
type: 'string',
|
|
652
|
+
description: 'Output format',
|
|
653
|
+
enum: ['png', 'jpeg'],
|
|
654
|
+
default: 'png'
|
|
655
|
+
},
|
|
656
|
+
negative_prompt: {
|
|
657
|
+
type: 'string',
|
|
658
|
+
description: 'Negative prompt (max 500 characters)',
|
|
659
|
+
maxLength: 500,
|
|
660
|
+
default: ' '
|
|
661
|
+
},
|
|
662
|
+
acceleration: {
|
|
663
|
+
type: 'string',
|
|
664
|
+
description: 'Acceleration level',
|
|
665
|
+
enum: ['none', 'regular', 'high'],
|
|
666
|
+
default: 'none'
|
|
667
|
+
},
|
|
668
|
+
num_images: {
|
|
669
|
+
type: 'string',
|
|
670
|
+
description: 'Number of images (1-4, edit mode only)',
|
|
671
|
+
enum: ['1', '2', '3', '4']
|
|
672
|
+
},
|
|
673
|
+
sync_mode: {
|
|
674
|
+
type: 'boolean',
|
|
675
|
+
description: 'Sync mode (edit mode only)',
|
|
676
|
+
default: false
|
|
677
|
+
},
|
|
678
|
+
seed: {
|
|
679
|
+
type: 'number',
|
|
680
|
+
description: 'Random seed for reproducible results'
|
|
681
|
+
},
|
|
682
|
+
callBackUrl: {
|
|
683
|
+
type: 'string',
|
|
684
|
+
description: 'Optional: URL for task completion notifications (uses KIE_AI_CALLBACK_URL env var if not provided)',
|
|
685
|
+
format: 'uri'
|
|
686
|
+
}
|
|
687
|
+
},
|
|
688
|
+
required: ['prompt']
|
|
689
|
+
}
|
|
690
|
+
},
|
|
609
691
|
{
|
|
610
692
|
name: 'runway_aleph_video',
|
|
611
693
|
description: 'Transform videos using Runway Aleph video-to-video generation with AI-powered editing',
|
|
@@ -750,6 +832,8 @@ class KieAiMcpServer {
|
|
|
750
832
|
return await this.handleByteDanceSeedanceVideo(args);
|
|
751
833
|
case 'bytedance_seedream_image':
|
|
752
834
|
return await this.handleByteDanceSeedreamImage(args);
|
|
835
|
+
case 'qwen_image':
|
|
836
|
+
return await this.handleQwenImage(args);
|
|
753
837
|
case 'runway_aleph_video':
|
|
754
838
|
return await this.handleRunwayAlephVideo(args);
|
|
755
839
|
case 'wan_video':
|
|
@@ -1515,6 +1599,101 @@ class KieAiMcpServer {
|
|
|
1515
1599
|
});
|
|
1516
1600
|
}
|
|
1517
1601
|
}
|
|
1602
|
+
async handleQwenImage(args) {
|
|
1603
|
+
try {
|
|
1604
|
+
const request = QwenImageSchema.parse(args);
|
|
1605
|
+
// Use environment variable as fallback if callBackUrl not provided
|
|
1606
|
+
if (!request.callBackUrl && process.env.KIE_AI_CALLBACK_URL) {
|
|
1607
|
+
request.callBackUrl = process.env.KIE_AI_CALLBACK_URL;
|
|
1608
|
+
}
|
|
1609
|
+
const response = await this.client.generateQwenImage(request);
|
|
1610
|
+
if (response.code === 200 && response.data?.taskId) {
|
|
1611
|
+
// Determine mode for user feedback
|
|
1612
|
+
const isEdit = !!request.image_url;
|
|
1613
|
+
const mode = isEdit ? 'Image Editing' : 'Text-to-Image';
|
|
1614
|
+
// Store task in database
|
|
1615
|
+
await this.db.createTask({
|
|
1616
|
+
task_id: response.data.taskId,
|
|
1617
|
+
api_type: 'qwen-image',
|
|
1618
|
+
status: 'pending'
|
|
1619
|
+
});
|
|
1620
|
+
return {
|
|
1621
|
+
content: [
|
|
1622
|
+
{
|
|
1623
|
+
type: 'text',
|
|
1624
|
+
text: JSON.stringify({
|
|
1625
|
+
success: true,
|
|
1626
|
+
task_id: response.data.taskId,
|
|
1627
|
+
message: `Qwen ${mode} task created successfully`,
|
|
1628
|
+
parameters: {
|
|
1629
|
+
mode: mode,
|
|
1630
|
+
prompt: request.prompt.substring(0, 100) + (request.prompt.length > 100 ? '...' : ''),
|
|
1631
|
+
image_size: request.image_size || 'square_hd',
|
|
1632
|
+
num_inference_steps: request.num_inference_steps || (isEdit ? 25 : 30),
|
|
1633
|
+
guidance_scale: request.guidance_scale || (isEdit ? 4 : 2.5),
|
|
1634
|
+
enable_safety_checker: request.enable_safety_checker !== false,
|
|
1635
|
+
output_format: request.output_format || 'png',
|
|
1636
|
+
negative_prompt: request.negative_prompt || (isEdit ? 'blurry, ugly' : ' '),
|
|
1637
|
+
acceleration: request.acceleration || 'none',
|
|
1638
|
+
seed: request.seed,
|
|
1639
|
+
...(isEdit && {
|
|
1640
|
+
image_url: request.image_url,
|
|
1641
|
+
num_images: request.num_images,
|
|
1642
|
+
sync_mode: request.sync_mode
|
|
1643
|
+
})
|
|
1644
|
+
},
|
|
1645
|
+
next_steps: [
|
|
1646
|
+
`Use get_task_status with task_id: ${response.data.taskId} to check progress`,
|
|
1647
|
+
'Generated images will be available when status is "completed"'
|
|
1648
|
+
],
|
|
1649
|
+
usage_examples: [
|
|
1650
|
+
`get_task_status: {"task_id": "${response.data.taskId}"}`,
|
|
1651
|
+
`list_tasks: {"limit": 10}`
|
|
1652
|
+
]
|
|
1653
|
+
}, null, 2)
|
|
1654
|
+
}
|
|
1655
|
+
]
|
|
1656
|
+
};
|
|
1657
|
+
}
|
|
1658
|
+
else {
|
|
1659
|
+
throw new Error(response.msg || 'Failed to create Qwen image task');
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
catch (error) {
|
|
1663
|
+
if (error instanceof z.ZodError) {
|
|
1664
|
+
return this.formatError('qwen_image', error, {
|
|
1665
|
+
prompt: 'Required: Text prompt for image generation or editing',
|
|
1666
|
+
image_url: 'Optional: URL of image to edit (required for edit mode)',
|
|
1667
|
+
image_size: 'Optional: Image size (square, square_hd, portrait_4_3, portrait_16_9, landscape_4_3, landscape_16_9)',
|
|
1668
|
+
num_inference_steps: 'Optional: Number of inference steps (2-250 for text-to-image, 2-49 for edit)',
|
|
1669
|
+
guidance_scale: 'Optional: CFG scale (0-20, default: 2.5 for text-to-image, 4 for edit)',
|
|
1670
|
+
enable_safety_checker: 'Optional: Enable safety checker (default: true)',
|
|
1671
|
+
output_format: 'Optional: Output format (png/jpeg, default: png)',
|
|
1672
|
+
negative_prompt: 'Optional: Negative prompt (max 500 chars)',
|
|
1673
|
+
acceleration: 'Optional: Acceleration level (none/regular/high, default: none)',
|
|
1674
|
+
num_images: 'Optional: Number of images (1-4, edit mode only)',
|
|
1675
|
+
sync_mode: 'Optional: Sync mode (edit mode only)',
|
|
1676
|
+
seed: 'Optional: Random seed for reproducible results',
|
|
1677
|
+
callBackUrl: 'Optional: URL for task completion notifications (uses KIE_AI_CALLBACK_URL env var if not provided)'
|
|
1678
|
+
});
|
|
1679
|
+
}
|
|
1680
|
+
return this.formatError('qwen_image', error, {
|
|
1681
|
+
prompt: 'Required: Text prompt for image generation or editing',
|
|
1682
|
+
image_url: 'Optional: URL of image to edit (required for edit mode)',
|
|
1683
|
+
image_size: 'Optional: Image size (square, square_hd, portrait_4_3, portrait_16_9, landscape_4_3, landscape_16_9)',
|
|
1684
|
+
num_inference_steps: 'Optional: Number of inference steps (2-250 for text-to-image, 2-49 for edit)',
|
|
1685
|
+
guidance_scale: 'Optional: CFG scale (0-20, default: 2.5 for text-to-image, 4 for edit)',
|
|
1686
|
+
enable_safety_checker: 'Optional: Enable safety checker (default: true)',
|
|
1687
|
+
output_format: 'Optional: Output format (png/jpeg, default: png)',
|
|
1688
|
+
negative_prompt: 'Optional: Negative prompt (max 500 chars)',
|
|
1689
|
+
acceleration: 'Optional: Acceleration level (none/regular/high, default: none)',
|
|
1690
|
+
num_images: 'Optional: Number of images (1-4, edit mode only)',
|
|
1691
|
+
sync_mode: 'Optional: Sync mode (edit mode only)',
|
|
1692
|
+
seed: 'Optional: Random seed for reproducible results',
|
|
1693
|
+
callBackUrl: 'Optional: URL for task completion notifications (uses KIE_AI_CALLBACK_URL env var if not provided)'
|
|
1694
|
+
});
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1518
1697
|
async handleRunwayAlephVideo(args) {
|
|
1519
1698
|
try {
|
|
1520
1699
|
const request = RunwayAlephVideoSchema.parse(args);
|
package/dist/kie-ai-client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { KieAiConfig, KieAiResponse, NanoBananaGenerateRequest, NanaBananaEditRequest, NanoBananaUpscaleRequest, Veo3GenerateRequest, SunoGenerateRequest, ElevenLabsTTSRequest, ElevenLabsSoundEffectsRequest, ByteDanceSeedanceVideoRequest, RunwayAlephVideoRequest, WanVideoRequest, ByteDanceSeedreamImageRequest, ImageResponse, TaskResponse } from './types.js';
|
|
1
|
+
import { KieAiConfig, KieAiResponse, NanoBananaGenerateRequest, NanaBananaEditRequest, NanoBananaUpscaleRequest, Veo3GenerateRequest, SunoGenerateRequest, ElevenLabsTTSRequest, ElevenLabsSoundEffectsRequest, ByteDanceSeedanceVideoRequest, RunwayAlephVideoRequest, WanVideoRequest, ByteDanceSeedreamImageRequest, QwenImageRequest, ImageResponse, TaskResponse } from './types.js';
|
|
2
2
|
export declare class KieAiClient {
|
|
3
3
|
private config;
|
|
4
4
|
constructor(config: KieAiConfig);
|
|
@@ -15,5 +15,6 @@ export declare class KieAiClient {
|
|
|
15
15
|
generateRunwayAlephVideo(request: RunwayAlephVideoRequest): Promise<KieAiResponse<TaskResponse>>;
|
|
16
16
|
generateWanVideo(request: WanVideoRequest): Promise<KieAiResponse<TaskResponse>>;
|
|
17
17
|
generateByteDanceSeedreamImage(request: ByteDanceSeedreamImageRequest): Promise<KieAiResponse<TaskResponse>>;
|
|
18
|
+
generateQwenImage(request: QwenImageRequest): Promise<KieAiResponse<TaskResponse>>;
|
|
18
19
|
getVeo1080pVideo(taskId: string, index?: number): Promise<KieAiResponse<any>>;
|
|
19
20
|
}
|
package/dist/kie-ai-client.js
CHANGED
|
@@ -80,7 +80,7 @@ export class KieAiClient {
|
|
|
80
80
|
else if (apiType === 'suno') {
|
|
81
81
|
return this.makeRequest(`/generate/record-info?taskId=${taskId}`, 'GET');
|
|
82
82
|
}
|
|
83
|
-
else if (apiType === 'elevenlabs-tts' || apiType === 'elevenlabs-sound-effects' || apiType === 'bytedance-seedance-video' || apiType === 'bytedance-seedream-image' || apiType === 'wan-video') {
|
|
83
|
+
else if (apiType === 'elevenlabs-tts' || apiType === 'elevenlabs-sound-effects' || apiType === 'bytedance-seedance-video' || apiType === 'bytedance-seedream-image' || apiType === 'qwen-image' || apiType === 'wan-video') {
|
|
84
84
|
return this.makeRequest(`/jobs/recordInfo?taskId=${taskId}`, 'GET');
|
|
85
85
|
}
|
|
86
86
|
else if (apiType === 'runway-aleph-video') {
|
|
@@ -254,6 +254,38 @@ export class KieAiClient {
|
|
|
254
254
|
};
|
|
255
255
|
return this.makeRequest('/jobs/createTask', 'POST', jobRequest);
|
|
256
256
|
}
|
|
257
|
+
async generateQwenImage(request) {
|
|
258
|
+
// Determine mode based on presence of image_url
|
|
259
|
+
const isEdit = !!request.image_url;
|
|
260
|
+
const model = isEdit ? 'qwen/image-edit' : 'qwen/text-to-image';
|
|
261
|
+
const input = {
|
|
262
|
+
prompt: request.prompt,
|
|
263
|
+
image_size: request.image_size || 'square_hd',
|
|
264
|
+
num_inference_steps: request.num_inference_steps || (isEdit ? 25 : 30),
|
|
265
|
+
seed: request.seed,
|
|
266
|
+
guidance_scale: request.guidance_scale || (isEdit ? 4 : 2.5),
|
|
267
|
+
enable_safety_checker: request.enable_safety_checker !== false,
|
|
268
|
+
output_format: request.output_format || 'png',
|
|
269
|
+
negative_prompt: request.negative_prompt || (isEdit ? 'blurry, ugly' : ' '),
|
|
270
|
+
acceleration: request.acceleration || 'none'
|
|
271
|
+
};
|
|
272
|
+
// Add edit-specific parameters
|
|
273
|
+
if (isEdit) {
|
|
274
|
+
input.image_url = request.image_url;
|
|
275
|
+
if (request.num_images) {
|
|
276
|
+
input.num_images = request.num_images;
|
|
277
|
+
}
|
|
278
|
+
if (request.sync_mode !== undefined) {
|
|
279
|
+
input.sync_mode = request.sync_mode;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
const jobRequest = {
|
|
283
|
+
model,
|
|
284
|
+
input,
|
|
285
|
+
callBackUrl: request.callBackUrl || process.env.KIE_AI_CALLBACK_URL
|
|
286
|
+
};
|
|
287
|
+
return this.makeRequest('/jobs/createTask', 'POST', jobRequest);
|
|
288
|
+
}
|
|
257
289
|
async getVeo1080pVideo(taskId, index) {
|
|
258
290
|
const params = new URLSearchParams({ taskId });
|
|
259
291
|
if (index !== undefined) {
|
package/dist/types.d.ts
CHANGED
|
@@ -443,6 +443,105 @@ export declare const ByteDanceSeedreamImageSchema: z.ZodEffects<z.ZodObject<{
|
|
|
443
443
|
image_resolution?: "1K" | "2K" | "4K" | undefined;
|
|
444
444
|
max_images?: number | undefined;
|
|
445
445
|
}>;
|
|
446
|
+
export declare const QwenImageSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
447
|
+
prompt: z.ZodString;
|
|
448
|
+
image_url: z.ZodOptional<z.ZodString>;
|
|
449
|
+
image_size: z.ZodOptional<z.ZodDefault<z.ZodEnum<["square", "square_hd", "portrait_4_3", "portrait_16_9", "landscape_4_3", "landscape_16_9"]>>>;
|
|
450
|
+
num_inference_steps: z.ZodOptional<z.ZodNumber>;
|
|
451
|
+
seed: z.ZodOptional<z.ZodNumber>;
|
|
452
|
+
guidance_scale: z.ZodOptional<z.ZodNumber>;
|
|
453
|
+
enable_safety_checker: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
454
|
+
output_format: z.ZodOptional<z.ZodDefault<z.ZodEnum<["png", "jpeg"]>>>;
|
|
455
|
+
negative_prompt: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
456
|
+
acceleration: z.ZodOptional<z.ZodDefault<z.ZodEnum<["none", "regular", "high"]>>>;
|
|
457
|
+
num_images: z.ZodOptional<z.ZodEnum<["1", "2", "3", "4"]>>;
|
|
458
|
+
sync_mode: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
459
|
+
callBackUrl: z.ZodOptional<z.ZodString>;
|
|
460
|
+
}, "strip", z.ZodTypeAny, {
|
|
461
|
+
prompt: string;
|
|
462
|
+
output_format?: "png" | "jpeg" | undefined;
|
|
463
|
+
image_size?: "square" | "square_hd" | "portrait_4_3" | "portrait_16_9" | "landscape_4_3" | "landscape_16_9" | undefined;
|
|
464
|
+
callBackUrl?: string | undefined;
|
|
465
|
+
image_url?: string | undefined;
|
|
466
|
+
seed?: number | undefined;
|
|
467
|
+
enable_safety_checker?: boolean | undefined;
|
|
468
|
+
negative_prompt?: string | undefined;
|
|
469
|
+
num_inference_steps?: number | undefined;
|
|
470
|
+
guidance_scale?: number | undefined;
|
|
471
|
+
acceleration?: "none" | "regular" | "high" | undefined;
|
|
472
|
+
num_images?: "1" | "2" | "3" | "4" | undefined;
|
|
473
|
+
sync_mode?: boolean | undefined;
|
|
474
|
+
}, {
|
|
475
|
+
prompt: string;
|
|
476
|
+
output_format?: "png" | "jpeg" | undefined;
|
|
477
|
+
image_size?: "square" | "square_hd" | "portrait_4_3" | "portrait_16_9" | "landscape_4_3" | "landscape_16_9" | undefined;
|
|
478
|
+
callBackUrl?: string | undefined;
|
|
479
|
+
image_url?: string | undefined;
|
|
480
|
+
seed?: number | undefined;
|
|
481
|
+
enable_safety_checker?: boolean | undefined;
|
|
482
|
+
negative_prompt?: string | undefined;
|
|
483
|
+
num_inference_steps?: number | undefined;
|
|
484
|
+
guidance_scale?: number | undefined;
|
|
485
|
+
acceleration?: "none" | "regular" | "high" | undefined;
|
|
486
|
+
num_images?: "1" | "2" | "3" | "4" | undefined;
|
|
487
|
+
sync_mode?: boolean | undefined;
|
|
488
|
+
}>, {
|
|
489
|
+
prompt: string;
|
|
490
|
+
output_format?: "png" | "jpeg" | undefined;
|
|
491
|
+
image_size?: "square" | "square_hd" | "portrait_4_3" | "portrait_16_9" | "landscape_4_3" | "landscape_16_9" | undefined;
|
|
492
|
+
callBackUrl?: string | undefined;
|
|
493
|
+
image_url?: string | undefined;
|
|
494
|
+
seed?: number | undefined;
|
|
495
|
+
enable_safety_checker?: boolean | undefined;
|
|
496
|
+
negative_prompt?: string | undefined;
|
|
497
|
+
num_inference_steps?: number | undefined;
|
|
498
|
+
guidance_scale?: number | undefined;
|
|
499
|
+
acceleration?: "none" | "regular" | "high" | undefined;
|
|
500
|
+
num_images?: "1" | "2" | "3" | "4" | undefined;
|
|
501
|
+
sync_mode?: boolean | undefined;
|
|
502
|
+
}, {
|
|
503
|
+
prompt: string;
|
|
504
|
+
output_format?: "png" | "jpeg" | undefined;
|
|
505
|
+
image_size?: "square" | "square_hd" | "portrait_4_3" | "portrait_16_9" | "landscape_4_3" | "landscape_16_9" | undefined;
|
|
506
|
+
callBackUrl?: string | undefined;
|
|
507
|
+
image_url?: string | undefined;
|
|
508
|
+
seed?: number | undefined;
|
|
509
|
+
enable_safety_checker?: boolean | undefined;
|
|
510
|
+
negative_prompt?: string | undefined;
|
|
511
|
+
num_inference_steps?: number | undefined;
|
|
512
|
+
guidance_scale?: number | undefined;
|
|
513
|
+
acceleration?: "none" | "regular" | "high" | undefined;
|
|
514
|
+
num_images?: "1" | "2" | "3" | "4" | undefined;
|
|
515
|
+
sync_mode?: boolean | undefined;
|
|
516
|
+
}>, {
|
|
517
|
+
prompt: string;
|
|
518
|
+
output_format?: "png" | "jpeg" | undefined;
|
|
519
|
+
image_size?: "square" | "square_hd" | "portrait_4_3" | "portrait_16_9" | "landscape_4_3" | "landscape_16_9" | undefined;
|
|
520
|
+
callBackUrl?: string | undefined;
|
|
521
|
+
image_url?: string | undefined;
|
|
522
|
+
seed?: number | undefined;
|
|
523
|
+
enable_safety_checker?: boolean | undefined;
|
|
524
|
+
negative_prompt?: string | undefined;
|
|
525
|
+
num_inference_steps?: number | undefined;
|
|
526
|
+
guidance_scale?: number | undefined;
|
|
527
|
+
acceleration?: "none" | "regular" | "high" | undefined;
|
|
528
|
+
num_images?: "1" | "2" | "3" | "4" | undefined;
|
|
529
|
+
sync_mode?: boolean | undefined;
|
|
530
|
+
}, {
|
|
531
|
+
prompt: string;
|
|
532
|
+
output_format?: "png" | "jpeg" | undefined;
|
|
533
|
+
image_size?: "square" | "square_hd" | "portrait_4_3" | "portrait_16_9" | "landscape_4_3" | "landscape_16_9" | undefined;
|
|
534
|
+
callBackUrl?: string | undefined;
|
|
535
|
+
image_url?: string | undefined;
|
|
536
|
+
seed?: number | undefined;
|
|
537
|
+
enable_safety_checker?: boolean | undefined;
|
|
538
|
+
negative_prompt?: string | undefined;
|
|
539
|
+
num_inference_steps?: number | undefined;
|
|
540
|
+
guidance_scale?: number | undefined;
|
|
541
|
+
acceleration?: "none" | "regular" | "high" | undefined;
|
|
542
|
+
num_images?: "1" | "2" | "3" | "4" | undefined;
|
|
543
|
+
sync_mode?: boolean | undefined;
|
|
544
|
+
}>;
|
|
446
545
|
export type NanoBananaGenerateRequest = z.infer<typeof NanoBananaGenerateSchema>;
|
|
447
546
|
export type NanaBananaEditRequest = z.infer<typeof NanoBananaEditSchema>;
|
|
448
547
|
export type NanoBananaUpscaleRequest = z.infer<typeof NanoBananaUpscaleSchema>;
|
|
@@ -454,6 +553,7 @@ export type ByteDanceSeedanceVideoRequest = z.infer<typeof ByteDanceSeedanceVide
|
|
|
454
553
|
export type RunwayAlephVideoRequest = z.infer<typeof RunwayAlephVideoSchema>;
|
|
455
554
|
export type WanVideoRequest = z.infer<typeof WanVideoSchema>;
|
|
456
555
|
export type ByteDanceSeedreamImageRequest = z.infer<typeof ByteDanceSeedreamImageSchema>;
|
|
556
|
+
export type QwenImageRequest = z.infer<typeof QwenImageSchema>;
|
|
457
557
|
export interface KieAiResponse<T = any> {
|
|
458
558
|
code: number;
|
|
459
559
|
msg: string;
|
|
@@ -469,7 +569,7 @@ export interface TaskResponse {
|
|
|
469
569
|
export interface TaskRecord {
|
|
470
570
|
id?: number;
|
|
471
571
|
task_id: string;
|
|
472
|
-
api_type: 'nano-banana' | 'nano-banana-edit' | 'nano-banana-upscale' | 'veo3' | 'suno' | 'elevenlabs-tts' | 'elevenlabs-sound-effects' | 'bytedance-seedance-video' | 'runway-aleph-video' | 'wan-video' | 'bytedance-seedream-image';
|
|
572
|
+
api_type: 'nano-banana' | 'nano-banana-edit' | 'nano-banana-upscale' | 'veo3' | 'suno' | 'elevenlabs-tts' | 'elevenlabs-sound-effects' | 'bytedance-seedance-video' | 'runway-aleph-video' | 'wan-video' | 'bytedance-seedream-image' | 'qwen-image';
|
|
473
573
|
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
474
574
|
created_at: string;
|
|
475
575
|
updated_at: string;
|
package/dist/types.js
CHANGED
|
@@ -202,3 +202,54 @@ export const ByteDanceSeedreamImageSchema = z.object({
|
|
|
202
202
|
message: "callBackUrl is required (either directly or via KIE_AI_CALLBACK_URL environment variable)",
|
|
203
203
|
path: ["callBackUrl"]
|
|
204
204
|
});
|
|
205
|
+
export const QwenImageSchema = z.object({
|
|
206
|
+
prompt: z.string().min(1),
|
|
207
|
+
image_url: z.string().url().optional(), // Required for edit mode, optional for text-to-image
|
|
208
|
+
image_size: z.enum([
|
|
209
|
+
'square', 'square_hd', 'portrait_4_3', 'portrait_16_9',
|
|
210
|
+
'landscape_4_3', 'landscape_16_9'
|
|
211
|
+
]).default('square_hd').optional(),
|
|
212
|
+
num_inference_steps: z.number().int().min(2).max(250).optional(),
|
|
213
|
+
seed: z.number().optional(),
|
|
214
|
+
guidance_scale: z.number().min(0).max(20).optional(),
|
|
215
|
+
enable_safety_checker: z.boolean().default(true).optional(),
|
|
216
|
+
output_format: z.enum(['png', 'jpeg']).default('png').optional(),
|
|
217
|
+
negative_prompt: z.string().max(500).default(' ').optional(),
|
|
218
|
+
acceleration: z.enum(['none', 'regular', 'high']).default('none').optional(),
|
|
219
|
+
// Edit-specific parameters
|
|
220
|
+
num_images: z.enum(['1', '2', '3', '4']).optional(),
|
|
221
|
+
sync_mode: z.boolean().default(false).optional(),
|
|
222
|
+
callBackUrl: z.string().url().optional()
|
|
223
|
+
}).refine((data) => {
|
|
224
|
+
// Check if callBackUrl is provided directly or via environment variable
|
|
225
|
+
const hasCallBackUrl = data.callBackUrl || process.env.KIE_AI_CALLBACK_URL;
|
|
226
|
+
if (!hasCallBackUrl) {
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
return true;
|
|
230
|
+
}, {
|
|
231
|
+
message: "callBackUrl is required (either directly or via KIE_AI_CALLBACK_URL environment variable)",
|
|
232
|
+
path: ["callBackUrl"]
|
|
233
|
+
}).refine((data) => {
|
|
234
|
+
// Validate edit mode requirements
|
|
235
|
+
const isEditMode = !!data.image_url;
|
|
236
|
+
if (isEditMode) {
|
|
237
|
+
// Edit mode specific validations
|
|
238
|
+
if (data.num_inference_steps && (data.num_inference_steps < 2 || data.num_inference_steps > 49)) {
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
if (data.prompt && data.prompt.length > 2000) {
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
// Text-to-image mode specific validations
|
|
247
|
+
if (data.prompt && data.prompt.length > 5000) {
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return true;
|
|
252
|
+
}, {
|
|
253
|
+
message: "Invalid parameters for detected mode",
|
|
254
|
+
path: []
|
|
255
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@felores/kie-ai-mcp-server",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.3",
|
|
4
4
|
"description": "MCP server for Kie.ai APIs (Nano Banana image generation/editing, ByteDance Seedream V4 image generation/editing, Veo3 video generation, Suno music generation, and ElevenLabs text-to-speech)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|