@funny-booth/langley-video-mcp 0.7.0 → 0.9.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 +13 -4
- package/dist/index.js +23 -10
- package/package.json +4 -2
package/dist/client.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// - サーバーへは Authorization: Bearer <TOOL_TOKEN> を付けるだけ。本人と許可を決めるのはサーバー側
|
|
4
4
|
// - 401・403 はサーバーの文言をそのまま返す(「起動し直して」「管理者に頼んで」を利用者に届ける)
|
|
5
5
|
// - トークンが無いときはサーバーに行かずに止める
|
|
6
|
+
// - 401(ログインは24時間で切れる)は、保存してあるログインを読み直して1回だけやり直す(10/30・agent-core の同梱 MCP と同じ)
|
|
6
7
|
import { createWriteStream } from "node:fs";
|
|
7
8
|
import { mkdir, rename, rm } from "node:fs/promises";
|
|
8
9
|
import { Readable } from "node:stream";
|
|
@@ -21,12 +22,20 @@ export function explain(status, body) {
|
|
|
21
22
|
: `サーバーが ${status} を返しました`;
|
|
22
23
|
}
|
|
23
24
|
async function call(path, token, init = {}, f = fetch) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const res = await f(`${base()}${path}`, {
|
|
25
|
+
const get = typeof token === "function" ? token : async () => token;
|
|
26
|
+
const send = (t) => f(`${base()}${path}`, {
|
|
27
27
|
...init,
|
|
28
|
-
headers: { ...init.headers, Authorization: `Bearer ${
|
|
28
|
+
headers: { ...init.headers, Authorization: `Bearer ${t}` },
|
|
29
29
|
});
|
|
30
|
+
const before = await get(false);
|
|
31
|
+
if (!before?.trim())
|
|
32
|
+
throw new AgentError(NO_TOKEN_MESSAGE);
|
|
33
|
+
let res = await send(before);
|
|
34
|
+
if (res.status === 401) {
|
|
35
|
+
const after = await get(true);
|
|
36
|
+
if (after?.trim() && after !== before)
|
|
37
|
+
res = await send(after);
|
|
38
|
+
}
|
|
30
39
|
if (!res.ok) {
|
|
31
40
|
let body = null;
|
|
32
41
|
try {
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// @funny-booth/langley-video-mcp — Langley-AgentOS の「WEBマーケクリエイティブ」から、ラングレー動画の制作を扱う MCP(stdio)。
|
|
3
3
|
// 鍵は持たない。Langley-AgentOS の起動プログラムが渡す TOOL_TOKEN(本人のログイン)を、動画の VPS に渡すだけ。
|
|
4
|
+
// ログインは24時間で切れるので、切れたら金庫に保存してあるログイン(TOOL_NAME で引く)を agent-core で読み直す。
|
|
4
5
|
// 重い処理(台本・素材選び・AI カット・仕上げ)はすべて VPS で動く。このパソコンでは呼び出しと保存だけをする。
|
|
5
6
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
6
7
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
7
8
|
import { z } from "zod";
|
|
8
9
|
import { AgentError, CHANGE_AREAS, CHANGE_URGENCIES, appeals, delivery, myRequests, planAct, planStart, planStatus, productions, request, requestChange } from "./client.js";
|
|
9
|
-
|
|
10
|
+
// agent-core は CommonJS なので、名前つきの import では起動のときに落ちる(default から取る)
|
|
11
|
+
import portalClient from "@funny-booth/agent-core/dist/portalClient.js";
|
|
12
|
+
const portal = portalClient.portalClientFromEnv(); // PORTAL_URL・TOOL_TOKEN が無ければ null
|
|
13
|
+
const token = () => portal ? (force) => portal.token(force) : process.env.TOOL_TOKEN;
|
|
10
14
|
const text = (t) => ({ content: [{ type: "text", text: t }] });
|
|
11
15
|
const fail = (e) => ({
|
|
12
16
|
content: [{ type: "text", text: e instanceof AgentError ? e.message : `動画の受け口につながりません: ${String(e)}` }],
|
|
13
17
|
isError: true,
|
|
14
18
|
});
|
|
15
|
-
const server = new McpServer({ name: "langley-video", version: "0.
|
|
19
|
+
const server = new McpServer({ name: "langley-video", version: "0.9.0" });
|
|
16
20
|
server.registerTool("video_productions", {
|
|
17
21
|
description: "ラングレー動画の制作の一覧(新しい順)。どの動画がどの段階か(絵コンテ承認待ち・最終確認待ち・納品できる)と、承認画面のリンクを返す",
|
|
18
22
|
inputSchema: {},
|
|
@@ -68,8 +72,13 @@ server.registerTool("video_request", {
|
|
|
68
72
|
return fail(e);
|
|
69
73
|
}
|
|
70
74
|
});
|
|
71
|
-
const planText = (p) => [
|
|
72
|
-
`台本づくり ${p.id}(${p.sku}
|
|
75
|
+
const planText = (p, full = false) => [
|
|
76
|
+
`台本づくり ${p.id}(${p.sku}・${p.started ?? ""} 開始${p.mine ? "・あなたが始めた" : ""}): 今の段 ${p.stage_ja}` +
|
|
77
|
+
`${p.working ? "(いま案を作っています。30秒ほどおいてもう一度確かめてください)" : ""}`,
|
|
78
|
+
...(p.push_needed ? [`シナリオの OK の前に、推す特典・数字を平山様に聞いてください(OK のとき push に答えを入れる。「おまかせ」も可)` +
|
|
79
|
+
(p.push_candidates?.length ? `\n LP の今の候補: ${p.push_candidates.join(" / ")}` : "")] : []),
|
|
80
|
+
...(p.push ? [`推す特典・数字(平山様が決めた): ${p.push}`] : []),
|
|
81
|
+
...(p.brief ? (full ? [`クリエイティブブリーフ(広告の相談から引き継いだ):\n${p.brief}`] : [`クリエイティブブリーフあり(${p.brief.length}字・番号を渡すと全文を返す)`]) : []),
|
|
73
82
|
...(p.error ? [`前回の案づくりが止まりました: ${p.error}`] : []),
|
|
74
83
|
...Object.entries(p.approved).map(([, a]) => `OK 済み: ${a.summary}(${a.who})`),
|
|
75
84
|
...(p.latest ? [`最新の案: シート「${p.latest.tab}」(第${p.latest.version}版)`, ...p.latest.summary.map((s) => ` ${s}`)] : []),
|
|
@@ -79,12 +88,13 @@ const planText = (p) => [
|
|
|
79
88
|
server.registerTool("video_plan_start", {
|
|
80
89
|
description: "台本づくりを始める(シナリオ → 構成 → 台本 を、段ごとに平山様の OK をもらって進める。台本の OK の後に制作が始まる)。" +
|
|
81
90
|
"まずシナリオの案(3つ)を作り、台本のシート(Google スプレッドシート)に書き出す。数分かかるので、video_plan_status で確かめる。" +
|
|
82
|
-
"依頼の文章(wish)はそのまま渡す。方向性(direction
|
|
91
|
+
"依頼の文章(wish)はそのまま渡す。方向性(direction)は広告の相談で決まったこと。広告の相談で作ったクリエイティブブリーフ(brief)があれば全文を渡す",
|
|
83
92
|
inputSchema: {
|
|
84
93
|
sku: z.string().describe("商品の名前(例: ブラトップ・ヒートインナー)"),
|
|
85
94
|
wish: z.string().min(1).max(2000).optional().describe("依頼した人の文章(そのまま・要約しない)"),
|
|
86
95
|
references: z.array(z.string().url()).max(5).optional().describe("参考の広告の動画の URL(1本目の音声を文字に起こし、役割に分けて参考にする)"),
|
|
87
96
|
direction: z.string().max(2000).optional().describe("方向性(広告の相談で決まった、何を作るか・季節や行事)"),
|
|
97
|
+
brief: z.string().max(8000).optional().describe("クリエイティブブリーフ(広告の相談で平山様と決めたことの全文・Markdown・要約しない)"),
|
|
88
98
|
},
|
|
89
99
|
}, async (args) => {
|
|
90
100
|
try {
|
|
@@ -96,12 +106,13 @@ server.registerTool("video_plan_start", {
|
|
|
96
106
|
}
|
|
97
107
|
});
|
|
98
108
|
server.registerTool("video_plan_status", {
|
|
99
|
-
description: "台本づくりの様子(今の段・案づくりの途中か・最新の案の要点とシートの名前・OK
|
|
109
|
+
description: "台本づくりの様子(今の段・案づくりの途中か・最新の案の要点とシートの名前・OK 済みの段・誰が始めたか・推す特典を聞く必要があるか)。" +
|
|
110
|
+
"番号を渡せばその1件(ブリーフの全文も)、渡さなければ新しい順に10件",
|
|
100
111
|
inputSchema: { id: z.string().optional().describe("台本づくりの番号(p で始まる)") },
|
|
101
112
|
}, async ({ id }) => {
|
|
102
113
|
try {
|
|
103
114
|
const list = await planStatus(token(), id);
|
|
104
|
-
return text(list.length ? list.map(planText).join("\n\n") : "台本づくりはまだありません");
|
|
115
|
+
return text(list.length ? list.map((p) => planText(p, Boolean(id))).join("\n\n") : "台本づくりはまだありません");
|
|
105
116
|
}
|
|
106
117
|
catch (e) {
|
|
107
118
|
return fail(e);
|
|
@@ -132,15 +143,17 @@ server.registerTool("video_plan_redo", {
|
|
|
132
143
|
});
|
|
133
144
|
server.registerTool("video_plan_approve", {
|
|
134
145
|
description: "今の段の最新の案に OK を出して次の段へ進む。平山様が会話ではっきり OK と言ったときだけ呼ぶ(あいまいなら聞き直す・あなたが判断して呼ばない)。" +
|
|
135
|
-
"シナリオは選んだ案の番号(choice
|
|
146
|
+
"シナリオは選んだ案の番号(choice)を渡す。推す特典・数字が決まっていない台本づくりでは、シナリオの OK の前に平山様に聞き、答えを push に入れる" +
|
|
147
|
+
"(言葉のまま・「おまかせ」も可。聞かずに呼ぶと断られる)。台本の OK で、その台本のまま制作が始まる(絵コンテができたら Slack で知らせる)。OK を出せるのは平山様だけ",
|
|
136
148
|
inputSchema: {
|
|
137
149
|
id: z.string(),
|
|
138
150
|
choice: z.number().int().min(1).optional().describe("シナリオの段で、OK を出す案の番号"),
|
|
139
151
|
test: z.boolean().optional().describe("動作確認の試験のときだけ true(台本の OK で始まる制作に【試験】が付く)"),
|
|
152
|
+
push: z.string().max(500).optional().describe("シナリオの OK のとき、平山様が決めた推す特典・数字(言葉のまま・「おまかせ」も可)"),
|
|
140
153
|
},
|
|
141
|
-
}, async ({ id, choice, test }) => {
|
|
154
|
+
}, async ({ id, choice, test, push }) => {
|
|
142
155
|
try {
|
|
143
|
-
const r = await planAct(token(), "approve", { id, choice, test: test === true });
|
|
156
|
+
const r = await planAct(token(), "approve", { id, choice, test: test === true, push });
|
|
144
157
|
return text(r.message + (r.productions?.length ? `\n制作名: ${r.productions.join("、")}` : ""));
|
|
145
158
|
}
|
|
146
159
|
catch (e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funny-booth/langley-video-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "ラングレー動画の制作の状況・制作の依頼・納品セットの取得(Langley-AgentOS の「WEBマーケクリエイティブ」から使う MCP・stdio)",
|
|
6
6
|
"publishConfig": {
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"funnyBooth": {
|
|
20
20
|
"env": [
|
|
21
21
|
"TOOL_TOKEN",
|
|
22
|
-
"PORTAL_URL"
|
|
22
|
+
"PORTAL_URL",
|
|
23
|
+
"TOOL_NAME"
|
|
23
24
|
]
|
|
24
25
|
},
|
|
25
26
|
"scripts": {
|
|
@@ -30,6 +31,7 @@
|
|
|
30
31
|
"test": "node --experimental-strip-types --disable-warning=ExperimentalWarning --test \"tests/**/*.test.ts\""
|
|
31
32
|
},
|
|
32
33
|
"dependencies": {
|
|
34
|
+
"@funny-booth/agent-core": "^0.1.53",
|
|
33
35
|
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
34
36
|
"zod": "^4.6.7"
|
|
35
37
|
},
|