@darrenjaws/spotify-mcp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +606 -0
  3. package/build/bin.d.ts +7 -0
  4. package/build/bin.d.ts.map +1 -0
  5. package/build/bin.js +22 -0
  6. package/build/bin.js.map +1 -0
  7. package/build/handlers/call-tool.d.ts +6 -0
  8. package/build/handlers/call-tool.d.ts.map +1 -0
  9. package/build/handlers/call-tool.js +46 -0
  10. package/build/handlers/call-tool.js.map +1 -0
  11. package/build/handlers/tools.d.ts +296 -0
  12. package/build/handlers/tools.d.ts.map +1 -0
  13. package/build/handlers/tools.js +246 -0
  14. package/build/handlers/tools.js.map +1 -0
  15. package/build/index.d.ts +2 -0
  16. package/build/index.d.ts.map +1 -0
  17. package/build/index.js +147 -0
  18. package/build/index.js.map +1 -0
  19. package/build/setup.d.ts +7 -0
  20. package/build/setup.d.ts.map +1 -0
  21. package/build/setup.js +290 -0
  22. package/build/setup.js.map +1 -0
  23. package/build/spotify/auth.d.ts +43 -0
  24. package/build/spotify/auth.d.ts.map +1 -0
  25. package/build/spotify/auth.js +263 -0
  26. package/build/spotify/auth.js.map +1 -0
  27. package/build/spotify/client.d.ts +14 -0
  28. package/build/spotify/client.d.ts.map +1 -0
  29. package/build/spotify/client.js +40 -0
  30. package/build/spotify/client.js.map +1 -0
  31. package/build/tools/playback.d.ts +17 -0
  32. package/build/tools/playback.d.ts.map +1 -0
  33. package/build/tools/playback.js +143 -0
  34. package/build/tools/playback.js.map +1 -0
  35. package/build/tools/playlists.d.ts +11 -0
  36. package/build/tools/playlists.d.ts.map +1 -0
  37. package/build/tools/playlists.js +93 -0
  38. package/build/tools/playlists.js.map +1 -0
  39. package/build/tools/search.d.ts +6 -0
  40. package/build/tools/search.d.ts.map +1 -0
  41. package/build/tools/search.js +62 -0
  42. package/build/tools/search.js.map +1 -0
  43. package/build/tools/user.d.ts +8 -0
  44. package/build/tools/user.d.ts.map +1 -0
  45. package/build/tools/user.js +103 -0
  46. package/build/tools/user.js.map +1 -0
  47. package/build/types.d.ts +56 -0
  48. package/build/types.d.ts.map +1 -0
  49. package/build/types.js +5 -0
  50. package/build/types.js.map +1 -0
  51. package/build/utils/logger.d.ts +12 -0
  52. package/build/utils/logger.d.ts.map +1 -0
  53. package/build/utils/logger.js +86 -0
  54. package/build/utils/logger.js.map +1 -0
  55. package/package.json +70 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Darren Jaworski
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,606 @@
1
+ # Spotify MCP Server
2
+
3
+ A Model Context Protocol (MCP) server that provides seamless integration with Spotify's API, enabling AI assistants to control and interact with Spotify playback, manage playlists, search for music, and retrieve user listening data.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Overview](#overview)
8
+ - [Features](#features)
9
+ - [Current Features](#current-features)
10
+ - [Planned Features](#planned-features)
11
+ - [Quick Start](#quick-start)
12
+ - [Installation](#installation)
13
+ - [Configuration](#configuration)
14
+ - [Automated Setup](#automated-setup-recommended)
15
+ - [Manual Setup](#manual-setup)
16
+ - [Spotify App Setup](#spotify-app-setup)
17
+ - [Environment Variables](#environment-variables)
18
+ - [MCP Configuration](#mcp-configuration)
19
+ - [Usage](#usage)
20
+ - [Available Tools (16 total)](#available-tools-16-total)
21
+ - [Playback](#playback)
22
+ - [Search & Discovery](#search--discovery)
23
+ - [Library Management](#library-management)
24
+ - [User Data](#user-data)
25
+ - [Local Development](#local-development)
26
+ - [Prerequisites](#prerequisites)
27
+ - [Initial Setup](#initial-setup)
28
+ - [Development Workflow](#development-workflow)
29
+ - [Testing Your MCP Server](#testing-your-mcp-server)
30
+ - [Development Tips](#development-tips)
31
+ - [Testing](#testing)
32
+ - [Linting and Code Quality](#linting-and-code-quality)
33
+ - [Troubleshooting](#troubleshooting)
34
+ - [Authentication Flow](#authentication-flow)
35
+ - [Security](#security)
36
+ - [Contributing](#contributing)
37
+ - [License](#license)
38
+ - [Acknowledgments](#acknowledgments)
39
+ - [Support](#support)
40
+ - [Related Projects](#related-projects)
41
+ - [Resources](#resources)
42
+
43
+ ## Overview
44
+
45
+ The Spotify MCP Server bridges the gap between AI assistants and Spotify, allowing natural language interactions with your music library and playback. Whether you want to play specific songs, create playlists, discover new music, or analyze your listening habits, this server provides the tools to make it happen.
46
+
47
+ ## Features
48
+
49
+ ### Current Features
50
+ - **Authentication & Authorization**: OAuth 2.0 Authorization Code flow for secure Spotify API access
51
+ - **Playback Control**: Play, pause, skip, adjust volume, and control playback across devices
52
+ - **Search**: Find tracks, albums, artists, and playlists
53
+ - **Library Management**: Access and manage saved tracks, albums, and playlists
54
+ - **User Data**: Retrieve user profile information and listening statistics
55
+
56
+ ### Planned Features
57
+ See [ROADMAP.md](ROADMAP.md) for detailed feature timeline and future enhancements.
58
+
59
+ ## Quick Start
60
+
61
+ The **fastest and easiest** way to get started is using the interactive setup wizard:
62
+
63
+ ```bash
64
+ # Run the setup wizard (no installation required!)
65
+ npx @darrenjaws/spotify-mcp setup
66
+ ```
67
+
68
+ The wizard will:
69
+ - ✅ Guide you through creating a Spotify Developer app
70
+ - ✅ Open your browser to the right pages automatically
71
+ - ✅ Validate your credentials as you enter them
72
+ - ✅ Generate the correct configuration for your environment
73
+ - ✅ Give you copy-paste ready configs for Claude Desktop or Claude Code
74
+
75
+ **That's it!** The whole setup takes about 2 minutes.
76
+
77
+ ## Installation
78
+
79
+ ### Option 1: NPM (Recommended)
80
+
81
+ **Interactive Setup (Easiest):**
82
+ ```bash
83
+ # No installation required - run the setup wizard
84
+ npx @darrenjaws/spotify-mcp setup
85
+ ```
86
+
87
+ **Or install globally first:**
88
+ ```bash
89
+ npm install -g @darrenjaws/spotify-mcp
90
+
91
+ # Then run setup
92
+ spotify-mcp setup
93
+ ```
94
+
95
+ **Using npx without setup wizard:**
96
+ ```bash
97
+ # Skip to manual configuration (see Configuration section below)
98
+ npx -y @darrenjaws/spotify-mcp
99
+ ```
100
+
101
+ ### Option 2: From Source
102
+
103
+ For development or contributing:
104
+
105
+ ```bash
106
+ # Clone the repository
107
+ git clone https://github.com/darrenjaworski/spotify-mcp.git
108
+ cd spotify-mcp
109
+
110
+ # Install dependencies
111
+ npm install
112
+
113
+ # Build the project
114
+ npm run build
115
+
116
+ # Run the setup wizard
117
+ npm run build && node build/bin.js setup
118
+ ```
119
+
120
+ ## Configuration
121
+
122
+ ### Automated Setup (Recommended)
123
+
124
+ Use the interactive setup wizard for the easiest configuration experience:
125
+
126
+ ```bash
127
+ npx @darrenjaws/spotify-mcp setup
128
+ ```
129
+
130
+ The wizard walks you through:
131
+ 1. Creating a Spotify Developer app
132
+ 2. Getting your Client ID and Secret
133
+ 3. Choosing your configuration method (Claude Desktop, Claude Code, or development)
134
+ 4. Generating the correct config file
135
+
136
+ ### Manual Setup
137
+
138
+ If you prefer to configure manually or need to update credentials:
139
+
140
+ #### Spotify App Setup
141
+
142
+ 1. Go to the [Spotify Developer Dashboard](https://developer.spotify.com/dashboard)
143
+ 2. Create a new application
144
+ 3. Note your **Client ID** and **Client Secret**
145
+ 4. Add `http://127.0.0.1:3000/callback` to your app's Redirect URIs (note: use `127.0.0.1`, not `localhost`)
146
+
147
+ ### Environment Variables
148
+
149
+ **For NPM/npx users**: Configure environment variables in your Claude Desktop config (see MCP Configuration above).
150
+
151
+ **For development from source**: Create a `.env` file in the project root:
152
+
153
+ ```env
154
+ SPOTIFY_CLIENT_ID=your_client_id_here
155
+ SPOTIFY_CLIENT_SECRET=your_client_secret_here
156
+ SPOTIFY_REDIRECT_URI=http://127.0.0.1:3000/callback
157
+ ```
158
+
159
+ ### MCP Configuration
160
+
161
+ Add to your Claude Desktop config file:
162
+
163
+ **MacOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
164
+ **Windows**: `%APPDATA%/Claude/claude_desktop_config.json`
165
+
166
+ **Using npx (recommended):**
167
+ ```json
168
+ {
169
+ "mcpServers": {
170
+ "spotify": {
171
+ "command": "npx",
172
+ "args": ["-y", "@darrenjaws/spotify-mcp"],
173
+ "env": {
174
+ "SPOTIFY_CLIENT_ID": "your_client_id_here",
175
+ "SPOTIFY_CLIENT_SECRET": "your_client_secret_here",
176
+ "SPOTIFY_REDIRECT_URI": "http://127.0.0.1:3000/callback"
177
+ }
178
+ }
179
+ }
180
+ }
181
+ ```
182
+
183
+ **Using global installation:**
184
+ ```json
185
+ {
186
+ "mcpServers": {
187
+ "spotify": {
188
+ "command": "spotify-mcp",
189
+ "env": {
190
+ "SPOTIFY_CLIENT_ID": "your_client_id_here",
191
+ "SPOTIFY_CLIENT_SECRET": "your_client_secret_here",
192
+ "SPOTIFY_REDIRECT_URI": "http://127.0.0.1:3000/callback"
193
+ }
194
+ }
195
+ }
196
+ }
197
+ ```
198
+
199
+ **From source (development):**
200
+ ```json
201
+ {
202
+ "mcpServers": {
203
+ "spotify": {
204
+ "command": "node",
205
+ "args": ["/absolute/path/to/spotify-mcp/build/bin.js"],
206
+ "env": {
207
+ "SPOTIFY_CLIENT_ID": "your_client_id_here",
208
+ "SPOTIFY_CLIENT_SECRET": "your_client_secret_here",
209
+ "SPOTIFY_REDIRECT_URI": "http://127.0.0.1:3000/callback"
210
+ }
211
+ }
212
+ }
213
+ }
214
+ ```
215
+
216
+ **Note**: When using npx or global install, environment variables must be specified in the MCP config (not in a `.env` file).
217
+
218
+ ### Claude Code (Terminal) Configuration
219
+
220
+ If you're using [Claude Code](https://claude.com/code) (the terminal CLI), you can add this MCP server to your project or global configuration.
221
+
222
+ #### Option 1: Using Claude Code's MCP Command (Recommended)
223
+
224
+ ```bash
225
+ # Add the server interactively
226
+ claude mcp add
227
+
228
+ # Follow the prompts:
229
+ # - Server name: spotify
230
+ # - Command: npx
231
+ # - Args: -y @darrenjaws/spotify-mcp
232
+ # - Add environment variables when prompted
233
+ ```
234
+
235
+ #### Option 2: Manual Configuration
236
+
237
+ **Global config** (`~/.claude/config.json`):
238
+ ```json
239
+ {
240
+ "mcpServers": {
241
+ "spotify": {
242
+ "command": "npx",
243
+ "args": ["-y", "@darrenjaws/spotify-mcp"],
244
+ "env": {
245
+ "SPOTIFY_CLIENT_ID": "your_client_id_here",
246
+ "SPOTIFY_CLIENT_SECRET": "your_client_secret_here",
247
+ "SPOTIFY_REDIRECT_URI": "http://127.0.0.1:3000/callback"
248
+ }
249
+ }
250
+ }
251
+ }
252
+ ```
253
+
254
+ **Project-specific config** (`.claude/config.json` in your project):
255
+ ```json
256
+ {
257
+ "mcpServers": {
258
+ "spotify": {
259
+ "command": "npx",
260
+ "args": ["-y", "@darrenjaws/spotify-mcp"],
261
+ "env": {
262
+ "SPOTIFY_CLIENT_ID": "your_client_id_here",
263
+ "SPOTIFY_CLIENT_SECRET": "your_client_secret_here",
264
+ "SPOTIFY_REDIRECT_URI": "http://127.0.0.1:3000/callback"
265
+ }
266
+ }
267
+ }
268
+ }
269
+ ```
270
+
271
+ #### Migrating from Claude Desktop to Claude Code
272
+
273
+ If you already have this configured in Claude Desktop, you can copy your configuration:
274
+
275
+ **1. View your Claude Desktop config:**
276
+ ```bash
277
+ # macOS
278
+ cat ~/Library/Application\ Support/Claude/claude_desktop_config.json
279
+
280
+ # Windows (PowerShell)
281
+ Get-Content $env:APPDATA\Claude\claude_desktop_config.json
282
+ ```
283
+
284
+ **2. Copy the `spotify` server config to Claude Code:**
285
+ ```bash
286
+ # Create Claude Code config directory if it doesn't exist
287
+ mkdir -p ~/.claude
288
+
289
+ # Edit your Claude Code config
290
+ nano ~/.claude/config.json
291
+ # or
292
+ code ~/.claude/config.json
293
+ ```
294
+
295
+ **3. Paste the same `mcpServers` configuration** - the format is identical!
296
+
297
+ **4. Verify it works:**
298
+ ```bash
299
+ claude mcp list
300
+ ```
301
+
302
+ You should see `spotify` in the list of available MCP servers.
303
+
304
+ ## Usage
305
+
306
+ Once configured, you can interact with Spotify through natural language:
307
+
308
+ - "Play my Discover Weekly playlist"
309
+ - "What song is currently playing?"
310
+ - "Create a playlist called 'Workout Mix' with these songs..."
311
+ - "Skip to the next track"
312
+ - "Show me my top artists from the last month"
313
+ - "Search for songs by The Beatles"
314
+ - "Add this song to my liked songs"
315
+
316
+ ## Available Tools (16 total)
317
+
318
+ ### Playback
319
+ - `spotify_play` - Start or resume playback
320
+ - `spotify_pause` - Pause playback
321
+ - `spotify_next` - Skip to next track
322
+ - `spotify_previous` - Skip to previous track
323
+ - `spotify_set_volume` - Adjust volume level
324
+ - `spotify_get_playback_state` - Get current playback information
325
+
326
+ ### Search & Discovery
327
+ - `spotify_search` - Search for tracks, albums, artists, or playlists
328
+ - `spotify_get_recommendations` - Get song recommendations based on seeds
329
+
330
+ ### Library Management
331
+ - `spotify_get_playlists` - Get user's playlists
332
+ - `spotify_get_playlist` - Get specific playlist details
333
+ - `spotify_create_playlist` - Create a new playlist
334
+ - `spotify_add_to_playlist` - Add tracks to a playlist
335
+ - `spotify_get_saved_tracks` - Get user's saved tracks
336
+
337
+ ### User Data
338
+ - `spotify_get_user_profile` - Get user profile information
339
+ - `spotify_get_top_items` - Get user's top artists or tracks
340
+ - `spotify_get_recently_played` - Get recently played tracks
341
+
342
+ ## Local Development
343
+
344
+ ### Prerequisites
345
+
346
+ - Node.js >= 18.0.0
347
+ - npm or yarn
348
+ - Spotify Developer account with app credentials
349
+
350
+ ### Initial Setup
351
+
352
+ 1. **Clone and install dependencies**
353
+ ```bash
354
+ git clone https://github.com/darrenjaworski/spotify-mcp.git
355
+ cd spotify-mcp
356
+ npm install
357
+ ```
358
+
359
+ 2. **Configure environment variables**
360
+ ```bash
361
+ cp .env.example .env
362
+ # Edit .env with your Spotify credentials
363
+ ```
364
+
365
+ 3. **Build the project**
366
+ ```bash
367
+ npm run build
368
+ ```
369
+
370
+ ### Development Workflow
371
+
372
+ #### Watch Mode (Recommended)
373
+
374
+ Run TypeScript compiler in watch mode for automatic rebuilds:
375
+
376
+ ```bash
377
+ npm run dev
378
+ ```
379
+
380
+ This continuously watches for file changes and rebuilds automatically. Keep this running in one terminal while you develop.
381
+
382
+ #### Manual Build
383
+
384
+ ```bash
385
+ npm run build # Compile TypeScript to build/
386
+ npm run clean # Remove build directory
387
+ ```
388
+
389
+ ### Testing Your MCP Server
390
+
391
+ #### Option 1: MCP Inspector (Recommended)
392
+
393
+ The [MCP Inspector](https://modelcontextprotocol.io/docs/tools/inspector) is the official interactive testing tool for MCP servers. It provides a browser-based UI to test tools, see protocol messages, and debug your server.
394
+
395
+ **Start the Inspector:**
396
+
397
+ ```bash
398
+ npx @modelcontextprotocol/inspector node build/bin.js
399
+ ```
400
+
401
+ This opens a browser at `http://localhost:6274` with:
402
+ - **Server Connection Pane**: Configure transport and environment variables
403
+ - **Tools Tab**: See all available tools and test them interactively
404
+ - **Resources Tab**: View server resources
405
+ - **Notifications Pane**: See real-time protocol messages
406
+
407
+ **With Environment Variables:**
408
+
409
+ ```bash
410
+ npx @modelcontextprotocol/inspector node build/bin.js -- \
411
+ SPOTIFY_CLIENT_ID=your_id \
412
+ SPOTIFY_CLIENT_SECRET=your_secret \
413
+ SPOTIFY_REDIRECT_URI=http://127.0.0.1:3000/callback
414
+ ```
415
+
416
+ **Enable Debug Logging:**
417
+
418
+ ```bash
419
+ DEBUG=true npx @modelcontextprotocol/inspector node build/bin.js
420
+ ```
421
+
422
+ **Benefits:**
423
+ - ✅ Interactive UI to test all 16 tools
424
+ - ✅ See JSON-RPC messages in real-time
425
+ - ✅ No need to configure Claude Desktop during development
426
+ - ✅ Quickly iterate on tool implementations
427
+
428
+ #### Option 2: Test with Claude Desktop
429
+
430
+ Add to your Claude Desktop config for real-world testing:
431
+
432
+ **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
433
+
434
+ ```json
435
+ {
436
+ "mcpServers": {
437
+ "spotify-dev": {
438
+ "command": "node",
439
+ "args": ["/absolute/path/to/spotify-mcp/build/bin.js"],
440
+ "env": {
441
+ "SPOTIFY_CLIENT_ID": "your_client_id",
442
+ "SPOTIFY_CLIENT_SECRET": "your_client_secret",
443
+ "SPOTIFY_REDIRECT_URI": "http://127.0.0.1:3000/callback",
444
+ "LOG_LEVEL": "debug"
445
+ }
446
+ }
447
+ }
448
+ }
449
+ ```
450
+
451
+ Restart Claude Desktop after config changes.
452
+
453
+ #### Option 3: Manual stdio Testing
454
+
455
+ For low-level debugging, you can send JSON-RPC messages directly:
456
+
457
+ ```bash
458
+ # Build first
459
+ npm run build
460
+
461
+ # Test list tools
462
+ echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | node build/bin.js
463
+
464
+ # Test a tool call
465
+ echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"spotify_get_user_profile","arguments":{}}}' | node build/bin.js
466
+ ```
467
+
468
+ ### Development Tips
469
+
470
+ **1. Use Watch Mode + Inspector Together**
471
+
472
+ Terminal 1:
473
+ ```bash
474
+ npm run dev # Watch mode - rebuilds on changes
475
+ ```
476
+
477
+ Terminal 2:
478
+ ```bash
479
+ npx @modelcontextprotocol/inspector node build/bin.js
480
+ ```
481
+
482
+ Refresh the Inspector after each rebuild to test changes.
483
+
484
+ **2. Enable Debug Logging**
485
+
486
+ Set `LOG_LEVEL=debug` in your `.env` file to see detailed logs:
487
+
488
+ ```bash
489
+ LOG_LEVEL=debug node build/bin.js
490
+ ```
491
+
492
+ **3. Test Individual Tools**
493
+
494
+ Use the Inspector's Tools tab to test each tool with different inputs before integrating with Claude.
495
+
496
+ **4. Check stderr for Logs**
497
+
498
+ The server logs to stderr (not stdout) to avoid interfering with stdio transport:
499
+
500
+ ```bash
501
+ node build/bin.js 2> server.log # Capture logs to file
502
+ ```
503
+
504
+ ### Testing
505
+
506
+ Run the test suite to verify tool registration and functionality:
507
+
508
+ ```bash
509
+ npm test # Run all tests
510
+ npm run test:watch # Run tests in watch mode
511
+ npm run test:coverage # Generate coverage report
512
+ ```
513
+
514
+ **Test Coverage:**
515
+ - ✅ 30 tests covering tool registration
516
+ - ✅ Validates all 14 tools are registered correctly
517
+ - ✅ Verifies tool naming conventions
518
+ - ✅ Checks input schema validation with Zod
519
+ - ✅ Integration tests for MCP server setup
520
+
521
+ ### Linting and Code Quality
522
+
523
+ ```bash
524
+ npm run lint # Check code style
525
+ npm run lint:fix # Auto-fix linting issues
526
+ ```
527
+
528
+ ### Troubleshooting
529
+
530
+ **Build Errors:**
531
+ - Ensure TypeScript is installed: `npm install`
532
+ - Check Node version: `node --version` (should be >= 18)
533
+
534
+ **Inspector Not Loading:**
535
+ - Check if port 6274 is available
536
+ - Try clearing browser cache
537
+ - Restart the inspector
538
+
539
+ **OAuth Errors:**
540
+ - Verify Spotify credentials in `.env`
541
+ - Check redirect URI matches in Spotify Dashboard
542
+ - Ensure scopes are correct in `src/spotify/auth.ts`
543
+
544
+ **Server Not Responding:**
545
+ - Check logs: `LOG_LEVEL=debug node build/bin.js`
546
+ - Verify build succeeded: `ls -la build/`
547
+ - Test with simple tool like `spotify_get_user_profile`
548
+
549
+ ## Authentication Flow
550
+
551
+ The server uses Spotify's OAuth 2.0 Authorization Code flow:
552
+
553
+ 1. First request triggers the auth flow
554
+ 2. User is redirected to Spotify login with secure state parameter for CSRF protection
555
+ 3. After authorization, tokens are exchanged using client_secret
556
+ 4. Tokens are stored securely in `~/.spotify-mcp/tokens.json` with 0600 permissions
557
+ 5. Tokens are automatically refreshed when expired
558
+
559
+ ## Security
560
+
561
+ - OAuth tokens are stored securely with restricted file permissions (0600) and never logged
562
+ - Cryptographically secure state parameter prevents CSRF attacks
563
+ - Client secrets are kept in environment variables, never in source code
564
+ - All API requests use HTTPS
565
+ - Uses Authorization Code flow appropriate for confidential server applications
566
+
567
+ ## Contributing
568
+
569
+ Contributions are welcome! Please read our contributing guidelines before submitting PRs.
570
+
571
+ 1. Fork the repository
572
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
573
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
574
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
575
+ 5. Open a Pull Request
576
+
577
+ ## License
578
+
579
+ MIT License - see LICENSE file for details
580
+
581
+ ## Acknowledgments
582
+
583
+ - Built on the [Model Context Protocol](https://modelcontextprotocol.io/)
584
+ - Uses the [Spotify Web API](https://developer.spotify.com/documentation/web-api)
585
+
586
+ ## Support
587
+
588
+ - Report bugs via [GitHub Issues](https://github.com/darrenjaworski/spotify-mcp/issues)
589
+ - Join discussions in [GitHub Discussions](https://github.com/darrenjaworski/spotify-mcp/discussions)
590
+
591
+ ## Related Projects
592
+
593
+ - [MCP Specification](https://spec.modelcontextprotocol.io/)
594
+ - [Spotify Web API SDK](https://github.com/spotify/spotify-web-api-node)
595
+
596
+ ## Resources
597
+
598
+ ### MCP Development Tools
599
+ - [MCP Inspector Documentation](https://modelcontextprotocol.io/docs/tools/inspector) - Official testing tool
600
+ - [MCP Inspector GitHub](https://github.com/modelcontextprotocol/inspector) - Source code
601
+ - [Testing MCP Servers Guide](https://www.stainless.com/mcp/how-to-test-mcp-servers) - Comprehensive testing strategies
602
+ - [MCP Inspector Tutorial](https://hackteam.io/blog/build-test-mcp-server-typescript-mcp-inspector/) - Step-by-step guide
603
+
604
+ ### Spotify API
605
+ - [Spotify Web API Documentation](https://developer.spotify.com/documentation/web-api)
606
+ - [Spotify Developer Dashboard](https://developer.spotify.com/dashboard)
package/build/bin.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * CLI entry point for Spotify MCP Server
4
+ * Handles both setup wizard and normal server mode
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=bin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAEA;;;GAGG"}
package/build/bin.js ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * CLI entry point for Spotify MCP Server
4
+ * Handles both setup wizard and normal server mode
5
+ */
6
+ const args = process.argv.slice(2);
7
+ // Check if user wants to run setup
8
+ if (args.includes('setup') || args.includes('--setup') || args.includes('init')) {
9
+ // Run setup wizard
10
+ import('./setup.js').then(({ runSetup }) => {
11
+ runSetup().catch((err) => {
12
+ console.error('Setup failed:', err);
13
+ process.exit(1);
14
+ });
15
+ });
16
+ }
17
+ else {
18
+ // Run normal MCP server
19
+ import('./index.js');
20
+ }
21
+ export {};
22
+ //# sourceMappingURL=bin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAEA;;;GAGG;AAEH,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEnC,mCAAmC;AACnC,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;IAChF,mBAAmB;IACnB,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;QACzC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACvB,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;YACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;KAAM,CAAC;IACN,wBAAwB;IACxB,MAAM,CAAC,YAAY,CAAC,CAAC;AACvB,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Tool call handler - routes tool calls to appropriate implementations
3
+ */
4
+ import type { ToolResponse } from "../types.js";
5
+ export declare function handleToolCall(name: string, args: Record<string, any>): Promise<ToolResponse>;
6
+ //# sourceMappingURL=call-tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call-tool.d.ts","sourceRoot":"","sources":["../../src/handlers/call-tool.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAMhD,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAyCnG"}