deep-roon-mcp 0.4.6 → 0.4.8
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/README.md +6 -0
- package/dist/deep-roon-mcp.js +68 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -200,6 +200,12 @@ status; it holds no secrets).
|
|
|
200
200
|
- Several clients at once (Claude Desktop and Claude Code, or ChatGPT next to them) work: Roon keeps one connection
|
|
201
201
|
per extension, and the client that asks a question takes it over for that moment.
|
|
202
202
|
- Album, track and artist keys stay valid between calls.
|
|
203
|
+
- Covers: every `image` key comes with an `image_url` to load it from your Core. Roon has two kinds of image keys that
|
|
204
|
+
aren't interchangeable. Deep Roon reads Roon's internal library, so most keys are internal ones (short, like
|
|
205
|
+
`doicaaaa`): the Core serves them at `http://<core>:9330/image/<key>.jpg`, or scaled at `/image/<key>.300.jpg` (any
|
|
206
|
+
width). The zones (`roon_now_playing`) come from Roon's official extension API, whose keys (long hex) are served at
|
|
207
|
+
`/api/image/<key>?scale=fit&width=600&height=600`. The URL uses the Core's address as Deep Roon sees it — when Deep
|
|
208
|
+
Roon runs on the Core's own machine that is `127.0.0.1`; from another device, put the Core's IP there.
|
|
203
209
|
- The log goes to stderr (your MCP client keeps it).
|
|
204
210
|
- At the start it asks GitHub once whether a newer release is out (`DEEP_ROON_NO_UPDATE_CHECK=1` turns that off). Nothing
|
|
205
211
|
else leaves your network except what your client sends to its model.
|
package/dist/deep-roon-mcp.js
CHANGED
|
@@ -12358,7 +12358,7 @@ var require_websocket = __commonJS({
|
|
|
12358
12358
|
var EventEmitter = require("events");
|
|
12359
12359
|
var https = require("https");
|
|
12360
12360
|
var http2 = require("http");
|
|
12361
|
-
var
|
|
12361
|
+
var net3 = require("net");
|
|
12362
12362
|
var tls = require("tls");
|
|
12363
12363
|
var { randomBytes: randomBytes2, createHash } = require("crypto");
|
|
12364
12364
|
var { Duplex, Readable: Readable2 } = require("stream");
|
|
@@ -13120,13 +13120,13 @@ var require_websocket = __commonJS({
|
|
|
13120
13120
|
__name(emitErrorAndClose, "emitErrorAndClose");
|
|
13121
13121
|
function netConnect(options) {
|
|
13122
13122
|
options.path = options.socketPath;
|
|
13123
|
-
return
|
|
13123
|
+
return net3.connect(options);
|
|
13124
13124
|
}
|
|
13125
13125
|
__name(netConnect, "netConnect");
|
|
13126
13126
|
function tlsConnect(options) {
|
|
13127
13127
|
options.path = void 0;
|
|
13128
13128
|
if (!options.servername && options.servername !== "") {
|
|
13129
|
-
options.servername =
|
|
13129
|
+
options.servername = net3.isIP(options.host) ? "" : options.host;
|
|
13130
13130
|
}
|
|
13131
13131
|
return tls.connect(options);
|
|
13132
13132
|
}
|
|
@@ -15525,7 +15525,7 @@ var require_lib2 = __commonJS({
|
|
|
15525
15525
|
var version2;
|
|
15526
15526
|
var init_package = __esm({
|
|
15527
15527
|
"package.json"() {
|
|
15528
|
-
version2 = "0.4.
|
|
15528
|
+
version2 = "0.4.8";
|
|
15529
15529
|
}
|
|
15530
15530
|
});
|
|
15531
15531
|
|
|
@@ -15613,10 +15613,51 @@ function connect() {
|
|
|
15613
15613
|
transport = null;
|
|
15614
15614
|
zones.clear();
|
|
15615
15615
|
zonesIn = false;
|
|
15616
|
-
|
|
15617
|
-
}, "onclose")
|
|
15616
|
+
void afterClose();
|
|
15617
|
+
}, "onclose"),
|
|
15618
|
+
// A connection that never opened gets no onclose from node-roon-api, only an error — and `open` stayed true, so neither
|
|
15619
|
+
// a tool nor the retry ever tried again. Before pairing, an error means: not connected.
|
|
15620
|
+
onerror: /* @__PURE__ */ __name(() => {
|
|
15621
|
+
if (transport) return;
|
|
15622
|
+
open2 = false;
|
|
15623
|
+
void afterClose();
|
|
15624
|
+
}, "onerror")
|
|
15618
15625
|
});
|
|
15619
15626
|
}
|
|
15627
|
+
function reachable(ms = 3e3) {
|
|
15628
|
+
return new Promise((resolve) => {
|
|
15629
|
+
if (!core) return resolve(false);
|
|
15630
|
+
const sock = import_net.default.connect({ host: core.host, port: core.port });
|
|
15631
|
+
const done = /* @__PURE__ */ __name((ok) => {
|
|
15632
|
+
sock.destroy();
|
|
15633
|
+
resolve(ok);
|
|
15634
|
+
}, "done");
|
|
15635
|
+
sock.setTimeout(ms, () => done(false));
|
|
15636
|
+
sock.once("connect", () => done(true));
|
|
15637
|
+
sock.once("error", () => done(false));
|
|
15638
|
+
});
|
|
15639
|
+
}
|
|
15640
|
+
async function afterClose() {
|
|
15641
|
+
if (retrying) return;
|
|
15642
|
+
if (await reachable()) {
|
|
15643
|
+
log("the extension connection closed while the Core answers \u2014 probably another copy of Deep Roon MCP took it over; it opens again when a tool needs it");
|
|
15644
|
+
return;
|
|
15645
|
+
}
|
|
15646
|
+
retrying = true;
|
|
15647
|
+
log("the extension connection closed and the Core doesn't answer (network or Core restart) \u2014 reconnecting when it's back");
|
|
15648
|
+
let pause = 5e3;
|
|
15649
|
+
while (!open2) {
|
|
15650
|
+
await new Promise((r) => setTimeout(r, pause).unref());
|
|
15651
|
+
if (open2) break;
|
|
15652
|
+
if (await reachable()) {
|
|
15653
|
+
log("the Core answers again \u2014 reconnecting");
|
|
15654
|
+
connect();
|
|
15655
|
+
break;
|
|
15656
|
+
}
|
|
15657
|
+
pause = Math.min(pause * 2, 3e5);
|
|
15658
|
+
}
|
|
15659
|
+
retrying = false;
|
|
15660
|
+
}
|
|
15620
15661
|
async function paired(ms = 8e3) {
|
|
15621
15662
|
if (transport) return transport;
|
|
15622
15663
|
connect();
|
|
@@ -15658,11 +15699,12 @@ async function setVolume(name, change) {
|
|
|
15658
15699
|
}
|
|
15659
15700
|
return { zone: z2.display_name, outputs: outs.map((o) => ({ output: o.display_name, scale: `${o.volume.min}\u2013${o.volume.max}` })), volume: change.value, muted: change.mute };
|
|
15660
15701
|
}
|
|
15661
|
-
var import_fs, import_os, import_path, import_node_roon_api, import_node_roon_api_transport, STATE_FILE, readState, writeState, transport, zones, started, waiting, zonesIn, zoneWaiting, roon, core, open2, officialZones, isPaired;
|
|
15702
|
+
var import_fs, import_net, import_os, import_path, import_node_roon_api, import_node_roon_api_transport, STATE_FILE, readState, writeState, transport, zones, started, waiting, zonesIn, zoneWaiting, roon, core, open2, retrying, officialZones, coreWeb, isPaired;
|
|
15662
15703
|
var init_official = __esm({
|
|
15663
15704
|
"src/core/official.ts"() {
|
|
15664
15705
|
"use strict";
|
|
15665
15706
|
import_fs = __toESM(require("fs"));
|
|
15707
|
+
import_net = __toESM(require("net"));
|
|
15666
15708
|
import_os = __toESM(require("os"));
|
|
15667
15709
|
import_path = __toESM(require("path"));
|
|
15668
15710
|
import_node_roon_api = __toESM(require_lib());
|
|
@@ -15694,8 +15736,12 @@ var init_official = __esm({
|
|
|
15694
15736
|
open2 = false;
|
|
15695
15737
|
__name(startOfficial, "startOfficial");
|
|
15696
15738
|
__name(connect, "connect");
|
|
15739
|
+
__name(reachable, "reachable");
|
|
15740
|
+
retrying = false;
|
|
15741
|
+
__name(afterClose, "afterClose");
|
|
15697
15742
|
__name(paired, "paired");
|
|
15698
15743
|
officialZones = /* @__PURE__ */ __name(() => [...zones.values()], "officialZones");
|
|
15744
|
+
coreWeb = /* @__PURE__ */ __name(() => core ? `http://${core.host}:${core.port}` : null, "coreWeb");
|
|
15699
15745
|
isPaired = /* @__PURE__ */ __name(() => !!transport, "isPaired");
|
|
15700
15746
|
__name(officialReady, "officialReady");
|
|
15701
15747
|
__name(officialZone, "officialZone");
|
|
@@ -50373,10 +50419,23 @@ function updateNotice() {
|
|
|
50373
50419
|
__name(updateNotice, "updateNotice");
|
|
50374
50420
|
|
|
50375
50421
|
// src/tools/run.ts
|
|
50422
|
+
init_official();
|
|
50423
|
+
function withImageUrls(v, base) {
|
|
50424
|
+
if (Array.isArray(v)) return v.map((x) => withImageUrls(x, base));
|
|
50425
|
+
if (!v || typeof v !== "object") return v;
|
|
50426
|
+
const url2 = /* @__PURE__ */ __name((k) => /^[0-9a-f]{32,}$/.test(k) ? `${base}/api/image/${k}?scale=fit&width=600&height=600` : `${base}/image/${k}.jpg`, "url");
|
|
50427
|
+
const o = {};
|
|
50428
|
+
for (const [k, x] of Object.entries(v)) o[k] = withImageUrls(x, base);
|
|
50429
|
+
if (typeof o.image === "string" && o.image && o.image_url === void 0) o.image_url = url2(o.image);
|
|
50430
|
+
if (Array.isArray(o.images) && o.image_urls === void 0) o.image_urls = o.images.filter((k) => typeof k === "string").map(url2);
|
|
50431
|
+
return o;
|
|
50432
|
+
}
|
|
50433
|
+
__name(withImageUrls, "withImageUrls");
|
|
50376
50434
|
var compact = /* @__PURE__ */ __name((_k, v) => v === void 0 ? void 0 : typeof v === "bigint" ? v.toString() : v, "compact");
|
|
50377
50435
|
async function run(work2) {
|
|
50378
50436
|
try {
|
|
50379
|
-
const
|
|
50437
|
+
const base = coreWeb();
|
|
50438
|
+
const result = base ? withImageUrls(await work2(), base) : await work2();
|
|
50380
50439
|
const notice = updateNotice();
|
|
50381
50440
|
return { content: [{ type: "text", text: JSON.stringify(result, compact) }, ...notice ? [{ type: "text", text: notice }] : []] };
|
|
50382
50441
|
} catch (e) {
|
|
@@ -50413,7 +50472,7 @@ function registerReadTools(server, internal = true) {
|
|
|
50413
50472
|
const reg = /* @__PURE__ */ __name(((name, cfg, cb) => R(name) ? server.registerTool.call(server, name, cfg, cb) : void 0), "reg");
|
|
50414
50473
|
reg("roon_search", {
|
|
50415
50474
|
title: "Search Roon",
|
|
50416
|
-
description:
|
|
50475
|
+
description: "Search Roon \u2014 the user's Roon library and the catalogues of the streaming services signed in (Qobuz, TIDAL) at once; each row says its `source` (library, Qobuz, TIDAL). Rows carry `image`, the key of the cover, and `image_url`, where the Core serves it (for clients that draw; a chat shows covers with roon_cover). Deep Roon's keys are Roon's internal ones (/image/<key>.jpg, scaled /image/<key>.300.jpg), not the official API's (roon_now_playing; /api/image/<key>) \u2014 `image_url` always has the right one. Returns albums (with format, e.g. FLAC 96kHz 24bit), artists and tracks. `kind` narrows to album, track or artist \u2014 use `kind: \"track\"` with the song title (and artist) to find one specific track; a broad query without `kind` can fill up with artists. Albums and tracks carry a `key` for `roon_album`; artists carry a `key` for `roon_artist` and `roon_bio`. Albums say their `year`, and `in_library` when the user has them in Roon. Keys stay valid between calls.",
|
|
50417
50476
|
inputSchema: { query: external_exports.string().min(1), kind: external_exports.enum(["album", "track", "artist"]).optional(), limit: limit(100, 30) },
|
|
50418
50477
|
annotations: READ
|
|
50419
50478
|
}, ({ query, kind, limit: n }) => run(() => search(query, n ?? 30, kind)));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deep-roon-mcp",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.8",
|
|
4
4
|
"description": "An MCP server for Roon that reaches the parts the official API doesn't: reviews, biographies, Qobuz's and TIDAL's shelves, TIDAL's playlists, your history, search across your library and the streaming services",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "René Bouwmeester <21277119+renebouwmeester@users.noreply.github.com>",
|