[PR #45] feat: Add SPOTIPY_CACHE_PATH environment variable support #44

Open
opened 2026-02-28 15:42:58 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/varunneal/spotify-mcp/pull/45
Author: @jmward09
Created: 11/5/2025
Status: 🔄 Open

Base: mainHead: feature/spotipy-cache-path


📝 Commits (1)

  • 952a1aa feat: Add SPOTIPY_CACHE_PATH environment variable support

📊 Changes

1 file changed (+15 additions, -5 deletions)

View changed files

📝 src/spotify_mcp/spotify_api.py (+15 -5)

📄 Description

Summary

This PR adds support for the SPOTIPY_CACHE_PATH environment variable, allowing users to specify a custom location for OAuth token cache files.

Motivation

When deploying spotify-mcp in certain environments, it's useful to control where token cache files are stored:

  • Containerized deployments: Cache location needs to match volume mounts
  • Multi-user setups: Different users need separate token storage
  • CI/CD environments: Specific cache paths required by build systems
  • MCP wrapper scripts: Easier token management with explicit paths

Changes

  • Modified spotify_api.py Client initialization to check for SPOTIPY_CACHE_PATH environment variable
  • If set, passes cache_path parameter to SpotifyOAuth
  • If not set, uses spotipy's default behavior (backward compatible)

Testing

Tested in production environment with custom cache path:

export SPOTIPY_CACHE_PATH="/home/user/.cache-spotify"

Token caching works correctly with custom path specified.

Backward Compatibility

Fully backward compatible - if SPOTIPY_CACHE_PATH is not set, behavior is unchanged

None currently open, but this pattern is common across Python projects using environment variables for configuration.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/varunneal/spotify-mcp/pull/45 **Author:** [@jmward09](https://github.com/jmward09) **Created:** 11/5/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feature/spotipy-cache-path` --- ### 📝 Commits (1) - [`952a1aa`](https://github.com/varunneal/spotify-mcp/commit/952a1aa1cc6b06c4136dbddb23bf9f9f44f78c02) feat: Add SPOTIPY_CACHE_PATH environment variable support ### 📊 Changes **1 file changed** (+15 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `src/spotify_mcp/spotify_api.py` (+15 -5) </details> ### 📄 Description ## Summary This PR adds support for the `SPOTIPY_CACHE_PATH` environment variable, allowing users to specify a custom location for OAuth token cache files. ## Motivation When deploying spotify-mcp in certain environments, it's useful to control where token cache files are stored: - **Containerized deployments**: Cache location needs to match volume mounts - **Multi-user setups**: Different users need separate token storage - **CI/CD environments**: Specific cache paths required by build systems - **MCP wrapper scripts**: Easier token management with explicit paths ## Changes - Modified `spotify_api.py` Client initialization to check for `SPOTIPY_CACHE_PATH` environment variable - If set, passes `cache_path` parameter to SpotifyOAuth - If not set, uses spotipy's default behavior (backward compatible) ## Testing Tested in production environment with custom cache path: ```bash export SPOTIPY_CACHE_PATH="/home/user/.cache-spotify" ``` Token caching works correctly with custom path specified. ## Backward Compatibility ✅ Fully backward compatible - if `SPOTIPY_CACHE_PATH` is not set, behavior is unchanged ## Related Issues None currently open, but this pattern is common across Python projects using environment variables for configuration. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify-mcp-varunneal#44
No description provided.