@agimon-ai/video-editor-mcp 0.2.0

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,52 @@
1
+ Business Source License 1.1
2
+
3
+ Parameters
4
+
5
+ Licensor: AgiFlow
6
+ Licensed Work: @agimon-ai/public-packages
7
+ The Licensed Work is (c) 2026 AgiFlow.
8
+ Additional Use Grant: None
9
+ Change Date: 2030-03-06
10
+ Change License: Apache License, Version 2.0
11
+
12
+ Terms
13
+
14
+ The Licensor hereby grants you the right to copy, modify, create derivative
15
+ works, redistribute, and make non-production use of the Licensed Work. The
16
+ Licensor may make an Additional Use Grant, above, permitting limited
17
+ production use.
18
+
19
+ Effective on the Change Date, or the fourth anniversary of the first publicly
20
+ available distribution of a specific version of the Licensed Work under this
21
+ License, whichever comes first, the Licensor hereby grants you rights under
22
+ the terms of the Change License, and the rights granted in the paragraph
23
+ above terminate.
24
+
25
+ If your use of the Licensed Work does not comply with the requirements
26
+ currently in effect as described in this License, you must purchase a
27
+ commercial license from the Licensor, its affiliated entities, or authorized
28
+ resellers, or you must refrain from using the Licensed Work.
29
+
30
+ All copies of the original and modified Licensed Work, and derivative works
31
+ of the Licensed Work, are subject to this License. This License applies
32
+ separately for each version of the Licensed Work and the Change Date may vary
33
+ for each version of the Licensed Work released by Licensor.
34
+
35
+ You must conspicuously display this License on each original or modified copy
36
+ of the Licensed Work. If you receive the Licensed Work in original or
37
+ modified form from a third party, the terms and conditions set forth in this
38
+ License apply to your use of that work.
39
+
40
+ Any use of the Licensed Work in violation of this License will automatically
41
+ terminate your rights under this License for the current and all other
42
+ versions of the Licensed Work.
43
+
44
+ This License does not grant you any right in any trademark or logo of
45
+ Licensor or its affiliates (provided that you may use a trademark or logo of
46
+ Licensor as expressly required by this License).
47
+
48
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
49
+ AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
50
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
51
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
52
+ TITLE.
package/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # video-editor
2
+
3
+ MCP server for video editing with FFmpeg/editly
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm install
9
+ ```
10
+
11
+ ## Development
12
+
13
+ ```bash
14
+ pnpm dev
15
+ ```
16
+
17
+ ## Build
18
+
19
+ ```bash
20
+ pnpm build
21
+ ```
22
+
23
+ ## Test
24
+
25
+ ```bash
26
+ pnpm test
27
+ ```
28
+
29
+ ## Usage with Claude Code
30
+
31
+ Add to your Claude Code configuration:
32
+
33
+ ```json
34
+ {
35
+ "mcpServers": {
36
+ "video-editor": {
37
+ "command": "npx",
38
+ "args": ["video-editor", "mcp-serve"]
39
+ }
40
+ }
41
+ }
42
+ ```
package/dist/cli.cjs ADDED
@@ -0,0 +1,179 @@
1
+ #!/usr/bin/env node
2
+ const require_stdio = require('./stdio-C-vwZanD.cjs');
3
+ let commander = require("commander");
4
+ let node_child_process = require("node:child_process");
5
+ let node_path = require("node:path");
6
+ node_path = require_stdio.__toESM(node_path);
7
+ let chalk = require("chalk");
8
+ chalk = require_stdio.__toESM(chalk);
9
+ let node_fs = require("node:fs");
10
+ node_fs = require_stdio.__toESM(node_fs);
11
+
12
+ //#region package.json
13
+ var version = "0.1.0";
14
+
15
+ //#endregion
16
+ //#region src/commands/http-serve.ts
17
+ /**
18
+ * HTTP Serve Command
19
+ *
20
+ * Starts Remotion Studio for interactive video editing.
21
+ */
22
+ const httpServeCommand = new commander.Command("http-serve").description("Start Remotion Studio for video editing").option("-p, --port <port>", "Port to run Remotion Studio on", "3001").action(async (options) => {
23
+ try {
24
+ const port = parseInt(options.port, 10);
25
+ const packageDir = node_path.default.resolve(__dirname, "..");
26
+ console.error(chalk.default.green(`✓ Starting Remotion Studio on port ${port}...`));
27
+ console.error(chalk.default.gray(` Working directory: ${packageDir}`));
28
+ const studio = (0, node_child_process.spawn)(node_path.default.join(packageDir, "node_modules", ".bin", "remotion"), [
29
+ "studio",
30
+ "--port",
31
+ String(port)
32
+ ], {
33
+ stdio: "inherit",
34
+ cwd: packageDir
35
+ });
36
+ studio.on("error", (error) => {
37
+ console.error(chalk.default.red(`Failed to start Remotion Studio: ${error.message}`));
38
+ process.exit(1);
39
+ });
40
+ process.on("SIGINT", () => {
41
+ studio.kill("SIGINT");
42
+ process.exit(0);
43
+ });
44
+ process.on("SIGTERM", () => {
45
+ studio.kill("SIGTERM");
46
+ process.exit(0);
47
+ });
48
+ } catch (error) {
49
+ console.error("Error executing http-serve:", error);
50
+ process.exit(1);
51
+ }
52
+ });
53
+
54
+ //#endregion
55
+ //#region src/commands/mcp-serve.ts
56
+ /**
57
+ * MCP Serve Command
58
+ *
59
+ * DESIGN PATTERNS:
60
+ * - Command pattern with Commander for CLI argument parsing
61
+ * - Transport abstraction pattern for flexible deployment (stdio, HTTP, SSE)
62
+ * - Factory pattern for creating transport handlers
63
+ * - Graceful shutdown pattern with signal handling
64
+ *
65
+ * CODING STANDARDS:
66
+ * - Use async/await for asynchronous operations
67
+ * - Implement proper error handling with try-catch blocks
68
+ * - Handle process signals for graceful shutdown
69
+ * - Provide clear CLI options and help messages
70
+ *
71
+ * AVOID:
72
+ * - Hardcoded configuration values (use CLI options or environment variables)
73
+ * - Missing error handling for transport startup
74
+ * - Not cleaning up resources on shutdown
75
+ */
76
+ /**
77
+ * Start MCP server with given transport handler
78
+ */
79
+ async function startServer(handler) {
80
+ await handler.start();
81
+ const shutdown = async (signal) => {
82
+ console.error(`\nReceived ${signal}, shutting down gracefully...`);
83
+ try {
84
+ await handler.stop();
85
+ process.exit(0);
86
+ } catch (error) {
87
+ console.error("Error during shutdown:", error);
88
+ process.exit(1);
89
+ }
90
+ };
91
+ process.on("SIGINT", () => shutdown("SIGINT"));
92
+ process.on("SIGTERM", () => shutdown("SIGTERM"));
93
+ }
94
+ /**
95
+ * MCP Serve command
96
+ */
97
+ const mcpServeCommand = new commander.Command("mcp-serve").description("Start MCP server with specified transport").option("-t, --type <type>", "Transport type: stdio", "stdio").action(async (options) => {
98
+ try {
99
+ const transportType = options.type.toLowerCase();
100
+ if (transportType === "stdio") await startServer(new require_stdio.StdioTransportHandler(require_stdio.createServer(require_stdio.createContainer())));
101
+ else {
102
+ console.error(`Unknown transport type: ${transportType}. Use: stdio`);
103
+ process.exit(1);
104
+ }
105
+ } catch (error) {
106
+ console.error("Failed to start MCP server:", error);
107
+ process.exit(1);
108
+ }
109
+ });
110
+
111
+ //#endregion
112
+ //#region src/commands/render.ts
113
+ /**
114
+ * Render Command
115
+ *
116
+ * Renders a video from JSON props using Remotion.
117
+ */
118
+ const renderCommand = new commander.Command("render").description("Render a video from JSON props file").requiredOption("-i, --input <path>", "Path to JSON props file").requiredOption("-o, --output <path>", "Output video file path").option("-c, --composition <id>", "Composition ID", "Main").option("--codec <codec>", "Video codec (h264, h265, vp8, vp9)", "h264").action(async (options) => {
119
+ try {
120
+ process.stderr.write(chalk.default.blue("🎬 Starting video render...\n"));
121
+ process.stderr.write(chalk.default.gray(` Input: ${options.input}\n`));
122
+ process.stderr.write(chalk.default.gray(` Output: ${options.output}\n`));
123
+ process.stderr.write(chalk.default.gray(` Composition: ${options.composition}\n`));
124
+ process.stderr.write(chalk.default.gray(` Codec: ${options.codec}\n`));
125
+ if (!node_fs.default.existsSync(options.input)) {
126
+ process.stderr.write(chalk.default.red(`Error: Input file not found: ${options.input}\n`));
127
+ process.exit(1);
128
+ }
129
+ const propsContent = node_fs.default.readFileSync(options.input, "utf-8");
130
+ const inputProps = JSON.parse(propsContent);
131
+ const renderService = require_stdio.createContainer().get(require_stdio.TYPES.RenderService);
132
+ process.stderr.write(chalk.default.blue("📦 Bundling Remotion project...\n"));
133
+ const result = await renderService.render({
134
+ compositionId: options.composition,
135
+ inputProps,
136
+ outputPath: options.output,
137
+ codec: options.codec
138
+ });
139
+ process.stderr.write(chalk.default.green(`✓ Video rendered successfully: ${result.outputPath}\n`));
140
+ } catch (error) {
141
+ process.stderr.write(chalk.default.red(`Error rendering video: ${error}\n`));
142
+ process.exit(1);
143
+ }
144
+ });
145
+
146
+ //#endregion
147
+ //#region src/cli.ts
148
+ /**
149
+ * MCP Server Entry Point
150
+ *
151
+ * DESIGN PATTERNS:
152
+ * - CLI pattern with Commander for argument parsing
153
+ * - Command pattern for organizing CLI commands
154
+ * - Transport abstraction for multiple communication methods
155
+ *
156
+ * CODING STANDARDS:
157
+ * - Use async/await for asynchronous operations
158
+ * - Handle errors gracefully with try-catch
159
+ * - Log important events for debugging
160
+ * - Register all commands in main entry point
161
+ *
162
+ * AVOID:
163
+ * - Hardcoding command logic in index.ts (use separate command files)
164
+ * - Missing error handling for command execution
165
+ */
166
+ /**
167
+ * Main entry point
168
+ */
169
+ async function main() {
170
+ const program = new commander.Command();
171
+ program.name("video-editor-mcp").description("MCP server for video editing with Remotion").version(version);
172
+ program.addCommand(mcpServeCommand);
173
+ program.addCommand(httpServeCommand);
174
+ program.addCommand(renderCommand);
175
+ await program.parseAsync(process.argv);
176
+ }
177
+ main();
178
+
179
+ //#endregion
package/dist/cli.d.cts ADDED
@@ -0,0 +1 @@
1
+ export { };
package/dist/cli.d.mts ADDED
@@ -0,0 +1 @@
1
+ export { };
package/dist/cli.mjs ADDED
@@ -0,0 +1,177 @@
1
+ #!/usr/bin/env node
2
+ import { d as TYPES, n as createServer, r as createContainer, t as StdioTransportHandler } from "./stdio-C7h0m1FD.mjs";
3
+ import { Command } from "commander";
4
+ import { spawn } from "node:child_process";
5
+ import path from "node:path";
6
+ import chalk from "chalk";
7
+ import fs from "node:fs";
8
+
9
+ //#region package.json
10
+ var version = "0.1.0";
11
+
12
+ //#endregion
13
+ //#region src/commands/http-serve.ts
14
+ /**
15
+ * HTTP Serve Command
16
+ *
17
+ * Starts Remotion Studio for interactive video editing.
18
+ */
19
+ const httpServeCommand = new Command("http-serve").description("Start Remotion Studio for video editing").option("-p, --port <port>", "Port to run Remotion Studio on", "3001").action(async (options) => {
20
+ try {
21
+ const port = parseInt(options.port, 10);
22
+ const packageDir = path.resolve(import.meta.dirname, "..");
23
+ console.error(chalk.green(`✓ Starting Remotion Studio on port ${port}...`));
24
+ console.error(chalk.gray(` Working directory: ${packageDir}`));
25
+ const studio = spawn(path.join(packageDir, "node_modules", ".bin", "remotion"), [
26
+ "studio",
27
+ "--port",
28
+ String(port)
29
+ ], {
30
+ stdio: "inherit",
31
+ cwd: packageDir
32
+ });
33
+ studio.on("error", (error) => {
34
+ console.error(chalk.red(`Failed to start Remotion Studio: ${error.message}`));
35
+ process.exit(1);
36
+ });
37
+ process.on("SIGINT", () => {
38
+ studio.kill("SIGINT");
39
+ process.exit(0);
40
+ });
41
+ process.on("SIGTERM", () => {
42
+ studio.kill("SIGTERM");
43
+ process.exit(0);
44
+ });
45
+ } catch (error) {
46
+ console.error("Error executing http-serve:", error);
47
+ process.exit(1);
48
+ }
49
+ });
50
+
51
+ //#endregion
52
+ //#region src/commands/mcp-serve.ts
53
+ /**
54
+ * MCP Serve Command
55
+ *
56
+ * DESIGN PATTERNS:
57
+ * - Command pattern with Commander for CLI argument parsing
58
+ * - Transport abstraction pattern for flexible deployment (stdio, HTTP, SSE)
59
+ * - Factory pattern for creating transport handlers
60
+ * - Graceful shutdown pattern with signal handling
61
+ *
62
+ * CODING STANDARDS:
63
+ * - Use async/await for asynchronous operations
64
+ * - Implement proper error handling with try-catch blocks
65
+ * - Handle process signals for graceful shutdown
66
+ * - Provide clear CLI options and help messages
67
+ *
68
+ * AVOID:
69
+ * - Hardcoded configuration values (use CLI options or environment variables)
70
+ * - Missing error handling for transport startup
71
+ * - Not cleaning up resources on shutdown
72
+ */
73
+ /**
74
+ * Start MCP server with given transport handler
75
+ */
76
+ async function startServer(handler) {
77
+ await handler.start();
78
+ const shutdown = async (signal) => {
79
+ console.error(`\nReceived ${signal}, shutting down gracefully...`);
80
+ try {
81
+ await handler.stop();
82
+ process.exit(0);
83
+ } catch (error) {
84
+ console.error("Error during shutdown:", error);
85
+ process.exit(1);
86
+ }
87
+ };
88
+ process.on("SIGINT", () => shutdown("SIGINT"));
89
+ process.on("SIGTERM", () => shutdown("SIGTERM"));
90
+ }
91
+ /**
92
+ * MCP Serve command
93
+ */
94
+ const mcpServeCommand = new Command("mcp-serve").description("Start MCP server with specified transport").option("-t, --type <type>", "Transport type: stdio", "stdio").action(async (options) => {
95
+ try {
96
+ const transportType = options.type.toLowerCase();
97
+ if (transportType === "stdio") await startServer(new StdioTransportHandler(createServer(createContainer())));
98
+ else {
99
+ console.error(`Unknown transport type: ${transportType}. Use: stdio`);
100
+ process.exit(1);
101
+ }
102
+ } catch (error) {
103
+ console.error("Failed to start MCP server:", error);
104
+ process.exit(1);
105
+ }
106
+ });
107
+
108
+ //#endregion
109
+ //#region src/commands/render.ts
110
+ /**
111
+ * Render Command
112
+ *
113
+ * Renders a video from JSON props using Remotion.
114
+ */
115
+ const renderCommand = new Command("render").description("Render a video from JSON props file").requiredOption("-i, --input <path>", "Path to JSON props file").requiredOption("-o, --output <path>", "Output video file path").option("-c, --composition <id>", "Composition ID", "Main").option("--codec <codec>", "Video codec (h264, h265, vp8, vp9)", "h264").action(async (options) => {
116
+ try {
117
+ process.stderr.write(chalk.blue("🎬 Starting video render...\n"));
118
+ process.stderr.write(chalk.gray(` Input: ${options.input}\n`));
119
+ process.stderr.write(chalk.gray(` Output: ${options.output}\n`));
120
+ process.stderr.write(chalk.gray(` Composition: ${options.composition}\n`));
121
+ process.stderr.write(chalk.gray(` Codec: ${options.codec}\n`));
122
+ if (!fs.existsSync(options.input)) {
123
+ process.stderr.write(chalk.red(`Error: Input file not found: ${options.input}\n`));
124
+ process.exit(1);
125
+ }
126
+ const propsContent = fs.readFileSync(options.input, "utf-8");
127
+ const inputProps = JSON.parse(propsContent);
128
+ const renderService = createContainer().get(TYPES.RenderService);
129
+ process.stderr.write(chalk.blue("📦 Bundling Remotion project...\n"));
130
+ const result = await renderService.render({
131
+ compositionId: options.composition,
132
+ inputProps,
133
+ outputPath: options.output,
134
+ codec: options.codec
135
+ });
136
+ process.stderr.write(chalk.green(`✓ Video rendered successfully: ${result.outputPath}\n`));
137
+ } catch (error) {
138
+ process.stderr.write(chalk.red(`Error rendering video: ${error}\n`));
139
+ process.exit(1);
140
+ }
141
+ });
142
+
143
+ //#endregion
144
+ //#region src/cli.ts
145
+ /**
146
+ * MCP Server Entry Point
147
+ *
148
+ * DESIGN PATTERNS:
149
+ * - CLI pattern with Commander for argument parsing
150
+ * - Command pattern for organizing CLI commands
151
+ * - Transport abstraction for multiple communication methods
152
+ *
153
+ * CODING STANDARDS:
154
+ * - Use async/await for asynchronous operations
155
+ * - Handle errors gracefully with try-catch
156
+ * - Log important events for debugging
157
+ * - Register all commands in main entry point
158
+ *
159
+ * AVOID:
160
+ * - Hardcoding command logic in index.ts (use separate command files)
161
+ * - Missing error handling for command execution
162
+ */
163
+ /**
164
+ * Main entry point
165
+ */
166
+ async function main() {
167
+ const program = new Command();
168
+ program.name("video-editor-mcp").description("MCP server for video editing with Remotion").version(version);
169
+ program.addCommand(mcpServeCommand);
170
+ program.addCommand(httpServeCommand);
171
+ program.addCommand(renderCommand);
172
+ await program.parseAsync(process.argv);
173
+ }
174
+ main();
175
+
176
+ //#endregion
177
+ export { };