WT

weiyu-t/netease-music-mcp-vercel

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

0 stars 14 forks 质量 74 趋势 4MIT

Vercel-deployable MCP server for NetEase Cloud Music search and lyrics

概览

Local stdio or remote HTTP MCP server for quickly searching NetEase Cloud Music and fetching timestamped lyrics. The implementation is based on the NetEase Music developer docs you linked, especially the pages for keyword search and lyric retrieval: - 803202bd65bc469587d05b507dcd31e7: lyric retrieval - ffd83c003331452d9d0bdb45e8ab1261: comprehensive keyword search - b175e0d52550427cbb7cd4735a9de765: keyword song search - ca7eda92ab634c0fbc1436c99fdaad5d: keyword album search - a1c2bcb0e9b44c09a45b614c3d4f1784: keyword artist search - a6d0565f06c54439b7c75c145b216995: album song list - ba84444321a94ffea19f592e2f92b70a: artist album list For this assignment, the MCP focuses on the operations you said you wanted to make fast: searching songs, searching albums, searching artists, listing album songs, listing artist albums, and fetching lyrics. The NetEase web API adapter is isolated in server/lib/neteaseClient.js and server/lib/neteaseCrypto.

README

以下为原文 README 节选,完整内容请查看原文。

NetEase Music MCP

Local stdio or remote HTTP MCP server for quickly searching NetEase Cloud Music and fetching timestamped lyrics.

What It Wraps

The implementation is based on the NetEase Music developer docs you linked, especially the pages for keyword search and lyric retrieval:

  • 803202bd65bc469587d05b507dcd31e7: lyric retrieval
  • ffd83c003331452d9d0bdb45e8ab1261: comprehensive keyword search
  • b175e0d52550427cbb7cd4735a9de765: keyword song search
  • ca7eda92ab634c0fbc1436c99fdaad5d: keyword album search
  • a1c2bcb0e9b44c09a45b614c3d4f1784: keyword artist search
  • a6d0565f06c54439b7c75c145b216995: album song list
  • ba84444321a94ffea19f592e2f92b70a: artist album list

For this assignment, the MCP focuses on the operations you said you wanted to make fast: searching songs, searching albums, searching artists, listing album songs, listing artist albums, and fetching lyrics. The NetEase web API adapter is isolated in server/lib/neteaseClient.js and server/lib/neteaseCrypto.js, so you can later replace it with official app-key signing if your developer account requires it.

Design Choice: No NetEase Login

This server intentionally avoids logging in to NetEase Music. It only calls public web endpoints so setup stays lightweight: no NetEase cookies, no personal account session, and no credential storage. That makes lyric/search fetching easier to run locally, deploy remotely, and share with MCP clients.

The tradeoff is that account-only behavior is out of scope. Region-restricted, VIP-only, or personalized data may be incomplete or unavailable.

Prerequisites

  • Node.js 20 or newer
  • Network access to https://music.163.com

Install dependencies before running tests or the Vercel route:

npm install

The stdio server itself still uses only Node built-ins. The extra dependencies are for the Vercel/Next.js Streamable HTTP route.

Project Structure

app/api/[transport]/route.js   # Vercel MCP route at /api/mcp
app/page.js                    # small landing page for deployed app
server/index.js              # stdio entrypoint
server/http.js               # HTTP entrypoint for remote deployment
server/mcpServer.js          # MCP JSON-RPC routing
server/tools/musicTools.js   # tool schemas and handlers
server/tools/registerMcpTools.js # adapter for mcp-handler on Vercel
server/lib/neteaseClient.js  # NetEase HTTP client, timeouts, throttling
server/lib/neteaseCrypto.js  # NetEase weapi payload encryption
server/lib/normalizers.js    # response shaping
server/lib/validation.js     # tool input validation
server/lib/errors.js         # typed tool/upstream errors
server/lib/config.js         # server constants and env-backed settings
server/lib/logger.js         # stderr logging

Run Locally With Stdio

npm start

That starts a stdio MCP server. It is meant to be launched by an MCP client, so it will wait for JSON-RPC messages on stdin.

To inspect it interactively:

在 GitHub 查看完整 README

安装

npx vercel --prod --yes
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "netease-music": { "command": "node", "args": [ "/absolute/path/to/week3/server/index.js" ], "env": { "NETEASE_TIMEOUT_MS": "10000", "NETEASE_MIN_INTERVAL_MS": "350" } } } }