deep-roon-mcp 0.5.9 → 0.5.11
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 +3 -2
- package/dist/deep-roon-mcp.js +140 -37
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -185,7 +185,7 @@ ChatGPT on the web can't run a server on your computer — use the desktop app.
|
|
|
185
185
|
The same settings as environment variables: `ROON_HOST` (the Core's address, empty = find it), `ROON_PROFILE` (a Roon profile
|
|
186
186
|
by name, empty = the first; see below), `DEEP_ROON_TOOLS=essentials`,
|
|
187
187
|
`DEEP_ROON_INTERNAL=off`, `DEEP_ROON_READ_ONLY=library` (nothing changes the library; playing works) or `DEEP_ROON_READ_ONLY=all`
|
|
188
|
-
(Deep Roon only looks: no playing, queueing or zone changes either), `DEEP_ROON_PLAYLIST_EDIT=1` (the playlist edits). Leave out what you don't need. VS Code calls the block `"servers"` instead of `"mcpServers"`.
|
|
188
|
+
(Deep Roon only looks: no playing, queueing or zone changes either; any other value except `off` means `library`), `DEEP_ROON_PLAYLIST_EDIT=1` (the playlist edits). Leave out what you don't need. VS Code calls the block `"servers"` instead of `"mcpServers"`.
|
|
189
189
|
|
|
190
190
|
Then, once, in Roon: Settings › Extensions › **Enable** next to "Deep Roon MCP". Until then the tools say so.
|
|
191
191
|
|
|
@@ -205,7 +205,8 @@ DEEP_ROON_HTTP=127.0.0.1:9301 npx -y deep-roon-mcp
|
|
|
205
205
|
|
|
206
206
|
`DEEP_ROON_HTTP` is `[host:]port`; the host defaults to `127.0.0.1`. There is **no authentication**: keep it on your own
|
|
207
207
|
computer, or put it behind something that has one (a reverse proxy with a key, a private tunnel). Never expose it to
|
|
208
|
-
the internet as it is.
|
|
208
|
+
the internet as it is. Browsers can't use it: a request that carries an `Origin` header is refused, and on a loopback
|
|
209
|
+
address only a loopback `Host` is accepted (so a web page can't reach it through DNS rebinding). Bodies over 4 MB are refused.
|
|
209
210
|
|
|
210
211
|
### From source
|
|
211
212
|
|
package/dist/deep-roon-mcp.js
CHANGED
|
@@ -7813,7 +7813,11 @@ var init_connection = __esm({
|
|
|
7813
7813
|
let pending = Buffer.alloc(0);
|
|
7814
7814
|
socket.on("data", (data) => {
|
|
7815
7815
|
if (this.established) {
|
|
7816
|
-
|
|
7816
|
+
try {
|
|
7817
|
+
this.dataHandler(data);
|
|
7818
|
+
} catch (e) {
|
|
7819
|
+
socket.destroy(e);
|
|
7820
|
+
}
|
|
7817
7821
|
return;
|
|
7818
7822
|
}
|
|
7819
7823
|
pending = pending.length === 0 ? data : Buffer.concat([pending, data]);
|
|
@@ -7949,13 +7953,14 @@ function encodeResponse(rid, body, isFinal = true) {
|
|
|
7949
7953
|
writeFlexInt(out, body.length);
|
|
7950
7954
|
return Buffer.concat([Buffer.from(out), Buffer.from(body)]);
|
|
7951
7955
|
}
|
|
7952
|
-
var FrameParser;
|
|
7956
|
+
var MAX_FRAME, FrameParser;
|
|
7953
7957
|
var init_frame = __esm({
|
|
7954
7958
|
"src/intern/proto/frame.ts"() {
|
|
7955
7959
|
"use strict";
|
|
7956
7960
|
init_flex();
|
|
7957
7961
|
__name(encodeRequest, "encodeRequest");
|
|
7958
7962
|
__name(encodeResponse, "encodeResponse");
|
|
7963
|
+
MAX_FRAME = 64 * 1024 * 1024;
|
|
7959
7964
|
FrameParser = class {
|
|
7960
7965
|
static {
|
|
7961
7966
|
__name(this, "FrameParser");
|
|
@@ -8006,6 +8011,7 @@ var init_frame = __esm({
|
|
|
8006
8011
|
const lenR = flex(pos);
|
|
8007
8012
|
if (!lenR) return null;
|
|
8008
8013
|
const [bodyLen, bodyStart] = lenR;
|
|
8014
|
+
if (bodyLen > MAX_FRAME) throw new RangeError(`malformed frame: body of ${bodyLen} bytes`);
|
|
8009
8015
|
if (u.length < bodyStart + bodyLen) return null;
|
|
8010
8016
|
const frame = {
|
|
8011
8017
|
isResponse,
|
|
@@ -8337,9 +8343,16 @@ var init_reader = __esm({
|
|
|
8337
8343
|
get remaining() {
|
|
8338
8344
|
return this.buf.length - this.pos;
|
|
8339
8345
|
}
|
|
8346
|
+
/** Never past the end, never backwards (15 Nov 2026): lengths and counts come from the wire. A negative length moved
|
|
8347
|
+
* the cursor back (a loop that never ends), and reads past the end returned zeros (billions of empty members) — all
|
|
8348
|
+
* inside the socket's data handler. Now a malformed frame throws, and the connection closes and reconnects. */
|
|
8349
|
+
need(n) {
|
|
8350
|
+
if (!Number.isInteger(n) || n < 0 || this.pos + n > this.buf.length) throw new RangeError(`malformed frame: ${n} bytes at ${this.pos} of ${this.buf.length}`);
|
|
8351
|
+
}
|
|
8340
8352
|
flexInt() {
|
|
8341
8353
|
let num = 0;
|
|
8342
8354
|
for (; ; ) {
|
|
8355
|
+
this.need(1);
|
|
8343
8356
|
const b = this.buf[this.pos++];
|
|
8344
8357
|
num = num << 7 | b & 127;
|
|
8345
8358
|
if ((b & 128) === 0) break;
|
|
@@ -8354,6 +8367,7 @@ var init_reader = __esm({
|
|
|
8354
8367
|
flexLong() {
|
|
8355
8368
|
let num = 0n;
|
|
8356
8369
|
for (; ; ) {
|
|
8370
|
+
this.need(1);
|
|
8357
8371
|
const b = this.buf[this.pos++];
|
|
8358
8372
|
num = num << 7n | BigInt(b & 127);
|
|
8359
8373
|
if ((b & 128) === 0) break;
|
|
@@ -8364,9 +8378,11 @@ var init_reader = __esm({
|
|
|
8364
8378
|
return this.flexLong();
|
|
8365
8379
|
}
|
|
8366
8380
|
boolean() {
|
|
8381
|
+
this.need(1);
|
|
8367
8382
|
return this.buf[this.pos++] !== 0;
|
|
8368
8383
|
}
|
|
8369
8384
|
bytes(n) {
|
|
8385
|
+
this.need(n);
|
|
8370
8386
|
const b = Buffer.from(this.buf.subarray(this.pos, this.pos + n));
|
|
8371
8387
|
this.pos += n;
|
|
8372
8388
|
return b;
|
|
@@ -8375,11 +8391,13 @@ var init_reader = __esm({
|
|
|
8375
8391
|
return this.bytes(16);
|
|
8376
8392
|
}
|
|
8377
8393
|
double() {
|
|
8394
|
+
this.need(8);
|
|
8378
8395
|
const v = Buffer.from(this.buf.subarray(this.pos, this.pos + 8)).readDoubleLE(0);
|
|
8379
8396
|
this.pos += 8;
|
|
8380
8397
|
return v;
|
|
8381
8398
|
}
|
|
8382
8399
|
float() {
|
|
8400
|
+
this.need(4);
|
|
8383
8401
|
const v = Buffer.from(this.buf.subarray(this.pos, this.pos + 4)).readFloatLE(0);
|
|
8384
8402
|
this.pos += 4;
|
|
8385
8403
|
return v;
|
|
@@ -8399,6 +8417,7 @@ var init_reader = __esm({
|
|
|
8399
8417
|
string() {
|
|
8400
8418
|
const len = this.integer();
|
|
8401
8419
|
if (len < 0) return null;
|
|
8420
|
+
this.need(len);
|
|
8402
8421
|
const s = Buffer.from(this.buf.subarray(this.pos, this.pos + len)).toString("utf8");
|
|
8403
8422
|
this.pos += len;
|
|
8404
8423
|
return s;
|
|
@@ -8493,6 +8512,7 @@ var init_objects = __esm({
|
|
|
8493
8512
|
const id = r.flexInt();
|
|
8494
8513
|
const name = r.string() ?? "";
|
|
8495
8514
|
const count = r.flexInt();
|
|
8515
|
+
if (count > r.remaining / 2) throw new RangeError(`malformed frame: type ${name} claims ${count} members, ${r.remaining} bytes left`);
|
|
8496
8516
|
const members2 = [];
|
|
8497
8517
|
for (let i = 0; i < count; i++) {
|
|
8498
8518
|
const mname = r.string() ?? "";
|
|
@@ -15469,7 +15489,7 @@ var require_lib2 = __commonJS({
|
|
|
15469
15489
|
var version2;
|
|
15470
15490
|
var init_package = __esm({
|
|
15471
15491
|
"package.json"() {
|
|
15472
|
-
version2 = "0.5.
|
|
15492
|
+
version2 = "0.5.11";
|
|
15473
15493
|
}
|
|
15474
15494
|
});
|
|
15475
15495
|
|
|
@@ -15487,6 +15507,25 @@ var init_log = __esm({
|
|
|
15487
15507
|
}
|
|
15488
15508
|
});
|
|
15489
15509
|
|
|
15510
|
+
// src/core/namematch.ts
|
|
15511
|
+
function pickByName(items2, name, nameOf, what = "Roon zone") {
|
|
15512
|
+
const want = String(name ?? "").trim().toLowerCase();
|
|
15513
|
+
if (!want) throw new RoonError(`Name a ${what}; Roon has: ${items2.map(nameOf).join(", ")}`, "invalid");
|
|
15514
|
+
const lc = /* @__PURE__ */ __name((x) => nameOf(x).toLowerCase(), "lc");
|
|
15515
|
+
const exact = items2.find((x) => lc(x) === want) ?? items2.find((x) => lc(x).split(" + ").includes(want));
|
|
15516
|
+
if (exact) return exact;
|
|
15517
|
+
const part = items2.filter((x) => lc(x).includes(want));
|
|
15518
|
+
if (part.length > 1) throw new RoonError(`"${name}" fits more than one ${what}: ${part.map(nameOf).join(", ")} \u2014 say which`, "invalid");
|
|
15519
|
+
return part[0];
|
|
15520
|
+
}
|
|
15521
|
+
var init_namematch = __esm({
|
|
15522
|
+
"src/core/namematch.ts"() {
|
|
15523
|
+
"use strict";
|
|
15524
|
+
init_errors();
|
|
15525
|
+
__name(pickByName, "pickByName");
|
|
15526
|
+
}
|
|
15527
|
+
});
|
|
15528
|
+
|
|
15490
15529
|
// src/core/official.ts
|
|
15491
15530
|
function configDir() {
|
|
15492
15531
|
if (process.platform === "darwin") return import_path.default.join(import_os.default.homedir(), "Library", "Application Support", "deep-roon-mcp");
|
|
@@ -15494,7 +15533,17 @@ function configDir() {
|
|
|
15494
15533
|
return import_path.default.join(process.env.XDG_CONFIG_HOME ?? import_path.default.join(import_os.default.homedir(), ".config"), "deep-roon-mcp");
|
|
15495
15534
|
}
|
|
15496
15535
|
function startOfficial(target2) {
|
|
15497
|
-
if (started)
|
|
15536
|
+
if (started) {
|
|
15537
|
+
if (core && (core.host !== target2.host || core.port !== target2.port)) {
|
|
15538
|
+
log(`the Core moved to ${target2.host}:${target2.port} \u2014 following it`);
|
|
15539
|
+
core = target2;
|
|
15540
|
+
if (!transport) {
|
|
15541
|
+
open2 = false;
|
|
15542
|
+
connect();
|
|
15543
|
+
}
|
|
15544
|
+
}
|
|
15545
|
+
return;
|
|
15546
|
+
}
|
|
15498
15547
|
started = true;
|
|
15499
15548
|
core = target2;
|
|
15500
15549
|
roon = new import_node_roon_api.default({
|
|
@@ -15621,8 +15670,7 @@ async function officialReady(ms = 4e3) {
|
|
|
15621
15670
|
});
|
|
15622
15671
|
}
|
|
15623
15672
|
function officialZone(name) {
|
|
15624
|
-
|
|
15625
|
-
return all.find((z2) => z2.display_name.toLowerCase() === want) ?? all.find((z2) => z2.display_name.toLowerCase().split(" + ").includes(want)) ?? all.find((z2) => z2.display_name.toLowerCase().includes(want));
|
|
15673
|
+
return pickByName(officialZones(), name, (z2) => z2.display_name);
|
|
15626
15674
|
}
|
|
15627
15675
|
async function setVolume(name, change) {
|
|
15628
15676
|
const t = await paired();
|
|
@@ -15632,18 +15680,21 @@ async function setVolume(name, change) {
|
|
|
15632
15680
|
const outs = z2.outputs.filter((o) => o.volume);
|
|
15633
15681
|
if (!outs.length) throw new RoonError(`${z2.display_name} has a fixed volume (Roon can't change it)`, "invalid");
|
|
15634
15682
|
const call2 = /* @__PURE__ */ __name((fn) => new Promise((res, rej) => fn((err) => err ? rej(new RoonError(`Roon refused: ${err}`)) : res())), "call");
|
|
15683
|
+
if (change.value !== void 0) {
|
|
15684
|
+
const buiten = outs.filter((o) => o.volume.type !== "incremental" && (change.value < o.volume.min || change.value > o.volume.max));
|
|
15685
|
+
if (buiten.length) throw new RoonError(`${change.value} is outside the volume scale of ${buiten.map((o) => `${o.display_name} (${o.volume.min}\u2013${o.volume.max})`).join(", ")}`, "invalid");
|
|
15686
|
+
}
|
|
15635
15687
|
for (const o of outs) {
|
|
15636
15688
|
if (change.value !== void 0) {
|
|
15637
15689
|
const v = o.volume;
|
|
15638
15690
|
if (v.type === "incremental") throw new RoonError(`${o.display_name} only steps its volume up or down (no level)`, "invalid");
|
|
15639
|
-
|
|
15640
|
-
await call2((cb) => t.change_volume(o.output_id, "absolute", value, cb));
|
|
15691
|
+
await call2((cb) => t.change_volume(o.output_id, "absolute", change.value, cb));
|
|
15641
15692
|
}
|
|
15642
15693
|
if (change.mute !== void 0) await call2((cb) => t.mute(o.output_id, change.mute ? "mute" : "unmute", cb));
|
|
15643
15694
|
}
|
|
15644
15695
|
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 };
|
|
15645
15696
|
}
|
|
15646
|
-
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;
|
|
15697
|
+
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, coreReachable, retrying, officialZones, coreWeb, isPaired;
|
|
15647
15698
|
var init_official = __esm({
|
|
15648
15699
|
"src/core/official.ts"() {
|
|
15649
15700
|
"use strict";
|
|
@@ -15656,6 +15707,7 @@ var init_official = __esm({
|
|
|
15656
15707
|
init_package();
|
|
15657
15708
|
init_log();
|
|
15658
15709
|
init_errors();
|
|
15710
|
+
init_namematch();
|
|
15659
15711
|
__name(configDir, "configDir");
|
|
15660
15712
|
STATE_FILE = import_path.default.join(configDir(), "pairing.json");
|
|
15661
15713
|
readState = /* @__PURE__ */ __name(() => {
|
|
@@ -15680,6 +15732,7 @@ var init_official = __esm({
|
|
|
15680
15732
|
open2 = false;
|
|
15681
15733
|
__name(startOfficial, "startOfficial");
|
|
15682
15734
|
__name(connect, "connect");
|
|
15735
|
+
coreReachable = /* @__PURE__ */ __name((ms = 3e3) => reachable(ms), "coreReachable");
|
|
15683
15736
|
__name(reachable, "reachable");
|
|
15684
15737
|
retrying = false;
|
|
15685
15738
|
__name(afterClose, "afterClose");
|
|
@@ -15768,7 +15821,12 @@ function close(reason) {
|
|
|
15768
15821
|
async function open3() {
|
|
15769
15822
|
if (client) return client;
|
|
15770
15823
|
const t = await findTarget();
|
|
15771
|
-
|
|
15824
|
+
try {
|
|
15825
|
+
await paired();
|
|
15826
|
+
} catch (e) {
|
|
15827
|
+
if (!process.env.ROON_HOST?.trim() && !await coreReachable()) target = null;
|
|
15828
|
+
throw e;
|
|
15829
|
+
}
|
|
15772
15830
|
const c = new RoonClient({ host: t.host, port: INTERNAL_PORT, serverBrokerId: brokerId(t.info.coreId), settleMs: 1500 });
|
|
15773
15831
|
c.conn.onclosed = () => {
|
|
15774
15832
|
try {
|
|
@@ -15784,6 +15842,10 @@ async function open3() {
|
|
|
15784
15842
|
try {
|
|
15785
15843
|
await c.connect();
|
|
15786
15844
|
} catch (e) {
|
|
15845
|
+
try {
|
|
15846
|
+
c.close();
|
|
15847
|
+
} catch {
|
|
15848
|
+
}
|
|
15787
15849
|
target = null;
|
|
15788
15850
|
throw new RoonError(`Can't connect to Roon's internal protocol at ${t.host}:${INTERNAL_PORT} (${e.message})`, "unavailable");
|
|
15789
15851
|
}
|
|
@@ -49575,6 +49637,7 @@ init_intern();
|
|
|
49575
49637
|
init_session();
|
|
49576
49638
|
init_official();
|
|
49577
49639
|
init_graph();
|
|
49640
|
+
init_namematch();
|
|
49578
49641
|
function currentEndpoints(c) {
|
|
49579
49642
|
const score = /* @__PURE__ */ __name((e) => {
|
|
49580
49643
|
const z2 = obj(c, field2(e, "Zone"));
|
|
@@ -49608,8 +49671,7 @@ function zoneNames(c) {
|
|
|
49608
49671
|
__name(zoneNames, "zoneNames");
|
|
49609
49672
|
function findZone(c, name) {
|
|
49610
49673
|
const zones4 = [...zoneNames(c)].map(([oid, n]) => ({ name: n, oid: BigInt(oid) }));
|
|
49611
|
-
const
|
|
49612
|
-
const z2 = zones4.find((x) => x.name.toLowerCase() === want) ?? zones4.find((x) => x.name.toLowerCase().split(" + ").includes(want)) ?? zones4.find((x) => x.name.toLowerCase().includes(want));
|
|
49674
|
+
const z2 = pickByName(zones4, name, (x) => x.name);
|
|
49613
49675
|
if (!z2) throw new RoonError(`No Roon zone called "${name}"; Roon has: ${zones4.map((x) => x.name).join(", ")}`, "not_found");
|
|
49614
49676
|
return z2;
|
|
49615
49677
|
}
|
|
@@ -49772,6 +49834,7 @@ init_official();
|
|
|
49772
49834
|
init_log();
|
|
49773
49835
|
init_graph();
|
|
49774
49836
|
init_library();
|
|
49837
|
+
init_namematch();
|
|
49775
49838
|
var PRIORITY = { now: 0, next: 3, queue: 4 };
|
|
49776
49839
|
function playParams(c, p, shuffle = false) {
|
|
49777
49840
|
const members2 = [];
|
|
@@ -50116,7 +50179,8 @@ async function ungroup(zoneName, only) {
|
|
|
50116
50179
|
const z2 = findZone(c, zoneName);
|
|
50117
50180
|
const all = outputsOf(c, z2.oid);
|
|
50118
50181
|
if (all.length < 2) throw new RoonError(`${z2.name} isn't in a group`, "invalid");
|
|
50119
|
-
const
|
|
50182
|
+
const een = only ? pickByName(all, only, (e) => String(field2(e, "Name")), "output in this group") : void 0;
|
|
50183
|
+
const off = only ? een ? [een] : [] : all;
|
|
50120
50184
|
if (!off.length) throw new RoonError(`"${only}" isn't in this group (${all.map((e) => field2(e, "Name")).join(" + ")})`, "not_found");
|
|
50121
50185
|
const res = await c.call(
|
|
50122
50186
|
"Transport",
|
|
@@ -50348,6 +50412,7 @@ __name(radioFavorite, "radioFavorite");
|
|
|
50348
50412
|
// src/core/officialtools.ts
|
|
50349
50413
|
init_errors();
|
|
50350
50414
|
init_official();
|
|
50415
|
+
init_namematch();
|
|
50351
50416
|
var call = /* @__PURE__ */ __name((fn) => new Promise((res, rej) => fn((err) => err ? rej(new RoonError(`Roon refused: ${err}`)) : res())), "call");
|
|
50352
50417
|
var duration4 = /* @__PURE__ */ __name((s) => {
|
|
50353
50418
|
const t = Math.round(s), h = Math.floor(t / 3600), m = Math.floor(t % 3600 / 60), r = t % 60;
|
|
@@ -50453,7 +50518,8 @@ __name(group2, "group");
|
|
|
50453
50518
|
async function ungroup2(name, only) {
|
|
50454
50519
|
const { t, z: z2 } = await zoneOf(name);
|
|
50455
50520
|
if (z2.outputs.length < 2) throw new RoonError(`${z2.display_name} isn't in a group`, "invalid");
|
|
50456
|
-
const
|
|
50521
|
+
const een = only ? pickByName(z2.outputs, only, (o) => o.display_name, "output in this group") : void 0;
|
|
50522
|
+
const off = only ? een ? [een] : [] : z2.outputs;
|
|
50457
50523
|
if (!off.length) throw new RoonError(`"${only}" isn't in this group`, "not_found");
|
|
50458
50524
|
await call((cb) => t.ungroup_outputs(off.map((o) => o.output_id), cb));
|
|
50459
50525
|
return { ok: true, released: off.map((o) => o.display_name) };
|
|
@@ -51732,6 +51798,16 @@ init_signature();
|
|
|
51732
51798
|
init_session();
|
|
51733
51799
|
init_graph();
|
|
51734
51800
|
init_library();
|
|
51801
|
+
|
|
51802
|
+
// src/core/readonly.ts
|
|
51803
|
+
function readOnlyMode(raw = process.env.DEEP_ROON_READ_ONLY) {
|
|
51804
|
+
const ro = (raw ?? "").trim().toLowerCase();
|
|
51805
|
+
if (!ro || ["off", "0", "false", "no"].includes(ro)) return "off";
|
|
51806
|
+
return ro === "all" ? "all" : "library";
|
|
51807
|
+
}
|
|
51808
|
+
__name(readOnlyMode, "readOnlyMode");
|
|
51809
|
+
|
|
51810
|
+
// src/roon/playlist-edit.ts
|
|
51735
51811
|
function writablePlaylist(c, p) {
|
|
51736
51812
|
const ro = field2(p, "IsReadOnly");
|
|
51737
51813
|
const declaredBool = c.graph.types.get(p.typeId)?.members.some((m) => m.name.endsWith("::IsReadOnly") && m.propType === 2) === true;
|
|
@@ -51749,8 +51825,7 @@ function revisionOf(key, name, entries) {
|
|
|
51749
51825
|
__name(revisionOf, "revisionOf");
|
|
51750
51826
|
var playlistEditOn = /* @__PURE__ */ __name(() => ["1", "true", "on", "yes"].includes((process.env.DEEP_ROON_PLAYLIST_EDIT ?? "").trim().toLowerCase()), "playlistEditOn");
|
|
51751
51827
|
function enabled() {
|
|
51752
|
-
|
|
51753
|
-
if (ro && !["off", "0", "false", "no"].includes(ro)) invalid("Playlist editing is disabled by DEEP_ROON_READ_ONLY.");
|
|
51828
|
+
if (readOnlyMode() !== "off") invalid("Playlist editing is disabled by DEEP_ROON_READ_ONLY.");
|
|
51754
51829
|
if (!playlistEditOn()) invalid("Playlist editing is experimental and disabled; see docs/playlist-editing.md.");
|
|
51755
51830
|
}
|
|
51756
51831
|
__name(enabled, "enabled");
|
|
@@ -52105,9 +52180,9 @@ function registerLibraryTools(server) {
|
|
|
52105
52180
|
server.registerTool("roon_play_mix", {
|
|
52106
52181
|
title: "Play a Daily Mix",
|
|
52107
52182
|
description: "Play one of today's Daily Mixes on a Roon zone (`key` from roon_mixes, or the mix's name). `mode`: now (default), next or queue. Only on an explicit request, never as a probe.",
|
|
52108
|
-
inputSchema: { key: external_exports.string(), zone: zone2, mode: mode2 },
|
|
52183
|
+
inputSchema: { key: external_exports.string(), zone: zone2, mode: mode2, profile: profile2 },
|
|
52109
52184
|
annotations: PLAYS2
|
|
52110
|
-
}, ({ key, zone: zn, mode: m }) => run(() => playMix(key, zn, m ?? "now")));
|
|
52185
|
+
}, ({ key, zone: zn, mode: m, profile: p }) => run(() => asProfile(p, () => playMix(key, zn, m ?? "now"))));
|
|
52111
52186
|
registerPlaylistEditTools(server);
|
|
52112
52187
|
server.registerTool("roon_playlists", {
|
|
52113
52188
|
title: "Playlists",
|
|
@@ -52160,9 +52235,9 @@ function registerLibraryTools(server) {
|
|
|
52160
52235
|
server.registerTool("roon_favorite", {
|
|
52161
52236
|
title: "Heart an album or track",
|
|
52162
52237
|
description: "Put a heart on an album or a track in Roon, or take it off (`on: false`). The `key` comes from a search, shelf, album or playlist result. Changes the user's library: only on an explicit request. Reads the heart back and says if Roon didn't change it.",
|
|
52163
|
-
inputSchema: { kind: external_exports.enum(["album", "track"]), key: external_exports.string(), on: external_exports.boolean().optional() },
|
|
52238
|
+
inputSchema: { kind: external_exports.enum(["album", "track"]), key: external_exports.string(), on: external_exports.boolean().optional(), profile: profile2 },
|
|
52164
52239
|
annotations: CHANGES
|
|
52165
|
-
}, ({ kind, key, on }) => run(() => favorite(kind, key, on !== false)));
|
|
52240
|
+
}, ({ kind, key, on, profile: p }) => run(() => asProfile(p, () => favorite(kind, key, on !== false))));
|
|
52166
52241
|
server.registerTool("roon_listen_later", {
|
|
52167
52242
|
title: "Listen Later",
|
|
52168
52243
|
description: "The user's Listen Later list in Roon: the albums (and tracks) marked to hear later, newest first, each with a `key`. By default only what still waits; `include_played: true` adds what has been heard since.",
|
|
@@ -52172,9 +52247,9 @@ function registerLibraryTools(server) {
|
|
|
52172
52247
|
server.registerTool("roon_listen_later_set", {
|
|
52173
52248
|
title: "Listen Later: add or remove",
|
|
52174
52249
|
description: "Put an album or a track on the Listen Later list in Roon, or take it off (`on: false`) \u2014 the natural thing to offer after recommending something the user can't hear right now. Changes the library: only on an explicit request. Reads it back.",
|
|
52175
|
-
inputSchema: { kind: external_exports.enum(["album", "track"]), key: external_exports.string(), on: external_exports.boolean().optional() },
|
|
52250
|
+
inputSchema: { kind: external_exports.enum(["album", "track"]), key: external_exports.string(), on: external_exports.boolean().optional(), profile: profile2 },
|
|
52176
52251
|
annotations: CHANGES
|
|
52177
|
-
}, ({ kind, key, on }) => run(() => listenLaterSet(kind, key, on !== false)));
|
|
52252
|
+
}, ({ kind, key, on, profile: p }) => run(() => asProfile(p, () => listenLaterSet(kind, key, on !== false))));
|
|
52178
52253
|
server.registerTool("roon_library_add", {
|
|
52179
52254
|
title: "Add to the library",
|
|
52180
52255
|
description: "Add a Qobuz or TIDAL album to the user's Roon library (the album `key` from a search, shelf or discography). Changes the library: only on an explicit request.",
|
|
@@ -52233,6 +52308,7 @@ init_official();
|
|
|
52233
52308
|
|
|
52234
52309
|
// src/roon/selftest.ts
|
|
52235
52310
|
init_library();
|
|
52311
|
+
init_focus();
|
|
52236
52312
|
async function timed(name, affects, f) {
|
|
52237
52313
|
const t0 = Date.now();
|
|
52238
52314
|
try {
|
|
@@ -52247,13 +52323,18 @@ async function runSelfTest() {
|
|
|
52247
52323
|
const out = [];
|
|
52248
52324
|
let albumKey;
|
|
52249
52325
|
out.push(await timed("search", "roon_search and everything that starts from a key", async () => {
|
|
52250
|
-
const
|
|
52251
|
-
|
|
52252
|
-
|
|
52253
|
-
|
|
52326
|
+
const first = (await library2({}, "added", false, 1, 0)).rows[0];
|
|
52327
|
+
if (!first?.title) {
|
|
52328
|
+
albumKey = void 0;
|
|
52329
|
+
return "nothing to search for (an empty library) \u2014 not tested";
|
|
52330
|
+
}
|
|
52331
|
+
const r = await search(first.title, 5, "album");
|
|
52332
|
+
albumKey = r.rows[0]?.key ?? first.key;
|
|
52333
|
+
if (!r.rows.length) throw new Error(`no results for "${first.title}", an album in this library`);
|
|
52334
|
+
return `${r.rows.length} album${r.rows.length === 1 ? "" : "s"} for "${first.title}"`;
|
|
52254
52335
|
}));
|
|
52255
52336
|
out.push(await timed("album page", "roon_album, roon_review, roon_versions, roon_similar", async () => {
|
|
52256
|
-
if (!albumKey)
|
|
52337
|
+
if (!albumKey) return "no album to open (an empty library) \u2014 not tested";
|
|
52257
52338
|
const a = await album(albumKey, false);
|
|
52258
52339
|
if (!a.tracks?.length) throw new Error("an album without tracks");
|
|
52259
52340
|
return `${a.tracks.length} tracks`;
|
|
@@ -52403,7 +52484,9 @@ function serveHttp(spec, internal, essentials, readOnly) {
|
|
|
52403
52484
|
process.exit(1);
|
|
52404
52485
|
}
|
|
52405
52486
|
const host = m[1] || "127.0.0.1", port = Number(m[2]);
|
|
52406
|
-
const
|
|
52487
|
+
const loopback = ["127.0.0.1", "localhost", "::1", "[::1]"].includes(host);
|
|
52488
|
+
const okHost = /* @__PURE__ */ __name((h) => !loopback || /^(127\.0\.0\.1|localhost|\[::1\])(:\d+)?$/i.test(h ?? ""), "okHost");
|
|
52489
|
+
const handle = /* @__PURE__ */ __name(async (req, res) => {
|
|
52407
52490
|
if (req.url?.split("?")[0] !== "/mcp") {
|
|
52408
52491
|
res.writeHead(404).end();
|
|
52409
52492
|
return;
|
|
@@ -52412,8 +52495,22 @@ function serveHttp(spec, internal, essentials, readOnly) {
|
|
|
52412
52495
|
res.writeHead(405, { allow: "POST" }).end();
|
|
52413
52496
|
return;
|
|
52414
52497
|
}
|
|
52498
|
+
if (req.headers.origin || !okHost(req.headers.host)) {
|
|
52499
|
+
res.writeHead(403).end("Forbidden");
|
|
52500
|
+
req.resume();
|
|
52501
|
+
return;
|
|
52502
|
+
}
|
|
52415
52503
|
const chunks = [];
|
|
52416
|
-
|
|
52504
|
+
let size = 0;
|
|
52505
|
+
for await (const c of req) {
|
|
52506
|
+
size += c.length;
|
|
52507
|
+
if (size > 4 * 1024 * 1024) {
|
|
52508
|
+
res.writeHead(413).end("Too large");
|
|
52509
|
+
req.destroy();
|
|
52510
|
+
return;
|
|
52511
|
+
}
|
|
52512
|
+
chunks.push(c);
|
|
52513
|
+
}
|
|
52417
52514
|
let body;
|
|
52418
52515
|
try {
|
|
52419
52516
|
body = JSON.parse(Buffer.concat(chunks).toString("utf8"));
|
|
@@ -52429,13 +52526,19 @@ function serveHttp(spec, internal, essentials, readOnly) {
|
|
|
52429
52526
|
server.close().catch(() => {
|
|
52430
52527
|
});
|
|
52431
52528
|
});
|
|
52432
|
-
|
|
52433
|
-
|
|
52434
|
-
|
|
52435
|
-
|
|
52529
|
+
await server.connect(transport2);
|
|
52530
|
+
await transport2.handleRequest(req, res, body);
|
|
52531
|
+
}, "handle");
|
|
52532
|
+
const web = import_http.default.createServer((req, res) => {
|
|
52533
|
+
handle(req, res).catch((e) => {
|
|
52436
52534
|
log(`http: ${e.message}`);
|
|
52437
|
-
if (!res.headersSent)
|
|
52438
|
-
|
|
52535
|
+
if (!res.headersSent) {
|
|
52536
|
+
try {
|
|
52537
|
+
res.writeHead(500).end();
|
|
52538
|
+
} catch {
|
|
52539
|
+
}
|
|
52540
|
+
}
|
|
52541
|
+
});
|
|
52439
52542
|
});
|
|
52440
52543
|
web.listen(port, host, () => log(`${version2} ready (http://${host}:${port}/mcp)`));
|
|
52441
52544
|
}
|
|
@@ -52443,8 +52546,8 @@ __name(serveHttp, "serveHttp");
|
|
|
52443
52546
|
async function main() {
|
|
52444
52547
|
const internal = !/^(off|false|0|no)$/i.test(process.env.DEEP_ROON_INTERNAL ?? "");
|
|
52445
52548
|
const essentials = /^(essentials|true|1|yes)$/i.test(process.env.DEEP_ROON_TOOLS ?? process.env.DEEP_ROON_ESSENTIALS ?? "");
|
|
52446
|
-
const
|
|
52447
|
-
|
|
52549
|
+
const readOnly = readOnlyMode();
|
|
52550
|
+
process.on("unhandledRejection", (e) => log(`unhandled: ${e?.message ?? String(e)}`));
|
|
52448
52551
|
if (internal) afterFirstConnect(() => selfTest(runSelfTest));
|
|
52449
52552
|
checkForUpdate().catch(() => {
|
|
52450
52553
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deep-roon-mcp",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.11",
|
|
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>",
|