Sonicmatch

io.github.js713-lab由 GitHub 帳號 js713-lab 發布v0.2.0更新於 Nov 3, 2026

Analyze video mood and pace, then recommend license-safe BGM with a mix spec.

概覽

AI 產生的概覽

分析影片的情緒、節奏與語音,推薦授權安全的背景音樂,並提供鉤子片段與 ffmpeg 閃避規格。

可以做什麼
  • 匯入本機影片檔或 HTTPS 連結,回傳資源識別碼而非影片本體
  • 分析畫面情緒、能量曲線、語音佔比、場景切換、鉤子區間與 BPM
  • 搜尋、排序並檢視曲目,每一列都附授權與署名資訊
  • 試聽混音:裁切鉤子、循環、閃避,並匯出混音規格與 ffmpeg 指令
  • 將剪接點對齊節拍格線、儲存品牌套件,並把最多 20 個片段聚類成共用歌單
適用情境
適合製作 Reels、Shorts 或商品短片等直式短影音時,讓助理依畫面挑選背景音樂,同時取得清楚的授權資訊與可直接執行的混音方案。
執行需求
以本機 Python 3.10+ 套件執行(uvx、pipx 或 python -m sonicmatch),PATH 中需有 ffmpeg 與 ffprobe。選用金鑰:GEMINI_API_KEY 用於影片理解,JAMENDO_CLIENT_ID 與 FREESOUND_API_KEY 用於擴充曲庫。沒有金鑰時仍可用內建小型種子曲庫。yt-dlp 平台連結匯入預設關閉。
安裝前請注意
選用 API 金鑰以環境變數傳入。透過 yt-dlp 匯入平台連結需手動開啟,可能失效或違反平台條款。HTTP 模式沒有身分驗證,應只綁定本機回環位址。生成的伴奏未取得商業授權,推薦結果也不會聲稱通過 Content ID 檢測。託管端點依呼叫扣減額度。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Sonicmatch,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

Sonicmatch

[CI] [PyPI] [License: MIT] [MCP Registry] [Python 3.10+]

Video-native MCP server for license-safe BGM. Watches the footage — not the script — and returns a shortlist, a 12–20s hook, and an ffmpeg ducking spec.

[Sonicmatch — video in, license-safe BGM out. Ingest, Analyze, Match, Mix.]

Package / CLI: sonicmatch-mcp. A Model Context Protocol server for Claude Desktop, Cursor, Codex, and other MCP clients. Drop an Instagram Reel, YouTube Short, or TikTok-style clip. Get royalty-free / Creative Commons matches with the license printed on every row.

Video-to-BGM already exists. The wedge is not “I also match music”:

  • it watches the footage, not the script
  • it returns a hook window + ffmpeg ducking spec
  • it is agent-native
  • it prints the license instead of lying

Catalog quality will kill or save this. More tools will not.

Video or URL in  → scene / mood / pace / speech analysis  → license-safe BGM shortlist  + beat/cut hints  + optional mix preview

Do not treat this as “script in → YouTube Music search out.” That already exists (mcp-bgm-recommender). Sonicmatch watches the video.

You ownYou do not own
Local file / public URL ingestPlatform music licenses
Mood, energy curve, speech vs silence, scene cutsMeta/TikTok “trending audio” graph
CC / royalty-free catalogs + optional paid adaptersSpotify / IG official libraries
Ranked tracks, preview URLs, mix spec, ffmpegAuto-publish to Instagram

North star: ingest_video → analyze_video_music → recommend_bgm → preview_mix → export_mix_spec

License warning (read this)

  • The code is MIT.
  • Every track has its own license. It is printed on every recommendation.
  • Nothing here is an official Instagram sticker, TikTok Commercial Music Library track, or YouTube Audio Library API result.
  • Do not recommend commercial pop unless the adapter is explicitly a user-owned licensed library.
  • CC-BY still needs attribution. CC-BY-NC is not ok for ads / shops. Non-commercial tracks are never auto-recommended.
  • For ads / shops, wire a user-owned Artlist / Epidemic JSON (examples/user_library.example.json). Do not scrape those sites.
  • Content ID can still hit you if you point at the wrong source. A CC label is not a waiver.

Demo

I dropped ./clip.mp4. Analyze it for an Instagram Reel and recommend 5 instrumental BGMs. Then mix the top pick with ducking and give me the ffmpeg command.

That prompt is the product. Install below, wire Claude Desktop, Cursor, or Codex, and paste it.

Quick start

Requires Python 3.10+ and ffmpeg / ffprobe on PATH. yt-dlp is optional and off by default (SONICMATCH_ALLOW_YTDLP=0) because platform extractors break and may violate ToS. Prefer a local file.

The PyPI project is sonicmatch-mcp. The console script is sonicmatch-mcp, which is what uvx and pipx run. python -m sonicmatch is the same server. The PyPI badge stays empty until the first tag is published. Install from git until then. Maintainer steps: PUBLISH.md.

Works today (git)

bash
uvx --from git+https://github.com/js713-lab/sonic-match-mcp.git sonicmatch-mcp
bash
pip install git+https://github.com/js713-lab/sonic-match-mcp.gitsonicmatch-mcp --version   # or: python -m sonicmatch --version

After the first PyPI release

bash
uvx sonicmatch-mcp# orpipx install sonicmatch-mcpsonicmatch-mcp --version

From a clone (editable + tests)

bash
git clone https://github.com/js713-lab/sonic-match-mcp.gitcd sonic-match-mcppython3 -m venv .venvsource .venv/bin/activatepip install -e ".[dev]"cp .env.example .env   # optional keys
# stdio (Claude Desktop / Cursor / Codex)sonicmatch-mcp
# streamable HTTP (web editors). No authentication. Keep it on loopback.sonicmatch-mcp --http --port 8765
bash
# same clone, uvuv venv && uv pip install -e ".[dev]"uv run sonicmatch-mcp
bash
pytest          # generates tiny color mp4s with ffmpegruff check src tests

The seed catalog is about 20 Reel-editor rows (cafe, product, talking-head, travel, food, fashion, event) plus a vocal fixture and a CC-BY-NC fixture. It runs without API keys. Gemini, Jamendo, and Freesound are optional and degrade with a note in the tool response. Seed rows have no hosted audio on purpose — preview_mix synthesizes a demo bed. For real ads, point SONICMATCH_LIBRARY_PATH / EPIDEMIC_LIBRARY_PATH / ARTLIST_LIBRARY_PATH at JSON you already licensed.

VariableRequiredWhat it does
GEMINI_API_KEYnoGemini video understanding for analyze_video_music
JAMENDO_CLIENT_IDnoJamendo search
FREESOUND_API_KEYnoFreesound beds and loops
SONICMATCH_LIBRARY_PATHnoUser-owned library JSON. Also EPIDEMIC_LIBRARY_PATH, ARTLIST_LIBRARY_PATH
SONICMATCH_ALLOW_YTDLPno1 turns on platform URL ingest. Default 0
SONICMATCH_MAX_DOWNLOAD_MBnoDownload cap. Default 200
SONICMATCH_HTTP_HOST / SONICMATCH_HTTP_PORTno--http bind. Default 127.0.0.1:8765

Features

  • Watches the picture. Gemini video understanding when GEMINI_API_KEY is set; otherwise local ffmpeg / audio heuristics (optional Whisper, PySceneDetect, librosa).
  • License on every row. CC / royalty-free / user-owned library. Non-commercial tracks are never auto-recommended. Generated beds stay out of auto recs.
  • Editor-shaped output. 12–20s hook in/out, speech ducking, ffmpeg recipe, mix spec for CapCut / Premiere / DaVinci / your agent.
  • Agent-native MCP. stdio for Claude Desktop and Cursor; streamable HTTP for web editors. Never ships raw multi-MB video through the payload — you get an asset_id.
  • Works without API keys. 20-track seed catalog for Reels. Optional Jamendo, Freesound, and user-owned Artlist / Epidemic JSON.
  • Cuts on the beat. suggest_cuts snaps scene cuts to a BPM grid and returns EDL-ish intro / peak / outro.
  • Brand lock. Save BPM / mood / no-vocals kits and pass brand_kit=… into recommend_bgm.
  • Series, not one-offs. analyze_batch (max 20) clusters mood and returns one shared mini-playlist.
  • Honest about closed graphs. No fake “trending audio,” official IG stickers, or Content-ID-safe stamps. yt-dlp platform ingest is opt-in.

Tools

ToolWhat it does
statusffmpeg / keys / seed count / day-1 risk gates
ingest_videoLocal path or HTTPS URL → asset_id (never video bytes). Platform URLs need SONICMATCH_ALLOW_YTDLP=1
analyze_video_musicMood, energy curve, speech, scenes, hook window, BPM, search queries
recommend_bgm3–7 ranked tracks + why + license + hook in/out
search_musicFree-text / BPM / mood over seed + optional catalogs
get_trackOne track’s metadata, license, attribution, URLs
preview_mixHook trim, loop, optional ducking → preview files + ffmpeg + mix spec
export_mix_specMix spec + ffmpeg + attribution (no render unless render=true)
suggest_cutsBeat grid, snapped scene cuts, EDL, intro / peak / outro
generate_bedDemo bed marked source=generated. Requires i_understand_not_commercially_cleared=true
save_brand_kitPersist BPM / moods / no-vocals for recommend_bgm(brand_kit=…)
analyze_batchUp to 20 clips → mood cluster + shared mini-playlist

Also ships a prompt template: “Score this video like an IG music sticker.”

Product rules (Instagram-like, not Instagram)

  • Prefer instrumental when speech_coverage > 0.25
  • Recommend a hook window, not the whole song
  • Show why (cuts at 0.8s average, 112 BPM, warm gold hour)
  • Always return license + attribution text
  • 3–7 tracks, not 40
  • User can override mood / genre / no-lyrics / platform / energy
  • Never claim “cleared for Instagram official sticker” unless it actually is

Example

Prompt:

I dropped ./clip.mp4. Analyze it for an Instagram Reel and recommend 5 instrumental BGMs. Then mix the top pick with ducking and give me the ffmpeg command.

The agent should call, in order:

  1. ingest_video with the local path. The result is an asset_id, not video bytes.
  2. analyze_video_music with platform_hint set to instagram_reel.
  3. recommend_bgm with that asset_id and max_results of 5.
  4. preview_mix on the top track with ducking, then export_mix_spec.

A recommendation row carries score, reason, suggested_in_out (the hook), ducking, license_ok_for_platform, and content_id_risk (unknown or likely, never cleared). Seed fixtures include seed_golden_hour_latte (CC0-1.0) and seed_indie_porch_110 (CC-BY-4.0). They have no hosted audio. preview_mix synthesizes a demo bed. CC-BY-NC rows are searchable and are not auto-recommended.

Claude Desktop

claude_desktop_config.json. From git, no clone:

json
{  "mcpServers": {    "sonicmatch": {      "command": "uvx",      "args": [        "--from",        "git+https://github.com/js713-lab/sonic-match-mcp.git",        "sonicmatch-mcp"      ],      "env": {        "GEMINI_API_KEY": "",        "JAMENDO_CLIENT_ID": "",        "FREESOUND_API_KEY": ""      }    }  }}

After a clone, command can be the absolute path of .venv/bin/sonicmatch-mcp. After the PyPI release, args is just ["sonicmatch-mcp"]. Copy-paste files: examples/claude_desktop.mcp.json, examples/claude_desktop.pypi.mcp.json.

Cursor

.cursor/mcp.json (project) or ~/.cursor/mcp.json. From git, no clone — examples/cursor.mcp.json:

json
{  "mcpServers": {    "sonicmatch": {      "command": "uvx",      "args": [        "--from",        "git+https://github.com/js713-lab/sonic-match-mcp.git",        "sonicmatch-mcp"      ],      "env": {        "GEMINI_API_KEY": "",        "JAMENDO_CLIENT_ID": "",        "FREESOUND_API_KEY": ""      }    }  }}

After PyPI, use examples/cursor.pypi.mcp.json (uvx with args ["sonicmatch-mcp"]). From a clone: "command": "uv", "args": ["--directory", "/absolute/path/to/sonic-match-mcp", "run", "sonicmatch-mcp"]. After pip install, "command": "python3", "args": ["-m", "sonicmatch"] works if that interpreter has the package.

Codex

Codex reads ~/.codex/config.toml. The same file is shared with the Codex IDE extension and the ChatGPT desktop app. Works today — examples/codex.config.toml:

toml
[mcp_servers.sonicmatch]command = "uvx"args = ["--from", "git+https://github.com/js713-lab/sonic-match-mcp.git", "sonicmatch-mcp"]
[mcp_servers.sonicmatch.env]GEMINI_API_KEY = ""JAMENDO_CLIENT_ID = ""FREESOUND_API_KEY = ""

Or from the CLI:

bash
codex mcp add sonicmatch -- uvx --from git+https://github.com/js713-lab/sonic-match-mcp.git sonicmatch-mcp

After the PyPI release, the args shrink to sonicmatch-mcp. That file is examples/codex.pypi.config.toml:

bash
codex mcp add sonicmatch -- uvx sonicmatch-mcp

codex mcp list should show sonicmatch. A trusted project can use .codex/config.toml instead of the home file.

User-owned Epidemic/Artlist JSON shape: examples/user_library.example.json. Registry metadata: server.json. HTTP editors can point at http://127.0.0.1:8765/mcp after sonicmatch-mcp --http.

Hosted (sonic.codecrafter.dev)

The GitHub repo stays MIT. Running it yourself is not metered.

The public endpoint charges credits per tool call. A trial key is 25 credits. Pack prices: Reel 500 credits / $9, Studio 3000 credits / $39. Card checkout is not connected on the host yet.

The landing page is https://sonic.codecrafter.dev. Use Use the sample clip there, or download examples/sample-clip.mp4 and upload it, to try a match without your own footage.

  1. Open https://sonic.codecrafter.dev and take a trial key (or use a paid key).
  2. export SONICMATCH_API_KEY=sm_…
  3. Add to Cursor: the button on that page, or paste examples/cursor.hosted.mcp.json into ~/.cursor/mcp.json.
json
{  "mcpServers": {    "sonicmatch": {      "url": "https://sonic.codecrafter.dev/mcp",      "headers": {        "Authorization": "Bearer ${env:SONICMATCH_API_KEY}"      }    }  }}

--http has no authentication. Keep it on loopback. The Docker image binds 0.0.0.0 so the container port works — do not publish that port to the internet. See SECURITY.md.

Architecture

mermaid
flowchart TB  subgraph mcp [MCP Server - FastMCP / Python - stdio + HTTP]    tools[ingest_video / analyze_video_music / recommend_bgm / preview_mix / export_mix_spec / suggest_cuts]  end  tools --> ingest  tools --> brain  tools --> hub  tools --> mixer  ingest[Ingestor<br/>yt-dlp · ffmpeg · ffprobe · URL/file]  brain[Video Brain<br/>Gemini / local VL · librosa · PySceneDetect · Whisper]  hub[Music Hub<br/>seed CC · Jamendo · Freesound · user library · generate]  mixer[Mixer<br/>ffmpeg · ducking · loop/trim · EDL cuts]  hub --> index[Track index<br/>tags + license + embeddings · SQLite · optional LanceDB]

Hard rule: never send raw multi-MB video through the MCP payload. Store locally, pass an asset_id. Loopback, file://, and private IPs are rejected (SSRF).

VideoSonic profile

Analysis returns structured JSON, not a paragraph:

json
{  "duration_sec": 18.4,  "aspect": "9:16",  "content_type": "lifestyle",  "has_speech": true,  "speech_coverage": 0.62,  "existing_music": false,  "overall_mood": ["warm", "playful"],  "energy_mean": 0.62,  "energy_curve": [{"t": 0, "energy": 0.3}, {"t": 4, "energy": 0.8}],  "pacing": "fast-cut",  "scenes": [{"start": 0, "end": 3.2, "description": "cafe exterior", "energy": 0.4}],  "hook_window": [9.0, 15.0],  "suggested_bpm": [95, 118],  "avoid": ["dark cinematic drone", "aggressive trap", "lyrics-dense"],  "search_queries": ["warm acoustic pop instrumental cafe"],  "platform_hint": "instagram_reel",  "analyzer": "local"}
  • Primary: Gemini video understanding when GEMINI_API_KEY is set.
  • Fallback: ffmpeg scene cuts + WAV energy / silence / ZCR heuristics. Optional faster-whisper, scenedetect, librosa if installed (pip install 'sonicmatch-mcp[local-vl]').

Music hub

Pluggable, license-first. v0 ships:

AdapterWhenLicense reality
Seed catalog (data/seed_tracks.json)always20 CC0 / CC-BY Reel beds + a vocal fixture + a CC-BY-NC fixture (NC is never auto-recommended)
JamendoJAMENDO_CLIENT_IDCC, check commercial
FreesoundFREESOUND_API_KEYCC, good for beds/loops not songs
User library JSONSONICMATCH_LIBRARY_PATH / EPIDEMIC_LIBRARY_PATH / ARTLIST_LIBRARY_PATHyou already licensed it; we do not scrape paid sites
Generategenerate_bedalways source=generated; local sine demo unless you swap a real model

Ranking (weighted): mood/energy → instrumental if speech → duration/loop → BPM vs cut rate → license fit → tag embedding cosine → user constraints. recommend_bgm drops non-commercial and generated tracks instead of downranking them.

Tracks are indexed in SQLite (~/.cache/sonicmatch-mcp/db/tracks.sqlite) with a 24-d tag embedding. If lancedb is installed (pip install 'sonicmatch-mcp[embeddings]'), vectors are also upserted there.

Seed tracks have no remote audio files on purpose (you should host files you actually have the rights to). preview_mix synthesizes a CC0 demo bed so the mixer still runs offline. generate_bed is a catalog-miss fallback and is not cleared for ads.

Docker

bash
docker build -t sonicmatch-mcp .# Loopback-only publish. The process inside the container has no HTTP auth.docker run --rm -p 127.0.0.1:8765:8765 -v sonic-cache:/data/cache sonicmatch-mcp

Roadmap

Catalog > new tools.

  • Freesound adapter (loops / beds)
  • Tag embeddings in SQLite (+ optional LanceDB extra)
  • Epidemic Sound / Artlist as user-owned JSON plugins (no scrape)
  • Beat-grid vs scene-cut suggestions (EDL-ish suggest_cuts)
  • MCP registry listing (server.json)
  • Generate tool, marked source=generated (local demo; swap a real model at your own legal risk)
  • Official MCP registry listing via GitHub Release MCPB (see PUBLISH.md)
  • Non-commercial licenses excluded from auto recommend_bgm
  • 20 seed beds a Reel editor would actually keep, with audio you host
  • User-owned Artlist / Epidemic JSON as the default path for ads
  • Real CLAP audio embeddings
  • PyPI project metadata, console script, and tag-triggered Trusted Publishing (.github/workflows/release.yml)
  • First upload on PyPI (uvx sonicmatch-mcp). Maintainer steps are in PUBLISH.md. The name was unregistered as of 2026-10-21.

Why this can be a good open-source project

Yes if you nail: (1) video-native analysis, (2) license honesty on every row, (3) editor-shaped output (hook in/out, ducking, mix spec), (4) a catalog someone would keep.

No if you only wrap YouTube Music search, or if the first five recs sound like leftover stock beds.

Day-1 risk gates (enforced in code, not slogans):

RiskGate
Content IDEvery rec/search/get_track includes content_id_warning. CC/RF is never "Content-ID-safe". content_id_risk is unknown or likely, never cleared.
yt-dlp ToS / broken extractorsPlatform URL ingest is off unless SONICMATCH_ALLOW_YTDLP=1. Failures map to YTDLP_EXTRACTOR and tell you to pass a local file.
Upload size / SSRFHTTPS-only remote ingest, no file:// / loopback / private IPs, SONICMATCH_MAX_DOWNLOAD_MB (default 200) on files, HTTP, and yt-dlp --max-filesize.
“Trending” is a closed Meta graphQueries for trending/viral/IG audio/TikTok sound return empty + TRENDING_UNAVAILABLE. recommend_bgm always sets trending_available=false.
Generation-model commercial termsgenerate_bed refuses unless i_understand_not_commercially_cleared=true. Generated tracks are excluded from auto recommend_bgm.

Use cases

IG Reel / Story · Shopee product clip · YouTube Shorts agent · CapCut/Premiere companion · campus recap · podcast clipper · travel-vlog batch · brand-kit lock (BPM + no vocals) · silent-film / accessibility · multi-agent studio.

Contributing

CONTRIBUTING.md · CODE_OF_CONDUCT.md · SECURITY.md · CHANGELOG.md · starter issues

License

MIT. Track licenses are independent of the repo license.

From CodeCrafter.

來源:README.md,提交 290c95c

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.2.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分