这是一个通过AppleScript命令在macOS上控制Apple Music(以前称为iTunes)的FastMCP服务器实现。
首先,确保已安装uv:
$ brew install uv
然后,在Claude Desktop中,向claude_desktop_config.json添加以下内容:
{
"mcpServers": {
"iTunesControlServer": {
"command": "uvx",
"args": ["-p", "3.13", "-n", "mcp-applemusic"]
}
}
}
通过MCP服务器可以使用以下命令:
itunes_play() # 开始播放
itunes_pause() # 暂停播放
itunes_next() # 跳到下一曲
itunes_previous() # 回到上一曲
itunes_search(query) # 在库中搜索曲目
itunes_play_song(song) # 播放特定歌曲
itunes_create_playlist(name, songs) # 创建新播放列表
itunes_library() # 获取库统计信息
启动服务器:
python server.py
示例交互:
# 搜索一首歌
results = itunes_search("Hey Jude")
# 创建一个新播放列表
itunes_create_playlist("披头士最爱", ["Yesterday", "Hey Jude", "Let It Be"])
# 播放特定歌曲
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 '添加精彩功能')git push origin feature/amazing-feature)本项目采用MIT许可证——详情见LICENSE文件。