@mindstone/mcp-server-runway 0.3.2 → 0.4.1
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 +45 -2
- package/dist/client.js +1 -2
- package/dist/server.js +2 -1
- package/dist/tools/audio.js +33 -9
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.js +1 -0
- package/dist/tools/upscale.d.ts +3 -0
- package/dist/tools/upscale.js +46 -0
- package/dist/tools/video.js +22 -14
- package/dist/tools/voices.js +29 -6
- package/dist/untrusted-content.d.ts +33 -0
- package/dist/untrusted-content.js +66 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,11 +5,53 @@
|
|
|
5
5
|
|
|
6
6
|
Runway ML MCP server for Model Context Protocol hosts. Generate AI video, images, audio, speech, sound effects, and manage custom voices — all through a standardised MCP interface powered by Runway's generative AI models.
|
|
7
7
|
|
|
8
|
+
## Status
|
|
9
|
+
|
|
10
|
+
- **Version:** [0.4.1](./CHANGELOG.md) · [npm](https://www.npmjs.com/package/@mindstone/mcp-server-runway)
|
|
11
|
+
- **Auth:** API key ([`RUNWAYML_API_SECRET`](./server.json))
|
|
12
|
+
- **Tools:** [23](./src/tools/) (video, image, audio, voices, tasks)
|
|
13
|
+
- **Surface:** cloud-api
|
|
14
|
+
- **Machine-readable:** [`STATUS.json`](./STATUS.json)
|
|
15
|
+
|
|
8
16
|
## Requirements
|
|
9
17
|
|
|
10
18
|
- Node.js 20+
|
|
11
19
|
- npm
|
|
12
20
|
|
|
21
|
+
<!-- BEGIN INSTALL_LINKS: do not edit by hand; regenerated by scripts/gen-install-links.mjs -->
|
|
22
|
+
## One-click install
|
|
23
|
+
|
|
24
|
+
[](cursor://anysphere.cursor-deeplink/mcp/install?name=Runway%20ML&config=eyJ0eXBlIjoic3RkaW8iLCJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBtaW5kc3RvbmUvbWNwLXNlcnZlci1ydW53YXkiXSwiZW52Ijp7IlJVTldBWU1MX0FQSV9TRUNSRVQiOiIiLCJSVU5XQVlfUkVRVUVTVF9USU1FT1VUX01TIjoiNjAwMDAiLCJSVU5XQVlfVVBMT0FEX1RJTUVPVVRfTVMiOiI2MDAwMDAifX0)
|
|
25
|
+
[](vscode:mcp/install?%7B%22name%22%3A%22Runway%20ML%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40mindstone%2Fmcp-server-runway%22%5D%2C%22env%22%3A%7B%22RUNWAYML_API_SECRET%22%3A%22%22%2C%22RUNWAY_REQUEST_TIMEOUT_MS%22%3A%2260000%22%2C%22RUNWAY_UPLOAD_TIMEOUT_MS%22%3A%22600000%22%7D%7D)
|
|
26
|
+
[](vscode-insiders:mcp/install?%7B%22name%22%3A%22Runway%20ML%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40mindstone%2Fmcp-server-runway%22%5D%2C%22env%22%3A%7B%22RUNWAYML_API_SECRET%22%3A%22%22%2C%22RUNWAY_REQUEST_TIMEOUT_MS%22%3A%2260000%22%2C%22RUNWAY_UPLOAD_TIMEOUT_MS%22%3A%22600000%22%7D%7D)
|
|
27
|
+
|
|
28
|
+
After clicking the button, your host will prompt you to fill: `RUNWAYML_API_SECRET`, `RUNWAY_REQUEST_TIMEOUT_MS`, `RUNWAY_UPLOAD_TIMEOUT_MS`.
|
|
29
|
+
|
|
30
|
+
<details>
|
|
31
|
+
<summary>Manual config for Claude Desktop / Claude Code / Goose / Continue.dev (Runway ML)</summary>
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"mcpServers": {
|
|
36
|
+
"Runway ML": {
|
|
37
|
+
"command": "npx",
|
|
38
|
+
"args": [
|
|
39
|
+
"-y",
|
|
40
|
+
"@mindstone/mcp-server-runway"
|
|
41
|
+
],
|
|
42
|
+
"env": {
|
|
43
|
+
"RUNWAYML_API_SECRET": "",
|
|
44
|
+
"RUNWAY_REQUEST_TIMEOUT_MS": "60000",
|
|
45
|
+
"RUNWAY_UPLOAD_TIMEOUT_MS": "600000"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
</details>
|
|
53
|
+
<!-- END INSTALL_LINKS -->
|
|
54
|
+
|
|
13
55
|
## Quick Start
|
|
14
56
|
|
|
15
57
|
### Install & build
|
|
@@ -76,7 +118,7 @@ node dist/index.js
|
|
|
76
118
|
}
|
|
77
119
|
```
|
|
78
120
|
|
|
79
|
-
## Tools (
|
|
121
|
+
## Tools (23)
|
|
80
122
|
|
|
81
123
|
### Configuration
|
|
82
124
|
- `configure_runway_api_key` — Save your Runway API key
|
|
@@ -84,8 +126,9 @@ node dist/index.js
|
|
|
84
126
|
### Video
|
|
85
127
|
- `generate_video_from_image` — Animate a still image into a video
|
|
86
128
|
- `generate_video_from_text` — Create a video from a text description
|
|
87
|
-
- `generate_video_from_video` — Re-style or transform an existing video
|
|
129
|
+
- `generate_video_from_video` — Re-style or transform an existing video (Aleph 2.0)
|
|
88
130
|
- `character_performance` — Animate a character with facial expressions and body movements (Act-Two)
|
|
131
|
+
- `upscale_video` — Upscale a video up to 4K (Magnific Video Upscaler)
|
|
89
132
|
|
|
90
133
|
### Image
|
|
91
134
|
- `generate_image` — Generate an image from text, optionally with reference images
|
package/dist/client.js
CHANGED
package/dist/server.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
2
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
-
import { registerConfigureTools, registerVideoTools, registerImageTools, registerAudioTools, registerVoiceTools, registerTaskTools, registerAccountTools, } from './tools/index.js';
|
|
3
|
+
import { registerConfigureTools, registerVideoTools, registerImageTools, registerAudioTools, registerVoiceTools, registerTaskTools, registerAccountTools, registerUpscaleTools, } from './tools/index.js';
|
|
4
4
|
const require = createRequire(import.meta.url);
|
|
5
5
|
const pkg = require('../package.json');
|
|
6
6
|
export function createServer() {
|
|
@@ -15,6 +15,7 @@ export function createServer() {
|
|
|
15
15
|
registerVoiceTools(server);
|
|
16
16
|
registerTaskTools(server);
|
|
17
17
|
registerAccountTools(server);
|
|
18
|
+
registerUpscaleTools(server);
|
|
18
19
|
return server;
|
|
19
20
|
}
|
|
20
21
|
//# sourceMappingURL=server.js.map
|
package/dist/tools/audio.js
CHANGED
|
@@ -1,26 +1,50 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { runwayFetch, resolveMediaInput } from '../client.js';
|
|
3
|
-
import { VOICE_PRESETS, DUBBING_LANGUAGES } from '../types.js';
|
|
3
|
+
import { RunwayError, VOICE_PRESETS, DUBBING_LANGUAGES } from '../types.js';
|
|
4
4
|
import { withErrorHandling } from '../utils.js';
|
|
5
|
+
// Custom voice IDs are UUIDs (as returned by create_custom_voice /
|
|
6
|
+
// list_custom_voices); the voice field accepts exactly a known preset name or
|
|
7
|
+
// a UUID — anything else must fail input validation rather than be guessed
|
|
8
|
+
// from string shape.
|
|
9
|
+
const voiceSchema = z.union([z.enum(VOICE_PRESETS), z.string().uuid()]);
|
|
10
|
+
const customVoiceIdSchema = z.string().uuid();
|
|
11
|
+
// Documented promptText ceiling for the speech models; the tighter
|
|
12
|
+
// model-dependent limits are enforced in the generate_speech handler.
|
|
13
|
+
const SPEECH_TEXT_MAX_CHARS = 5000;
|
|
5
14
|
export function registerAudioTools(server) {
|
|
6
15
|
// ── Text-to-Speech ────────────────────────────────────────────────────
|
|
7
16
|
server.registerTool('generate_speech', {
|
|
8
17
|
description: 'Generate spoken audio from text using ElevenLabs voices via Runway. ' +
|
|
9
|
-
'49 voice presets available. Can also use custom voice IDs. ' +
|
|
18
|
+
'49 voice presets available. Can also use custom voice IDs (eleven_multilingual_v2 only). ' +
|
|
19
|
+
'MODELS: eleven_multilingual_v2 (default), eleven_v3 (expressive; supports audio tags like [laughs] and [whispers] in the text; preset voices only). ' +
|
|
10
20
|
'COST: 1 credit per 50 characters. WORKFLOW: Returns task_id → poll or use wait_for_runway_task.',
|
|
11
21
|
inputSchema: z.object({
|
|
12
|
-
text: z.string().describe('Text to speak. Max 1000 characters.'),
|
|
13
|
-
voice:
|
|
22
|
+
text: z.string().max(SPEECH_TEXT_MAX_CHARS).describe('Text to speak. Max 1000 characters (5000 for eleven_v3, which also accepts audio tags like [laughs]).'),
|
|
23
|
+
voice: voiceSchema.optional().describe('Voice preset name or custom voice UUID (custom voices require eleven_multilingual_v2). Default: Maya.'),
|
|
24
|
+
model: z.enum(['eleven_multilingual_v2', 'eleven_v3']).optional().describe('Speech model. Default: eleven_multilingual_v2.'),
|
|
14
25
|
}),
|
|
15
26
|
annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: true },
|
|
16
27
|
}, withErrorHandling(async (args) => {
|
|
17
28
|
const voice = args.voice || 'Maya';
|
|
18
|
-
const
|
|
29
|
+
const model = args.model || 'eleven_multilingual_v2';
|
|
30
|
+
// Model-dependent text ceiling, enforced here rather than via a
|
|
31
|
+
// schema-level refine: a .superRefine on the object schema would make
|
|
32
|
+
// the MCP SDK advertise an empty parameter list for this tool.
|
|
33
|
+
const maxTextChars = model === 'eleven_v3' ? 5000 : 1000;
|
|
34
|
+
if (args.text.length > maxTextChars) {
|
|
35
|
+
throw new RunwayError(`Text is ${args.text.length} characters; ${model} supports at most ${maxTextChars}.`, 'INVALID_INPUT', model === 'eleven_v3'
|
|
36
|
+
? 'Shorten the text to 5000 characters or fewer.'
|
|
37
|
+
: 'Shorten the text to 1000 characters or fewer, or switch to eleven_v3 (up to 5000 characters).');
|
|
38
|
+
}
|
|
39
|
+
const isCustomVoice = customVoiceIdSchema.safeParse(voice).success;
|
|
40
|
+
if (isCustomVoice && model === 'eleven_v3') {
|
|
41
|
+
throw new RunwayError('eleven_v3 supports Runway preset voices only', 'INVALID_INPUT', 'Use a voice preset name (e.g. Maya) with eleven_v3, or switch to eleven_multilingual_v2 to use a custom voice.');
|
|
42
|
+
}
|
|
19
43
|
const voicePayload = isCustomVoice
|
|
20
44
|
? { type: 'custom', id: voice }
|
|
21
45
|
: { type: 'runway-preset', presetId: voice };
|
|
22
46
|
const body = {
|
|
23
|
-
model
|
|
47
|
+
model,
|
|
24
48
|
promptText: args.text,
|
|
25
49
|
voice: voicePayload,
|
|
26
50
|
};
|
|
@@ -28,9 +52,9 @@ export function registerAudioTools(server) {
|
|
|
28
52
|
const textLen = args.text.length;
|
|
29
53
|
const estCredits = Math.ceil(textLen / 50);
|
|
30
54
|
return JSON.stringify({
|
|
31
|
-
ok: true, task_id: result.id, status: 'PENDING', voice,
|
|
55
|
+
ok: true, task_id: result.id, status: 'PENDING', voice, model,
|
|
32
56
|
estimated_credits: estCredits, estimated_cost: `$${(estCredits * 0.01).toFixed(2)}`,
|
|
33
|
-
message: `Speech generation started (voice: ${voice}). Poll with check_runway_task("${result.id}") every 10s, or use wait_for_runway_task.`,
|
|
57
|
+
message: `Speech generation started (voice: ${voice}, model: ${model}). Poll with check_runway_task("${result.id}") every 10s, or use wait_for_runway_task.`,
|
|
34
58
|
});
|
|
35
59
|
}));
|
|
36
60
|
// ── Sound Effect ──────────────────────────────────────────────────────
|
|
@@ -38,7 +62,7 @@ export function registerAudioTools(server) {
|
|
|
38
62
|
description: 'Generate sound effects from a text description. ' +
|
|
39
63
|
'COST: 1 credit per 6 seconds. WORKFLOW: Returns task_id → poll or use wait_for_runway_task.',
|
|
40
64
|
inputSchema: z.object({
|
|
41
|
-
prompt_text: z.string().describe('Describe the sound effect. Max 3000 chars.'),
|
|
65
|
+
prompt_text: z.string().max(3000).describe('Describe the sound effect. Max 3000 chars.'),
|
|
42
66
|
duration: z.number().optional().describe('Duration in seconds (0.5-30). Auto-determined if omitted.'),
|
|
43
67
|
loop: z.boolean().optional().describe('If true, output loops seamlessly. Default: false.'),
|
|
44
68
|
}),
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -5,4 +5,5 @@ export { registerAudioTools } from './audio.js';
|
|
|
5
5
|
export { registerVoiceTools } from './voices.js';
|
|
6
6
|
export { registerTaskTools } from './tasks.js';
|
|
7
7
|
export { registerAccountTools } from './account.js';
|
|
8
|
+
export { registerUpscaleTools } from './upscale.js';
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/tools/index.js
CHANGED
|
@@ -5,4 +5,5 @@ export { registerAudioTools } from './audio.js';
|
|
|
5
5
|
export { registerVoiceTools } from './voices.js';
|
|
6
6
|
export { registerTaskTools } from './tasks.js';
|
|
7
7
|
export { registerAccountTools } from './account.js';
|
|
8
|
+
export { registerUpscaleTools } from './upscale.js';
|
|
8
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { runwayFetch, resolveMediaInput } from '../client.js';
|
|
3
|
+
import { withErrorHandling } from '../utils.js';
|
|
4
|
+
export function registerUpscaleTools(server) {
|
|
5
|
+
// ── Video Upscale ─────────────────────────────────────────────────────
|
|
6
|
+
server.registerTool('upscale_video', {
|
|
7
|
+
description: 'Upscale a video to a higher resolution with the Magnific Video Upscaler. ' +
|
|
8
|
+
'Input video must be 30 seconds or shorter. ' +
|
|
9
|
+
'COST: billed per output frame — roughly 210 credits for 10s @ 30fps at 720p/1k, 270 at 2k, 360 at 4k. ' +
|
|
10
|
+
'WORKFLOW: Returns task_id → poll with check_runway_task or use wait_for_runway_task.',
|
|
11
|
+
inputSchema: z.object({
|
|
12
|
+
video: z.string().describe('Video to upscale (max 30s). HTTPS URL, Runway URI, or local file path.'),
|
|
13
|
+
resolution: z.enum(['720p', '1k', '2k', '4k']).optional().describe('Target output resolution. Default: 2k.'),
|
|
14
|
+
creativity: z.number().int().min(0).max(100).optional().describe('How much AI-generated detail to add, 0 (faithful) to 100.'),
|
|
15
|
+
sharpen: z.number().int().min(0).max(100).optional().describe('Sharpness intensity, 0 (none) to 100.'),
|
|
16
|
+
smart_grain: z.number().int().min(0).max(100).optional().describe('Grain and texture enhancement, 0 to 100.'),
|
|
17
|
+
flavor: z.enum(['vivid', 'natural']).optional().describe('Processing style: vivid (enhanced color/detail) or natural (faithful reproduction).'),
|
|
18
|
+
fps_boost: z.boolean().optional().describe('Increase the output frame rate. Affects per-frame billing.'),
|
|
19
|
+
}),
|
|
20
|
+
annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: true },
|
|
21
|
+
}, withErrorHandling(async (args) => {
|
|
22
|
+
const videoUri = await resolveMediaInput(args.video, 'video');
|
|
23
|
+
const resolution = args.resolution || '2k';
|
|
24
|
+
const body = { model: 'magnific_video_upscaler_creative', videoUri };
|
|
25
|
+
if (args.resolution)
|
|
26
|
+
body.resolution = args.resolution;
|
|
27
|
+
if (args.creativity !== undefined)
|
|
28
|
+
body.creativity = args.creativity;
|
|
29
|
+
if (args.sharpen !== undefined)
|
|
30
|
+
body.sharpen = args.sharpen;
|
|
31
|
+
if (args.smart_grain !== undefined)
|
|
32
|
+
body.smartGrain = args.smart_grain;
|
|
33
|
+
if (args.flavor)
|
|
34
|
+
body.flavor = args.flavor;
|
|
35
|
+
if (args.fps_boost !== undefined)
|
|
36
|
+
body.fpsBoost = args.fps_boost;
|
|
37
|
+
const result = await runwayFetch('/video_upscale', { method: 'POST', body: JSON.stringify(body) });
|
|
38
|
+
return JSON.stringify({
|
|
39
|
+
ok: true, task_id: result.id, status: 'PENDING', model: 'magnific_video_upscaler_creative',
|
|
40
|
+
resolution,
|
|
41
|
+
cost_rate: 'per output frame: ~$0.007/frame (720p/1k), ~$0.009/frame (2k), ~$0.012/frame (4k)',
|
|
42
|
+
message: `Video upscale started (${resolution}). Poll with check_runway_task("${result.id}") every 30s, or use wait_for_runway_task.`,
|
|
43
|
+
});
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=upscale.js.map
|
package/dist/tools/video.js
CHANGED
|
@@ -5,23 +5,24 @@ export function registerVideoTools(server) {
|
|
|
5
5
|
// ── Image-to-Video ────────────────────────────────────────────────────
|
|
6
6
|
server.registerTool('generate_video_from_image', {
|
|
7
7
|
description: 'Animate a still image into a video. Supports first-frame (and optionally last-frame) keyframe control. ' +
|
|
8
|
-
'MODELS: gen4.5 (flagship), gen4_turbo (fast/cheap),
|
|
8
|
+
'MODELS: gen4.5 (flagship), gen4_turbo (fast/cheap), veo3.1 (best quality + audio), veo3.1_fast, veo3 (deprecated upstream). ' +
|
|
9
9
|
'WORKFLOW: Returns task_id → poll with check_runway_task or use wait_for_runway_task.',
|
|
10
10
|
inputSchema: z.object({
|
|
11
11
|
prompt_image: z.string().describe('First frame image. HTTPS URL, Runway URI, or local file path.'),
|
|
12
12
|
last_frame_image: z.string().optional().describe('Optional last frame image for transition.'),
|
|
13
13
|
prompt_text: z.string().optional().describe('Describe the desired motion.'),
|
|
14
|
-
model: z.enum(['gen4.5', 'gen4_turbo', '
|
|
14
|
+
model: z.enum(['gen4.5', 'gen4_turbo', 'veo3.1', 'veo3.1_fast', 'veo3']).optional().describe('Default: gen4_turbo.'),
|
|
15
15
|
ratio: z.enum(['1280:720', '720:1280', '960:960', '1104:832', '832:1104', '1584:672']).optional().describe('Output resolution. Default: 1280:720.'),
|
|
16
16
|
duration: z.number().optional().describe('Seconds. gen4: 2-10 (default 5). veo: 4,6,8 (default 8).'),
|
|
17
17
|
audio: z.boolean().optional().describe('Generate audio (veo models only). Default: true.'),
|
|
18
|
+
negative_prompt: z.string().max(1000).optional().describe('What should NOT appear in the output (veo models only, max 1000 chars). Omit to use the default negative prompt.'),
|
|
18
19
|
content_moderation: z.enum(['auto', 'low']).optional().describe('Public figure threshold.'),
|
|
19
20
|
seed: z.number().int().optional().describe('Random seed (0-4294967295) for reproducibility.'),
|
|
20
21
|
}),
|
|
21
22
|
annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: true },
|
|
22
23
|
}, withErrorHandling(async (args) => {
|
|
23
24
|
const model = args.model || 'gen4_turbo';
|
|
24
|
-
const isRunwayModel = ['gen4.5', 'gen4_turbo'
|
|
25
|
+
const isRunwayModel = ['gen4.5', 'gen4_turbo'].includes(model);
|
|
25
26
|
const ratio = args.ratio || '1280:720';
|
|
26
27
|
const duration = args.duration || (isRunwayModel ? 5 : 8);
|
|
27
28
|
const audio = args.audio;
|
|
@@ -43,6 +44,8 @@ export function registerVideoTools(server) {
|
|
|
43
44
|
body.promptText = args.prompt_text;
|
|
44
45
|
if (audio !== undefined && !isRunwayModel)
|
|
45
46
|
body.audio = audio;
|
|
47
|
+
if (args.negative_prompt && !isRunwayModel)
|
|
48
|
+
body.negativePrompt = args.negative_prompt;
|
|
46
49
|
if (seed !== undefined)
|
|
47
50
|
body.seed = seed;
|
|
48
51
|
addContentModeration(body, args.content_moderation);
|
|
@@ -58,14 +61,15 @@ export function registerVideoTools(server) {
|
|
|
58
61
|
// ── Text-to-Video ─────────────────────────────────────────────────────
|
|
59
62
|
server.registerTool('generate_video_from_text', {
|
|
60
63
|
description: 'Create a video entirely from a text description. ' +
|
|
61
|
-
'MODELS: gen4.5 (flagship), veo3.1 (best + audio), veo3.1_fast, veo3. ' +
|
|
64
|
+
'MODELS: gen4.5 (flagship), veo3.1 (best + audio), veo3.1_fast, veo3 (deprecated upstream). ' +
|
|
62
65
|
'WORKFLOW: Returns task_id → poll or use wait_for_runway_task.',
|
|
63
66
|
inputSchema: z.object({
|
|
64
|
-
prompt_text: z.string().describe('Detailed video description. Max 1000 chars.'),
|
|
67
|
+
prompt_text: z.string().max(1000).describe('Detailed video description. Max 1000 chars.'),
|
|
65
68
|
model: z.enum(['gen4.5', 'veo3.1', 'veo3.1_fast', 'veo3']).optional().describe('Default: gen4.5.'),
|
|
66
69
|
ratio: z.enum(['1280:720', '720:1280']).optional().describe('Output resolution. Default: 1280:720.'),
|
|
67
70
|
duration: z.number().optional().describe('Seconds. gen4.5: 2-10 (default 5). veo: 4,6,8 (default 8).'),
|
|
68
71
|
audio: z.boolean().optional().describe('Generate audio (veo models only). Default: true.'),
|
|
72
|
+
negative_prompt: z.string().max(1000).optional().describe('What should NOT appear in the output (veo models only, max 1000 chars). Omit to use the default negative prompt.'),
|
|
69
73
|
content_moderation: z.enum(['auto', 'low']).optional().describe('Public figure threshold.'),
|
|
70
74
|
seed: z.number().int().optional().describe('Random seed (0-4294967295).'),
|
|
71
75
|
}),
|
|
@@ -80,6 +84,8 @@ export function registerVideoTools(server) {
|
|
|
80
84
|
const body = { model, promptText: args.prompt_text, ratio, duration };
|
|
81
85
|
if (!isGen45)
|
|
82
86
|
body.audio = audio;
|
|
87
|
+
if (args.negative_prompt && !isGen45)
|
|
88
|
+
body.negativePrompt = args.negative_prompt;
|
|
83
89
|
if (seed !== undefined)
|
|
84
90
|
body.seed = seed;
|
|
85
91
|
addContentModeration(body, args.content_moderation);
|
|
@@ -93,13 +99,13 @@ export function registerVideoTools(server) {
|
|
|
93
99
|
}));
|
|
94
100
|
// ── Video-to-Video ────────────────────────────────────────────────────
|
|
95
101
|
server.registerTool('generate_video_from_video', {
|
|
96
|
-
description: 'Re-style or transform an existing video using
|
|
97
|
-
'MODEL:
|
|
102
|
+
description: 'Re-style or transform an existing video using Aleph 2.0. ' +
|
|
103
|
+
'MODEL: aleph2 (only option). 28 credits/sec (56 credit minimum). Input video must be 30 seconds or shorter. ' +
|
|
98
104
|
'WORKFLOW: Returns task_id → poll or use wait_for_runway_task.',
|
|
99
105
|
inputSchema: z.object({
|
|
100
|
-
video: z.string().describe('Source video. HTTPS URL, Runway URI, or local file path.'),
|
|
106
|
+
video: z.string().describe('Source video (max 30s). HTTPS URL, Runway URI, or local file path.'),
|
|
101
107
|
prompt_text: z.string().describe('Describe the transformation.'),
|
|
102
|
-
reference_image: z.string().optional().describe('Optional
|
|
108
|
+
reference_image: z.string().optional().describe('Optional guidance image, applied as a keyframe at the start of the video.'),
|
|
103
109
|
content_moderation: z.enum(['auto', 'low']).optional().describe('Public figure threshold.'),
|
|
104
110
|
seed: z.number().int().optional().describe('Random seed (0-4294967295).'),
|
|
105
111
|
}),
|
|
@@ -107,18 +113,20 @@ export function registerVideoTools(server) {
|
|
|
107
113
|
}, withErrorHandling(async (args) => {
|
|
108
114
|
const videoUri = await resolveMediaInput(args.video, 'video');
|
|
109
115
|
const seed = args.seed;
|
|
110
|
-
const body = { model: '
|
|
116
|
+
const body = { model: 'aleph2', videoUri, promptText: args.prompt_text };
|
|
111
117
|
if (seed !== undefined)
|
|
112
118
|
body.seed = seed;
|
|
113
119
|
if (args.reference_image) {
|
|
114
|
-
|
|
120
|
+
// aleph2 replaces gen4_aleph's `references` with timed keyframe images;
|
|
121
|
+
// a single reference maps to a keyframe at the start of the video.
|
|
122
|
+
body.keyframes = [{ uri: await resolveMediaInput(args.reference_image, 'image'), seconds: 0 }];
|
|
115
123
|
}
|
|
116
124
|
addContentModeration(body, args.content_moderation);
|
|
117
125
|
const result = await runwayFetch('/video_to_video', { method: 'POST', body: JSON.stringify(body) });
|
|
118
126
|
return JSON.stringify({
|
|
119
|
-
ok: true, task_id: result.id, status: 'PENDING', model: '
|
|
120
|
-
cost_rate: '
|
|
121
|
-
message: `Video-to-video started (
|
|
127
|
+
ok: true, task_id: result.id, status: 'PENDING', model: 'aleph2',
|
|
128
|
+
cost_rate: '28 credits/sec ($0.28/sec), 56 credit minimum',
|
|
129
|
+
message: `Video-to-video started (aleph2). Poll with check_runway_task("${result.id}") every 30s, or use wait_for_runway_task.`,
|
|
122
130
|
});
|
|
123
131
|
}));
|
|
124
132
|
// ── Character Performance ─────────────────────────────────────────────
|
package/dist/tools/voices.js
CHANGED
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { runwayFetch, runwayRawFetch } from '../client.js';
|
|
3
|
+
import { wrapUntrusted } from '../untrusted-content.js';
|
|
3
4
|
import { RunwayError } from '../types.js';
|
|
4
5
|
import { withErrorHandling } from '../utils.js';
|
|
6
|
+
/**
|
|
7
|
+
* External-response schema for GET /v1/voices. `name` and `description` are
|
|
8
|
+
* authored in the external system (by the user, or by whoever created the
|
|
9
|
+
* voice), so they are attacker-controllable text and must be enveloped before
|
|
10
|
+
* they reach model-visible output (invariant #6).
|
|
11
|
+
*/
|
|
12
|
+
const voiceItemSchema = z.object({
|
|
13
|
+
id: z.string(),
|
|
14
|
+
name: z.string(),
|
|
15
|
+
description: z.string().nullish(),
|
|
16
|
+
createdAt: z.string(),
|
|
17
|
+
status: z.string(),
|
|
18
|
+
});
|
|
19
|
+
const voiceListResponseSchema = z.object({
|
|
20
|
+
data: z.array(voiceItemSchema),
|
|
21
|
+
hasMore: z.boolean(),
|
|
22
|
+
nextCursor: z.string().nullish(),
|
|
23
|
+
});
|
|
5
24
|
export function registerVoiceTools(server) {
|
|
6
25
|
// ── List Custom Voices ────────────────────────────────────────────────
|
|
7
26
|
server.registerTool('list_custom_voices', {
|
|
@@ -10,9 +29,13 @@ export function registerVoiceTools(server) {
|
|
|
10
29
|
inputSchema: z.object({}),
|
|
11
30
|
annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },
|
|
12
31
|
}, withErrorHandling(async () => {
|
|
13
|
-
const
|
|
32
|
+
const raw = await runwayFetch('/voices');
|
|
33
|
+
const result = voiceListResponseSchema.parse(raw);
|
|
14
34
|
const voices = result.data.map(v => ({
|
|
15
|
-
id: v.id,
|
|
35
|
+
id: v.id,
|
|
36
|
+
name: wrapUntrusted(v.name, 'runway-voice'),
|
|
37
|
+
description: wrapUntrusted(v.description || '', 'runway-voice'),
|
|
38
|
+
status: v.status, created: v.createdAt,
|
|
16
39
|
}));
|
|
17
40
|
return JSON.stringify({
|
|
18
41
|
ok: true, voices, count: voices.length, has_more: result.hasMore,
|
|
@@ -27,10 +50,10 @@ export function registerVoiceTools(server) {
|
|
|
27
50
|
'MODELS: eleven_multilingual_ttv_v2 (default), eleven_ttv_v3 (newer). ' +
|
|
28
51
|
'Check status with list_custom_voices. Once READY, use its ID with generate_speech.',
|
|
29
52
|
inputSchema: z.object({
|
|
30
|
-
name: z.string().describe('Name for the voice. Max 100 characters.'),
|
|
31
|
-
prompt: z.string().describe('Text description of desired voice. Min 20, max 1000 characters.'),
|
|
53
|
+
name: z.string().min(1).max(100).describe('Name for the voice. Max 100 characters.'),
|
|
54
|
+
prompt: z.string().min(20).max(1000).describe('Text description of desired voice. Min 20, max 1000 characters.'),
|
|
32
55
|
model: z.enum(['eleven_multilingual_ttv_v2', 'eleven_ttv_v3']).optional().describe('Voice design model. Default: eleven_multilingual_ttv_v2.'),
|
|
33
|
-
description: z.string().optional().describe('Optional description for your reference. Max 512 characters.'),
|
|
56
|
+
description: z.string().max(512).optional().describe('Optional description for your reference. Max 512 characters.'),
|
|
34
57
|
}),
|
|
35
58
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: true },
|
|
36
59
|
}, withErrorHandling(async (args) => {
|
|
@@ -52,7 +75,7 @@ export function registerVoiceTools(server) {
|
|
|
52
75
|
description: 'Generate a short audio preview of a voice from a text description, without creating it. ' +
|
|
53
76
|
'Use to audition voice characteristics before committing with create_custom_voice.',
|
|
54
77
|
inputSchema: z.object({
|
|
55
|
-
prompt: z.string().describe('Text description of desired voice. Min 20, max 1000 characters.'),
|
|
78
|
+
prompt: z.string().min(20).max(1000).describe('Text description of desired voice. Min 20, max 1000 characters.'),
|
|
56
79
|
model: z.enum(['eleven_multilingual_ttv_v2', 'eleven_ttv_v3']).optional().describe('Voice design model. Default: eleven_multilingual_ttv_v2.'),
|
|
57
80
|
}),
|
|
58
81
|
annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AGENTS.md security invariant #6 — content fetched from an external system
|
|
3
|
+
* MUST be wrapped in an `<untrusted-content source="…">…</untrusted-content>`
|
|
4
|
+
* envelope (with close-tag breakout escaping) before it is returned to the
|
|
5
|
+
* LLM, so the model treats third-party / attacker-controllable text as DATA,
|
|
6
|
+
* not as instructions.
|
|
7
|
+
*
|
|
8
|
+
* This is the canonical implementation a new connector ships with. It is a
|
|
9
|
+
* VENDORED copy of the shared reference in `test-harness/src/untrusted-content.ts`
|
|
10
|
+
* — connectors cannot `import` the test-harness at runtime (it is a
|
|
11
|
+
* test/dev-only `file:` dependency that is never published into a connector's
|
|
12
|
+
* `dist/`), so the helper lives in the connector's own runtime source. Keep
|
|
13
|
+
* this byte-for-byte in sync with the shared reference; do NOT weaken the
|
|
14
|
+
* escaping back to a simple `replaceAll` (that family misses whitespace / case
|
|
15
|
+
* close-tag variants like `</untrusted-content >` / `</UNTRUSTED-CONTENT>`).
|
|
16
|
+
*
|
|
17
|
+
* `scripts/check-untrusted-coverage.mjs` greps for a reference to
|
|
18
|
+
* `untrusted-content` in any connector that talks to an external system; this
|
|
19
|
+
* file (and the call sites that import from it) is what satisfies that gate.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Wrap a single untrusted string in an `<untrusted-content source="…">`
|
|
23
|
+
* envelope, escaping any embedded close-tag variant so the envelope cannot be
|
|
24
|
+
* broken out of. `undefined` passes through untouched. Idempotent for the same
|
|
25
|
+
* `source`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function wrapUntrusted(text: string | null | undefined, source: string): string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Recursively wrap every string value reachable inside `value`. Object keys are
|
|
30
|
+
* structural and NOT wrapped; non-string leaves pass through unchanged.
|
|
31
|
+
*/
|
|
32
|
+
export declare function wrapUntrustedJsonStrings<T>(value: T, source: string): T;
|
|
33
|
+
//# sourceMappingURL=untrusted-content.d.ts.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AGENTS.md security invariant #6 — content fetched from an external system
|
|
3
|
+
* MUST be wrapped in an `<untrusted-content source="…">…</untrusted-content>`
|
|
4
|
+
* envelope (with close-tag breakout escaping) before it is returned to the
|
|
5
|
+
* LLM, so the model treats third-party / attacker-controllable text as DATA,
|
|
6
|
+
* not as instructions.
|
|
7
|
+
*
|
|
8
|
+
* This is the canonical implementation a new connector ships with. It is a
|
|
9
|
+
* VENDORED copy of the shared reference in `test-harness/src/untrusted-content.ts`
|
|
10
|
+
* — connectors cannot `import` the test-harness at runtime (it is a
|
|
11
|
+
* test/dev-only `file:` dependency that is never published into a connector's
|
|
12
|
+
* `dist/`), so the helper lives in the connector's own runtime source. Keep
|
|
13
|
+
* this byte-for-byte in sync with the shared reference; do NOT weaken the
|
|
14
|
+
* escaping back to a simple `replaceAll` (that family misses whitespace / case
|
|
15
|
+
* close-tag variants like `</untrusted-content >` / `</UNTRUSTED-CONTENT>`).
|
|
16
|
+
*
|
|
17
|
+
* `scripts/check-untrusted-coverage.mjs` greps for a reference to
|
|
18
|
+
* `untrusted-content` in any connector that talks to an external system; this
|
|
19
|
+
* file (and the call sites that import from it) is what satisfies that gate.
|
|
20
|
+
*/
|
|
21
|
+
const UNTRUSTED_CLOSE_TAG_VARIANT = /<\/untrusted-content\s*>/gi;
|
|
22
|
+
const ESCAPED_UNTRUSTED_CLOSE_TAG = '<\\/untrusted-content>';
|
|
23
|
+
function escapeAttr(s) {
|
|
24
|
+
return s.replaceAll('&', '&').replaceAll('"', '"').replaceAll('<', '<').replaceAll('>', '>');
|
|
25
|
+
}
|
|
26
|
+
function escapeCloseTagSentinels(s) {
|
|
27
|
+
return s.replace(UNTRUSTED_CLOSE_TAG_VARIANT, ESCAPED_UNTRUSTED_CLOSE_TAG);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Wrap a single untrusted string in an `<untrusted-content source="…">`
|
|
31
|
+
* envelope, escaping any embedded close-tag variant so the envelope cannot be
|
|
32
|
+
* broken out of. `undefined` passes through untouched. Idempotent for the same
|
|
33
|
+
* `source`.
|
|
34
|
+
*/
|
|
35
|
+
export function wrapUntrusted(text, source) {
|
|
36
|
+
if (text === undefined || text === null)
|
|
37
|
+
return undefined;
|
|
38
|
+
const open = `<untrusted-content source="${escapeAttr(source)}">`;
|
|
39
|
+
const close = '</untrusted-content>';
|
|
40
|
+
if (text.startsWith(open) && text.endsWith(close) && text.length >= open.length + close.length) {
|
|
41
|
+
const inner = text.slice(open.length, text.length - close.length);
|
|
42
|
+
if (!UNTRUSTED_CLOSE_TAG_VARIANT.test(inner)) {
|
|
43
|
+
UNTRUSTED_CLOSE_TAG_VARIANT.lastIndex = 0;
|
|
44
|
+
return text;
|
|
45
|
+
}
|
|
46
|
+
UNTRUSTED_CLOSE_TAG_VARIANT.lastIndex = 0;
|
|
47
|
+
}
|
|
48
|
+
return `${open}${escapeCloseTagSentinels(text)}${close}`;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Recursively wrap every string value reachable inside `value`. Object keys are
|
|
52
|
+
* structural and NOT wrapped; non-string leaves pass through unchanged.
|
|
53
|
+
*/
|
|
54
|
+
export function wrapUntrustedJsonStrings(value, source) {
|
|
55
|
+
if (typeof value === 'string') {
|
|
56
|
+
return wrapUntrusted(value, source);
|
|
57
|
+
}
|
|
58
|
+
if (Array.isArray(value)) {
|
|
59
|
+
return value.map((item) => wrapUntrustedJsonStrings(item, source));
|
|
60
|
+
}
|
|
61
|
+
if (value && typeof value === 'object') {
|
|
62
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, wrapUntrustedJsonStrings(item, source)]));
|
|
63
|
+
}
|
|
64
|
+
return value;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=untrusted-content.js.map
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mindstone/mcp-server-runway",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"mcpName": "io.github.mindstone/mcp-server-runway",
|
|
5
|
-
"description": "Runway ML MCP server for Model Context Protocol hosts
|
|
5
|
+
"description": "Runway ML MCP server for Model Context Protocol hosts — AI video, image, audio generation, custom voices, task management",
|
|
6
6
|
"license": "FSL-1.1-MIT",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"bin": {
|