KosmoKrator

other

Spotify MCP Integration for LangChain

Connect Spotify to LangChain through the local KosmoKrator MCP gateway with scoped tools, credentials, and write policy.

8 functions 7 read 1 write Manual OAuth token auth

Connect Spotify to LangChain

Bridge LangChain agents to local KosmoKrator integration tools through MCP or headless CLI calls.

Use the MCP gateway when the agent should discover tools, or wrap kosmo integrations:call for fixed chains. The gateway is local, scoped to this integration, and starts with --write=deny so LangChain can inspect read-capable tools without receiving write access by default.

Spotify MCP Config for LangChain

Keep the gateway scoped to the integration and operation class needed by the chain.

{
  "mcpServers": {
    "kosmokrator-spotify": {
      "type": "stdio",
      "command": "kosmo",
      "args": [
        "mcp:serve",
        "--integration=spotify",
        "--write=deny"
      ]
    }
  }
}

Run the Gateway Manually

kosmokrator mcp:serve --integration=spotify --write=deny

Why Use KosmoKrator Here

Scoped tools

Expose only Spotify instead of a broad multi-service tool list.

Local credentials

Reuse credentials already configured for the KosmoKrator CLI and Lua runtime.

Write policy

Start read-only, then opt into ask or allow for trusted workspaces.

Spotify Tools Visible to LangChain

LangChain sees stable MCP tool names generated from the Spotify integration catalog.

MCP toolSource functionTypeDescription
integration__spotify__spotify_search spotify.spotify_search Read Search for tracks, artists, albums, or playlists on Spotify. Returns matching items with basic metadata. Use specific get tools for detailed information about a single item.
integration__spotify__spotify_get_track spotify.spotify_get_track Read Get detailed information about a specific Spotify track, including artists, album, duration, and popularity.
integration__spotify__spotify_get_artist spotify.spotify_get_artist Read Get detailed information about a specific Spotify artist, including followers, genres, and popularity.
integration__spotify__spotify_list_playlists spotify.spotify_list_playlists Read List the current user's Spotify playlists. Returns playlist names, IDs, and track counts.
integration__spotify__spotify_get_playlist spotify.spotify_get_playlist Read Get detailed information about a Spotify playlist, including its tracks with artist and album details.
integration__spotify__spotify_create_playlist spotify.spotify_create_playlist Write Create a new Spotify playlist for the current user. Use the "Get Current User" tool first if you need the user ID.
integration__spotify__spotify_list_albums spotify.spotify_list_albums Read List albums by a specific Spotify artist. Includes singles and compilations by default.
integration__spotify__spotify_get_current_user spotify.spotify_get_current_user Read Get the authenticated user's Spotify profile, including their user ID (needed for creating playlists), display name, and follower count.

Related Spotify Pages