@agentmedia/mcp-server 0.1.1 → 0.1.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/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@agentmedia/mcp-server",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
+ "mcpName": "io.github.yuvalsuede/agent-media",
4
5
  "description": "MCP server for agent-media — generate AI UGC videos from Claude Code, Cursor, Windsurf, or any MCP-compatible client.",
5
6
  "type": "module",
6
7
  "license": "Apache-2.0",
@@ -28,6 +29,12 @@
28
29
  "publishConfig": {
29
30
  "access": "public"
30
31
  },
32
+ "files": [
33
+ "dist",
34
+ "README.md",
35
+ "LICENSE",
36
+ "server.json"
37
+ ],
31
38
  "bin": {
32
39
  "mcp-server": "./dist/index.js",
33
40
  "agent-media-mcp": "./dist/index.js"
package/server.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.yuvalsuede/agent-media",
4
+ "description": "Generate AI UGC videos with talking heads, B-roll, and subtitles.",
5
+ "repository": {
6
+ "url": "https://github.com/yuvalsuede/agent-media",
7
+ "source": "github",
8
+ "subfolder": "packages/mcp-server"
9
+ },
10
+ "version": "0.1.3",
11
+ "packages": [
12
+ {
13
+ "registryType": "npm",
14
+ "identifier": "@agentmedia/mcp-server",
15
+ "version": "0.1.3",
16
+ "transport": {
17
+ "type": "stdio"
18
+ },
19
+ "environmentVariables": [
20
+ {
21
+ "description": "API key (ma_xxx format) from agent-media.ai",
22
+ "isRequired": true,
23
+ "format": "string",
24
+ "isSecret": true,
25
+ "name": "AGENT_MEDIA_API_KEY"
26
+ }
27
+ ]
28
+ }
29
+ ]
30
+ }
@@ -1,3 +0,0 @@
1
- {
2
- "0bd6ae0e-31bc-4fd0-a11b-5a413dfb6071": 6747
3
- }
@@ -1 +0,0 @@
1
- []
@@ -1,5 +0,0 @@
1
- {
2
- "name": "mcp-server",
3
- "description": "",
4
- "extractionCount": 3
5
- }
package/CLAUDE.md DELETED
@@ -1,7 +0,0 @@
1
- <!-- MEMORY:START -->
2
- # mcp-server
3
-
4
- _Last updated: 2026-04-13 | 0 active memories, 0 total_
5
-
6
- _For deeper context, use memory_search, memory_related, or memory_ask tools._
7
- <!-- MEMORY:END -->
package/src/index.ts DELETED
@@ -1,208 +0,0 @@
1
- #!/usr/bin/env node
2
- // Copyright 2026 agent-media contributors. Apache-2.0 license.
3
-
4
- /**
5
- * agent-media MCP Server
6
- *
7
- * Exposes agent-media video generation to Claude Code, Cursor, Windsurf,
8
- * and any MCP-compatible client.
9
- *
10
- * Tools:
11
- * - create_video: Generate a UGC video from a script
12
- * - list_actors: Browse available AI actors
13
- * - get_video_status: Check generation job status
14
- *
15
- * Auth: Set AGENT_MEDIA_API_KEY env var (ma_xxx format).
16
- * API URL: Defaults to api-v2. Override with AGENT_MEDIA_API_URL.
17
- */
18
-
19
- import { Server } from '@modelcontextprotocol/sdk/server/index.js';
20
- import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
21
- import {
22
- CallToolRequestSchema,
23
- ListToolsRequestSchema,
24
- } from '@modelcontextprotocol/sdk/types.js';
25
- import { zodToJsonSchema } from 'zod-to-json-schema';
26
- import {
27
- GENERATORS,
28
- CreateVideoSchema,
29
- } from '@agentmedia/schema';
30
-
31
- const API_URL = process.env.AGENT_MEDIA_API_URL || 'https://api-v2-production-2f24.up.railway.app';
32
- const API_KEY = process.env.AGENT_MEDIA_API_KEY || '';
33
-
34
- if (!API_KEY) {
35
- console.error('AGENT_MEDIA_API_KEY is required. Set it to your ma_xxx API key.');
36
- process.exit(1);
37
- }
38
-
39
- // ── API client ───────────────────────────────────────────────────────────────
40
-
41
- async function apiCall(method: string, path: string, body?: unknown): Promise<{ status: number; data: any }> {
42
- const resp = await fetch(`${API_URL}${path}`, {
43
- method,
44
- headers: {
45
- 'Content-Type': 'application/json',
46
- 'Authorization': `Bearer ${API_KEY}`,
47
- },
48
- ...(body ? { body: JSON.stringify(body) } : {}),
49
- signal: AbortSignal.timeout(60_000),
50
- });
51
- const data = await resp.json();
52
- return { status: resp.status, data };
53
- }
54
-
55
- async function pollUntilDone(jobId: string, maxWait = 600_000): Promise<any> {
56
- const start = Date.now();
57
- while (Date.now() - start < maxWait) {
58
- const { data } = await apiCall('GET', `/v1/videos/${jobId}`);
59
- if (data.status === 'completed' || data.status === 'failed') return data;
60
- await new Promise(r => setTimeout(r, 5_000));
61
- }
62
- return { status: 'timeout', error_message: 'Polling timed out after 10 minutes' };
63
- }
64
-
65
- // ── Tool definitions ─────────────────────────────────────────────────────────
66
-
67
- const createVideoSchema = zodToJsonSchema(CreateVideoSchema, {
68
- name: 'create_video_input',
69
- $refStrategy: 'none',
70
- });
71
- const createVideoInputSchema = (createVideoSchema as any).definitions?.create_video_input ?? createVideoSchema;
72
-
73
- const tools = [
74
- {
75
- name: 'create_video',
76
- description: GENERATORS.ugc_video.description + '. Submits the job and polls until complete. Returns the video URL.',
77
- inputSchema: createVideoInputSchema,
78
- },
79
- {
80
- name: 'list_actors',
81
- description: 'List available AI actors for talking head videos. Returns slugs, names, and demographics. Use the slug in create_video\'s actor_slug field.',
82
- inputSchema: {
83
- type: 'object' as const,
84
- properties: {
85
- limit: { type: 'number', description: 'Max actors to return (default 20, max 200)', default: 20 },
86
- offset: { type: 'number', description: 'Pagination offset', default: 0 },
87
- },
88
- },
89
- },
90
- {
91
- name: 'get_video_status',
92
- description: 'Check the status of a video generation job. Returns status, video URL (when completed), and error message (when failed).',
93
- inputSchema: {
94
- type: 'object' as const,
95
- properties: {
96
- job_id: { type: 'string', description: 'Job ID from create_video' },
97
- },
98
- required: ['job_id'],
99
- },
100
- },
101
- ];
102
-
103
- // ── MCP Server ───────────────────────────────────────────────────────────────
104
-
105
- const server = new Server(
106
- { name: 'agent-media', version: '0.1.0' },
107
- { capabilities: { tools: {} } },
108
- );
109
-
110
- server.setRequestHandler(ListToolsRequestSchema, async () => ({
111
- tools,
112
- }));
113
-
114
- server.setRequestHandler(CallToolRequestSchema, async (request) => {
115
- const { name, arguments: args } = request.params;
116
-
117
- switch (name) {
118
- case 'create_video': {
119
- const { status, data } = await apiCall('POST', '/v1/generate/ugc_video', args);
120
- if (status !== 201) {
121
- return {
122
- content: [{ type: 'text', text: `Error (${status}): ${data.error?.message ?? JSON.stringify(data)}` }],
123
- isError: true,
124
- };
125
- }
126
-
127
- // Poll until done
128
- const result = await pollUntilDone(data.job_id);
129
-
130
- if (result.status === 'completed') {
131
- return {
132
- content: [{
133
- type: 'text',
134
- text: `Video generated successfully!\n\nJob ID: ${data.job_id}\nCredits: ${data.credits_deducted}\nVideo URL: ${result.video_url}`,
135
- }],
136
- };
137
- } else if (result.status === 'failed') {
138
- return {
139
- content: [{ type: 'text', text: `Video generation failed: ${result.error_message}` }],
140
- isError: true,
141
- };
142
- } else {
143
- return {
144
- content: [{ type: 'text', text: `Video generation timed out. Job ID: ${data.job_id} — check status later.` }],
145
- };
146
- }
147
- }
148
-
149
- case 'list_actors': {
150
- const limit = (args as any)?.limit ?? 20;
151
- const offset = (args as any)?.offset ?? 0;
152
- const { status, data } = await apiCall('GET', `/v1/actors?limit=${limit}&offset=${offset}`);
153
-
154
- if (status !== 200) {
155
- return {
156
- content: [{ type: 'text', text: `Error: ${data.error?.message ?? 'Failed to fetch actors'}` }],
157
- isError: true,
158
- };
159
- }
160
-
161
- const actorList = data.actors.map((a: any) =>
162
- `${a.slug} — ${a.name} (${a.gender}, ${a.age}, ${a.nationality})`
163
- ).join('\n');
164
-
165
- return {
166
- content: [{
167
- type: 'text',
168
- text: `${data.total} actors available (showing ${data.actors.length}):\n\n${actorList}`,
169
- }],
170
- };
171
- }
172
-
173
- case 'get_video_status': {
174
- const jobId = (args as any)?.job_id;
175
- if (!jobId) {
176
- return { content: [{ type: 'text', text: 'job_id is required' }], isError: true };
177
- }
178
-
179
- const { status, data } = await apiCall('GET', `/v1/videos/${jobId}`);
180
- if (status === 404) {
181
- return { content: [{ type: 'text', text: `Job ${jobId} not found` }], isError: true };
182
- }
183
-
184
- return {
185
- content: [{
186
- type: 'text',
187
- text: `Job: ${data.job_id}\nStatus: ${data.status}\n${data.video_url ? `Video URL: ${data.video_url}` : ''}${data.error_message ? `Error: ${data.error_message}` : ''}`,
188
- }],
189
- };
190
- }
191
-
192
- default:
193
- return { content: [{ type: 'text', text: `Unknown tool: ${name}` }], isError: true };
194
- }
195
- });
196
-
197
- // ── Start ────────────────────────────────────────────────────────────────────
198
-
199
- async function main() {
200
- const transport = new StdioServerTransport();
201
- await server.connect(transport);
202
- console.error('agent-media MCP server running on stdio');
203
- }
204
-
205
- main().catch((err) => {
206
- console.error('Fatal:', err);
207
- process.exit(1);
208
- });
package/tsconfig.json DELETED
@@ -1,15 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "ESNext",
5
- "moduleResolution": "bundler",
6
- "strict": true,
7
- "outDir": "./dist",
8
- "rootDir": "./src",
9
- "declaration": true,
10
- "sourceMap": true,
11
- "esModuleInterop": true,
12
- "skipLibCheck": true
13
- },
14
- "include": ["src"]
15
- }