beplus-mcp 0.10.1 → 0.12.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/dist/index.js +67 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -157,7 +157,15 @@ var BeplusClient = class {
|
|
|
157
157
|
return this.request("DELETE", `/generations/${id}`);
|
|
158
158
|
}
|
|
159
159
|
listGenerations(query) {
|
|
160
|
-
return this.request("GET", "/generations", {
|
|
160
|
+
return this.request("GET", "/generations", {
|
|
161
|
+
query: {
|
|
162
|
+
limit: query.limit,
|
|
163
|
+
offset: query.offset,
|
|
164
|
+
// Only send when true — the backend treats truthy as "constrain".
|
|
165
|
+
favorite: query.favorite ? "true" : void 0,
|
|
166
|
+
approved: query.approved ? "true" : void 0
|
|
167
|
+
}
|
|
168
|
+
});
|
|
161
169
|
}
|
|
162
170
|
tts(body) {
|
|
163
171
|
return this.request("POST", "/tts", { body, timeoutMs: 9e4 });
|
|
@@ -480,7 +488,7 @@ var VOICES = [
|
|
|
480
488
|
];
|
|
481
489
|
var ASPECT_RATIOS = ["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "4:5", "5:4", "21:9"];
|
|
482
490
|
var IMAGE_RESOLUTIONS = ["1K", "2K", "4K"];
|
|
483
|
-
var VIDEO_RESOLUTIONS = ["480p", "720p", "1080p", "
|
|
491
|
+
var VIDEO_RESOLUTIONS = ["480p", "720p", "1080p", "4K"];
|
|
484
492
|
var DEFAULTS = {
|
|
485
493
|
imageModel: "google/nano-banana-2",
|
|
486
494
|
imageAspect: "1:1",
|
|
@@ -497,6 +505,22 @@ var DEFAULTS = {
|
|
|
497
505
|
// src/tools/generation.ts
|
|
498
506
|
var IMAGE_BUDGET_MS = 9e4;
|
|
499
507
|
var VIDEO_BUDGET_MS = 12e4;
|
|
508
|
+
function flagsLine(g) {
|
|
509
|
+
const parts = [
|
|
510
|
+
g.is_favorite ? "\u2B50 like" : null,
|
|
511
|
+
g.is_approved_plan ? "\u2714\uFE0F aprovado" : null
|
|
512
|
+
].filter(Boolean);
|
|
513
|
+
return parts.length ? `
|
|
514
|
+
${parts.join(" \xB7 ")}` : "";
|
|
515
|
+
}
|
|
516
|
+
function firstOutputUrl(output) {
|
|
517
|
+
if (!output) return null;
|
|
518
|
+
const o = output;
|
|
519
|
+
if (Array.isArray(o) && typeof o[0] === "string") return o[0];
|
|
520
|
+
if (Array.isArray(o.urls) && typeof o.urls[0] === "string") return o.urls[0];
|
|
521
|
+
if (typeof o.url === "string") return o.url;
|
|
522
|
+
return null;
|
|
523
|
+
}
|
|
500
524
|
function registerGenerationTools(server, client, cfg) {
|
|
501
525
|
server.registerTool(
|
|
502
526
|
"generate_image",
|
|
@@ -677,7 +701,7 @@ ${footer}` }, ...blocks] };
|
|
|
677
701
|
prompt: z.string().min(1).max(4e3).describe("Descri\xE7\xE3o do v\xEDdeo desejado."),
|
|
678
702
|
model: z.enum(VIDEO_MODELS).default(DEFAULTS.videoModel).describe("seedance-2.0-fast = barato/r\xE1pido; seedance-2.0 = melhor; kling-v3-video = alternativa."),
|
|
679
703
|
aspect_ratio: z.enum(ASPECT_RATIOS).optional().describe("Propor\xE7\xE3o. Padr\xE3o 16:9."),
|
|
680
|
-
resolution: z.enum(VIDEO_RESOLUTIONS).optional().describe("480p/720p/1080p/
|
|
704
|
+
resolution: z.enum(VIDEO_RESOLUTIONS).optional().describe("480p/720p/1080p/4K (1080p/4K S\xD3 no seedance-2.0 standard; fast e mini aceitam apenas 480p/720p). Padr\xE3o 720p."),
|
|
681
705
|
duration: z.number().int().min(3).max(60).optional().describe(
|
|
682
706
|
"Dura\xE7\xE3o em segundos. Seedance 2.0/2.0-fast: 4\u201315 (granular). Kling: 5 ou 10. O backend valida por modelo \u2014 consulte list_models p/ os valores aceitos. Padr\xE3o 5."
|
|
683
707
|
),
|
|
@@ -699,9 +723,9 @@ ${footer}` }, ...blocks] };
|
|
|
699
723
|
},
|
|
700
724
|
async (args) => {
|
|
701
725
|
try {
|
|
702
|
-
if (args.model === "bytedance/seedance-2.0-mini" && args.resolution && args.resolution !== "480p" && args.resolution !== "720p") {
|
|
726
|
+
if ((args.model === "bytedance/seedance-2.0-mini" || args.model === "bytedance/seedance-2.0-fast") && args.resolution && args.resolution !== "480p" && args.resolution !== "720p") {
|
|
703
727
|
return errorResult(
|
|
704
|
-
|
|
728
|
+
`${args.model} s\xF3 suporta 480p ou 720p (voc\xEA pediu ${args.resolution}). Use seedance-2.0 (standard) para 1080p/4K.`
|
|
705
729
|
);
|
|
706
730
|
}
|
|
707
731
|
const firstFrame = await resolveRef(cfg, args.first_frame_image ?? args.reference_image);
|
|
@@ -777,7 +801,7 @@ ${footer}`);
|
|
|
777
801
|
const blocks = await buildImageBlocks(urls, cfg);
|
|
778
802
|
const list = urls.map((u, i) => `${i + 1}. ${u}`).join("\n") || "(sem URLs)";
|
|
779
803
|
return { content: [{ type: "text", text: `\u2705 Pronto.
|
|
780
|
-
${list}` }, ...blocks] };
|
|
804
|
+
${list}${flagsLine(status)}` }, ...blocks] };
|
|
781
805
|
}
|
|
782
806
|
if (status.status === "failed") {
|
|
783
807
|
return errorResult(`Gera\xE7\xE3o falhou: ${status.error_message || "erro desconhecido"}.`);
|
|
@@ -790,6 +814,43 @@ ${list}` }, ...blocks] };
|
|
|
790
814
|
}
|
|
791
815
|
}
|
|
792
816
|
);
|
|
817
|
+
server.registerTool(
|
|
818
|
+
"list_generations",
|
|
819
|
+
{
|
|
820
|
+
title: "Listar gera\xE7\xF5es",
|
|
821
|
+
description: 'Lista as suas gera\xE7\xF5es (imagens/v\xEDdeos) mais recentes, com os flags de favorito ("like") e de plano aprovado. Use os filtros favorite=true / approved=true para ver s\xF3 as favoritadas ou s\xF3 as aprovadas. Retorna id, modelo, tipo, status, data, um trecho do prompt e (quando h\xE1) a URL.',
|
|
822
|
+
inputSchema: {
|
|
823
|
+
limit: z.number().int().min(1).max(100).optional().describe("Quantas trazer (padr\xE3o 20, m\xE1x 100)."),
|
|
824
|
+
offset: z.number().int().min(0).optional().describe("Deslocamento para paginar (padr\xE3o 0)."),
|
|
825
|
+
favorite: z.boolean().optional().describe('S\xF3 as favoritadas ("like"). Padr\xE3o: todas.'),
|
|
826
|
+
approved: z.boolean().optional().describe("S\xF3 as com plano aprovado. Padr\xE3o: todas.")
|
|
827
|
+
}
|
|
828
|
+
},
|
|
829
|
+
async ({ limit, offset, favorite, approved }) => {
|
|
830
|
+
try {
|
|
831
|
+
const { generations } = await client.listGenerations({ limit, offset, favorite, approved });
|
|
832
|
+
if (!generations.length) {
|
|
833
|
+
const scope = favorite && approved ? " (favoritadas + aprovadas)" : favorite ? " favoritadas" : approved ? " aprovadas" : "";
|
|
834
|
+
return textResult(`Nenhuma gera\xE7\xE3o${scope} encontrada.`);
|
|
835
|
+
}
|
|
836
|
+
const lines = generations.map((g, i) => {
|
|
837
|
+
const type = g.generation_type || "image";
|
|
838
|
+
const when = g.created_at ? new Date(g.created_at).toISOString().slice(0, 10) : "\u2014";
|
|
839
|
+
const prompt = (g.prompt || "").replace(/\s+/g, " ").slice(0, 80);
|
|
840
|
+
const url = firstOutputUrl(g.output);
|
|
841
|
+
const marks = [g.is_favorite ? "\u2B50" : null, g.is_approved_plan ? "\u2714\uFE0F" : null].filter(Boolean).join(" ");
|
|
842
|
+
const marksSuffix = marks ? ` ${marks}` : "";
|
|
843
|
+
return `${i + 1}. ${type} \xB7 ${g.status} \xB7 ${when} \xB7 ${g.model}${marksSuffix}
|
|
844
|
+
${g.id}
|
|
845
|
+
"${prompt}"${url ? `
|
|
846
|
+
${url}` : ""}`;
|
|
847
|
+
});
|
|
848
|
+
return textResult(lines.join("\n\n"));
|
|
849
|
+
} catch (e) {
|
|
850
|
+
return errorResult(apiErrorToUserMessage(e));
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
);
|
|
793
854
|
server.registerTool(
|
|
794
855
|
"cancel_generation",
|
|
795
856
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "beplus-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Conector MCP da equipe BePlus — gere imagens/vídeos/áudio e consulte calls, projetos e clientes pela sua conta BePlus (diamantes, limites e histórico aplicados pela plataforma).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|