@shuffll/mcp-server 1.0.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/build/api-client.d.ts +56 -0
- package/build/api-client.js +216 -0
- package/build/api-client.js.map +1 -0
- package/build/config.d.ts +7 -0
- package/build/config.js +17 -0
- package/build/config.js.map +1 -0
- package/build/index.d.ts +2 -0
- package/build/index.js +35 -0
- package/build/index.js.map +1 -0
- package/build/resources.d.ts +4 -0
- package/build/resources.js +119 -0
- package/build/resources.js.map +1 -0
- package/build/tools/content-tools.d.ts +4 -0
- package/build/tools/content-tools.js +112 -0
- package/build/tools/content-tools.js.map +1 -0
- package/build/tools/edit-tools.d.ts +4 -0
- package/build/tools/edit-tools.js +290 -0
- package/build/tools/edit-tools.js.map +1 -0
- package/build/tools/project-tools.d.ts +4 -0
- package/build/tools/project-tools.js +179 -0
- package/build/tools/project-tools.js.map +1 -0
- package/build/tools/scene-tools.d.ts +4 -0
- package/build/tools/scene-tools.js +157 -0
- package/build/tools/scene-tools.js.map +1 -0
- package/build/types.d.ts +169 -0
- package/build/types.js +5 -0
- package/build/types.js.map +1 -0
- package/build/utils/logger.d.ts +5 -0
- package/build/utils/logger.js +15 -0
- package/build/utils/logger.js.map +1 -0
- package/build/utils/polling.d.ts +5 -0
- package/build/utils/polling.js +11 -0
- package/build/utils/polling.js.map +1 -0
- package/package.json +33 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ShufflMcpConfig } from "./config.js";
|
|
2
|
+
import type { CreateProjectRequest, ProjectCreationResponse, CreationStatusResponse, ProjectOutDTO, ExportStatusResponse, EnhanceStatusResponse, ScriptSuggestionResponse, SelectedShot, UpdatePropertyRequest, TemplateOutDTO, PromptSuggestion } from "./types.js";
|
|
3
|
+
export declare class ShufflApiError extends Error {
|
|
4
|
+
statusCode: number;
|
|
5
|
+
responseBody: unknown;
|
|
6
|
+
constructor(statusCode: number, responseBody: unknown, message?: string);
|
|
7
|
+
}
|
|
8
|
+
export declare class ShufflApiClient {
|
|
9
|
+
private baseUrl;
|
|
10
|
+
private apiKey;
|
|
11
|
+
constructor(config: ShufflMcpConfig);
|
|
12
|
+
private request;
|
|
13
|
+
private get;
|
|
14
|
+
private post;
|
|
15
|
+
private put;
|
|
16
|
+
private delete;
|
|
17
|
+
createProject(body: CreateProjectRequest): Promise<ProjectCreationResponse>;
|
|
18
|
+
getProject(projectId: string): Promise<ProjectOutDTO>;
|
|
19
|
+
getCreationStatus(projectId: string): Promise<CreationStatusResponse>;
|
|
20
|
+
updateProject(projectId: string, key: string, value: unknown): Promise<unknown>;
|
|
21
|
+
deleteProject(projectId: string): Promise<unknown>;
|
|
22
|
+
updateAiVoice(projectId: string, key: string, value: unknown, startGenerateAiVoice?: boolean): Promise<unknown>;
|
|
23
|
+
updateAiAvatar(projectId: string, key: string, value: unknown, startGenerateAiVoice?: boolean): Promise<unknown>;
|
|
24
|
+
addScene(projectId: string, composition: unknown, relativePosition?: {
|
|
25
|
+
position: "before" | "after";
|
|
26
|
+
sceneId?: string;
|
|
27
|
+
}): Promise<unknown>;
|
|
28
|
+
getScene(projectId: string, sceneId: string): Promise<unknown>;
|
|
29
|
+
updateScene(projectId: string, sceneId: string, key: string, value: unknown): Promise<unknown>;
|
|
30
|
+
updateSceneComposition(projectId: string, sceneId: string, composition: unknown): Promise<unknown>;
|
|
31
|
+
deleteScene(projectId: string, sceneId: string): Promise<unknown>;
|
|
32
|
+
writeSceneScript(projectId: string, sceneId: string): Promise<ScriptSuggestionResponse>;
|
|
33
|
+
createDefaultEdit(projectId: string): Promise<ProjectOutDTO>;
|
|
34
|
+
createEdit(projectId: string, edit?: unknown): Promise<unknown>;
|
|
35
|
+
getEdit(projectId: string, editId: string): Promise<unknown>;
|
|
36
|
+
updateEditShots(projectId: string, editId: string, selectedShots: SelectedShot[], toAutoEnhanceDemo?: boolean, toAutoExport?: boolean): Promise<unknown>;
|
|
37
|
+
updateEditProperty(projectId: string, editId: string, properties: UpdatePropertyRequest[]): Promise<unknown>;
|
|
38
|
+
updateEditStatus(projectId: string, editId: string, status: string): Promise<unknown>;
|
|
39
|
+
exportEdit(projectId: string, editId: string): Promise<{
|
|
40
|
+
projectId: string;
|
|
41
|
+
editId: string;
|
|
42
|
+
}>;
|
|
43
|
+
getExportStatus(projectId: string, editId: string): Promise<ExportStatusResponse>;
|
|
44
|
+
getEnhanceStatus(projectId: string, editId: string): Promise<EnhanceStatusResponse>;
|
|
45
|
+
generateAiVoiceForEdit(projectId: string, editId: string): Promise<unknown>;
|
|
46
|
+
generateAiVoiceForScene(projectId: string, editId: string, sceneId: string): Promise<unknown>;
|
|
47
|
+
updateSubtitleProperty(projectId: string, editId: string, key: string, value: unknown): Promise<unknown>;
|
|
48
|
+
updateBGMusic(projectId: string, editId: string, properties: UpdatePropertyRequest[]): Promise<unknown>;
|
|
49
|
+
rewriteText(projectId: string, selectedText: string, rewriteType: string, context?: string): Promise<ScriptSuggestionResponse>;
|
|
50
|
+
rewriteTextCustom(projectId: string, selectedText: string, customPrompt: string, context?: string): Promise<ScriptSuggestionResponse>;
|
|
51
|
+
getTemplates(): Promise<TemplateOutDTO[]>;
|
|
52
|
+
getPlatformTemplates(): Promise<TemplateOutDTO[]>;
|
|
53
|
+
getTemplate(templateId: string): Promise<TemplateOutDTO>;
|
|
54
|
+
getBranding(entityId: string): Promise<unknown>;
|
|
55
|
+
getPromptSuggestions(workspaceId: string): Promise<PromptSuggestion[]>;
|
|
56
|
+
}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { logError } from "./utils/logger.js";
|
|
2
|
+
export class ShufflApiError extends Error {
|
|
3
|
+
statusCode;
|
|
4
|
+
responseBody;
|
|
5
|
+
constructor(statusCode, responseBody, message) {
|
|
6
|
+
super(message || `Shuffll API request failed with status ${statusCode}`);
|
|
7
|
+
this.statusCode = statusCode;
|
|
8
|
+
this.responseBody = responseBody;
|
|
9
|
+
this.name = "ShufflApiError";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export class ShufflApiClient {
|
|
13
|
+
baseUrl;
|
|
14
|
+
apiKey;
|
|
15
|
+
constructor(config) {
|
|
16
|
+
this.baseUrl = config.apiBaseUrl;
|
|
17
|
+
this.apiKey = config.apiKey;
|
|
18
|
+
}
|
|
19
|
+
// ------------------------------------------------------------------
|
|
20
|
+
// Internal HTTP helpers
|
|
21
|
+
// ------------------------------------------------------------------
|
|
22
|
+
async request(method, path, body) {
|
|
23
|
+
const url = `${this.baseUrl}${path}`;
|
|
24
|
+
const headers = {
|
|
25
|
+
"X-API-KEY": this.apiKey,
|
|
26
|
+
"Content-Type": "application/json",
|
|
27
|
+
};
|
|
28
|
+
const res = await fetch(url, {
|
|
29
|
+
method,
|
|
30
|
+
headers,
|
|
31
|
+
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
32
|
+
});
|
|
33
|
+
let responseBody;
|
|
34
|
+
const contentType = res.headers.get("content-type") || "";
|
|
35
|
+
if (contentType.includes("application/json")) {
|
|
36
|
+
responseBody = await res.json();
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
responseBody = await res.text();
|
|
40
|
+
}
|
|
41
|
+
if (!res.ok) {
|
|
42
|
+
logError(`API ${method} ${path} failed (${res.status})`, responseBody);
|
|
43
|
+
throw new ShufflApiError(res.status, responseBody);
|
|
44
|
+
}
|
|
45
|
+
return responseBody;
|
|
46
|
+
}
|
|
47
|
+
get(path) {
|
|
48
|
+
return this.request("GET", path);
|
|
49
|
+
}
|
|
50
|
+
post(path, body) {
|
|
51
|
+
return this.request("POST", path, body);
|
|
52
|
+
}
|
|
53
|
+
put(path, body) {
|
|
54
|
+
return this.request("PUT", path, body);
|
|
55
|
+
}
|
|
56
|
+
delete(path, body) {
|
|
57
|
+
return this.request("DELETE", path, body);
|
|
58
|
+
}
|
|
59
|
+
// ------------------------------------------------------------------
|
|
60
|
+
// Project lifecycle
|
|
61
|
+
// ------------------------------------------------------------------
|
|
62
|
+
async createProject(body) {
|
|
63
|
+
return this.post("/auth/project/create/", body);
|
|
64
|
+
}
|
|
65
|
+
async getProject(projectId) {
|
|
66
|
+
return this.get(`/auth/project/${projectId}`);
|
|
67
|
+
}
|
|
68
|
+
async getCreationStatus(projectId) {
|
|
69
|
+
return this.get(`/auth/project/${projectId}/create/status`);
|
|
70
|
+
}
|
|
71
|
+
async updateProject(projectId, key, value) {
|
|
72
|
+
return this.put(`/auth/project/${projectId}`, { key, value });
|
|
73
|
+
}
|
|
74
|
+
async deleteProject(projectId) {
|
|
75
|
+
return this.delete(`/auth/project/${projectId}`);
|
|
76
|
+
}
|
|
77
|
+
// ------------------------------------------------------------------
|
|
78
|
+
// AI Voice / Avatar settings
|
|
79
|
+
// ------------------------------------------------------------------
|
|
80
|
+
async updateAiVoice(projectId, key, value, startGenerateAiVoice = false) {
|
|
81
|
+
return this.put(`/auth/project/${projectId}/ai-voice`, {
|
|
82
|
+
key,
|
|
83
|
+
value,
|
|
84
|
+
startGenerateAiVoice,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
async updateAiAvatar(projectId, key, value, startGenerateAiVoice = false) {
|
|
88
|
+
return this.put(`/auth/project/${projectId}/ai-avatar`, {
|
|
89
|
+
key,
|
|
90
|
+
value,
|
|
91
|
+
startGenerateAiVoice,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
// ------------------------------------------------------------------
|
|
95
|
+
// Scene management
|
|
96
|
+
// ------------------------------------------------------------------
|
|
97
|
+
async addScene(projectId, composition, relativePosition) {
|
|
98
|
+
return this.post(`/auth/project/${projectId}/add-scene`, {
|
|
99
|
+
composition,
|
|
100
|
+
relativePosition,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
async getScene(projectId, sceneId) {
|
|
104
|
+
return this.get(`/auth/project/${projectId}/scenes/${sceneId}`);
|
|
105
|
+
}
|
|
106
|
+
async updateScene(projectId, sceneId, key, value) {
|
|
107
|
+
return this.put(`/auth/project/${projectId}/scenes/${sceneId}`, {
|
|
108
|
+
key,
|
|
109
|
+
value,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
async updateSceneComposition(projectId, sceneId, composition) {
|
|
113
|
+
return this.put(`/auth/project/${projectId}/scenes/${sceneId}/composition`, { composition });
|
|
114
|
+
}
|
|
115
|
+
async deleteScene(projectId, sceneId) {
|
|
116
|
+
return this.delete(`/auth/project/${projectId}/scenes/${sceneId}`);
|
|
117
|
+
}
|
|
118
|
+
async writeSceneScript(projectId, sceneId) {
|
|
119
|
+
return this.post(`/auth/project/${projectId}/scenes/${sceneId}/write-scene-script`);
|
|
120
|
+
}
|
|
121
|
+
// ------------------------------------------------------------------
|
|
122
|
+
// Edit / Export
|
|
123
|
+
// ------------------------------------------------------------------
|
|
124
|
+
async createDefaultEdit(projectId) {
|
|
125
|
+
return this.post(`/auth/project/${projectId}/edit/default`);
|
|
126
|
+
}
|
|
127
|
+
async createEdit(projectId, edit) {
|
|
128
|
+
return this.post(`/auth/project/${projectId}/edit`, {
|
|
129
|
+
edit,
|
|
130
|
+
isDummy: false,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
async getEdit(projectId, editId) {
|
|
134
|
+
return this.get(`/auth/project/${projectId}/edit/${editId}`);
|
|
135
|
+
}
|
|
136
|
+
async updateEditShots(projectId, editId, selectedShots, toAutoEnhanceDemo = false, toAutoExport = false) {
|
|
137
|
+
return this.put(`/auth/project/${projectId}/edit/${editId}`, {
|
|
138
|
+
dataToUpdate: { selectedShots, toAutoEnhanceDemo, toAutoExport },
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
async updateEditProperty(projectId, editId, properties) {
|
|
142
|
+
return this.put(`/auth/project/${projectId}/edit/${editId}/property`, {
|
|
143
|
+
propertiesToUpdate: properties,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
async updateEditStatus(projectId, editId, status) {
|
|
147
|
+
return this.put(`/auth/project/${projectId}/edit/${editId}/status`, {
|
|
148
|
+
status,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
async exportEdit(projectId, editId) {
|
|
152
|
+
return this.post(`/auth/project/${projectId}/edit/${editId}/export`);
|
|
153
|
+
}
|
|
154
|
+
async getExportStatus(projectId, editId) {
|
|
155
|
+
return this.get(`/auth/project/${projectId}/edit/${editId}/status/export`);
|
|
156
|
+
}
|
|
157
|
+
async getEnhanceStatus(projectId, editId) {
|
|
158
|
+
return this.get(`/auth/project/${projectId}/edit/${editId}/status/enhance`);
|
|
159
|
+
}
|
|
160
|
+
async generateAiVoiceForEdit(projectId, editId) {
|
|
161
|
+
return this.post(`/auth/project/${projectId}/edit/${editId}/voice_ai`, {
|
|
162
|
+
projectStatus: "editing",
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
async generateAiVoiceForScene(projectId, editId, sceneId) {
|
|
166
|
+
return this.post(`/auth/project/${projectId}/edit/${editId}/scene_voice_ai`, { projectStatus: "editing", sceneId });
|
|
167
|
+
}
|
|
168
|
+
// ------------------------------------------------------------------
|
|
169
|
+
// Subtitles
|
|
170
|
+
// ------------------------------------------------------------------
|
|
171
|
+
async updateSubtitleProperty(projectId, editId, key, value) {
|
|
172
|
+
return this.put(`/auth/project/${projectId}/edit/${editId}/subtitles`, { key, value });
|
|
173
|
+
}
|
|
174
|
+
// ------------------------------------------------------------------
|
|
175
|
+
// Background music
|
|
176
|
+
// ------------------------------------------------------------------
|
|
177
|
+
async updateBGMusic(projectId, editId, properties) {
|
|
178
|
+
return this.put(`/auth/project/${projectId}/edit/${editId}/bg-music`, {
|
|
179
|
+
properties,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
// ------------------------------------------------------------------
|
|
183
|
+
// Content / Text rewriting
|
|
184
|
+
// ------------------------------------------------------------------
|
|
185
|
+
async rewriteText(projectId, selectedText, rewriteType, context) {
|
|
186
|
+
return this.post(`/auth/project/${projectId}/rewrite-text`, { selectedText, rewriteType, context });
|
|
187
|
+
}
|
|
188
|
+
async rewriteTextCustom(projectId, selectedText, customPrompt, context) {
|
|
189
|
+
return this.post(`/auth/project/${projectId}/rewrite-text-custom`, { selectedText, customPrompt, context });
|
|
190
|
+
}
|
|
191
|
+
// ------------------------------------------------------------------
|
|
192
|
+
// Templates
|
|
193
|
+
// ------------------------------------------------------------------
|
|
194
|
+
async getTemplates() {
|
|
195
|
+
return this.get(`/auth/templates`);
|
|
196
|
+
}
|
|
197
|
+
async getPlatformTemplates() {
|
|
198
|
+
return this.get(`/auth/templates/platform`);
|
|
199
|
+
}
|
|
200
|
+
async getTemplate(templateId) {
|
|
201
|
+
return this.get(`/auth/templates/${templateId}`);
|
|
202
|
+
}
|
|
203
|
+
// ------------------------------------------------------------------
|
|
204
|
+
// Branding
|
|
205
|
+
// ------------------------------------------------------------------
|
|
206
|
+
async getBranding(entityId) {
|
|
207
|
+
return this.get(`/auth/branding/entity?entityId=${entityId}`);
|
|
208
|
+
}
|
|
209
|
+
// ------------------------------------------------------------------
|
|
210
|
+
// Creative / Prompt suggestions
|
|
211
|
+
// ------------------------------------------------------------------
|
|
212
|
+
async getPromptSuggestions(workspaceId) {
|
|
213
|
+
return this.get(`/auth/creative/prompt-suggestions?workspaceId=${workspaceId}`);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
//# sourceMappingURL=api-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-client.js","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAe7C,MAAM,OAAO,cAAe,SAAQ,KAAK;IAE9B;IACA;IAFT,YACS,UAAkB,EAClB,YAAqB,EAC5B,OAAgB;QAEhB,KAAK,CAAC,OAAO,IAAI,0CAA0C,UAAU,EAAE,CAAC,CAAC;QAJlE,eAAU,GAAV,UAAU,CAAQ;QAClB,iBAAY,GAAZ,YAAY,CAAS;QAI5B,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC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QAEnB,OAAO,IAAI,CAAC,GAAG,CACb,iDAAiD,WAAW,EAAE,CAC/D,CAAC;IACJ,CAAC;CACF"}
|
package/build/config.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function loadConfig() {
|
|
2
|
+
const apiBaseUrl = process.env.SHUFFLL_API_BASE_URL;
|
|
3
|
+
const apiKey = process.env.SHUFFLL_API_KEY;
|
|
4
|
+
if (!apiBaseUrl) {
|
|
5
|
+
throw new Error("SHUFFLL_API_BASE_URL environment variable is required");
|
|
6
|
+
}
|
|
7
|
+
if (!apiKey) {
|
|
8
|
+
throw new Error("SHUFFLL_API_KEY environment variable is required");
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
apiBaseUrl: apiBaseUrl.replace(/\/$/, ""),
|
|
12
|
+
apiKey,
|
|
13
|
+
pollIntervalMs: parseInt(process.env.SHUFFLL_POLL_INTERVAL_MS || "3000", 10),
|
|
14
|
+
pollTimeoutMs: parseInt(process.env.SHUFFLL_POLL_TIMEOUT_MS || "300000", 10),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,UAAU;IACxB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;IACpD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;IAE3C,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;IACD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IAED,OAAO;QACL,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;QACzC,MAAM;QACN,cAAc,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,MAAM,EAAE,EAAE,CAAC;QAC5E,aAAa,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,QAAQ,EAAE,EAAE,CAAC;KAC7E,CAAC;AACJ,CAAC"}
|
package/build/index.d.ts
ADDED
package/build/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { loadConfig } from "./config.js";
|
|
5
|
+
import { ShufflApiClient } from "./api-client.js";
|
|
6
|
+
import { registerProjectTools } from "./tools/project-tools.js";
|
|
7
|
+
import { registerSceneTools } from "./tools/scene-tools.js";
|
|
8
|
+
import { registerEditTools } from "./tools/edit-tools.js";
|
|
9
|
+
import { registerContentTools } from "./tools/content-tools.js";
|
|
10
|
+
import { registerResources } from "./resources.js";
|
|
11
|
+
import { log, logError } from "./utils/logger.js";
|
|
12
|
+
async function main() {
|
|
13
|
+
const config = loadConfig();
|
|
14
|
+
const apiClient = new ShufflApiClient(config);
|
|
15
|
+
const server = new McpServer({
|
|
16
|
+
name: "shuffll-video",
|
|
17
|
+
version: "1.0.0",
|
|
18
|
+
});
|
|
19
|
+
// Register all tools
|
|
20
|
+
registerProjectTools(server, apiClient, config);
|
|
21
|
+
registerSceneTools(server, apiClient, config);
|
|
22
|
+
registerEditTools(server, apiClient, config);
|
|
23
|
+
registerContentTools(server, apiClient, config);
|
|
24
|
+
// Register resources
|
|
25
|
+
registerResources(server, apiClient, config);
|
|
26
|
+
// Connect via stdio transport
|
|
27
|
+
const transport = new StdioServerTransport();
|
|
28
|
+
await server.connect(transport);
|
|
29
|
+
log("Shuffll MCP server started successfully");
|
|
30
|
+
}
|
|
31
|
+
main().catch((error) => {
|
|
32
|
+
logError("Fatal error starting Shuffll MCP server", error);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,MAAM,SAAS,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;IAE9C,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;IAEH,qBAAqB;IACrB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAChD,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAC9C,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAC7C,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAEhD,qBAAqB;IACrB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAE7C,8BAA8B;IAC9B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,GAAG,CAAC,yCAAyC,CAAC,CAAC;AACjD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,QAAQ,CAAC,yCAAyC,EAAE,KAAK,CAAC,CAAC;IAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { ShufflApiClient } from "./api-client.js";
|
|
3
|
+
import { ShufflMcpConfig } from "./config.js";
|
|
4
|
+
export declare function registerResources(server: McpServer, apiClient: ShufflApiClient, _config: ShufflMcpConfig): void;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { ShufflApiError } from "./api-client.js";
|
|
2
|
+
function formatError(error) {
|
|
3
|
+
if (error instanceof ShufflApiError) {
|
|
4
|
+
return `Shuffll API error (${error.statusCode}): ${JSON.stringify(error.responseBody)}`;
|
|
5
|
+
}
|
|
6
|
+
if (error instanceof Error) {
|
|
7
|
+
return `Error: ${error.message}`;
|
|
8
|
+
}
|
|
9
|
+
return `Unknown error: ${String(error)}`;
|
|
10
|
+
}
|
|
11
|
+
export function registerResources(server, apiClient, _config) {
|
|
12
|
+
// ----------------------------------------------------------------
|
|
13
|
+
// shuffll://templates
|
|
14
|
+
// ----------------------------------------------------------------
|
|
15
|
+
server.resource("templates", "shuffll://templates", {
|
|
16
|
+
description: "List of available video templates in the workspace with their names, descriptions, and scene structures.",
|
|
17
|
+
mimeType: "application/json",
|
|
18
|
+
}, async () => {
|
|
19
|
+
try {
|
|
20
|
+
const templates = await apiClient.getTemplates();
|
|
21
|
+
return {
|
|
22
|
+
contents: [
|
|
23
|
+
{
|
|
24
|
+
uri: "shuffll://templates",
|
|
25
|
+
mimeType: "application/json",
|
|
26
|
+
text: JSON.stringify(templates, null, 2),
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
return {
|
|
33
|
+
contents: [
|
|
34
|
+
{
|
|
35
|
+
uri: "shuffll://templates",
|
|
36
|
+
mimeType: "text/plain",
|
|
37
|
+
text: formatError(error),
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
// ----------------------------------------------------------------
|
|
44
|
+
// shuffll://templates/platform
|
|
45
|
+
// ----------------------------------------------------------------
|
|
46
|
+
server.resource("platform-templates", "shuffll://templates/platform", {
|
|
47
|
+
description: "Platform-wide video templates available to all users.",
|
|
48
|
+
mimeType: "application/json",
|
|
49
|
+
}, async () => {
|
|
50
|
+
try {
|
|
51
|
+
const templates = await apiClient.getPlatformTemplates();
|
|
52
|
+
return {
|
|
53
|
+
contents: [
|
|
54
|
+
{
|
|
55
|
+
uri: "shuffll://templates/platform",
|
|
56
|
+
mimeType: "application/json",
|
|
57
|
+
text: JSON.stringify(templates, null, 2),
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
return {
|
|
64
|
+
contents: [
|
|
65
|
+
{
|
|
66
|
+
uri: "shuffll://templates/platform",
|
|
67
|
+
mimeType: "text/plain",
|
|
68
|
+
text: formatError(error),
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
// ----------------------------------------------------------------
|
|
75
|
+
// shuffll://project/{projectId}
|
|
76
|
+
// ----------------------------------------------------------------
|
|
77
|
+
server.resource("project", "shuffll://project/{projectId}", {
|
|
78
|
+
description: "Full details of a specific video project including scenes, edits, and status.",
|
|
79
|
+
mimeType: "application/json",
|
|
80
|
+
}, async (uri) => {
|
|
81
|
+
try {
|
|
82
|
+
// Extract projectId from the URI
|
|
83
|
+
const projectId = uri.pathname.split("/").pop();
|
|
84
|
+
if (!projectId) {
|
|
85
|
+
return {
|
|
86
|
+
contents: [
|
|
87
|
+
{
|
|
88
|
+
uri: uri.href,
|
|
89
|
+
mimeType: "text/plain",
|
|
90
|
+
text: "Error: No project ID provided in URI",
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
const project = await apiClient.getProject(projectId);
|
|
96
|
+
return {
|
|
97
|
+
contents: [
|
|
98
|
+
{
|
|
99
|
+
uri: uri.href,
|
|
100
|
+
mimeType: "application/json",
|
|
101
|
+
text: JSON.stringify(project, null, 2),
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
return {
|
|
108
|
+
contents: [
|
|
109
|
+
{
|
|
110
|
+
uri: uri.href,
|
|
111
|
+
mimeType: "text/plain",
|
|
112
|
+
text: formatError(error),
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../src/resources.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGlE,SAAS,WAAW,CAAC,KAAc;IACjC,IAAI,KAAK,YAAY,cAAc,EAAE,CAAC;QACpC,OAAO,sBAAsB,KAAK,CAAC,UAAU,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC;IAC1F,CAAC;IACD,IA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AO;gBACL,QAAQ,EAAE;oBACR;wBACE,GAAG,EAAE,GAAG,CAAC,IAAI;wBACb,QAAQ,EAAE,YAAY;wBACtB,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC;qBACzB;iBACF;aACF,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { ShufflApiClient } from "../api-client.js";
|
|
3
|
+
import { ShufflMcpConfig } from "../config.js";
|
|
4
|
+
export declare function registerContentTools(server: McpServer, apiClient: ShufflApiClient, _config: ShufflMcpConfig): void;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ShufflApiError } from "../api-client.js";
|
|
3
|
+
function formatError(error) {
|
|
4
|
+
if (error instanceof ShufflApiError) {
|
|
5
|
+
return `Shuffll API error (${error.statusCode}): ${JSON.stringify(error.responseBody)}`;
|
|
6
|
+
}
|
|
7
|
+
if (error instanceof Error) {
|
|
8
|
+
return `Error: ${error.message}`;
|
|
9
|
+
}
|
|
10
|
+
return `Unknown error: ${String(error)}`;
|
|
11
|
+
}
|
|
12
|
+
export function registerContentTools(server, apiClient, _config) {
|
|
13
|
+
// ----------------------------------------------------------------
|
|
14
|
+
// rewrite_text
|
|
15
|
+
// ----------------------------------------------------------------
|
|
16
|
+
server.tool("rewrite_text", "Use AI to rewrite text in a specific style. Useful for improving scene scripts, headlines, or call-to-action text. Returns one or more rewritten suggestions.", {
|
|
17
|
+
projectId: z
|
|
18
|
+
.string()
|
|
19
|
+
.describe("The project ID (provides context for the rewrite)"),
|
|
20
|
+
selectedText: z
|
|
21
|
+
.string()
|
|
22
|
+
.describe("The text to rewrite"),
|
|
23
|
+
rewriteType: z
|
|
24
|
+
.enum([
|
|
25
|
+
"improve",
|
|
26
|
+
"conversational",
|
|
27
|
+
"shorten",
|
|
28
|
+
"expand",
|
|
29
|
+
"formal",
|
|
30
|
+
"friendly",
|
|
31
|
+
"confident",
|
|
32
|
+
"persuasive",
|
|
33
|
+
])
|
|
34
|
+
.describe("How to rewrite the text"),
|
|
35
|
+
context: z
|
|
36
|
+
.string()
|
|
37
|
+
.optional()
|
|
38
|
+
.describe("Additional context about the text's purpose or where it appears in the video"),
|
|
39
|
+
}, async (args) => {
|
|
40
|
+
try {
|
|
41
|
+
const result = await apiClient.rewriteText(args.projectId, args.selectedText, args.rewriteType, args.context);
|
|
42
|
+
return {
|
|
43
|
+
content: [
|
|
44
|
+
{ type: "text", text: JSON.stringify(result, null, 2) },
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
return {
|
|
50
|
+
content: [{ type: "text", text: formatError(error) }],
|
|
51
|
+
isError: true,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
// ----------------------------------------------------------------
|
|
56
|
+
// rewrite_text_custom
|
|
57
|
+
// ----------------------------------------------------------------
|
|
58
|
+
server.tool("rewrite_text_custom", "Use AI to rewrite text based on a custom prompt/instruction. Provides more flexibility than rewrite_text for specific rewriting needs.", {
|
|
59
|
+
projectId: z
|
|
60
|
+
.string()
|
|
61
|
+
.describe("The project ID (provides context for the rewrite)"),
|
|
62
|
+
selectedText: z
|
|
63
|
+
.string()
|
|
64
|
+
.describe("The text to rewrite"),
|
|
65
|
+
customPrompt: z
|
|
66
|
+
.string()
|
|
67
|
+
.describe("Custom instructions for how to rewrite the text (e.g., 'Make it sound more urgent and add a question at the end')"),
|
|
68
|
+
context: z
|
|
69
|
+
.string()
|
|
70
|
+
.optional()
|
|
71
|
+
.describe("Additional context about the text's purpose"),
|
|
72
|
+
}, async (args) => {
|
|
73
|
+
try {
|
|
74
|
+
const result = await apiClient.rewriteTextCustom(args.projectId, args.selectedText, args.customPrompt, args.context);
|
|
75
|
+
return {
|
|
76
|
+
content: [
|
|
77
|
+
{ type: "text", text: JSON.stringify(result, null, 2) },
|
|
78
|
+
],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
return {
|
|
83
|
+
content: [{ type: "text", text: formatError(error) }],
|
|
84
|
+
isError: true,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
// ----------------------------------------------------------------
|
|
89
|
+
// get_prompt_suggestions
|
|
90
|
+
// ----------------------------------------------------------------
|
|
91
|
+
server.tool("get_prompt_suggestions", "Get AI-generated video prompt suggestions based on workspace branding and company information. Returns suggestions organized by video category/tag.", {
|
|
92
|
+
workspaceId: z
|
|
93
|
+
.string()
|
|
94
|
+
.describe("The workspace ID to get suggestions for"),
|
|
95
|
+
}, async (args) => {
|
|
96
|
+
try {
|
|
97
|
+
const result = await apiClient.getPromptSuggestions(args.workspaceId);
|
|
98
|
+
return {
|
|
99
|
+
content: [
|
|
100
|
+
{ type: "text", text: JSON.stringify(result, null, 2) },
|
|
101
|
+
],
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
return {
|
|
106
|
+
content: [{ type: "text", text: formatError(error) }],
|
|
107
|
+
isError: true,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=content-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-tools.js","sourceRoot":"","sources":["../../src/tools/content-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAmB,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGnE,SAAS,WAAW,CAAC,KAAc;IACjC,IAAI,KAAK,YAAY,cAAc,EAAE,CAAC;QACpC,OAAO,sBAAsB,KAAK,CAAC,UAAU,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC;IAC1F,C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rJ;QACE,WAAW,EAAE,CAAC;aACX,MAAM,EAAE;aACR,QAAQ,CAAC,yCAAyC,CAAC;KACvD,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,oBAAoB,CACjD,IAAI,CAAC,WAAW,CACjB,CAAC;YACF,OAAO;gBACL,OAAO,EAAE;oBACP,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;iBACjE;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC9D,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { ShufflApiClient } from "../api-client.js";
|
|
3
|
+
import { ShufflMcpConfig } from "../config.js";
|
|
4
|
+
export declare function registerEditTools(server: McpServer, apiClient: ShufflApiClient, _config: ShufflMcpConfig): void;
|