@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/build/types.js ADDED
@@ -0,0 +1,138 @@
1
+ // Response shapes we read. Each schema lists only the fields this server uses
2
+ // or returns in compact results. `looseObject` keeps every other field, so
3
+ // `verbose` results still carry the full upstream object. SoundCloud omits or
4
+ // nulls fields freely, so entity fields are all optional.
5
+ import { z } from "zod";
6
+ const text = z.string().nullish();
7
+ const count = z.number().nullish();
8
+ /** The few user fields that tracks and playlists repeat for their creator. */
9
+ const creatorShape = {
10
+ id: count,
11
+ urn: text,
12
+ /** Display name. Not unique; never use it for access control. */
13
+ username: text,
14
+ permalink_url: text,
15
+ };
16
+ const userShape = {
17
+ ...creatorShape,
18
+ /** Profile URL slug. Unique across accounts. */
19
+ permalink: text,
20
+ full_name: text,
21
+ avatar_url: text,
22
+ city: text,
23
+ country: text,
24
+ followers_count: count,
25
+ followings_count: count,
26
+ track_count: count,
27
+ playlist_count: count,
28
+ public_favorites_count: count,
29
+ station_urn: text,
30
+ };
31
+ const trackShape = {
32
+ id: count,
33
+ urn: text,
34
+ title: text,
35
+ /** Credited artist, when it differs from the uploader. */
36
+ metadata_artist: text,
37
+ duration: count,
38
+ genre: text,
39
+ tag_list: text,
40
+ bpm: count,
41
+ /** `playable`, `preview`, or `blocked`. Blocked tracks have no stream. */
42
+ access: text,
43
+ sharing: text,
44
+ created_at: text,
45
+ permalink_url: text,
46
+ artwork_url: text,
47
+ playback_count: count,
48
+ favoritings_count: count,
49
+ reposts_count: count,
50
+ comment_count: count,
51
+ station_urn: text,
52
+ };
53
+ // Stations (system playlists) share this shape; they hold only the tracks the
54
+ // caller can see and have no numeric id.
55
+ const playlistShape = {
56
+ id: count,
57
+ urn: text,
58
+ title: text,
59
+ playlist_type: text,
60
+ duration: count,
61
+ genre: text,
62
+ tag_list: text,
63
+ sharing: text,
64
+ created_at: text,
65
+ permalink_url: text,
66
+ artwork_url: text,
67
+ track_count: count,
68
+ likes_count: count,
69
+ repost_count: count,
70
+ };
71
+ export const UserSchema = z.looseObject(userShape);
72
+ export const TrackSchema = z.looseObject({ ...trackShape, user: UserSchema.nullish() });
73
+ export const PlaylistSchema = z.looseObject({
74
+ ...playlistShape,
75
+ user: UserSchema.nullish(),
76
+ tracks: z.array(TrackSchema).nullish(),
77
+ });
78
+ /** Drops the `utm_*` tracking parameters SoundCloud appends to every permalink. */
79
+ export function stripTracking(link) {
80
+ let url;
81
+ try {
82
+ url = new URL(link);
83
+ }
84
+ catch {
85
+ return link;
86
+ }
87
+ const tracking = [...url.searchParams.keys()].filter((key) => key.startsWith("utm_"));
88
+ if (tracking.length === 0)
89
+ return link;
90
+ for (const key of tracking)
91
+ url.searchParams.delete(key);
92
+ return url.href;
93
+ }
94
+ // Compact results: `z.object` strips every field the shapes above leave out.
95
+ // Tracks and playlists name their creator rather than repeating the profile.
96
+ const permalink = { permalink_url: text.transform((link) => link && stripTracking(link)) };
97
+ const creator = z.object({ ...creatorShape, ...permalink }).nullish();
98
+ export const CompactUser = z.object({ ...userShape, ...permalink });
99
+ export const CompactTrack = z.object({ ...trackShape, ...permalink, user: creator });
100
+ export const CompactPlaylist = z.object({
101
+ ...playlistShape,
102
+ ...permalink,
103
+ user: creator,
104
+ tracks: z.array(CompactTrack).nullish(),
105
+ });
106
+ /** A playlist inside a list result: `track_count` stays, the tracklist goes. */
107
+ export const CompactPlaylistSummary = CompactPlaylist.omit({ tracks: true });
108
+ export const CommentSchema = z.looseObject({ user: UserSchema.nullish() });
109
+ /** An external link on a profile, from /users/{urn}/web-profiles. */
110
+ export const WebProfileSchema = z.looseObject({ service: text, title: text, url: text });
111
+ // /me/feed/tracks returns activity wrappers, not bare tracks: each entry has a
112
+ // `type` like "track" or "track:repost" and carries the track inside.
113
+ export const FeedItemSchema = z.looseObject({
114
+ type: text,
115
+ created_at: text,
116
+ track: TrackSchema.nullish(),
117
+ playlist: PlaylistSchema.nullish(),
118
+ user: UserSchema.nullish(),
119
+ });
120
+ // Time-limited playback URLs from /tracks/{urn}/streams. The progressive
121
+ // `http_mp3_128_url` was removed on 2026-08-12; full-length playback is HLS.
122
+ export const TrackStreamsSchema = z.looseObject({
123
+ hls_mp3_128_url: text,
124
+ hls_aac_160_url: text,
125
+ preview_mp3_128_url: text,
126
+ });
127
+ /** Cursor-paginated collection (requires linked_partitioning=true). */
128
+ export function pageOf(item) {
129
+ return z.looseObject({ collection: z.array(item), next_href: z.string().nullish() });
130
+ }
131
+ /** SoundCloud's token endpoint response. Refresh tokens are single-use. */
132
+ export const OAuthTokenResponseSchema = z.looseObject({
133
+ access_token: z.string(),
134
+ refresh_token: z.string().optional(),
135
+ expires_in: z.number().optional(),
136
+ scope: z.string().optional(),
137
+ token_type: z.string().optional(),
138
+ });
package/package.json CHANGED
@@ -1,6 +1,71 @@
1
1
  {
2
- "name": "@jamiew/soundcloud-mcp",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@jamiew/soundcloud-mcp",
3
+ "version": "1.2.0",
4
+ "description": "Unofficial SoundCloud MCP server for stdio and Cloudflare Workers",
5
+ "mcpName": "io.github.jamiew/soundcloud-mcp",
6
+ "type": "module",
7
+ "main": "build/index.js",
8
+ "bin": {
9
+ "soundcloud-mcp": "build/index.js",
10
+ "soundcloud-mcp-auth": "build/stdio/auth.js"
11
+ },
12
+ "files": [
13
+ "build"
14
+ ],
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "scripts": {
19
+ "build": "tsc -p tsconfig.build.json && node -e \"['index','stdio/auth'].forEach(f=>require('fs').chmodSync('build/'+f+'.js','755'))\"",
20
+ "start": "node --env-file-if-exists=.env build/index.js",
21
+ "auth": "pnpm build && node --env-file-if-exists=.env build/stdio/auth.js",
22
+ "dev": "tsc -p tsconfig.build.json --watch",
23
+ "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.worker.json",
24
+ "test": "vitest run && vitest run --config vitest.workerd.config.ts",
25
+ "test:watch": "vitest",
26
+ "lint": "biome check .",
27
+ "lint:md": "markdownlint-cli2 \"*.md\"",
28
+ "format": "biome check --write .",
29
+ "check": "pnpm lint && pnpm lint:md && pnpm typecheck && pnpm test",
30
+ "prepublishOnly": "pnpm build",
31
+ "verify": "pnpm build && node scripts/verify.mjs",
32
+ "worker:dev": "wrangler dev",
33
+ "worker:deploy": "wrangler deploy",
34
+ "inspector": "pnpm build && pnpm dlx @modelcontextprotocol/inspector node --env-file-if-exists=.env build/index.js"
35
+ },
36
+ "keywords": [
37
+ "mcp",
38
+ "soundcloud",
39
+ "api"
40
+ ],
41
+ "author": "Jamie Dubs",
42
+ "license": "MIT",
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "git+https://github.com/jamiew/soundcloud-mcp.git"
46
+ },
47
+ "homepage": "https://github.com/jamiew/soundcloud-mcp#readme",
48
+ "bugs": "https://github.com/jamiew/soundcloud-mcp/issues",
49
+ "packageManager": "pnpm@11.21.0",
50
+ "engines": {
51
+ "node": "^22.18.0 || >=24.11.0"
52
+ },
53
+ "dependencies": {
54
+ "@modelcontextprotocol/server": "2.4.0",
55
+ "zod": "^4.6.7"
56
+ },
57
+ "devDependencies": {
58
+ "@biomejs/biome": "^2.6.9",
59
+ "@cloudflare/vitest-plugin": "^1.9.2",
60
+ "@cloudflare/workers-oauth-provider": "^1.4.0",
61
+ "@cloudflare/workers-types": "^5.20261125.1",
62
+ "@modelcontextprotocol/client": "2.4.0",
63
+ "@types/node": "^22.20.7",
64
+ "agents": "^0.34.1",
65
+ "hono": "^4.13.23",
66
+ "markdownlint-cli2": "^0.24.2",
67
+ "typescript": "^7.0.2",
68
+ "vitest": "^5.1.2",
69
+ "wrangler": "^4.168.0"
70
+ }
71
+ }