From 8251f4f02a299fefd376e1b7c977adf49df86a78 Mon Sep 17 00:00:00 2001
From: "juancarlos.cavero"
Date: Thu, 27 Aug 2026 19:35:40 +0200
Subject: [PATCH] feat(mcp): auto_hook and hook_style on process_video
The dashboard burns the AI hook line by default; API/MCP callers never
could because the field is off when absent. Exposed as an explicit opt-in
so existing integrations keep their output byte-for-byte.
---
README.md | 2 +-
dashboard/seo/pages.js | 2 +-
mcp_server.py | 19 ++++++++++++++++++-
tests/test_agent_uploads.py | 14 ++++++++++++++
4 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index ddc48b2..a71209a 100644
--- a/README.md
+++ b/README.md
@@ -314,7 +314,7 @@ claude mcp add --transport http openshorts https://mcp.openshorts.app/mcp \
claude mcp add --transport http openshorts http://localhost:8000/mcp
```
-Tools: `process_video` (URL or `upload_id`, `captions: false` when the source already has subtitles), `create_upload` (hand the agent a local file: PUT the bytes, then process), `get_job_status`, `list_clips`, `get_quota`, `add_subtitles`, `recut_clip`, `publish_clip`. A prompt like *"clip this podcast and schedule the best 3 to TikTok"* is now a one-liner in your agent of choice.
+Tools: `process_video` (URL or `upload_id`; `captions: false` when the source already has subtitles, `auto_hook: true` to burn the hook line like the dashboard), `create_upload` (hand the agent a local file: PUT the bytes, then process), `get_job_status`, `list_clips`, `get_quota`, `add_subtitles`, `recut_clip`, `publish_clip`. A prompt like *"clip this podcast and schedule the best 3 to TikTok"* is now a one-liner in your agent of choice.
### REST API + API keys
diff --git a/dashboard/seo/pages.js b/dashboard/seo/pages.js
index 586472a..e131f0f 100644
--- a/dashboard/seo/pages.js
+++ b/dashboard/seo/pages.js
@@ -1069,7 +1069,7 @@ snippets for Claude Desktop, Cursor, n8n and curl.
| Tool | What it does |
-process_video | Starts clipping a video from a URL or an upload_id. Returns a job id immediately; processing takes minutes. Pass captions: false when the source already has subtitles burned in. |
+process_video | Starts clipping a video from a URL or an upload_id. Returns a job id immediately; processing takes minutes. Pass captions: false when the source already has subtitles burned in, auto_hook: true to burn the hook line. |
create_upload | Reserves an upload slot for a local file: the agent PUTs the bytes to the returned URL, then processes it by upload_id. |
get_job_status | Progress, recent log lines, and the clips once the job completes. |
list_clips | Titles, durations, platform-ready descriptions and download URLs for a finished job. |
diff --git a/mcp_server.py b/mcp_server.py
index db7b6e2..48e1548 100644
--- a/mcp_server.py
+++ b/mcp_server.py
@@ -62,7 +62,9 @@ TOOLS = [
"description": (
"Start clipping a video from its URL. OpenShorts downloads the "
"source itself, transcribes it, finds the most viral moments with AI "
- "and renders vertical (9:16) clips with captions. Call this directly "
+ "and renders vertical (9:16) clips. Captions are burned unless "
+ "captions=false; the AI hook line is burned only with auto_hook=true. "
+ "Call this directly "
"with the URL the user gave you; do not fetch, search or inspect the "
"URL yourself first (you cannot access the video, and it is not "
"needed). Returns a job_id immediately — the work takes minutes; "
@@ -86,6 +88,17 @@ TOOLS = [
"file was PUT to its upload_url. Use when the user gave you a "
"video file rather than a link.",
},
+ "auto_hook": {
+ "type": "boolean",
+ "description": "Burn the AI-written hook line (the clip's title) over the first "
+ "seconds of each clip, as the dashboard does by default. Off when "
+ "omitted, so existing integrations keep their output.",
+ },
+ "hook_style": {
+ "type": "string",
+ "enum": ["classic", "dark", "yellow", "red", "outline", "outline_yellow"],
+ "description": "Look of the hook text (with auto_hook). Default classic.",
+ },
"captions": {
"type": "boolean",
"description": "Default true: burn word-level captions on every clip. Set false "
@@ -346,6 +359,10 @@ async def _tool_process_video(client, args):
for k in ("target_clips", "clip_min_seconds", "clip_max_seconds", "captions"):
if args.get(k) is not None:
body[k] = args[k]
+ if args.get("auto_hook"):
+ body["auto_hook"] = True
+ if args.get("hook_style"):
+ body["auto_hook_style"] = args["hook_style"]
resp = await client.post("/api/process", json=body)
if resp.status_code >= 400:
return _api_error(resp), True
diff --git a/tests/test_agent_uploads.py b/tests/test_agent_uploads.py
index 75081cd..c0423da 100644
--- a/tests/test_agent_uploads.py
+++ b/tests/test_agent_uploads.py
@@ -141,3 +141,17 @@ def test_tmpfiles_link_is_refreshed_through_the_page():
assert file_hosts.resolve_tmpfiles("https://tmpfiles.org/wAwNGnPW0lXW/video.mp4", fetch=fetch) == fresh
assert file_hosts.resolve_tmpfiles(stale, fetch=lambda u: "no link") == stale
assert not file_hosts.is_tmpfiles("https://youtube.com/watch?v=x")
+
+
+def test_auto_hook_reaches_the_job_env(dirs, monkeypatch):
+ slot = _tool_payload(_mcp("create_upload", {}))
+ async def _put():
+ async with _client() as c:
+ return await c.put(f"/api/uploads/{slot['upload_id']}", content=b"x" * 100)
+ assert asyncio.run(_put()).status_code == 200
+ async def fake_put(item): pass
+ monkeypatch.setattr(app_module.job_queue, "put", fake_put)
+ payload = _tool_payload(_mcp("process_video", {"upload_id": slot["upload_id"], "confirm_rights": True,
+ "auto_hook": True, "hook_style": "yellow"}))
+ env = app_module.jobs[payload["job_id"]]["env"]
+ assert env["AUTO_HOOK"] == "1" and env["AUTO_HOOK_STYLE"] == "yellow"