Skip to main content
Glama

Spotify MCP サーバー

このプロジェクトは、 CursorClaude for Desktop (macOS および Windows のみ) などの MCP クライアントを通じて自然言語を使用して Spotify の再生を制御できるModel Context Protocol (MCP)サーバーを実装します。

特徴

このサーバーは次のツールを公開します。

  • play : トラック、アルバム、またはプレイリストを再生するか、再生を再開します。

  • pause : 再生を一時停止します。

  • next : 次のトラックにスキップします。

  • previous : 前のトラックにスキップします。

  • get_current_track : 現在再生中のトラックに関する情報を取得します。

  • search : トラック、アルバム、アーティスト、またはプレイリストを検索します。

Related MCP server: Spotify MCP Server

前提条件

  • Bun (バージョン1.0.0以降)

  • Spotify Premium アカウント。

  • Spotify 開発者アプリケーション:

    • Spotify 開発者ダッシュボードで作成します。

    • クライアント ID とクライアント シークレットを取得します。

    • アプリの設定のリダイレクト URI にhttp://localhost:8888/callbackを追加します。

  • MCP クライアント (例: Cursor または Claude for Desktop)。

インストールとセットアップ

  1. リポジトリをクローンします。

    git clone https://github.com/obre10off/spotify-mcp.git cd spotify-mcp
  2. 依存関係をインストールします:

    bun install
  3. .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=
  4. 認証スクリプトを実行します。

    このスクリプトはブラウザを開き、Spotify にログインして権限を付与するように要求し、最初のアクセス トークンと更新トークンを取得します。

    bun run auth

    スクリプトはコンソールにSPOTIFY_ACCESS_TOKENSPOTIFY_REFRESH_TOKENを出力します。これらの値を.envファイルにコピーしてください。

  5. 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

    • **重要:**クライアント構成では常に絶対パスを使用してください。

  6. MCPクライアントを再起動します

    設定を適用するには、必ず MCP クライアント (Cursor/Claude) を再起動してください。

サーバーの実行

bun run start This command starts the server with automatic reloading on file changes (thanks to Bun's --watch flag). Keep this terminal window open while you're using the server. ## Usage Once the server is running and your MCP client is configured, you can start using natural language commands to control Spotify. Examples: "Play Bohemian Rhapsody" "Pause the music" "What song is playing?" "Search for Taylor Swift albums" "Next track" "Play spotify:track:4uLU6hMCjMI75M1A2tKUQC"
-
security - not tested
F
license - not found
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/obre10off/spotify-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server