@funny-booth/langley-video-mcp 0.0.0-stage → 0.1.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/client.js +59 -0
- package/dist/index.js +59 -0
- package/package.json +43 -4
- package/README.md +0 -3
package/dist/client.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// ラングレー動画の VPS の入口(/video-agent-api/)を呼ぶ部分。
|
|
2
|
+
// 3チームの約束(2026-10-17・広告側の見本 packages/langley-ads-mcp/src/core/relay.ts と同じ決まり):
|
|
3
|
+
// - サーバーへは Authorization: Bearer <TOOL_TOKEN> を付けるだけ。本人と許可を決めるのはサーバー側
|
|
4
|
+
// - 401・403 はサーバーの文言をそのまま返す(「起動し直して」「管理者に頼んで」を利用者に届ける)
|
|
5
|
+
// - トークンが無いときはサーバーに行かずに止める
|
|
6
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
7
|
+
import { homedir } from "node:os";
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
export const DEFAULT_API_URL = "https://langley.funny-booth.jp/video-agent-api";
|
|
10
|
+
const base = () => (process.env.LANGLEY_VIDEO_API_URL ?? DEFAULT_API_URL).replace(/\/$/, "");
|
|
11
|
+
export const NO_TOKEN_MESSAGE = "Langley-AgentOS のログインの証明(TOOL_TOKEN)がありません。Langley-AgentOS から起動し直してください";
|
|
12
|
+
export class AgentError extends Error {
|
|
13
|
+
}
|
|
14
|
+
/** サーバーの文言をそのまま返す(言い換えない)。文言が無ければ状態コードを伝える */
|
|
15
|
+
export function explain(status, body) {
|
|
16
|
+
return typeof body === "object" && body !== null && typeof body.error === "string"
|
|
17
|
+
? body.error
|
|
18
|
+
: `サーバーが ${status} を返しました`;
|
|
19
|
+
}
|
|
20
|
+
async function call(path, token, init = {}, f = fetch) {
|
|
21
|
+
if (!token?.trim())
|
|
22
|
+
throw new AgentError(NO_TOKEN_MESSAGE);
|
|
23
|
+
const res = await f(`${base()}${path}`, {
|
|
24
|
+
...init,
|
|
25
|
+
headers: { ...init.headers, Authorization: `Bearer ${token}` },
|
|
26
|
+
});
|
|
27
|
+
if (!res.ok) {
|
|
28
|
+
let body = null;
|
|
29
|
+
try {
|
|
30
|
+
body = await res.json();
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
/* 本文が JSON でないときは状態コードだけで説明する */
|
|
34
|
+
}
|
|
35
|
+
throw new AgentError(explain(res.status, body));
|
|
36
|
+
}
|
|
37
|
+
return res;
|
|
38
|
+
}
|
|
39
|
+
export async function productions(token, f = fetch) {
|
|
40
|
+
const res = await call("/productions", token, {}, f);
|
|
41
|
+
return (await res.json()).productions;
|
|
42
|
+
}
|
|
43
|
+
export async function request(token, sku, appeal, count, f = fetch) {
|
|
44
|
+
const res = await call("/request", token, {
|
|
45
|
+
method: "POST",
|
|
46
|
+
headers: { "Content-Type": "application/json" },
|
|
47
|
+
body: JSON.stringify({ sku, appeal, count }),
|
|
48
|
+
}, f);
|
|
49
|
+
return (await res.json());
|
|
50
|
+
}
|
|
51
|
+
/** 納品セットの zip を、パソコンのダウンロードフォルダに保存する。保存した場所を返す */
|
|
52
|
+
export async function delivery(token, name, dir = join(homedir(), "Downloads"), f = fetch) {
|
|
53
|
+
const res = await call(`/delivery?name=${encodeURIComponent(name)}`, token, {}, f);
|
|
54
|
+
const data = Buffer.from(await res.arrayBuffer());
|
|
55
|
+
await mkdir(dir, { recursive: true });
|
|
56
|
+
const file = join(dir, `納品_${name.replace(/[\\/:*?"<>|]/g, "_")}.zip`);
|
|
57
|
+
await writeFile(file, data);
|
|
58
|
+
return file;
|
|
59
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// @funny-booth/langley-video-mcp — Langley-AgentOS の「WEBマーケクリエイティブ」から、ラングレー動画の制作を扱う MCP(stdio)。
|
|
3
|
+
// 鍵は持たない。Langley-AgentOS の起動プログラムが渡す TOOL_TOKEN(本人のログイン)を、動画の VPS に渡すだけ。
|
|
4
|
+
// 重い処理(台本・素材選び・AI カット・仕上げ)はすべて VPS で動く。このパソコンでは呼び出しと保存だけをする。
|
|
5
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
6
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { AgentError, delivery, productions, request } from "./client.js";
|
|
9
|
+
const token = () => process.env.TOOL_TOKEN;
|
|
10
|
+
const text = (t) => ({ content: [{ type: "text", text: t }] });
|
|
11
|
+
const fail = (e) => ({
|
|
12
|
+
content: [{ type: "text", text: e instanceof AgentError ? e.message : `動画の受け口につながりません: ${String(e)}` }],
|
|
13
|
+
isError: true,
|
|
14
|
+
});
|
|
15
|
+
const server = new McpServer({ name: "langley-video", version: "0.1.0" });
|
|
16
|
+
server.registerTool("video_productions", {
|
|
17
|
+
description: "ラングレー動画の制作の一覧(新しい順)。どの動画がどの段階か(絵コンテ承認待ち・最終確認待ち・納品できる)と、承認画面のリンクを返す",
|
|
18
|
+
inputSchema: {},
|
|
19
|
+
}, async () => {
|
|
20
|
+
try {
|
|
21
|
+
const list = await productions(token());
|
|
22
|
+
if (!list.length)
|
|
23
|
+
return text("制作はまだありません");
|
|
24
|
+
return text(list.map((p) => `${p.test ? "【試験】" : ""}${p.title || p.name}(${p.sku}・${p.appeal}): ${p.stage}\n 制作名: ${p.name}\n 画面: ${p.page}`).join("\n"));
|
|
25
|
+
}
|
|
26
|
+
catch (e) {
|
|
27
|
+
return fail(e);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
server.registerTool("video_request", {
|
|
31
|
+
description: "ラングレー動画の制作を依頼する。商品(例: ブラトップ・ヒートインナー)と訴求(AI 分類の区分名。おまかせも可)と本数を指定する。" +
|
|
32
|
+
"制作は VPS で1本ずつ順番に始まり、絵コンテ(ゲート①)ができたら Slack で知らせる。ここではクレジットを使わない",
|
|
33
|
+
inputSchema: {
|
|
34
|
+
sku: z.string().describe("商品の名前(ブレインの商品の一覧にあるもの)"),
|
|
35
|
+
appeal: z.string().describe("訴求の区分名(例: 服の着映え・一枚で完結)か「おまかせ」"),
|
|
36
|
+
count: z.number().int().min(1).max(5).default(1).describe("本数(1〜5)"),
|
|
37
|
+
},
|
|
38
|
+
}, async ({ sku, appeal, count }) => {
|
|
39
|
+
try {
|
|
40
|
+
const r = await request(token(), sku, appeal, count);
|
|
41
|
+
return text(`${r.message}\n制作名: ${r.productions.join("、")}`);
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
return fail(e);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
server.registerTool("video_delivery", {
|
|
48
|
+
description: "最終確認(ゲート②)で承認された動画の納品セット(Premiere の編集データ・素材・テロップ一式)を、このパソコンのダウンロードフォルダに zip で保存する",
|
|
49
|
+
inputSchema: { name: z.string().describe("制作名(video_productions で分かる)") },
|
|
50
|
+
}, async ({ name }) => {
|
|
51
|
+
try {
|
|
52
|
+
const file = await delivery(token(), name);
|
|
53
|
+
return text(`保存しました: ${file}\n解凍して、中の編集データ(.xml)を Premiere で読み込んでください`);
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
return fail(e);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
await server.connect(new StdioServerTransport());
|
package/package.json
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funny-booth/langley-video-mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "ラングレー動画の制作の状況・制作の依頼・納品セットの取得(Langley-AgentOS の「WEBマーケクリエイティブ」から使う MCP・stdio)",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"bin": {
|
|
10
|
+
"langley-video-mcp": "dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"!dist/.tsbuildinfo"
|
|
15
|
+
],
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=20"
|
|
18
|
+
},
|
|
19
|
+
"funnyBooth": {
|
|
20
|
+
"env": [
|
|
21
|
+
"TOOL_TOKEN",
|
|
22
|
+
"PORTAL_URL"
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"mcp": "node --experimental-strip-types --disable-warning=ExperimentalWarning src/index.ts",
|
|
27
|
+
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.json",
|
|
28
|
+
"prepublishOnly": "npm run build",
|
|
29
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
30
|
+
"test": "node --experimental-strip-types --disable-warning=ExperimentalWarning --test \"tests/**/*.test.ts\""
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
34
|
+
"zod": "^4.6.7"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "^22.20.5",
|
|
38
|
+
"typescript": "~6.0.3"
|
|
39
|
+
},
|
|
40
|
+
"license": "UNLICENSED",
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "git+https://github.com/yutamatsuura/langley-video-mcp.git"
|
|
44
|
+
}
|
|
45
|
+
}
|
package/README.md
DELETED