diff --git a/README.md b/README.md index a71209a..f71e3ef 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, `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. +Tools: `process_video` (URL or `upload_id`; `captions: false` when the source already has subtitles, `auto_hook: false` to skip the hook line, burned by default 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 e131f0f..3c98ecb 100644 --- a/dashboard/seo/pages.js +++ b/dashboard/seo/pages.js @@ -1069,7 +1069,7 @@ snippets for Claude Desktop, Cursor, n8n and curl.

- + diff --git a/mcp_server.py b/mcp_server.py index 48e1548..db84a58 100644 --- a/mcp_server.py +++ b/mcp_server.py @@ -62,8 +62,8 @@ 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. Captions are burned unless " - "captions=false; the AI hook line is burned only with auto_hook=true. " + "and renders vertical (9:16) clips. Captions and the AI hook line are " + "burned by default; pass captions=false or auto_hook=false to skip either. " "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 " @@ -91,8 +91,8 @@ TOOLS = [ "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.", + "seconds of each clip, as the dashboard does. Default true; set " + "false for clean clips.", }, "hook_style": { "type": "string", @@ -359,7 +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"): + # Same default as the dashboard: hook on unless the caller opts out. The + # REST endpoint keeps "absent = off" for older integrations; the MCP + # tool is newer than the hook and its users expect the dashboard output. + if args.get("auto_hook", True): body["auto_hook"] = True if args.get("hook_style"): body["auto_hook_style"] = args["hook_style"] diff --git a/tests/test_agent_uploads.py b/tests/test_agent_uploads.py index c0423da..ad4b3f5 100644 --- a/tests/test_agent_uploads.py +++ b/tests/test_agent_uploads.py @@ -97,7 +97,9 @@ def test_captions_default_leaves_env_alone(dirs, monkeypatch): 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})) - assert "AUTO_CAPTIONS" not in app_module.jobs[payload["job_id"]]["env"] + env = app_module.jobs[payload["job_id"]]["env"] + assert "AUTO_CAPTIONS" not in env + assert env["AUTO_HOOK"] == "1" # MCP default matches the dashboard def test_unknown_or_unfinished_upload_id(dirs): @@ -155,3 +157,15 @@ def test_auto_hook_reaches_the_job_env(dirs, monkeypatch): "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" + + +def test_auto_hook_false_opts_out(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": False})) + assert "AUTO_HOOK" not in app_module.jobs[payload["job_id"]]["env"]
ToolWhat it does
process_videoStarts 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.
process_videoStarts 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: false to skip the hook line (on by default).
create_uploadReserves an upload slot for a local file: the agent PUTs the bytes to the returned URL, then processes it by upload_id.
get_job_statusProgress, recent log lines, and the clips once the job completes.
list_clipsTitles, durations, platform-ready descriptions and download URLs for a finished job.