agentleFS
fabioc-alohafabioc-aloha/spotify-mcpb/.github/copilot-instructions.md

spotify-mcpb

Copilot instructions0 starsChanged 14 months agoMITView on GitHub

Project Name: Spotify MCPB Version: 0.2.2 Type: MCPB Bundle (Model Context Protocol Bundle) for Claude Desktop Purpose: Cross-platform Spotify control and playlist management using Spotify Web API Important: This directory is named spotify-mcpb matching the project name. The project was rebranded from spotify-dxt to spotify-mcpb. See BUNDLE.md for details.

  • Reads credentials
  • Installs packages
  • Commits and pushes

The file

Show its rules and text

We split this copilot-instructions.md into the rules it gives an agent

37 rules. About 0 are common, 26 are distinctive, and 11 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈26

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 11

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    All 16 tool handlers are in this file

    line 162
  2. Distinctive:

    Follow existing patterns for new tools

    line 164
  3. Very specific:

    Always validate inputs using validation.js

    line 165
  4. Very specific:

    CRITICAL: All handler methods MUST call ensureReady() before operations

    line 167
  5. Very specific:

    Keep package.json in sync with actual usage

    line 171
  6. Distinctive:

    Only include production dependencies in bundle

    line 172
  7. Distinctive:

    Test after adding new dependencies

    line 173
  8. Distinctive:

    Update tool list when adding/removing tools

    line 177
  9. Very specific:

    Add tool definition in ListToolsRequestSchema handler

    line 187
  10. Very specific:

    Add case in CallToolRequestSchema switch statement

    line 188
  11. Very specific:

    Add tool to tools array

    line 192
  12. Distinctive:

    Add tool to README.md tool list

    line 195
  13. Distinctive:

    When updating docs, ensure consistency across:

    line 208
  14. Distinctive:

    Update all version references across documentation

    line 223
  15. Distinctive:

    Update bundle filename references

    line 224
  16. Distinctive:

    Update download links and examples

    line 225
  17. Distinctive:

    Verify all tools work

    line 234
  18. Distinctive:

    Check documentation is complete

    line 235
  19. Distinctive:

    Test authentication flow without refresh token

    line 236
  20. Distinctive:

    Benefit: No more manual OAuth flow, automated token exchange

    line 275
  21. Distinctive:

    Verify all required fields are present

    line 289
  22. Distinctive:

    Check all imports are valid

    line 295
  23. Very specific:

    Verify credentials in .env

    line 298
  24. Distinctive:

    Check refresh token is valid

    line 299
  25. Distinctive:

    Ensure proper OAuth scopes

    line 300
  26. Very specific:

    Use ES modules (import/export)

    line 307
  27. Very specific:

    Use async/await for promises

    line 308
  28. Distinctive:

    Use Markdown for all docs

    line 314
  29. Distinctive:

    Keep line length reasonable

    line 315
  30. Distinctive:

    Use clear section headers

    line 316
  31. Distinctive:

    Use conventional commits format

    line 321
  32. Distinctive:

    Keep commits focused and atomic

    line 323
  33. Very specific:

    Always specify bundle output name: when running mcpb pack

    line 358
  34. Distinctive:

    Update all documentation: when making changes

    line 361
  35. Very specific:

    Validate manifest: after any changes to manifest.json

    line 362
  36. Distinctive:

    Test locally: before creating distribution bundle

    line 363
  37. Distinctive:

    If you're new to this project, read in this order:

    line 370

≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

Spotify MCPB Project Instructions

Project Overview

Project Name: Spotify MCPB
Version: 0.2.2
Type: MCPB Bundle (Model Context Protocol Bundle) for Claude Desktop
Purpose: Cross-platform Spotify control and playlist management using Spotify Web API

Important: This directory is named spotify-mcpb matching the project name. The project was rebranded from spotify-dxt to spotify-mcpb.


🚨 Critical Project Guidelines

Project Naming

  • ✅ Use "Spotify MCPB" or "spotify-mcpb" when referring to this project
  • ✅ Repository URL: github.com/fabioc-aloha/spotify-mcpb
  • ❌ Do NOT call this project "spotify-dxt" (that's the original macOS project by Kenneth Lien)
  • ✅ Credit Original: Always acknowledge Kenneth Lien's spotify-dxt as the original inspiration

Authentication & Setup (Final v0.2.2 - Simplified)

  • ✅ All Three Parameters Required: manifest.json now requires client_id, client_secret, and refresh_token
  • ✅ Simple Token Generation: Users run npm run get-token script before installation
  • ✅ One-Step Setup: Enter all credentials during Claude Desktop installation
  • ✅ Use 127.0.0.1: Always use 127.0.0.1 instead of localhost for OAuth redirects
  • ✅ No Complex OAuth: Removed automatic OAuth flow from MCP server, use standalone script

Bundle Creation

✅ Directory renamed: The directory is now named spotify-mcpb, so mcpb pack creates correctly named bundles!

# ✅ CORRECT - Simple command now works
mcpb pack

# ✅ ALSO CORRECT - Specify version explicitly
mcpb pack . spotify-mcpb-0.2.2.mcpb

See BUNDLE.md for details.


📚 Essential Documentation Files

Quick Reference

  • README.md - Project overview and quick start
  • SETUP.md - Spotify API credential setup guide
  • LOCAL_TESTING.md - Local development and testing guide

Development

  • BUNDLE.md - Bundle creation, installation & distribution
  • CONTRIBUTING.md - Contribution guidelines

Distribution

  • CHANGELOG.md - Version history

Administrative

  • LICENSE.md - MIT License
  • SECURITY.md - Security policy
  • CODE_OF_CONDUCT.md - Code of conduct

🛠️ Project Structure

spotify-mcpb/
├── server/
│   ├── index.js                 # Main MCP server with 16 tool handlers
│   ├── spotifyWebController.js  # Spotify Web API wrapper
│   ├── playlistController.js    # High-level playlist operations
│   ├── logging.js               # Structured JSON logging
│   ├── error.js                 # Error handling with MCP responses
│   └── validation.js            # Input validation and sanitization
├── manifest.json                # MCPB v0.2 manifest (CRITICAL)
├── package.json                 # npm dependencies and scripts
├── .env.example                 # Credential template
├── icon.png                     # Bundle icon (23.9 KB)
└── [documentation files]        # See above

🎯 Key Features

16 MCP Tools Available

  1. spotify_get_refresh_token - Interactive OAuth flow (NEW in 0.2.0, FIXED in 0.2.2)
  2. spotify_play - Resume playback
  3. spotify_pause - Pause playback
  4. spotify_next_track - Skip to next track
  5. spotify_previous_track - Skip to previous track
  6. spotify_set_volume - Set volume (0-100)
  7. spotify_get_current_track - Get currently playing track
  8. spotify_get_playback_state - Get full playback state
  9. spotify_search_tracks - Search Spotify catalog
  10. spotify_create_playlist - Create new playlist
  11. spotify_add_tracks_to_playlist - Add tracks with deduplication
  12. spotify_get_playlist - Get playlist details
  13. spotify_get_user_playlists - List user's playlists
  14. spotify_get_recommendations - Get track recommendations
  15. spotify_get_audio_features - Get audio features for tracks
  16. spotify_analyze_playlist - Analyze playlist statistics

💻 Development Workflow

Initial Setup

# Clone repository
git clone https://github.com/fabioc-aloha/spotify-mcpb.git
cd spotify-mcpb

# Install dependencies
npm install

# Configure credentials
cp .env.example .env
# Edit .env with your Spotify API credentials

Testing Locally

# Run server directly
node server/index.js

# Or use npm script
npm start

# Generate refresh token interactively (NEW in v0.2.2)
npm run get-token

# Generate refresh token manually (fallback method)
npm run manual-token

Local Development Tools (NEW v0.2.2)

  • get-refresh-token.js - Interactive OAuth server on 127.0.0.1:8888
  • manual-token.js - Fallback token generation script
  • Both tools handle the full OAuth 2.0 flow automatically
  • Use 127.0.0.1 instead of localhost for better compatibility

Creating Bundle

# Install MCPB CLI (if not already installed)
npm install -g @anthropic-ai/mcpb

# Validate manifest
mcpb validate manifest.json

# Create bundle with explicit filename
mcpb pack . spotify-mcpb-0.2.2.mcpb

# Verify bundle
ls -lh spotify-mcpb-0.2.2.mcpb

Making Code Changes

Server Code (server/index.js)

  • All 16 tool handlers are in this file
  • Uses MCP SDK v1.20.1 (updated from v0.6.0 in v0.2.2)
  • Follow existing patterns for new tools
  • Always validate inputs using validation.js
  • Handle errors using error.js
  • CRITICAL: All handler methods MUST call ensureReady() before operations
  • Authentication Flow: Server starts without refresh token, users get it via interactive tool

Dependencies

  • Keep package.json in sync with actual usage
  • Only include production dependencies in bundle
  • Test after adding new dependencies

Manifest (manifest.json)

  • MCPB v0.2 format - do NOT change manifest_version
  • Update tool list when adding/removing tools
  • Validate with mcpb validate manifest.json after changes

🔧 Common Tasks

Adding a New Tool

  1. Update server/index.js:
    • Add tool definition in ListToolsRequestSchema handler
    • Add case in CallToolRequestSchema switch statement
    • Implement handler method (e.g., handleNewTool())
  2. Update manifest.json:
    • Add tool to tools array
  3. Update Documentation:
    • Add tool to README.md tool list
    • Update CHANGELOG.md
    • Update RELEASE_NOTES.md
  4. Test:
    node --check server/index.js
    mcpb validate manifest.json
    npm start

Updating Documentation

When updating docs, ensure consistency across:

  • Tool counts (currently 16 tools)
  • Version numbers (currently 0.2.2)
  • Repository URLs (github.com/fabioc-aloha/spotify-mcpb)
  • Project name (Spotify MCPB, not spotify-dxt)

Creating a Release

  1. Update Version:
    • package.json - version field
    • manifest.json - version field
    • server/index.js - version field
    • CHANGELOG.md - add new version section
  2. Update Documentation:
    • Update all version references across documentation
    • Update bundle filename references
    • Update download links and examples
  3. Create Bundle:
    mcpb pack . spotify-mcpb-{version}.mcpb
  4. Test Bundle:
    • Extract and test locally
    • Verify all tools work
    • Check documentation is complete
    • Test authentication flow without refresh token
  5. Tag and Release:
    git tag v{version}
    git push origin v{version}

🔧 Critical Fixes in v0.2.2

Authentication Flow Issues (RESOLVED)

  • Problem: manifest.json required refresh_token, blocking installation
  • Solution: Set required: false, default: "" in manifest.json
  • Impact: Users can now install without upfront token, get it via Claude

Missing Authentication Checks (RESOLVED)

  • Problem: 8 handler methods lacked ensureReady() calls
  • Affected Methods:
    • handleGetRefreshToken
    • handleSearchTracks
    • handleCreatePlaylist
    • handleAddTracksToPlaylist
    • handleGetPlaylist
    • handleGetUserPlaylists
    • handleGetRecommendations
    • handleAnalyzePlaylist
  • Solution: Added proper authentication validation to all handlers

Network Compatibility (IMPROVED)

  • Change: Updated all redirect URIs from localhost to 127.0.0.1
  • Reason: Better cross-platform compatibility, especially Windows
  • Files Updated: server/index.js, get-refresh-token.js, manual-token.js

Local Development Tools (NEW)

  • Added: get-refresh-token.js - Interactive OAuth server
  • Added: manual-token.js - Fallback token generation
  • Added: npm scripts: get-token, manual-token
  • Benefit: No more manual OAuth flow, automated token exchange

🐛 Troubleshooting

Common Issues

  1. Bundle has wrong name
    • Solution: Use mcpb pack . spotify-mcpb-0.2.2.mcpb
    • See BUNDLE.md
  2. Manifest validation fails
    • Check manifest_version is "0.2"
    • Verify all required fields are present
    • Run mcpb validate manifest.json
  3. Node.js errors
    • Ensure Node.js >= 18.0.0
    • Run node --check server/index.js
    • Check all imports are valid
  4. Spotify API errors
    • Verify credentials in .env
    • Check refresh token is valid
    • Ensure proper OAuth scopes

📝 Code Standards

JavaScript

  • Use ES modules (import/export)
  • Use async/await for promises
  • Always validate inputs
  • Handle errors gracefully
  • Log important events

Documentation

  • Use Markdown for all docs
  • Keep line length reasonable
  • Use clear section headers
  • Include code examples
  • Cross-reference related docs

Git Commits

  • Use conventional commits format
  • Reference issue numbers when applicable
  • Keep commits focused and atomic

🔗 Important Links

Repository

External Documentation

Tools

  • MCPB CLI: npm install -g @anthropic-ai/mcpb
  • Node.js: https://nodejs.org (>= 18.0.0 required)
  • Claude Desktop: For testing MCPB bundles

📊 Project Stats

  • Total Tools: 16
  • Lines of Code: ~16,000+ (with dependencies)
  • Bundle Size: 3.0 MB compressed, 10.2 MB unpacked
  • Documentation: 64.3 KB across 10 files
  • Dependencies: 60 packages (5 direct)

⚠️ Important Reminders

  1. Always specify bundle output name when running mcpb pack
  2. Use "spotify-mcpb" not "spotify-dxt" for this project
  3. Credit Kenneth Lien for the original spotify-dxt inspiration
  4. Update all documentation when making changes
  5. Validate manifest after any changes to manifest.json
  6. Test locally before creating distribution bundle
  7. Check Node.js syntax with node --check before bundling

🎓 Learning Resources

If you're new to this project, read in this order:

  1. README.md - Start here
  2. SETUP.md - Get credentials
  3. BUNDLE.md - Understand bundle creation
  4. LOCAL_TESTING.md - Local development setup

For specific tasks:

  • Adding features: See "Adding a New Tool" section above
  • Creating releases: See "Creating a Release" section above
  • Contributing: See CONTRIBUTING.md

Last Updated: October 20, 2025
Project Version: 0.2.2
Maintainer: Fabio Correa

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.