@jamiew/soundcloud-mcp 0.0.0-stage → 1.2.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 SoundCloud MCP Server Contributors
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 CHANGED
@@ -1,3 +1,243 @@
1
- # Temporary Holding Version
1
+ # SoundCloud MCP Server
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Search SoundCloud, discover music, manage playlists, and use your library from
4
+ MCP clients like Claude Code and ChatGPT.
5
+
6
+ Here's an example:
7
+
8
+ <!-- markdownlint-disable-next-line MD034 -->
9
+ https://github.com/user-attachments/assets/89625322-d329-46ef-9987-e25396b68c23
10
+
11
+ This integration is unofficial and not affiliated with SoundCloud.
12
+
13
+ It runs locally over stdio, or on Cloudflare Workers over Streamable HTTP so you
14
+ can use it from your phone.
15
+
16
+ You have to deploy the worker yourself. We don't run a shared instance at this time.
17
+
18
+ ## Quick start with npx
19
+
20
+ Requires Node 22.18+ or 24.11+. Create an app at <https://soundcloud.com/you/apps>,
21
+ register `http://localhost:8888/callback` as its redirect URI, then add the
22
+ published package to your MCP client:
23
+
24
+ ```bash
25
+ claude mcp add soundcloud \
26
+ -e SOUNDCLOUD_CLIENT_ID=your-client-id \
27
+ -e SOUNDCLOUD_CLIENT_SECRET=your-client-secret \
28
+ -- npx -y @jamiew/soundcloud-mcp
29
+ ```
30
+
31
+ Other clients use `npx -y @jamiew/soundcloud-mcp` with the same two variables.
32
+ Log in with the `connect_soundcloud` tool. The package also ships
33
+ `soundcloud-mcp-auth` for logging in from a terminal.
34
+
35
+ ## Local setup
36
+
37
+ To run from a checkout instead, you also need pnpm. See `package.json` for exact
38
+ versions.
39
+
40
+ 1. Create an app at <https://soundcloud.com/you/apps>. Save its client ID and
41
+ secret. Register `http://localhost:8888/callback` as the redirect URI, or set a
42
+ matching custom URI below.
43
+ 2. Install and configure:
44
+
45
+ ```bash
46
+ pnpm install
47
+ cp .env.example .env
48
+ ```
49
+
50
+ Fill in the app credentials in `.env`.
51
+ 3. Build and run:
52
+
53
+ ```bash
54
+ pnpm build
55
+ pnpm start
56
+ ```
57
+
58
+ For personal data and writes, run `pnpm run auth`. It opens a browser and saves
59
+ rotating tokens to `~/.soundcloud-mcp/tokens.json` with mode `600`. Use
60
+ `pnpm run auth --no-browser` to print the login URL. You can also use the
61
+ `connect_soundcloud` and `auth_status` tools. Public search uses cached
62
+ client-credentials tokens without user login. To sign out, run
63
+ `pnpm run auth --sign-out` or call `sign_out`. Both revoke the app's access at
64
+ SoundCloud and delete the token file.
65
+
66
+ ### Claude Code
67
+
68
+ The repo's `.mcp.json` registers this server as `soundcloud-local`. Run
69
+ `pnpm build`, fill in `.env` at the repo root, then start `claude` in the repo
70
+ and approve the project server when prompted. Its paths use
71
+ `${CLAUDE_PROJECT_DIR:-.}`, which falls back to `.` because Claude Code runs the
72
+ server from the project root, so no absolute paths are needed. Login tokens
73
+ still live in `~/.soundcloud-mcp/tokens.json`.
74
+
75
+ ### Claude Desktop
76
+
77
+ Open **Settings > Developer > Edit Config** and add:
78
+
79
+ ```json
80
+ {
81
+ "mcpServers": {
82
+ "soundcloud": {
83
+ "command": "node",
84
+ "args": ["/absolute/path/to/soundcloud-mcp/build/index.js"],
85
+ "env": {
86
+ "SOUNDCLOUD_CLIENT_ID": "your-client-id",
87
+ "SOUNDCLOUD_CLIENT_SECRET": "your-client-secret"
88
+ }
89
+ }
90
+ }
91
+ }
92
+ ```
93
+
94
+ Fully quit and reopen Claude Desktop. Other stdio clients use the same command
95
+ and environment variables. Build before connecting; clients run JavaScript, not
96
+ TypeScript. Paths must be absolute: clients do not expand `~` or shell variables.
97
+ If a GUI client cannot find Node, use its absolute path from `which node`.
98
+
99
+ The config file is at:
100
+
101
+ - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
102
+ - Windows: `%APPDATA%\Claude\claude_desktop_config.json`
103
+
104
+ ### Local environment
105
+
106
+ `pnpm start` and `pnpm run auth` load `.env` through Node. Direct
107
+ `node build/index.js` calls need environment variables supplied by the client.
108
+
109
+ | Variable | Purpose |
110
+ | --- | --- |
111
+ | `SOUNDCLOUD_CLIENT_ID` | Required app client ID |
112
+ | `SOUNDCLOUD_CLIENT_SECRET` | Required app secret |
113
+ | `SOUNDCLOUD_REDIRECT_URI` | Defaults to `http://localhost:8888/callback`; must match the app |
114
+ | `SOUNDCLOUD_TOKEN_FILE` | Defaults to `~/.soundcloud-mcp/tokens.json` |
115
+ | `MCP_DEBUG` | Set `true` for verbose stderr logging |
116
+
117
+ ## Worker setup
118
+
119
+ 1. Run `pnpm install`. Set your worker name in `wrangler.jsonc`.
120
+ 2. Create a KV namespace:
121
+
122
+ ```bash
123
+ pnpm exec wrangler kv namespace create soundcloud-mcp-OAUTH_KV
124
+ ```
125
+
126
+ Put the returned ID in `wrangler.jsonc` under the `OAUTH_KV` binding.
127
+ Keep the `migrations` block; on existing deployments it removes the old
128
+ `SoundCloudMCP` Durable Object.
129
+ 3. Set each secret with `pnpm exec wrangler secret put <NAME>`:
130
+ - `SOUNDCLOUD_CLIENT_ID`
131
+ - `SOUNDCLOUD_CLIENT_SECRET`
132
+ - `COOKIE_ENCRYPTION_KEY`: generate with `openssl rand -hex 32`
133
+ - `ALLOWED_USERS`: comma-separated profile URL slugs (the `name` in
134
+ `soundcloud.com/name`) or numeric user IDs. Display names do not match.
135
+ - `ENABLE_WRITE_TOOLS`: set to `true` to offer the Social and Playlists
136
+ tools. Unset, the worker only reads.
137
+ 4. Register `https://<your-worker>.workers.dev/callback` on your SoundCloud app.
138
+ It must match exactly.
139
+ 5. Run `pnpm worker:deploy`, then connect your MCP client to
140
+ `https://<your-worker>.workers.dev/mcp` and complete browser OAuth.
141
+
142
+ For local development, copy `.dev.vars.example` to `.dev.vars`, fill it in, and
143
+ run `pnpm worker:dev` at `http://localhost:8789`. Register its `/callback` URL
144
+ when testing local OAuth.
145
+
146
+ CI deploys pushes to `main` when the repository variable `DEPLOY_ENABLED` is
147
+ `true` and secret `CLOUDFLARE_API_TOKEN` is set. If the repository variable
148
+ `ENABLE_WRITE_TOOLS` is set, CI copies it into the worker secret of the same name
149
+ before deploying. Forks must also set their account ID in
150
+ `.github/workflows/ci.yml`. Reconnect clients after deploying new tools; clients
151
+ cache the tool list.
152
+
153
+ **Set `ALLOWED_USERS` unless you intend to offer public access.** Empty or unset
154
+ allows any SoundCloud account to use your API quota. Access is checked at the
155
+ OAuth callback and tool registration, and the worker deletes stored tokens for
156
+ accounts removed from the list. Public hosting also needs a review of
157
+ SoundCloud's terms and shared rate limits; see
158
+ [#1](https://github.com/jamiew/soundcloud-mcp/issues/1). SoundCloud's terms
159
+ restrict acting on users' behalf, so write tools stay off unless you set
160
+ `ENABLE_WRITE_TOOLS`.
161
+
162
+ The worker serves an install page at `/`, a privacy page at `/privacy`, an icon
163
+ at `/icon.svg`, and OAuth at `/authorize`, `/callback`, `/token`, and
164
+ `/register`. It stores each user's SoundCloud tokens, encrypted, in KV until
165
+ they call `sign_out` or 30 days pass. Update `src/worker/privacy.ts` if you
166
+ change what the worker stores.
167
+
168
+ ## Tools
169
+
170
+ Both servers share these tools. Only the local server has `connect_soundcloud`
171
+ and `auth_status`. On the hosted server, `sign_out` revokes the app's access at
172
+ SoundCloud and deletes your stored tokens for every connected client.
173
+
174
+ | Group | Tools |
175
+ | --- | --- |
176
+ | Auth | `connect_soundcloud`, `auth_status` (local only), `sign_out` |
177
+ | Search | `resolve_url`, `search_tracks`, `search_playlists`, `search_users` |
178
+ | Discovery | `get_track`, `get_user`, `get_user_tracks`, `get_user_playlists`, `get_user_likes`, `get_user_reposts`, `get_user_web_profiles`, `get_related_tracks`, `get_related_artists` |
179
+ | Audience | `get_track_likers`, `get_track_reposters`, `get_playlist_reposters`, `get_user_followers`, `get_user_followings` |
180
+ | Playback and browsing | `get_playlist`, `get_playlist_tracks`, `get_station`, `get_stream_url`, `get_comments`, `next_page` |
181
+ | Library (login) | `get_profile`, `get_my_likes`, `get_my_reposts`, `get_my_playlists`, `get_my_tracks`, `get_my_followings`, `get_my_followers`, `is_following`, `get_feed`, `get_recently_played` |
182
+ | Social (login) | `like_track`, `unlike_track`, `like_playlist`, `unlike_playlist`, `repost_track`, `unrepost_track`, `repost_playlist`, `unrepost_playlist`, `follow_user`, `unfollow_user`, `add_comment` |
183
+ | Playlists (login) | `create_playlist`, `update_playlist`, `add_tracks_to_playlist`, `remove_track_from_playlist`, `delete_playlist` |
184
+
185
+ - IDs accept numbers or URNs such as `soundcloud:tracks:123`; prefer URNs.
186
+ - `get_user_tracks` and `get_my_tracks` accept `sort="asc"` or `sort="desc"`.
187
+ - The likes and reposts list tools accept `kind="tracks"` (default) or
188
+ `kind="playlists"`. The likes tools also accept `kind="stations"`.
189
+ `get_feed` accepts `kind="all"` to include playlist activity.
190
+ - `get_station` takes a station URN from a track's or user's `station_urn`.
191
+ `like_playlist` and `unlike_playlist` also accept station URNs.
192
+ - Pass `next_href` to `next_page` for cursor pagination. Use SoundCloud API URLs
193
+ only; authenticated requests include your token.
194
+ - Playlist track changes replace the full tracklist. Adding or removing a track
195
+ fails when SoundCloud hides some of the playlist's tracks, since the rewrite
196
+ would delete them. Comments have no delete tool or public API endpoint; treat
197
+ them as permanent.
198
+ - Stream URLs expire, and blocked tracks have no stream. Full tracks stream over
199
+ HLS; the only MP3 is a short preview.
200
+ - Results list each track, user and playlist compactly: ids and URNs, title or
201
+ name, uploader, duration, links, counts, access and dates. Playlists in a
202
+ list show `track_count` without their tracks; read one with `get_playlist`
203
+ for its tracklist. Permalinks drop `utm_*` tracking parameters. Pass
204
+ `verbose: true` to get every field SoundCloud sends, such as descriptions.
205
+ Resources return full objects.
206
+
207
+ Tools provide behavior annotations, structured results, and resource links.
208
+ Resources include `soundcloud://me/{profile,playlists,likes}` and templates for
209
+ `soundcloud://{tracks,users,playlists}/{id}`.
210
+
211
+ ## Development
212
+
213
+ Shared API and MCP code lives in `src/{client,tools,types,server,icon}.ts`.
214
+ `src/index.ts` and `src/stdio/` handle local auth and transport;
215
+ `src/worker.ts` and `src/worker/` handle Workers OAuth and HTTP.
216
+
217
+ - `pnpm check`: lint, Markdown lint, both typechecks, and tests. Tests run on
218
+ Node, plus a few in workerd against the bundled Worker.
219
+ - `pnpm verify`: build and check the live stdio server, including read tools,
220
+ resources, and a temporary playlist create/like/read/delete cycle. Requires
221
+ login and writes to the connected account.
222
+ - `pnpm exec wrangler deploy --dry-run`: bundle the worker without deploying.
223
+ No test verifies a deployment.
224
+
225
+ See [CLAUDE.md](CLAUDE.md) for safety and verification rules and
226
+ [GitHub issues](https://github.com/jamiew/soundcloud-mcp/issues) for open work.
227
+ Use the `soundcloud-api-sync` skill before adding endpoints or checking upstream
228
+ changes. [Issue #2](https://github.com/jamiew/soundcloud-mcp/issues/2) records the
229
+ November 18, 2026 audit and deferred API coverage.
230
+ The standalone audit is:
231
+
232
+ ```bash
233
+ node .claude/skills/soundcloud-api-sync/audit.mjs --since 2026-10-28
234
+ ```
235
+
236
+ The [official spec](https://github.com/soundcloud/api) is authoritative. Track
237
+ [release notes](https://github.com/soundcloud/api/releases.atom) and
238
+ [spec edits](https://github.com/soundcloud/api/commits/master/openapi/api.yaml.atom).
239
+
240
+ ## Contributors
241
+
242
+ - [@jamiew](https://github.com/jamiew)
243
+ - [@c436zhan](https://github.com/c436zhan)