Skip to main content
Glama
NetEase Cloud Music MCP

NetEase Cloud Music MCP

by changeewuwsz
README.md
# NetEase Cloud Music MCP · 网易云音乐 MCP

An MCP server that lets Claude (or any MCP client) search NetEase Cloud Music and manage **your own**
library: playlists, liked songs, daily recommendations. Sign in by scanning a QR code with the NetEase
Cloud Music app — your password never touches the server.

让 Claude(或任何 MCP 客户端)搜索网易云音乐、管理**你自己的**音乐库:歌单、红心、每日推荐。
用网易云 App 扫码登录,服务器不会接触你的密码。

> Unofficial. It uses the same web/desktop API the official clients use. It does **not** download
> music or unlock VIP / region-restricted songs.
> 非官方项目,用的是官方客户端自己的接口;**不**提供下载,也**不**解锁 VIP 或地区限制的歌曲。

## Tools · 工具

| Tool | What it does · 功能 |
|---|---|
| `ncm_login` | QR code to scan in the app · 返回登录二维码 |
| `ncm_status` / `ncm_logout` | Who is signed in / sign out · 登录状态 / 退出 |
| `search` | Songs, albums, artists, playlists · 搜索歌曲、专辑、歌手、歌单 |
| `get_songs`, `get_lyrics` | Song details, lyrics (+ translation) · 歌曲详情、歌词(含翻译) |
| `get_playlist`, `get_album`, `get_artist`, `get_charts` | Catalogue · 歌单、专辑、歌手、排行榜 |
| `my_playlists`, `liked_songs`, `recently_played` | Your library · 我的歌单、红心、最近播放 |
| `daily_recommendations`, `personal_fm` | 每日推荐、私人漫游 |
| `like_song` | Like / unlike · 红心 / 取消红心 |
| `create_playlist`, `delete_playlist`, `edit_playlist_songs` | Manage playlists · 建歌单、删歌单、加删歌曲 |
| `ncm_troubleshoot` | Explains an error code · 解释错误代码 |

## Run · 运行

Needs [uv](https://docs.astral.sh/uv/). 需要先装 uv。The command below fetches and runs the server; nothing
else to install. 下面这条命令会自动下载并运行,不用另外安装。

```
uvx --from git+https://github.com/changeewuwsz/netease-music-mcp netease-music-mcp
```

**Claude Desktop** (`claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "netease-music": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/changeewuwsz/netease-music-mcp", "netease-music-mcp"]
    }
  }
}
```

**Claude Code**:

```
claude mcp add netease-music -- uvx --from git+https://github.com/changeewuwsz/netease-music-mcp netease-music-mcp
```

Then ask Claude to sign you in to NetEase Cloud Music; it shows a QR code. 然后让 Claude 帮你登录网易云,
它会显示二维码,用 App 扫一下并在手机上确认。

(From a clone you can also run `uv run --script ncm_server.py`. 克隆下来后也可以直接用这条。)

### Remote (HTTP + OAuth) · 远程使用

For clients that connect over the network (claude.ai custom connectors, ChatGPT, other agents), run it in
HTTP mode behind a tunnel (Tailscale Funnel, Cloudflare Tunnel, …). HTTP mode is protected by **OAuth**:
the URL alone is useless — a client must sign in on a page where you type your server password.

网络连接的客户端(claude.ai 自定义连接器、ChatGPT、其他 Agent)用 HTTP 模式,配一个隧道。HTTP 模式自带
**OAuth** 保护:光有地址没用,客户端第一次连接时会打开一个页面,要输入你设的服务器密码才能授权。

```
netease-music-mcp set-password          # once · 设一次密码(12 位以上)
NCM_MCP_PUBLIC_URL=https://your-host.example netease-music-mcp --http
```

(`netease-music-mcp` here stands for the `uvx --from … netease-music-mcp` command above.)

Then add `https://your-host.example/mcp` as a connector in your client and sign in when asked.
然后在客户端里添加 `https://your-host.example/mcp`,按提示授权即可。

- Simplest: the tunnel maps the **root** of a host to `127.0.0.1:8790`, because OAuth discovery lives under
  `/.well-known/`. Under a sub-path instead (e.g. `NCM_MCP_PUBLIC_URL=https://host/ncm`), also route
  `/.well-known/oauth-protected-resource/ncm` → `127.0.0.1:8790/.well-known/oauth-protected-resource/ncm` and
  `/.well-known/oauth-authorization-server/ncm` → `127.0.0.1:8790/.well-known/oauth-authorization-server`.
  Some clients (claude.ai in our tests) only reach port 443.
  最简单是把整个域名的根目录映射过来;放在子路径下的话,还要单独转发上面两个 `/.well-known/` 地址。
  有的客户端(我们测试时的 claude.ai)只连得上 443 端口。
- No terminal at hand (e.g. setting up from a phone): `setup-link` prints a one-time link (15 min) to set the
  first password in a browser. 手边没终端时,`setup-link` 生成一个 15 分钟有效的一次性网页链接来设密码。
- Clients that can't do OAuth: `netease-music-mcp add-key my-agent` prints an API key to send
  as `Authorization: Bearer <key>`. 不支持 OAuth 的客户端可以用 API 密钥。
- `revoke-all` signs every client out and deletes all keys. 一键撤销所有授权。
- `--no-auth` turns protection off — only for local use, never behind a tunnel.
- Access tokens last 1 hour; refresh tokens 90 days and are renewed on use. Five wrong passwords lock the
  page for 15 minutes. Only hashes are stored.

| Env | Default |
|---|---|
| `NCM_MCP_HOME` | `~/.config/netease-music-mcp` (session, device id, auth, log) |
| `NCM_MCP_PUBLIC_URL` | `http://127.0.0.1:8790` — the URL clients use; OAuth issuer |
| `NCM_MCP_PORT` | `8790` |
| `NCM_MCP_PATH` | `/mcp` |
| `NCM_MCP_ICON` | none — optional path to an image (png/jpg/svg/webp) used as the server icon · 可选:服务器图标图片的路径 |

## Notes · 说明

- Outside mainland China many songs are greyed out by licensing; results mark them `"playable": false`.
  在中国大陆以外,很多歌因为版权是灰色的,结果里会标 `"playable": false`。
- NetEase's anti-abuse checks are strict. Sign-in and liking use the desktop client's API because the
  web ones get blocked from scripts. Avoid hammering the tools.
  网易云风控较严;登录和红心走电脑客户端的接口。不要短时间大量调用。

## License

MIT