This repository now includes an MCP (Model Context Protocol) server that exposes the now playing functionality as a tool.
The MCP server provides a single tool:
now_playing: Returns currently playing song information from music players
-
Install dependencies:
uv sync
-
On Windows, ensure you have music players running (Spotify, QQMusic, NeteaseMusic)
Run the MCP server:
uv run mcp_server.pyThe server will run on stdio and communicate using the MCP protocol.
To use this server with an MCP client, add the following configuration:
{
"mcpServers": {
"now-playing": {
"command": "uv",
"args": ["run", "mcp_server.py"],
"cwd": "/path/to/NowPlayingAPI"
}
}
}- Windows: Full functionality with actual music player detection
MacOS/Linux currently not supported.
Description: Get currently playing song information from music players
Input: No parameters required
Output: Text response with currently playing songs, formatted as:
Currently playing:
🎵 Artist - Song Title (from spotify.exe)
🎵 Another Song - Artist (from qqmusic.exe)
🎵 One More Song - Artist (from cloudmusic.exe)
If no music is playing, returns: "No music is currently playing."