使用说明
Spotify MCP服务器
一个模型上下文协议(MCP)服务器,将您的Spotify帐户连接到Claude,实现有关您的音乐数据和播放列表管理的自然语言对话。
特性
- 访问您的Spotify收听数据(热门曲目、艺术家、最近播放的歌曲)
- 通过自然语言创建和管理播放列表
- 搜索和发现音乐
- 获取个性化推荐
- 查看当前播放状态
设置
1.先决条件
- Python 3.9或更高版本
- Spotify帐户
- Spotify开发者应用程序凭据
2.创建Spotify开发者应用程序
- 首选 Spotify开发者仪表板
- 创建新应用程序
- 注意你的
Client ID和Client Secret - 添加
http://localhost:8888/callback在应用设置中重定向URI
3.安装依赖项
# Create and activate virtual environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
4.配置环境
# Copy example environment file
cp .env.example .env
# Edit .env and add your Spotify credentials
5.运行服务器
python src/server.py
6.配置克劳德桌面
添加到您的Claude Desktop配置文件中:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
视窗: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"spotify": {
"command": "python",
"args": ["/absolute/path/to/spotify-mcp/src/server.py"],
"env": {
"SPOTIFY_CLIENT_ID": "your_client_id",
"SPOTIFY_CLIENT_SECRET": "your_client_secret",
"SPOTIFY_REDIRECT_URI": "http://localhost:8888/callback"
}
}
}
}
使用示例
连接到Claude Desktop后:
- “这个月我最喜欢的五首歌是什么?”
- “用我最有活力的曲目创建一个名为‘健身组合’的播放列表”
- “显示我最近播放的歌曲”
- “给我找一些爵士乐推荐”
- “我现在在听什么?”
项目结构
spotify-mcp-server/
├── src/
│ ├── server.py # Main MCP server
│ ├── auth/ # Authentication modules
│ ├── spotify/ # Spotify API client
│ ├── tools/ # MCP tool implementations
│ ├── resources/ # MCP resources
│ └── utils/ # Utilities
├── .env # Environment variables (not committed)
├── .env.example # Example environment file
├── requirements.txt # Python dependencies
└── README.md
发展
内置:
许可证
麻省理工学院