hum

io.github.anzal1v0.2.1更新於 Oct 2, 2026

Free music for your coding agent. Play songs, mood stations and Spotify links in your browser.

概覽

AI 產生的概覽

讓編碼助理控制本機瀏覽器音樂播放器:播放歌曲、啟動心情電台、匯入 Spotify 連結、跳過、調整音量並回報目前播放內容。

功能
hum 在瀏覽器分頁中執行本機音樂播放器,並以遠端控制的方式提供給支援 MCP 的助理。助理可以播放歌曲或歌手、啟動無限播放的心情電台、匯入 Spotify 播放清單、專輯或單曲連結、暫停、跳過、調整音量,並回報目前曲名、歌手、進度以及正在演唱的歌詞行。實際播放透過 YouTube 內嵌播放器在 hum 瀏覽器視窗中完成。
適用情境
適合希望在工作所用的同一個助理裡控制音樂的情境,例如不離開終端機就啟動專注電台或播放指定曲目。適合桌面環境,工作時可以保持瀏覽器視窗開啟。
執行需求
以 stdio MCP 伺服器在本機執行,需要 Node.js 18 或更新版本;文件中的安裝方式透過 npx 使用 GitHub 套件。播放時需要開啟 hum 瀏覽器分頁,本機伺服器預設監聽 3737 連接埠,可用環境變數 HUM_PORT 修改。未宣告需要帳號或 API 金鑰。
安裝前請注意
播放依賴 YouTube 內嵌播放器與 YouTube Music 的非官方網頁 API,可能隨時失效,也可能出現廣告,專案說明不會阻擋廣告。Spotify 匯入只包含播放清單的前 100 首歌曲。本機遠端介面僅監聽 127.0.0.1 並接受 JSON 指令,因此本機上任何能連到該連接埠的程式都能控制播放。新開的分頁需要先點一次才允許出聲。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

hum

Every song ever made, free, in a player that feels like a room lit by the album cover.

  • Search any song, or paste a Spotify playlist, album or track link (or press ⌘V anywhere).
  • Tap a station and it plays forever in that mood.
  • Time-synced lyrics, an endless autoplay mix, liked songs, shareable song links.
  • No accounts, no keys, no database. Your library lives in your browser.

Playback runs through YouTube's official embedded player, so ads and royalties work the normal way and artists still get paid.

Run it

One command (Node 18+). Starts hum and opens it in your browser:

bash
npx github:anzal1/hum

From a clone:

bash
node server.js

Docker (home server, VPS, NAS):

bash
docker build -t hum . && docker run -p 3737:3737 hum

Put it online for free

hum is a folder of static files plus one small function, so it fits the free tier of Cloudflare Workers: static files are unlimited and 100,000 searches a day are included.

  • One click: the Deploy to Cloudflare button on /developers.html, or https://deploy.workers.cloudflare.com/?url=https://github.com/anzal1/hum
  • From this folder: npx wrangler deploy

Vercel works too (api/ and vercel.json are ready), but its free plan is for non-commercial use.

Tested: node server.js, npx from a packed tarball, Docker, and Cloudflare's own runtime locally (npx wrangler dev). Every route answered in all four.

Put hum inside your app

One script tag adds a floating player to any page:

html
<script src="https://YOUR-HUM-HOST/embed.js" data-station="lofi beats"></script>

Then drive it from code: hum.play('Blinding Lights'), hum.station('deep focus'), hum.playlist(spotifyUrl), hum.pause(), hum.next(), hum.volume(60), hum.on('state', fn). Or use the iframe directly: widget.html?station=lofi and postMessage({ hum: 'play', query }). Live demo at /developers.html.

In your coding agent

hum works with any agent that speaks MCP. Your agent is the remote, and the music plays in a hum browser tab. It can play, start a station, import a Spotify link, skip, set the volume, and tell you what is playing, down to the line being sung. Needs Node 18+.

bash
claude mcp add --scope user hum -- npx -y -p github:anzal1/hum hum-mcp

VS Code:

bash
code --add-mcp '{"name":"hum","type":"stdio","command":"npx","args":["-y","-p","github:anzal1/hum","hum-mcp"]}'

Claude Desktop (one-click extension), Cursor (install link), Codex, Gemini CLI, Windsurf, Zed, Copilot CLI, opencode, Cline, Kiro, Amp, Goose and Continue are all in docs/agents.md.

From your terminal

Install once, and the commands start hum and open it for you when needed.

bash
npm i -g github:anzal1/hum
hum play blinding lights       # a song or artisthum station lofi beats         # an endless mixhum playlist <spotify link>hum pause | resume | toggle | next | prevhum vol 40hum duck                       # lower the music; hum unduck brings it backhum now                        # title, artist, progress and the line being sung

hum now --line prints one short line for status bars, and nothing when hum is not running: ♪ Amazing Grace · Judy Collins · I once was lost, but now I am found. It never starts hum and returns in about 30 ms. hum now --json is for scripts.

In tmux (~/.tmux.conf):

set -g status-right '#(hum now --line)'set -g status-interval 2

In Claude Code (~/.claude/settings.json):

json
"statusLine": { "type": "command", "command": "hum now --line" }

Anything else can POST to the local remote, which only listens on 127.0.0.1 and only accepts JSON:

bash
curl -X POST localhost:3737/api/remote -H 'content-type: application/json' -d '{"cmd":"station","mood":"lofi"}'

Playback always happens in the hum window, through YouTube's own player, so keep it open. The terminal is a remote and a display. HUM_PORT picks another port and HUM_NO_OPEN=1 stops it opening the browser.

How it works

PieceSource
Search, song metadata, autoplay mixesYouTube Music's public web API, called from api/_core.js
PlaybackYouTube IFrame Player API, always visible as the rules require
LyricsLRCLIB, called straight from the browser
Spotify importSpotify's public embed page for that playlist
ColoursPulled from the cover art in the browser, painted with a WebGL shader

If a song's main upload refuses to play outside YouTube, hum quietly tries the next best upload.

Desktop app with a live notch

desktop/ is a small Electron app: hum in its own window, plus an island that sits over the MacBook notch. The compact island wraps the notch (cover on the left, bars on the right); hover it and it drops down into a mini player with the lyric being sung, progress and controls. On Windows and on Macs without a notch it floats at the top centre of the screen. The island talks to the player over a BroadcastChannel, so any window of the same site can drive it.

bash
cd desktop && npm install && npm start          # uses https://hum.anzalabidi.devcd desktop && npm run dev                       # uses your local server on :3737

In the browser, press N for the same island inside the page.

Pop-out mini player

Press P or the pop-out button and the player moves into a small always-on-top window (Chrome and Edge, via Document Picture-in-Picture). Chrome can also open it by itself when you switch tabs mid-song. Close it and playback slides back into the page at the same second.

Share links

Song links look like /s/<id>. Chat apps and social sites see the song's own cover and title; people who click land straight in the player. The default preview image is public/og.jpg, made from og/og.html. Set the og:image in public/index.html to your full domain after deploying, since some crawlers ignore relative paths.

Tests

test/e2e.js is an end-to-end suite of 52 checks covering every search path, button, slider, switch, list action, keyboard shortcut, the widget, share pages and the remote. It passes in Chromium, Firefox and WebKit (Safari's engine). Serve it next to the app (cp test/e2e.js public/__e2e.js), start the app, press play once, then run in the console:

js
(await import('/__e2e.js')).run().then((r) => console.table(r))

Keys

KeyDoes
/ or ⌘KSearch
SpacePlay or pause
← →Seek 5s
Shift + ← →Previous or next
LLyrics
QUp next
SShuffle
MMute
PPop out the mini player
NNotch mode

Limits worth knowing

  • YouTube's rules say the player must stay visible and can't play in the background, so music stops when a phone locks. Desktop, tablets and TVs are fine.
  • Spotify import brings over the first 100 songs of a playlist.
  • Search and mixes use YouTube Music's unofficial web API, which can change without notice.
  • YouTube may show ads in the player. hum does not and should not block them. People signed in to YouTube Premium in the same browser usually get no ads.
  • A fresh tab needs one click before the browser allows sound. After that, agents and the widget API play freely.

來源:README.md,提交 bf06b2f

工具

0
工具後設資料尚未被收錄。

版本歷史

1
  1. v0.2.1最新Oct 2, 2026