music-mcp
Uses SQLite as the local library index for tracking downloaded songs, lyrics, and metadata.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@music-mcp搜一下周杰伦的晴天并下载"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
抓取歌曲 MCP
个人本地音乐抓取 MCP server。通过 Claude 自然语言完成"搜歌 -> 下载 -> 配歌词 -> 整理本地库"。
架构
三层单向依赖(mcp -> core -> sources):
sources:源适配器,统一 Protocol。网易云(自实现 weapi:搜索/下载/歌词)+ LRCLIB(
httpx:仅歌词)。下载链路只接网易云一个源;歌词链路双源择优(synced 优于 plain)。core:编排层。SearchOrchestrator / DownloadManager / LyricsMatcher / LibraryStore(SQLite)。
mcp:
fastmcp暴露 5 个 tool。
详见 docs/superpowers/specs/2026-07-21-music-mcp-design.md。
Related MCP server: netease-mcp
安装
要求 Python ≥ 3.11。
git clone <repo-url> music-mcp && cd music-mcp
pip install -e ".[dev]" # 装主包 + 依赖(含 cryptography)+ 测试
pytest -q # 单测全绿即环境就绪装完后 music-mcp 命令可用(见 pyproject.toml 的 [project.scripts])。网易云源自实现 weapi,无需额外依赖或步骤。
网易云源
网易云源自实现 weapi 客户端(双层 AES + 自定义 RSA),依赖 cryptography,已随主包 pip install -e ".[dev]" 安装,无需额外步骤。
游客模式:默认无登录态,音质写死
exhigh(约 320k);无损需登录(本期未实现)。下载只能拿到「游客可听」的歌:版权/VIP/付费曲
get_song_url返回url=None,属正常现象。只能「搜索命中」后下载,不能枚举全站曲库;搜不到的曲拿不到。
歌词只读
lrc.lyric(带时间轴)+tlyric.lyric(翻译);网易云的逐字歌词yrc未读,若某曲只有yrc则该源返回空,退回 LRCLIB 兜底。可选注入登录态:设
MUSIC_MCP_NETEASE_COOKIE(如MUSIC_U=...),为未来登录扩展预留。
配置(环境变量)
变量 | 默认 | 说明 |
|
| 歌曲下载目录( |
| (空) | 歌词存储目录;设置后 |
|
| SQLite 索引路径 |
|
| 网易云请求最小间隔(ms) |
| (空) | 网易云登录 cookie(可选,如 |
|
| 网易云请求超时(秒) |
|
| 日志级别 |
歌曲与歌词存储路径即通过以上两个变量配置:
MUSIC_MCP_DOWNLOAD_DIR决定歌曲落盘位置,MUSIC_MCP_LYRICS_DIR决定歌词落盘位置。两者均为可选,留空时歌曲默认./downloads、歌词不单独落盘(仅在与音频同目录时写)。
接入 Claude
配置时把歌曲/歌词存储路径用环境变量设好,之后所有 tool 自动用这两个目录,无需每次传参。
Claude Desktop
编辑配置文件(Windows: %APPDATA%\Claude\claude_desktop_config.json):
{
"mcpServers": {
"music-mcp": {
"command": "music-mcp",
"env": {
"MUSIC_MCP_DOWNLOAD_DIR": "D:/music/downloads",
"MUSIC_MCP_LYRICS_DIR": "D:/music/lyrics",
"MUSIC_MCP_DB_PATH": "D:/music/library.db"
}
}
}
}Claude Code
命令行注册(无需手编 JSON):
claude mcp add music-mcp \
-e MUSIC_MCP_DOWNLOAD_DIR=D:/music/downloads \
-e MUSIC_MCP_LYRICS_DIR=D:/music/lyrics \
-e MUSIC_MCP_DB_PATH=D:/music/library.db \
-- music-mcp若 Claude 报找不到
music-mcp命令,把command换成python -m music_mcp.server,或指向 venv 里该命令的绝对路径。
使用
接入后直接用自然语言驱动,5 个 tool 都支持「norm_key(来自搜索结果)」或「title + artist」两种入参形态。
帮我搜周杰伦的晴天 # search_songs
下载这首歌 # download_song(用上一步的 norm_key)
下载 晴天 周杰伦 # download_song(直接 title+artist)
给我这首歌的歌词 # get_lyrics
扫描 D:/music 这个目录并补歌词 # scan_library
本地库里有哪些没歌词的 # query_library典型流程:搜歌 → 下载 → 配歌词 → 扫描整理本地库 → 查询库。下载默认落 MUSIC_MCP_DOWNLOAD_DIR,歌词默认落 MUSIC_MCP_LYRICS_DIR(设了的话)。
提供的 tool
Tool | 说明 |
| 按关键词搜索歌曲,标记是否已入库 |
| 下载歌曲到本地(幂等,传 |
| 获取歌词(LRC 优先); |
| 扫描本地音频目录,补元数据并触发歌词补全 |
| 查询本地库,可按关键词/有无歌词过滤 |
测试
pytest -q # 单元测试(不发真网络请求)代码探索(可选,开发者)
仓库可用 codegraph 查调用链与影响面。未装可 npm i -g @colbymchenry/codegraph;索引数据 .codegraph/ 已 git 忽略(本地产物,clone 后需重建):
codegraph init # clone 后首次建索引
codegraph sync # 改代码后增量同步
codegraph status # 查看索引是否最新
codegraph impact <符号> # 改某符号前看影响面手动 smoke test
python scripts/smoke_test.py "晴天" "周杰伦"真实连网易云 + LRCLIB 跑搜索/下载/歌词全流程。不进自动化测试。
能力边界
以下是当前实现的真实边界,避免对能力过度预期。
下载
只能下载网易云「游客可听」的曲;版权/VIP 曲
url=None会失败。音质写死
exhigh;无损需登录态(未实现)。只接网易云一个下载源(LRCLIB 不提供音频),该源限流/不可用时无备胎。
歌词
双源择优:网易云(带时间轴 LRC 优先)-> LRCLIB 兜底;多数热门曲能拿到带时间轴 LRC。
不制作时间轴:只转发源里现成的 LRC。若两源都只有纯文本,落盘即纯文本歌词,系统不做音频对齐/强制时间戳。
网易云逐字歌词
yrc未读,仅读lrc(时间轴)+tlyric(翻译)。纯器乐 / 极冷门 / 刚发行的曲可能两边都无歌词,返回查不到。
风险说明
网易云抓取违反其 ToS,账号有被封风险,仅供个人学习与本地使用。
反爬细节集中在
netease/包内(weapi.py加密 +client.py请求),核心业务层不碰加密参数;接口变更时改动集中可见。不分发版权音乐。
Available Tools
5 toolsdownload_songB
下载歌曲到本地。传 norm_key(来自搜索结果)或 title+artist。 target_dir 省略时用 MUSIC_MCP_DOWNLOAD_DIR 配置。
| Name | Required | Description | Default |
|---|---|---|---|
| title | No | ||
| artist | No | ||
| norm_key | No | ||
| target_dir | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It discloses download behavior but doesn't mention key behavioral details like whether files are overwritten on conflict, what the output/return format is (though output schema exists), whether it requires authentication, or error conditions. For a file-writing operation with zero annotation coverage, the transparency is limited.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences, zero filler. The first sentence states the core purpose and parameter modes. The second sentence explains the default behavior for an optional parameter. Every word earns its place. Excellent concision.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the output schema exists (structuring the return), the description doesn't need to explain return values. However, this is a file-mutation tool with 4 parameters at 0% schema coverage and no annotations. The description covers the essential parameter logic (either/or modes, default dir) but lacks behavioral context like conflict handling and prerequisites. Slightly above minimum viable but incomplete for a download/mutation operation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, and the description only partially compensates. It explains the relationship between norm_key and title+artist (either-or), and that target_dir defaults to a config value when omitted. But it doesn't explain the format of norm_key, whether title/artist must both be provided together, or constraints on directory paths. At 0% schema coverage, the description should do more heavy lifting for all 4 parameters.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb+resource ('下载歌曲到本地' - download song to local). The purpose is clear: downloads a song to local storage. It doesn't explicitly distinguish from siblings, but siblings like search_songs, get_lyrics, scan_library are obviously different in function, so the differentiation is reasonably clear from the nature of the action.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear usage guidance: pass norm_key (from search results) OR title+artist. It also explains that target_dir defaults to MUSIC_MCP_DOWNLOAD_DIR config when omitted. This gives the agent clear direction on parameter selection. However, it doesn't explicitly state when NOT to use this tool versus alternatives, though the distinction is fairly apparent.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_lyricsA
获取歌词(LRC 优先)。传 norm_key 或 title+artist。 audio_dir 提供时写同名 .lrc;否则用 MUSIC_MCP_LYRICS_DIR 配置写 .lrc。
| Name | Required | Description | Default |
|---|---|---|---|
| title | No | ||
| artist | No | ||
| norm_key | No | ||
| audio_dir | No | ||
| duration_ms | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full behavioral disclosure burden. It discloses the tool WRITES a .lrc file (a side effect beyond simply retrieving), explains the file location logic (audio_dir provided vs MUSIC_MCP_LYRICS_DIR config fallback). Notably the description reveals this is not purely a read operation—it persists to disk—which is valuable behavioral transparency absent from any annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two crisp sentences, zero filler. Every clause adds value: LRC preference, identification options, and write-location logic. Highly efficient and front-loaded with the core purpose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool mutates the filesystem (writes .lrc), has 5 parameters all undocumented in schema, and no annotations—yet the description conveys the essential write behavior, identification options, and output-location logic. It covers the core complexity well; minor gaps include what duration_ms affects (LRC timing?) and return value behavior, though an output schema exists to cover return structure.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description bears full responsibility. It explains the meaning of norm_key and title+artist (identification methods) and audio_dir (output location), which covers 3 of 5 parameters. However, duration_ms and the precedence of norm_key vs title+artist semantics are not clarified beyond what the schema shows.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb (获取/retrieve lyrics), the resource (lyrics for a song), and a specific preference (LRC format prioritized). It distinguishes from siblings—search_songs is for searching not retrieving lyrics, download_song downloads audio not lyrics. The purpose is specific and action-oriented.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It explains the two ways to identify a song ('传 norm_key 或 title+artist'), giving usage direction. However, it doesn't mention when to choose this vs siblings or any exclusions/alternatives, so the when-to-use guidance is implied rather than explicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
query_libraryC
查询本地库,可按关键词和有无歌词过滤。
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| keyword | No | ||
| has_lyrics | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden for behavioral disclosure. It does not reveal return format, whether it's a read-only operation (though 'query' implies read), pagination, or how the has_lyrics filter behaves for null values. Since an output schema exists, some return info is covered, but behavioral traits are otherwise undisclosed.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single short sentence, which is efficient and free of waste. It is appropriately brief, though slightly under-specified. No unnecessary content or redundant restatement of the tool name.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool has 3 parameters, 0% schema coverage, no annotations, but does have an output schema which reduces some explanatory burden. However, the description is minimal and does not explain filter behavior, defaults, or how results are sorted/ordered. For a query tool with siblings offering similar functionality, more context is needed to disambiguate tool choice.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, meaning no parameters are documented in the schema itself. The description mentions keyword and has_lyrics filters (matching two of the three parameters), but does not explain the meaning, range, or behavior of 'limit' or the exact filter semantics. Given 0% coverage, the description must compensate but only partially covers two parameters.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states it queries the local library with keyword and lyrics filters. The verb 'query' plus 'local library' defines a clear purpose, but it does not differentiate from the sibling 'search_songs' which likely overlaps in functionality. The scope is somewhat clear but sibling differentiation is missing.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus the sibling 'search_songs'. It does not specify exclusions or alternative tools. The description gives context that it targets the local library, but there is no explicit when/when-not guidance or mention of alternatives.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
scan_libraryC
扫描本地音频目录,补元数据并触发歌词补全。
| Name | Required | Description | Default |
|---|---|---|---|
| dir | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. The description mentions '补元数据并触发歌词补全' (supplement metadata and trigger lyric completion), implying a mutating operation that modifies the library. However, it does not disclose what exactly gets changed, whether it's destructive, whether network access is required for lyric fetching, or what happens to existing metadata.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, compact sentence that wastes no words. It efficiently conveys the two core actions (scan + metadata + lyrics). Not verbose, but the brevity comes at the cost of missing depth described in other dimensions.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a 1-param mutating tool with no annotations, no schema coverage, the description is too thin. It does not explain the return value/output format (output schema exists but description could add context), what metadata fields are supplemented, the side effects of the scan, or failure modes. The description would benefit from stating what kind of directory, what metadata is added, and what the scan does to existing entries.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, and the single required param 'dir' is entirely undocumented in both schema and description. The description does not explain what 'dir' should be (a filesystem path? a library identifier?), what format, or what constraints apply. Given 0% coverage, the description must compensate but provides no parameter details whatsoever.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states the verb (扫描/san) and resource (本地音频目录/local audio directory) with clear actions: supplement metadata and trigger lyric completion. It distinguishes from siblings like search_songs and query_library, which are query-oriented, while scan_library is a write/scan operation on a directory.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit guidance on when to use this tool versus the alternatives. The description implies it's for scanning/batch operations, but does not clarify when one would choose scan_library over query_library or search_songs, nor state what prerequisites or consequences apply.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_songsC
按关键词搜索歌曲,返回标题/歌手/专辑/来源/是否已入库。
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| query | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
无任何注释提供,描述承担全部行为披露责任。描述仅列出返回字段,未说明搜索匹配逻辑(模糊/精确匹配)、是否区分大小写、排序行为、收录范围或外部来源行为。作为搜索工具,缺少对搜索执行细节的披露。
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
单句描述,简洁高效。直接说明功能并列出返回字段,没有冗余信息。结构清晰,价值密度高。
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
有输出schema存在可减轻返回格式负担,但仅2个参数却有0% schema描述覆盖率,且无注释,描述未解释参数含义和搜索行为。作为搜索工具,这个简洁度不足以支撑实际使用,特别是缺少与query_library的区分说明。
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
schema描述覆盖率为0%,描述应完全补偿参数说明,但描述完全未提及任何参数。'query'的含义(关键词格式、是否需要精确匹配)和'limit'(上限默认值)均未在描述中说明。两个参数均无任何语义补充。
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
描述明确说明了工具功能——按关键词搜索歌曲,并列出了返回的字段(标题/歌手/专辑/来源/是否已入库)。动词'搜索'+资源'歌曲'清晰。与兄弟工具有所区分(其他工具涉及下载、歌词、扫描、查询),但未明确说明与query_library的区别。
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
描述暗示了'搜索歌曲'的用途,但没有明确说明何时使用此工具而非query_library等替代工具。没有排除条件或前置要求。搜索场景implied但未具体说明与其他库查询工具的区别。
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
5 tool updates
v0.1.0- First observed
download_song - First observed
get_lyrics - First observed
query_library - First observed
scan_library - First observed
search_songs
TDQS
Scored across 5 tools
The tools are mostly distinct: search finds remote songs, download fetches them, get_lyrics retrieves lyrics, scan and query operate on the local library. Search/download/get_lyrics relate to remote content while scan/query relate to local content; these boundaries are fairly clear. The only minor overlap is that download and get_lyrics both accept the same identifying params, but their purposes differ.
All five tools follow a consistent verb_noun pattern: search_songs, download_song, get_lyrics, scan_library, query_library. The verbs and nouns are unambiguous and consistently styled in snake_case.
Five tools is a reasonable, compact set for a music management server. It could arguably benefit from a couple more operations (e.g., remove/delete songs), but the current count is well-scoped for the apparent purpose.
The surface covers search, download, lyrics retrieval, library scanning, and querying. Minor gaps include no delete/remove tool for downloaded songs or library entries, and no play or status operation, but core workflows are covered and agents can accomplish primary tasks.
Maintenance
Related MCP Connectors
MCP server for Suno AI music generation, lyrics, and covers
MCP server for AI dialogue using various LLM models via AceDataCloud
MCP server for Producer/Riffusion AI music generation
Related MCP Servers
- AlicenseAqualityDmaintenanceMCP server for controlling local music playback via NetEase Cloud Music, enabling search, play, pause, skip, and lyrics display through a local web player.1376MIT
- AlicenseNot gradedqualityDmaintenanceMCP server that enables AI assistants to search and retrieve music data (songs, lyrics, playlists, albums, artists) from Netease Cloud Music.MIT
- AlicenseNot gradedqualityAmaintenanceMCP server that enables LLMs to search, play, and manage music from multiple platforms (NetEase, QQ, Kugou) and local files, with lyrics retrieval and playback control.MIT
- AlicenseCqualityAmaintenanceMulti-source music search and playback MCP server supporting QQ Music, NetEase Cloud, and local files with playlist management.32MIT