网易云音乐 MCP Server
通过 MCP 协议让 AI 操控网易云音乐,实现一起听、搜歌、点歌、切歌、发私信和查歌单等功能。
README
网易云音乐 MCP Server(Zeabur 部署)
让 Claude.ai(官方 Connector)通过 MCP 协议操控网易云音乐:一起听、搜歌、加歌、切歌、发私信、查歌单。
架构
Claude.ai (Connector)
↓ HTTPS(Streamable HTTP,/mcp 端点)
ncm-mcp 服务(Python FastMCP,本仓库) ← 公网域名
├── 读操作(搜索/歌单/私信/详情)→ ncmapi 服务(NeteaseCloudMusicApi 镜像) ← 内网
└── 写操作(一起听/切歌/加歌/发私信)→ eapi/weapi 加密 → interface.music.163.com
两个 Zeabur 服务:
| 服务 | 内容 | 是否公网 |
|---|---|---|
ncmapi |
binaryify/netease_cloud_music_api:latest 镜像 |
否(内网) |
ncm-mcp |
本仓库的 Python 服务 | 是(绑域名) |
为什么写操作不走镜像?Docker Hub 那个镜像太老,eapi 加密参数过期,一起听/发私信会 400。所以写操作在 Python 里直接加密直连官方接口。
前置
- GitHub 仓库(本仓库)
- 网易云音乐账号给 AI 用(「大号」),你自己的账号是「小号」,互相关注
- 大号的完整 Cookie
获取 Cookie
- 电脑浏览器打开
music.163.com,登录大号 F12→ 网络(Network) → 随便找一个发到music.163.com的请求 → 请求标头 → 找到Cookie:→ 复制整条值- ⚠️ 必须整条,不能只抄
MUSIC_U(只存 MUSIC_U 的话写操作会全部 400)
部署步骤
1. 推代码到 GitHub
本仓库的 master 分支即为可部署代码,本地改完 git push 即可。
2. Zeabur 创建项目
登录 zeabur.com → 新建一个 Project。
3. 部署 ncmapi 服务(镜像)
Add Service → Docker Image → 填镜像名:
binaryify/netease_cloud_music_api:latest
- 服务名改成
ncmapi - 不用绑定域名(内网给 ncm-mcp 调用)
4. 部署 ncm-mcp 服务(本仓库)
Add Service → GitHub → 选仓库 Yvine34/ncm-mcp
- Zeabur 会自动识别根目录的
Dockerfile并构建 - 服务名改成
ncm-mcp
5. 配置环境变量
在 ncm-mcp 服务的 Variables 里加:
| 变量 | 值 | 说明 |
|---|---|---|
COOKIE |
大号的完整 Cookie | 必填,整条 |
NCM_API |
http://ncmapi:3000 |
ncmapi 的内网地址 |
如果
http://ncmapi:3000连不通,就给ncmapi服务也绑个域名,然后NCM_API填那个公网https://域名。
6. 绑定域名
ncm-mcp 服务 → Domains → 生成/绑定一个域名,得到 https://xxx.zeabur.app。
7. Claude.ai 添加 Connector
Claude.ai → Settings → Connectors → 添加:
- URL:
https://xxx.zeabur.app/mcp - 名称:网易云音乐
- 权限:Always allow
工具清单
| 工具 | 功能 | 加密 |
|---|---|---|
search_music |
搜索音乐 | 走镜像 |
get_song_detail |
歌曲详情 | 走镜像 |
get_user_playlist |
用户歌单 | 走镜像 |
get_playlist_detail |
歌单详情 | 走镜像 |
get_private_list |
私信列表 | 走镜像 |
get_private_messages |
私信历史 | 走镜像 |
get_login_status |
登录状态 | 走镜像 |
get_user_detail |
用户详情 | 走镜像 |
accept_listen_together |
接受一起听 | eapi |
end_listen_together |
退出一起听 | eapi |
listen_together_heartbeat |
心跳保活(另有后台自动) | eapi |
listen_together_status |
查询一起听状态 | eapi |
play_command |
切歌(实时) | eapi |
add_song |
加歌到播放列表 | eapi |
send_private_message |
发私信 | weapi |
http_request |
万能请求兜底 | 走镜像 |
使用流程
一起听
- 你(小号)在网易云 APP 里给大号发一起听邀请
- 告诉 Claude「私信给我发了一起听」
- Claude 调
get_private_list/get_private_messages读私信,解析出roomId、inviterId - Claude 调
accept_listen_together加入房间 - 后台线程每 60s 自动心跳保活,房间不会过期
点歌
- 告诉 Claude 想听什么
- Claude 调
search_music搜歌拿id - Claude 调
add_song加歌 - 你清一次 APP 后台重进,同步列表
- 之后 Claude 用
play_command随时切歌,实时生效
发私信
Claude 调 send_private_message 直接发私信(weapi/RSA,这部分未用真实 cookie 实测,首次用需验证)。
常见问题
- 写操作全部 400:Cookie 不完整,重新抓整条(含
__csrf、MUSIC_U、MUSIC_A_T、MUSIC_R_T)。 - Connector 连不上:确认 ncm-mcp 绑了域名,且 URL 是
https://域名/mcp(结尾带/mcp)。 - 读操作报错:确认
NCM_API能通(ncmapi 服务在运行)。 - 一起听房间掉了:正常,让 Claude 重新
accept_listen_together;自动心跳只在已 accept 的房间上生效。
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
E2B
Using MCP to run code via e2b.