MCP-AppleMusic
一个 FastMCP 服务器实现,用于通过 AppleScript 命令控制 macOS 上的 Apple Music(以前称为 iTunes)。
要求
Python 3.13+
安装了 Apple Music App 的 macOS
MCP 库≥1.2.1
Related MCP server: MCP Browser Tabs Server
安装
首先,确保您已安装 uv:
$ brew install uv
然后,使用Claude Desktop ,将以下内容添加到claude_desktop_config.json :
{
"mcpServers": {
"iTunesControlServer": {
"command": "uvx",
"args": ["-n", "mcp-applemusic"]
}
}
}
可用命令
以下命令可通过 MCP 服务器使用:
itunes_play() # Start playback
itunes_pause() # Pause playback
itunes_next() # Skip to next track
itunes_previous() # Go to previous track
itunes_search(query) # Search library for tracks
itunes_play_song(song) # Play specific song
itunes_create_playlist(name, songs) # Create new playlist
itunes_library() # Get library statistics
用法
启动服务器:
python server.py
交互示例:
# Search for a song
results = itunes_search("Hey Jude")
# Create a new playlist
itunes_create_playlist("Beatles Favorites", ["Yesterday", "Hey Jude", "Let It Be"])
# Play a specific song
itunes_play_song("Hey Jude")
发展
克隆存储库:
git clone https://github.com/yourusername/mcp-applemusic.git
cd mcp-applemusic
安装开发依赖项:
pip install -e ".[dev]"
贡献
分叉存储库
创建你的功能分支(
git checkout -b feature/amazing-feature)提交您的更改(
git commit -m 'Add amazing feature')推送到分支(
git push origin feature/amazing-feature)打开拉取请求
执照
该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。
笔记
由于依赖 AppleScript,此工具仅适用于 macOS 系统
需要安装 Apple Music(以前称为 iTunes)