Spotify MCP サーバー
このプロジェクトは、 CursorやClaude for Desktop (macOS および Windows のみ) などの MCP クライアントを通じて自然言語を使用して Spotify の再生を制御できるModel Context Protocol (MCP)サーバーを実装します。
特徴
このサーバーは次のツールを公開します。
play
: トラック、アルバム、またはプレイリストを再生するか、再生を再開します。pause
: 再生を一時停止します。next
: 次のトラックにスキップします。previous
: 前のトラックにスキップします。get_current_track
: 現在再生中のトラックに関する情報を取得します。search
: トラック、アルバム、アーティスト、またはプレイリストを検索します。
前提条件
Bun (バージョン1.0.0以降)
Spotify Premium アカウント。
Spotify 開発者アプリケーション:
Spotify 開発者ダッシュボードで作成します。
クライアント ID とクライアント シークレットを取得します。
アプリの設定のリダイレクト URI に
http://localhost:8888/callback
を追加します。
MCP クライアント (例: Cursor または Claude for Desktop)。
インストールとセットアップ
リポジトリをクローンします。
git clone https://github.com/obre10off/spotify-mcp.git cd spotify-mcp依存関係をインストールします:
bun install.env
プロジェクトディレクトリのルートに
.env
というファイルを作成します。以下のコードを追加し、プレースホルダーを実際のSpotifyの認証情報に置き換えます。SPOTIFY_CLIENT_ID=your_spotify_client_id SPOTIFY_CLIENT_SECRET=your_spotify_client_secret SPOTIFY_REDIRECT_URI=http://localhost:8888/callback # These will be filled in after running the auth script: SPOTIFY_ACCESS_TOKEN= SPOTIFY_REFRESH_TOKEN=認証スクリプトを実行します。
このスクリプトはブラウザを開き、Spotify にログインして権限を付与するように要求し、最初のアクセス トークンと更新トークンを取得します。
bun run authスクリプトはコンソールに
SPOTIFY_ACCESS_TOKEN
とSPOTIFY_REFRESH_TOKEN
を出力します。これらの値を.env
ファイルにコピーしてください。MCP クライアントを構成します。
カーソル:
カーソルの設定を開きます (Cmd+, または Ctrl+,)。
「モデルコンテキストプロトコル」を検索します。
「settings.json で編集」をクリックします。
mcp.servers
配列に以下を追加します (/absolute/path/to/your/spotify-mcp``spotify-mcp
ディレクトリへの絶対パスに置き換えます)。{ "mcp.servers": [ { "spotify": { "command": "bun", "args": ["/absolute/path/to/your/spotify-mcp/src/index.ts"], "env": { "SPOTIFY_CLIENT_ID": "your_spotify_client_id", "SPOTIFY_CLIENT_SECRET": "your_spotify_client_secret", "SPOTIFY_REDIRECT_URI": "http://localhost:8888/callback", "SPOTIFY_ACCESS_TOKEN": "your_spotify_access_token", "SPOTIFY_REFRESH_TOKEN": "your_spotify_refresh_token" } } } ] }値をsettings.jsonファイルに追加するのではなく、
.env
ファイルを使用して、Spotifyに関連する環境変数のみをそこに置くことをお勧めします。
デスクトップ版Claude(macOS/Windows):
Claude for Desktop 構成ファイルを開きます。
macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Windows:
%APPDATA%\Claude\claude_desktop_config.json
mcpServers
オブジェクトに以下を追加します (/absolute/path/to/your/spotify-mcp``spotify-mcp
ディレクトリへの絶対パスに置き換えます): GXP6
**重要:**クライアント構成では常に絶対パスを使用してください。
MCPクライアントを再起動します
設定を適用するには、必ず MCP クライアント (Cursor/Claude) を再起動してください。
サーバーの実行
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
Cursor や Claude for Desktop などの MCP クライアントで自然言語コマンドを使用して Spotify の再生を制御できるようにするモデル コンテキスト プロトコル サーバー。
Related MCP Servers
- AsecurityFlicenseAqualityA FastMCP tool that enables control of Spotify through natural language commands in Cursor Composer, allowing users to manage playback, search for content, and interact with playlists.Last updated -5
- AsecurityFlicenseAqualityA lightweight Model Context Protocol server that enables AI assistants like Cursor & Claude to control Spotify playback and manage playlists.Last updated -18154
- -securityFlicense-qualityA Model Context Protocol server that enables AI assistants like Claude to interact with Spotify, allowing them to search for tracks, control playback, and manage playlists.Last updated -1
- -security-license-qualityAn MCP server template that likely enables interaction with Spotify's API, allowing users to perform Spotify-related operations through natural language commands.