@mindstone/mcp-server-runway 0.3.2

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/LICENSE ADDED
@@ -0,0 +1,97 @@
1
+ # Functional Source License, Version 1.1, MIT Future License
2
+
3
+ ## Abbreviation
4
+
5
+ FSL-1.1-MIT
6
+
7
+ ## Notice
8
+
9
+ Copyright 2026 Mindstone Learning Limited
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ **Licensor**: Mindstone Learning Limited
18
+
19
+ ### The Software
20
+
21
+ The "Software" is each version of the software that we make available under
22
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
23
+ Conditions with the Software.
24
+
25
+ **Software**: Runway MCP Server
26
+
27
+ ### License Grant
28
+
29
+ Subject to your compliance with this License Grant and the Patents,
30
+ Redistribution and Trademark clauses below, we hereby grant you the right to
31
+ use, copy, modify, create derivative works, publicly perform, publicly display
32
+ and redistribute the Software for any Permitted Purpose identified below.
33
+
34
+ ### Permitted Purpose
35
+
36
+ A Permitted Purpose is any purpose other than a Competing Use. A "Competing
37
+ Use" means making the Software available to third parties as a commercial
38
+ hosted service that directly competes with any product or service provided by
39
+ the Licensor.
40
+
41
+ ### Patents
42
+
43
+ To the extent your use for a Permitted Purpose would necessarily infringe our
44
+ patents, the license grant above includes a license under our patents. If you
45
+ make a claim against any party that the Software infringes or contributes to
46
+ the infringement of any patent, then your patent license to the Software ends
47
+ immediately.
48
+
49
+ ### Redistribution
50
+
51
+ The Terms and Conditions apply to all copies, modifications and derivatives of
52
+ the Software.
53
+
54
+ If you redistribute any copies, modifications or derivatives of the Software,
55
+ you must include a copy of or a link to these Terms and Conditions and not
56
+ remove any copyright notices provided in or with the Software.
57
+
58
+ ### Disclaimer
59
+
60
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
61
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
62
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
63
+
64
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
65
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, OF
66
+ ANY CHARACTER INCLUDING DAMAGES FOR LOSS OF GOODWILL, LOST PROFITS, LOST SALES
67
+ OR BUSINESS, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, LOST CONTENT,
68
+ DATA OR DATA USE, BREACH OF DUTY OF GOOD FAITH, OR ANY AND ALL OTHER DAMAGES
69
+ OR LOSSES OF ANY KIND OR NATURE WHATSOEVER (WHETHER DIRECT, INDIRECT, SPECIAL,
70
+ COLLATERAL, INCIDENTAL, CONSEQUENTIAL OR OTHERWISE) ARISING OUT OF OR IN
71
+ CONNECTION WITH THE SOFTWARE OR THIS LICENSE, EVEN IF SUCH PARTY SHALL HAVE
72
+ BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES.
73
+
74
+ ### Trademark
75
+
76
+ Except for displaying the License Details and identifying us as the origin of
77
+ the Software, you have no right under these Terms and Conditions to use our
78
+ trademarks, trade names, service marks or product names.
79
+
80
+ ## Change Date
81
+
82
+ Four years from the date the Software is made available under these Terms and
83
+ Conditions: **2030-04-08**
84
+
85
+ ## Change License
86
+
87
+ MIT License
88
+
89
+ ## License Details
90
+
91
+ | Parameter | Value |
92
+ |---|---|
93
+ | Licensor | Mindstone Learning Limited |
94
+ | Software | Runway MCP Server |
95
+ | Use Limitation | Competing Use |
96
+ | Change Date | 2030-04-08 |
97
+ | Change License | MIT |
package/README.md ADDED
@@ -0,0 +1,119 @@
1
+ # @mindstone/mcp-server-runway
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@mindstone/mcp-server-runway.svg)](https://www.npmjs.com/package/@mindstone/mcp-server-runway)
4
+ [![License: FSL-1.1-MIT](https://img.shields.io/badge/License-FSL--1.1--MIT-blue.svg)](./LICENSE)
5
+
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
+
8
+ ## Requirements
9
+
10
+ - Node.js 20+
11
+ - npm
12
+
13
+ ## Quick Start
14
+
15
+ ### Install & build
16
+
17
+ ```bash
18
+ cd <path-to-repo>/connectors/runway
19
+ npm install
20
+ npm run build
21
+ ```
22
+
23
+ ### npx (once published)
24
+
25
+ ```bash
26
+ npx -y @mindstone/mcp-server-runway
27
+ ```
28
+
29
+ ### Local
30
+
31
+ ```bash
32
+ node dist/index.js
33
+ ```
34
+
35
+ ## Configuration
36
+
37
+ ### Environment variables
38
+
39
+ - `RUNWAYML_API_SECRET` — Runway API key (from dev.runwayml.com)
40
+ - `MCP_HOST_BRIDGE_STATE` — optional path to a host bridge state file used for credential management
41
+ - `MINDSTONE_REBEL_BRIDGE_STATE` — backwards-compatible alias for `MCP_HOST_BRIDGE_STATE`
42
+ - `RUNWAY_REQUEST_TIMEOUT_MS` — optional override (positive integer ms, max 30 min) for the outbound HTTP request timeout applied to Runway JSON API and host-bridge calls. Default: `60000` (60s). Raise this if you see `TIMEOUT` errors on slow submits; lower it if you want tighter bounds.
43
+ - `RUNWAY_UPLOAD_TIMEOUT_MS` — optional override (positive integer ms, max 30 min) for the signed-URL upload leg of `uploadEphemeral` (large local-file uploads). Default: `600000` (10 min). Sized for up-to-200MB uploads on typical consumer uplinks (~5 Mbps) with comfortable headroom; raise for slower connections or lower for tighter bounds.
44
+
45
+ ## Host configuration examples
46
+
47
+ ### Claude Desktop / Cursor
48
+
49
+ ```json
50
+ {
51
+ "mcpServers": {
52
+ "Runway": {
53
+ "command": "npx",
54
+ "args": ["-y", "@mindstone/mcp-server-runway"],
55
+ "env": {
56
+ "RUNWAYML_API_SECRET": "your-api-key"
57
+ }
58
+ }
59
+ }
60
+ }
61
+ ```
62
+
63
+ ### Local development (no npm publish needed)
64
+
65
+ ```json
66
+ {
67
+ "mcpServers": {
68
+ "Runway": {
69
+ "command": "node",
70
+ "args": ["<path-to-repo>/connectors/runway/dist/index.js"],
71
+ "env": {
72
+ "RUNWAYML_API_SECRET": "your-api-key"
73
+ }
74
+ }
75
+ }
76
+ }
77
+ ```
78
+
79
+ ## Tools (22)
80
+
81
+ ### Configuration
82
+ - `configure_runway_api_key` — Save your Runway API key
83
+
84
+ ### Video
85
+ - `generate_video_from_image` — Animate a still image into a video
86
+ - `generate_video_from_text` — Create a video from a text description
87
+ - `generate_video_from_video` — Re-style or transform an existing video
88
+ - `character_performance` — Animate a character with facial expressions and body movements (Act-Two)
89
+
90
+ ### Image
91
+ - `generate_image` — Generate an image from text, optionally with reference images
92
+
93
+ ### Audio
94
+ - `generate_speech` — Generate spoken audio from text using ElevenLabs voices
95
+ - `generate_sound_effect` — Generate sound effects from a text description
96
+ - `swap_voice` — Replace the voice in an audio or video file
97
+ - `dub_audio` — Translate and dub audio into a different language
98
+ - `isolate_voice` — Isolate voice from background audio
99
+
100
+ ### Voices
101
+ - `list_custom_voices` — List all custom voices you've created
102
+ - `create_custom_voice` — Create a custom voice from a text description
103
+ - `preview_voice` — Generate a short audio preview of a voice
104
+ - `delete_custom_voice` — Delete a custom voice
105
+
106
+ ### Task management
107
+ - `check_runway_task` — Check the status of a generation task
108
+ - `wait_for_runway_task` — Wait for a task to complete (auto-poll)
109
+ - `cancel_runway_task` — Cancel or delete a task
110
+ - `download_runway_output` — Download a Runway output to a local file
111
+ - `upload_media` — Upload a local file to Runway's ephemeral storage
112
+
113
+ ### Account
114
+ - `get_runway_balance` — Check credit balance, tier limits, and usage
115
+ - `query_credit_usage` — Query detailed credit usage by model and day
116
+
117
+ ## Licence
118
+
119
+ [FSL-1.1-MIT](./LICENSE) — Functional Source License, Version 1.1, with MIT future licence. The software converts to MIT licence on 2030-04-08.
package/dist/auth.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Runway authentication module.
3
+ *
4
+ * API key management — stored via env var (RUNWAYML_API_SECRET)
5
+ * or configured at runtime via the configure_runway_api_key tool.
6
+ *
7
+ * Auth: Authorization: Bearer {key} + X-Runway-Version header on all API requests.
8
+ */
9
+ /**
10
+ * Get the current API key.
11
+ */
12
+ export declare function getApiKey(): string;
13
+ /**
14
+ * Set the API key at runtime (from configure tool).
15
+ */
16
+ export declare function setApiKey(key: string): void;
17
+ /**
18
+ * Check if an API key is configured.
19
+ */
20
+ export declare function hasApiKey(): boolean;
21
+ //# sourceMappingURL=auth.d.ts.map
package/dist/auth.js ADDED
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Runway authentication module.
3
+ *
4
+ * API key management — stored via env var (RUNWAYML_API_SECRET)
5
+ * or configured at runtime via the configure_runway_api_key tool.
6
+ *
7
+ * Auth: Authorization: Bearer {key} + X-Runway-Version header on all API requests.
8
+ */
9
+ /** Runtime API key — starts from env, can be updated via configure tool. */
10
+ let apiKey = process.env.RUNWAYML_API_SECRET ?? '';
11
+ /**
12
+ * Get the current API key.
13
+ */
14
+ export function getApiKey() {
15
+ return apiKey;
16
+ }
17
+ /**
18
+ * Set the API key at runtime (from configure tool).
19
+ */
20
+ export function setApiKey(key) {
21
+ apiKey = key;
22
+ }
23
+ /**
24
+ * Check if an API key is configured.
25
+ */
26
+ export function hasApiKey() {
27
+ return apiKey.trim().length > 0;
28
+ }
29
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Path to bridge state file, supporting both current and legacy env vars.
3
+ */
4
+ export declare const BRIDGE_STATE_PATH: string;
5
+ /**
6
+ * Send a request to the host app bridge.
7
+ *
8
+ * The bridge is an HTTP server running inside the host app (e.g. the host application)
9
+ * that handles credential management and other cross-process operations.
10
+ */
11
+ export declare const bridgeRequest: (urlPath: string, body: Record<string, unknown>) => Promise<{
12
+ success: boolean;
13
+ warning?: string;
14
+ error?: string;
15
+ }>;
16
+ //# sourceMappingURL=bridge.d.ts.map
package/dist/bridge.js ADDED
@@ -0,0 +1,43 @@
1
+ import * as fs from 'fs';
2
+ import { getRequestTimeoutMs } from './types.js';
3
+ /**
4
+ * Path to bridge state file, supporting both current and legacy env vars.
5
+ */
6
+ export const BRIDGE_STATE_PATH = process.env.MCP_HOST_BRIDGE_STATE || process.env.MINDSTONE_REBEL_BRIDGE_STATE || '';
7
+ const loadBridgeState = () => {
8
+ if (!BRIDGE_STATE_PATH)
9
+ return null;
10
+ try {
11
+ const raw = fs.readFileSync(BRIDGE_STATE_PATH, 'utf8');
12
+ return JSON.parse(raw);
13
+ }
14
+ catch {
15
+ return null;
16
+ }
17
+ };
18
+ /**
19
+ * Send a request to the host app bridge.
20
+ *
21
+ * The bridge is an HTTP server running inside the host app (e.g. the host application)
22
+ * that handles credential management and other cross-process operations.
23
+ */
24
+ export const bridgeRequest = async (urlPath, body) => {
25
+ const bridge = loadBridgeState();
26
+ if (!bridge) {
27
+ return { success: false, error: 'Bridge not available' };
28
+ }
29
+ const response = await fetch(`http://127.0.0.1:${bridge.port}${urlPath}`, {
30
+ method: 'POST',
31
+ signal: AbortSignal.timeout(getRequestTimeoutMs()),
32
+ headers: {
33
+ 'Content-Type': 'application/json',
34
+ Authorization: `Bearer ${bridge.token}`,
35
+ },
36
+ body: JSON.stringify(body),
37
+ });
38
+ if (response.status === 401 || response.status === 403) {
39
+ return { success: false, error: `Bridge returned ${response.status}: unauthorized. Check host app authentication.` };
40
+ }
41
+ return response.json();
42
+ };
43
+ //# sourceMappingURL=bridge.js.map
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Runway API HTTP client.
3
+ *
4
+ * Centralises Bearer auth + X-Runway-Version header injection,
5
+ * error handling, rate-limit messaging, and timeout handling.
6
+ *
7
+ * Auth: Authorization: Bearer {key}, X-Runway-Version: 2024-11-06
8
+ * Base URL: https://api.dev.runwayml.com/v1
9
+ */
10
+ /**
11
+ * Validate that `input` is a local file path inside the allow-listed root,
12
+ * canonicalising via `fs.realpathSync` so that symlink-escape attempts are
13
+ * caught. Returns the canonicalised (or, for not-yet-existing files, the
14
+ * lexically-resolved) path.
15
+ *
16
+ * Throws a structured `RunwayError` with code `PATH_OUTSIDE_ALLOWED_ROOT`
17
+ * when the resolved path falls outside the allow-listed root. Does NOT
18
+ * throw for "file does not exist" — callers handle that via their existing
19
+ * `FILE_NOT_FOUND` paths so error attribution stays clean.
20
+ */
21
+ export declare function assertPathInAllowedRoot(input: string): string;
22
+ /**
23
+ * Validate that `outputPath` is a writable destination for
24
+ * `download_runway_output`:
25
+ * 1. Must lexically resolve under `RUNWAY_DOWNLOAD_ROOT` (catches `..`).
26
+ * 2. Parent dir must `realpathSync` cleanly into the same root (catches
27
+ * symlink-escape).
28
+ * 3. Resolved target must not match the static deny-list (catches the
29
+ * `RUNWAY_DOWNLOAD_ROOT=$HOME` / `=/` defeat path).
30
+ *
31
+ * Returns the realpath-resolved write target on success, or throws a
32
+ * structured `RunwayError` otherwise. Auto-creates the configured root
33
+ * directory if missing so the default `~/Downloads/runway-mcp` works
34
+ * out-of-the-box.
35
+ */
36
+ export declare function assertDownloadPathInRoot(outputPath: string): {
37
+ resolved: string;
38
+ root: string;
39
+ };
40
+ /**
41
+ * Make an authenticated JSON request to the Runway API.
42
+ */
43
+ export declare function runwayFetch<T>(urlPath: string, options?: RequestInit): Promise<T>;
44
+ /**
45
+ * Make a raw authenticated fetch (for DELETE endpoints that return 204 with no body).
46
+ */
47
+ export declare function runwayRawFetch(urlPath: string, options?: RequestInit): Promise<Response>;
48
+ /**
49
+ * Upload a local file to Runway's ephemeral storage.
50
+ * Returns a runway:// URI valid for 24 hours.
51
+ *
52
+ * SECURITY: refuses paths outside `RUNWAY_ALLOWED_ROOT` (default
53
+ * `os.tmpdir()`); see `assertPathInAllowedRoot`. The sandbox check runs
54
+ * BEFORE any file read or upstream API call, so a disallowed path never
55
+ * triggers an `/uploads` request and the file's bytes are never read.
56
+ */
57
+ export declare function uploadEphemeral(filePath: string): Promise<string>;
58
+ /**
59
+ * Resolve a media input to a usable URI.
60
+ * - HTTPS/data/runway URIs are passed through.
61
+ * - Local files under the size limit are converted to data URIs.
62
+ * - Large local files are uploaded via ephemeral upload.
63
+ *
64
+ * SECURITY: local-file inputs are sandboxed under `RUNWAY_ALLOWED_ROOT`
65
+ * (default `os.tmpdir()`). Paths outside the sandbox — including symlinks
66
+ * pointing outside it — are refused before any file read.
67
+ */
68
+ export declare function resolveMediaInput(input: string, category: 'image' | 'video' | 'audio'): Promise<string>;
69
+ /**
70
+ * Validate a download URL for SSRF safety.
71
+ * Returns an error message if the URL is unsafe, or null if OK.
72
+ */
73
+ export declare function validateDownloadUrl(url: string): string | null;
74
+ export declare function costEstimate(model: string, duration: number, audio?: boolean): {
75
+ credits: number;
76
+ usd: string;
77
+ };
78
+ /**
79
+ * Add content moderation to a request body if specified.
80
+ */
81
+ export declare function addContentModeration(body: Record<string, unknown>, contentMod?: string): void;
82
+ //# sourceMappingURL=client.d.ts.map