Skip to main content

QQ Music MCP Server - QQ Music API for LLMs

Project description

QQ Music MCP Server

一个基于 MCP (Model Context Protocol) 的 QQ 音乐 API 服务器,让大语言模型能够搜索音乐、获取歌曲信息、歌词和播放链接。

安装

# 使用 pip
pip install qq-music-mcp

# 或使用 uv
uv pip install qq-music-mcp

在 Claude Desktop 中使用

编辑 Claude Desktop 配置文件:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %AppData%\Claude\claude_desktop_config.json

添加以下配置:

{
  "mcpServers": {
    "qq-music": {
      "command": "uvx",
      "args": ["qq-music-mcp"]
    }
  }
}

或者如果使用 pip 安装:

{
  "mcpServers": {
    "qq-music": {
      "command": "qq-music-mcp"
    }
  }
}

然后重启 Claude Desktop。

功能

提供以下 MCP Tools:

Tool 名称 描述
search_music 搜索歌曲、专辑、歌单等
get_song_detail 获取歌曲详情
get_song_quality 获取歌曲可用音质
get_lyric 获取歌词
get_song_url 获取单首歌曲播放链接
get_batch_song_urls 批量获取歌曲播放链接
get_album_detail 获取专辑详情
get_album_songs 获取专辑歌曲列表
get_playlist_detail 获取歌单详情
get_album_cover 获取专辑封面 URL

VIP 内容访问

如需获取 VIP 歌曲的高品质播放链接,请设置环境变量:

export QQ_MUSIC_COOKIE="your_qq_music_cookie_here"

或在 Claude Desktop 配置中添加:

{
  "mcpServers": {
    "qq-music": {
      "command": "uvx",
      "args": ["qq-music-mcp"],
      "env": {
        "QQ_MUSIC_COOKIE": "your_cookie_here"
      }
    }
  }
}

获取 Cookie 的步骤:

  1. 打开浏览器访问 https://y.qq.com
  2. 登录你的 QQ 账号
  3. 打开开发者工具 (F12) -> Application -> Cookies
  4. 复制完整的 Cookie 字符串

音质类型说明

音质代码 说明
m4a AAC 格式
128 128kbps MP3
320 320kbps MP3
flac FLAC 无损
ape APE 无损
hires 臻品母带 (24bit/192kHz)
atmos 臻品全景声 (Dolby Atmos)

开发

# 克隆项目
git clone https://github.com/yourusername/qq-music-mcp.git
cd qq-music-mcp

# 安装依赖
uv sync

# 运行测试
uv run mcp dev src/qq_music_api/server.py

作为 Python 库使用

import asyncio
from qq_music_api import QQMusicClient

async def main():
    async with QQMusicClient() as client:
        # 搜索歌曲
        result = await client.search("周杰伦")
        print(result)

        # 获取歌词
        lyric = await client.get_lyric("000paPeF1SZp2I")
        print(lyric)

asyncio.run(main())

许可证

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qq_music_mcp-0.1.0.tar.gz (55.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qq_music_mcp-0.1.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file qq_music_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: qq_music_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 55.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for qq_music_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4af8137429b5474b94793fa113d3b91ad9996498dfa74f42615f6928c12a87c1
MD5 91f9f52e8e741f40d7e6f37cad8e7099
BLAKE2b-256 f261b90588a1fc2cf4899a03d3dd9d8356480acef359c15ba0f68e5f100de4c9

See more details on using hashes here.

File details

Details for the file qq_music_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: qq_music_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for qq_music_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0533539836a308cc15901f06a643ea63ed0ba07fe5a37b3d1a97630e8dcf2bf6
MD5 1fbd15e8ecf0058a894b568debd61dfc
BLAKE2b-256 039843bffc915645f153b9bdd59b8289fb635f6e78d2b42687cc6f53b73f005f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page