@audiolabtools/mcp-server 0.5.2 → 0.5.3

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 CHANGED
@@ -62,6 +62,23 @@ Every tool takes **one audio source**: a public `url` **or** a local `path`:
62
62
  | `compare_loudness` | A/B on two sources (`urlA`/`pathA` + `urlB`/`pathB`), returns both results |
63
63
  | `analyze_batch` | One route over up to 20 sources in a single call (`urls` and/or `paths`), per-item ok/data/error. For folder QA, library indexing, or checking a whole release against a target; with `endpoint:"signallab/index"` it takes `bandLimit:true` too. Each item meters as one call |
64
64
 
65
+ ## Options
66
+
67
+ Every option below is a tool argument. For each: what it is and what it is for, how you
68
+ use and read it, and what it is not.
69
+
70
+ | Option | What it is, what it is for | How to use and read it | What it is not |
71
+ |---|---|---|---|
72
+ | `measureStatus` | Per field its status (validated, proxy, beta, withdrawn), its basis, and its margin where known, so you know how far to trust each number. | **On by default** since 0.5.3; `false` leaves it out. On `analyze_loudness`, `analyze_voice`, `index_signal`, `analyze_profile`, `compare_loudness`, `analyze_batch`. Validated: state the number, inside its margin. Proxy: compare two recordings, do not state it as a fact. Beta: not shown to be right. Withdrawn: do not read it as what its name says. | Not a guarantee: a margin holds under the conditions on https://audiolab.tools/lenses. Fields that belong to no lens (counts, flags) get no entry. |
73
+ | `round` | Numbers rounded to what they are worth: dB and LUFS 2 decimals, seconds 3, ms 1, Hz 1, shares and ratios 3. Fewer tokens, no false precision. | **On by default** since 0.5.3; `false` gives full precision. Same tools as `measureStatus`. Same keys and types. | It makes nothing more accurate. `check_target`, `analyze_timeseries`, `get_spectrum` and `get_speech_segments` are not rounded. |
74
+ | `series` | The curves and per-block arrays: short-term loudness, waveform and spectrum (loudness); envelopes, voiced mask, segments and per-segment SNR (voice); curves, lanes and per-phrase values (profile). For your own charts and code. | `series: true`; off by default. On `analyze_loudness`, `analyze_voice`, `analyze_profile`, `analyze_batch`. | Not needed to answer a question, and a large payload. It is not the audio. |
75
+ | `speechDetector` | Which detector finds the speech: it decides the speech share, speech and silence time, long silences, segments and the pause measures. `k2` lets a phrase run on into its soft word starts and endings (at most 100 ms per side). | `speechDetector: "k2"`; `v1` is the default until 15 January 2027, then `k2`. On `analyze_voice`, `get_speech_segments`, `analyze_profile`, `analyze_batch`. | It finds when someone speaks, not who and not what: no speaker separation, no transcription. |
76
+ | `contentModel` | Which model gives the content type (voice, music, mixed, noise, unknown) and its confidence. `v2` is a small learned model, much better on speech and music in our tests. | `contentModel: "v2"`; `v1` is the default until 15 January 2027, then `v2`. With `v2` the evidence list holds `model:v2`. On `index_signal`, `analyze_profile`, `analyze_batch`. | A classifier, not a measurement. It met its bar for speech and music, not for steady noise, so it is a proxy. |
77
+ | `spectrumCalc` | Which spectrum calculation: `v2` corrects three errors found against an independent calculation (spectral roll-off read low; in the profile grid the flatness and the floor of -120 dB). | `spectrumCalc: "v2"`; `v1` is the default until 15 February 2027, then `v2`. On `analyze_loudness`, `get_spectrum`, `analyze_profile`, `compare_loudness`, `analyze_batch`. | Not a different spectrum: some values change a little, keys and types stay the same. |
78
+ | `bandLimit` | Whether the audio was upsampled: `bandLimit.upsampled` is `yes`, `no` or `cannot-say`, with its status, reason and basis. | `bandLimit: true` on `index_signal` and `analyze_batch` (`signallab/index`); off by default. Guide: https://audiolab.tools/docs/start/is-my-audio-upsampled | `cannot-say` means look at the file, not that it is fine. A telephone origin is a probability from the bandwidth; it does not name a codec. |
79
+ | `liveEvents` | The file read as a stream by the live monitor of /live: every dropout, clipping, level drop, dead air and hum it raised, with times and a reason. | `liveEvents: true` on `analyze_profile` (any profile); off by default. Every event has status `signals`. | Not a diagnosis: none of these detectors has been validated on live streams yet, so say "a signal", never "detected". |
80
+ | `roomSource` | How a `room` recording was made: `clap` (default), `balloon`, `impulse` or `sweep`. The room profile measures reverberation per octave band and flutter echo. | With `profile: "room"` on `analyze_profile`. Guide: https://audiolab.tools/docs/voicelab/measure-a-room-with-a-clap | The room profile cannot measure reverberation from speech; an earlier room-echo score was withdrawn. |
81
+
65
82
  Example asks to your AI:
66
83
 
67
84
  - *“Analyze the loudness of https://example.com/track.wav”* → `analyze_loudness` with `url`
package/hosted-server.mjs CHANGED
@@ -192,8 +192,11 @@ async function batchSources({ urls = [], paths = [] }, endpoint, extra, key, loc
192
192
 
193
193
  // Resolve one audio source (url OR local path) to a route call. `local` gates path reads:
194
194
  // the remote /mcp endpoint passes local=false and must NEVER touch the server filesystem.
195
- async function analyzeSource(route, { url, path } = {}, extra = {}, key, local = false) {
195
+ async function analyzeSource(route, { url, path, measureStatus, round } = {}, extra = {}, key, local = false) {
196
196
  if (url && path) throw new Error('Provide exactly one of url or path, not both.');
197
+ // on by default (0.5.3); routes without lenses (check-target, timeseries, spectrum, segments) ignore both
198
+ if (measureStatus !== false) extra = { ...extra, measureStatus: true };
199
+ if (round !== false) extra = { ...extra, round: true };
197
200
  if (path) {
198
201
  if (!local) throw new Error('Local file paths are only supported by the local (stdio) MCP server; use a public https url instead.');
199
202
  let buf;
@@ -226,6 +229,16 @@ const sourceShape = (local) => local
226
229
  }
227
230
  : { url: z.string().url().describe('Public https URL to the audio file.') };
228
231
 
232
+ // measureStatus is on by default: an agent should not read a proxy or a withdrawn field as a fact.
233
+ const MS_DOC = ' The answer carries measureStatus: per field its status (validated, proxy, beta, withdrawn), basis and margin where known. Report a proxy as an approximation, never present a withdrawn field as what its name says, and stay inside a stated margin (https://audiolab.tools/docs/start/read-a-response#the-five-statuses).';
234
+ const msShape = { measureStatus: z.boolean().optional().describe('Add measureStatus to the answer: the status of each field. On by default; set false to leave it out.') };
235
+ const roundShape = { round: z.boolean().optional().describe('Round numbers to what they are worth (dB and LUFS 2 decimals, seconds 3, ms 1, Hz 1, shares 3); same keys and types. On by default; set false for full precision.') };
236
+ const scShape = { spectrumCalc: z.enum(['v1', 'v2']).optional().describe('Spectrum calculation: v1 (the default until 15 February 2027) or v2 (fixes three errors found against an independent calculation; values change a little, keys do not).') };
237
+ const seriesShape = { series: z.boolean().optional().describe('Include the curves and per-block arrays (large payload). Off by default.') };
238
+ const cmShape = { contentModel: z.enum(['v1', 'v2']).optional().describe('Content-type model: v1 (the default until 15 January 2027) or v2 (the newer small learned model).') };
239
+ const sdShape = { speechDetector: z.enum(['v1', 'k2']).optional().describe('Speech detector: v1 (the default until 15 January 2027) or k2 (lets a phrase run on into its soft word starts and endings, at most 100 ms per side).') };
240
+ const opt = (i, ...names) => Object.fromEntries(names.filter((n) => i[n] !== undefined).map((n) => [n, i[n]]));
241
+
229
242
  export function buildServer({ apiKey, local = false } = {}) {
230
243
  const server = new McpServer({ name: 'audiolab', version: PKG_VERSION });
231
244
  const toolNames = [];
@@ -235,9 +248,9 @@ export function buildServer({ apiKey, local = false } = {}) {
235
248
 
236
249
  tool('analyze_loudness', {
237
250
  title: 'Analyze loudness (MixLab)',
238
- description: 'Loudness and dynamics for a track: integrated LUFS (EBU R128 / BS.1770-4), true-peak (dBTP), loudness range (LRA), crest factor, stereo correlation, mono compatibility, and tonal balance.' + srcDoc,
239
- inputSchema: src,
240
- }, wrap((i) => analyzeSource('mixlab/analyze', i, {}, apiKey, local)));
251
+ description: 'Loudness and dynamics for a track: integrated LUFS (EBU R128 / BS.1770-4), true-peak (dBTP), loudness range (LRA), crest factor, stereo correlation, mono compatibility, and tonal balance.' + MS_DOC + srcDoc,
252
+ inputSchema: { ...src, ...msShape, ...roundShape, ...seriesShape, ...scShape },
253
+ }, wrap((i) => analyzeSource('mixlab/analyze', i, opt(i, 'series', 'spectrumCalc'), apiKey, local)));
241
254
 
242
255
  tool('check_target', {
243
256
  title: 'Check audio against a loudness target (Spotify, EBU, etc.)',
@@ -254,29 +267,29 @@ export function buildServer({ apiKey, local = false } = {}) {
254
267
  tool('get_spectrum', {
255
268
  title: 'FFT spectrum data',
256
269
  description: 'Frequency-domain magnitude data (paired frequency/magnitude arrays) plus energies in 7 standard bands (sub/bass/lowMid/mid/highMid/presence/air). There is no dominant-band field in the response. For spectrum-analyzer UIs and tonal-balance analysis.' + srcDoc,
257
- inputSchema: src,
258
- }, wrap((i) => analyzeSource('mixlab/spectrum', i, {}, apiKey, local)));
270
+ inputSchema: { ...src, ...scShape },
271
+ }, wrap((i) => analyzeSource('mixlab/spectrum', i, opt(i, 'spectrumCalc'), apiKey, local)));
259
272
 
260
273
  tool('analyze_voice', {
261
274
  title: 'Analyze voice quality (VoiceLab)',
262
- description: 'Speech-quality QA for a voice recording: speech/silence ratio, speaking-rate label, signal-to-noise, noise floor, pause energy, sibilance risk, clipping severity. Gates a voice take. Status: levels, SNR, noise floor and clipping are validated against known signals; speaking rate, background scene and intelligibility are proxies, and the pause-energy field is not a reverb measure (https://audiolab.tools/lenses).' + srcDoc,
263
- inputSchema: src,
264
- }, wrap((i) => analyzeSource('voicelab/qa', i, {}, apiKey, local)));
275
+ description: 'Speech-quality QA for a voice recording: speech/silence ratio, speaking-rate label, signal-to-noise, noise floor, pause energy, sibilance risk, clipping severity. Gates a voice take. Status: levels, SNR, noise floor and clipping are validated against known signals; speaking rate, background scene and intelligibility are proxies, and the pause-energy field is not a reverb measure (https://audiolab.tools/lenses).' + MS_DOC + srcDoc,
276
+ inputSchema: { ...src, ...msShape, ...roundShape, ...seriesShape, ...sdShape },
277
+ }, wrap((i) => analyzeSource('voicelab/qa', i, opt(i, 'speechDetector', 'series'), apiKey, local)));
265
278
 
266
279
  tool('get_speech_segments', {
267
280
  title: 'Speech segments (VoiceLab)',
268
281
  description: 'List voiced speech regions with start/end timestamps and per-segment RMS. For auto-trim and chapter generation. RMS-based voice-activity detection: it finds where speech is, not who is speaking, and it does not detect speaker turns. Status: a proxy, the speech gate is not measured against labelled speech.' + srcDoc,
269
- inputSchema: src,
270
- }, wrap((i) => analyzeSource('voicelab/segments', i, {}, apiKey, local)));
282
+ inputSchema: { ...src, ...sdShape },
283
+ }, wrap((i) => analyzeSource('voicelab/segments', i, opt(i, 'speechDetector'), apiKey, local)));
271
284
 
272
285
  tool('index_signal', {
273
286
  title: 'Index a signal (SignalLab)',
274
- description: 'A metadata index for any audio file: content-type guess (voice/music/mixed/noise/silence) with confidence, brightness & dynamics buckets, a rough band label, clipping/silence regions, and tag suggestions. For triage or auto-tagging a library. Status: content type, regions and confidence come from a frame classifier that is a proxy, not validated on a labelled corpus of real recordings; the tags describe the signal only, never the speaker (https://audiolab.tools/lenses). Set bandLimit:true to ask whether the audio was upsampled: bandLimit.upsampled is yes, no or cannot-say, with the reason in plain words. yes rests on a validated rule (study UP-1: the band stops under 5 kHz in a file of 16 kHz or more, as after a telephone call); no and the bandwidth ratio are proxies (study UP-2); cannot-say means look at the file, not that it is fine.' + srcDoc,
287
+ description: 'A metadata index for any audio file: content-type guess (voice/music/mixed/noise/silence) with confidence, brightness & dynamics buckets, a rough band label, clipping/silence regions, and tag suggestions. For triage or auto-tagging a library. Status: content type, regions and confidence come from a frame classifier that is a proxy, not validated on a labelled corpus of real recordings; the tags describe the signal only, never the speaker (https://audiolab.tools/lenses). Set bandLimit:true to ask whether the audio was upsampled: bandLimit.upsampled is yes, no or cannot-say, with the reason in plain words. yes rests on a validated rule (study UP-1: the band stops under 5 kHz in a file of 16 kHz or more, as after a telephone call); no and the bandwidth ratio are proxies (study UP-2); cannot-say means look at the file, not that it is fine.' + MS_DOC + srcDoc,
275
288
  inputSchema: {
276
- ...src,
289
+ ...src, ...msShape, ...roundShape, ...cmShape,
277
290
  bandLimit: z.boolean().optional().describe('Also return bandLimit: whether the audio was upsampled (yes, no or cannot-say), its status, reason and basis. Off by default.'),
278
291
  },
279
- }, wrap((i) => analyzeSource('signallab', i, { bandLimit: i.bandLimit }, apiKey, local)));
292
+ }, wrap((i) => analyzeSource('signallab', i, { bandLimit: i.bandLimit, ...opt(i, 'contentModel') }, apiKey, local)));
280
293
 
281
294
  // analyze_profile: the lens registry as one tool. A model that knows what it
282
295
  // is looking for names the question, not forty field names; a model that does
@@ -302,9 +315,9 @@ export function buildServer({ apiKey, local = false } = {}) {
302
315
  + 'Set liveEvents:true to also get liveEvents: the file read as a stream by the live monitor, with every dropout, clipping, level drop, dead air '
303
316
  + 'and hum event, its times and its reason. Status signals: none of these detectors has been validated on live streams yet, so say "a signal", '
304
317
  + 'never "detected". A dropout or clipping event names the file measure with its own rule (chain.dropoutCount, signal.clipping) and why the two can differ.'
305
- + srcDoc,
318
+ + MS_DOC + srcDoc,
306
319
  inputSchema: {
307
- ...src,
320
+ ...src, ...msShape, ...roundShape, ...cmShape, ...sdShape, ...scShape,
308
321
  profile: z.enum(['basic', 'voice', 'master', 'provenance', 'dataset', 'environment', 'broadcast', 'loop', 'room', 'chain', 'pitch'])
309
322
  .describe('Which question to answer.'),
310
323
  series: z.boolean().optional()
@@ -314,7 +327,7 @@ export function buildServer({ apiKey, local = false } = {}) {
314
327
  liveEvents: z.boolean().optional()
315
328
  .describe('Also return liveEvents: the events of the live monitor over the whole file, status signals. Off by default.'),
316
329
  },
317
- }, wrap((i) => analyzeSource('analyze/profile', i, { profile: i.profile, series: i.series === true, ...(i.roomSource ? { roomSource: i.roomSource } : {}), ...(i.liveEvents ? { liveEvents: true } : {}) }, apiKey, local)));
330
+ }, wrap((i) => analyzeSource('analyze/profile', i, { profile: i.profile, series: i.series === true, ...(i.roomSource ? { roomSource: i.roomSource } : {}), ...(i.liveEvents ? { liveEvents: true } : {}), ...opt(i, 'contentModel', 'speechDetector', 'spectrumCalc') }, apiKey, local)));
318
331
 
319
332
  // compare_loudness: two independent sources, each a url or (local only) a path.
320
333
  const cmp = local
@@ -330,12 +343,12 @@ export function buildServer({ apiKey, local = false } = {}) {
330
343
  };
331
344
  tool('compare_loudness', {
332
345
  title: 'Compare two tracks (A/B)',
333
- description: 'Run loudness analysis on TWO sources and return both results for an A/B comparison: master vs reference, before vs after a fix, two encoders, two cuts.' + srcDoc,
334
- inputSchema: cmp,
346
+ description: 'Run loudness analysis on TWO sources and return both results for an A/B comparison: master vs reference, before vs after a fix, two encoders, two cuts.' + MS_DOC + srcDoc,
347
+ inputSchema: { ...cmp, ...msShape, ...roundShape, ...scShape },
335
348
  }, wrap(async (i) => {
336
349
  const [a, b] = await Promise.all([
337
- analyzeSource('mixlab/analyze', { url: i.urlA, path: i.pathA }, {}, apiKey, local),
338
- analyzeSource('mixlab/analyze', { url: i.urlB, path: i.pathB }, {}, apiKey, local),
350
+ analyzeSource('mixlab/analyze', { url: i.urlA, path: i.pathA, measureStatus: i.measureStatus, round: i.round }, opt(i, 'spectrumCalc'), apiKey, local),
351
+ analyzeSource('mixlab/analyze', { url: i.urlB, path: i.pathB, measureStatus: i.measureStatus, round: i.round }, opt(i, 'spectrumCalc'), apiKey, local),
339
352
  ]);
340
353
  return { a, b };
341
354
  }));
@@ -349,7 +362,7 @@ export function buildServer({ apiKey, local = false } = {}) {
349
362
  : { urls: z.array(z.string().url()).min(1).max(20).describe('Public https URLs to audio files (max 20).') };
350
363
  tool('analyze_batch', {
351
364
  title: 'Batch: one analysis route over many files',
352
- description: 'Run one analysis route over up to 20 audio sources in a single call. Returns per-item ok/data/error; each item is metered as one call. Routes: mixlab/analyze (default), mixlab/check-target, mixlab/timeseries, mixlab/spectrum, voicelab/qa, voicelab/segments, signallab/index. Use for folder QA, library indexing, or checking a whole release against a loudness target.' + (local ? ' Sources: public https urls and/or local file paths.' : ' Sources: public https urls.'),
365
+ description: 'Run one analysis route over up to 20 audio sources in a single call. Returns per-item ok/data/error; each item is metered as one call. Routes: mixlab/analyze (default), mixlab/check-target, mixlab/timeseries, mixlab/spectrum, voicelab/qa, voicelab/segments, signallab/index. Use for folder QA, library indexing, or checking a whole release against a loudness target. On mixlab/analyze, voicelab/qa and signallab/index each item carries measureStatus (on by default): report a proxy as an approximation, never a withdrawn field as what its name says.' + (local ? ' Sources: public https urls and/or local file paths.' : ' Sources: public https urls.'),
353
366
  inputSchema: {
354
367
  ...batchSrc,
355
368
  endpoint: z.string().optional().describe('Analysis route to run for every item (default mixlab/analyze).'),
@@ -357,8 +370,9 @@ export function buildServer({ apiKey, local = false } = {}) {
357
370
  lufs: z.number().optional().describe('For target="custom": integrated LUFS target.'),
358
371
  tp: z.number().optional().describe('For target="custom": max true-peak (dBTP).'),
359
372
  bandLimit: z.boolean().optional().describe('For signallab/index: also return bandLimit per file, with upsampled yes, no or cannot-say (see index_signal).'),
373
+ ...msShape, ...roundShape, ...seriesShape, ...cmShape, ...sdShape, ...scShape,
360
374
  },
361
- }, wrap((i) => batchSources({ urls: i.urls || [], paths: i.paths || [] }, i.endpoint || 'mixlab/analyze', { target: i.target, lufs: i.lufs, tp: i.tp, bandLimit: i.bandLimit }, apiKey, local)));
375
+ }, wrap((i) => batchSources({ urls: i.urls || [], paths: i.paths || [] }, i.endpoint || 'mixlab/analyze', { target: i.target, lufs: i.lufs, tp: i.tp, bandLimit: i.bandLimit, measureStatus: i.measureStatus !== false, round: i.round !== false, ...opt(i, 'series', 'contentModel', 'speechDetector', 'spectrumCalc') }, apiKey, local)));
362
376
 
363
377
  return { server, toolNames };
364
378
  }
@@ -391,6 +405,21 @@ if (isMain && process.argv.includes('--selftest')) {
391
405
  } finally { globalThis.fetch = realFetch; }
392
406
  }
393
407
 
408
+ // measureStatus is on by default (0.5.3): a call carries it, measureStatus:false leaves it out.
409
+ {
410
+ const realFetch = globalThis.fetch;
411
+ let body;
412
+ globalThis.fetch = async (_url, init) => { body = JSON.parse(init.body); return new Response('{"ok":true}', { status: 200 }); };
413
+ try {
414
+ await analyzeSource('voicelab/qa', { url: 'https://example.com/a.wav' }, {}, 'al_live_selftest', false);
415
+ assert.equal(body.measureStatus, true, 'measureStatus goes out by default');
416
+ assert.equal(body.round, true, 'round goes out by default');
417
+ await analyzeSource('voicelab/qa', { url: 'https://example.com/a.wav', measureStatus: false, round: false }, {}, 'al_live_selftest', false);
418
+ assert.ok(!('measureStatus' in body), 'measureStatus:false leaves it out');
419
+ assert.ok(!('round' in body), 'round:false leaves it out');
420
+ } finally { globalThis.fetch = realFetch; }
421
+ }
422
+
394
423
  // Elke fout die de gebruiker te zien krijgt draagt één regel Docs met een vaste code (mcp/error-docs.mjs; de uitleg staat op /docs/errors).
395
424
  {
396
425
  const { withDocs, codeFor } = await import('./error-docs.mjs');
@@ -427,7 +456,7 @@ if (isMain && process.argv.includes('--selftest')) {
427
456
  if (e?.code !== 'ERR_MODULE_NOT_FOUND') throw e;
428
457
  }
429
458
 
430
- console.log(`selftest ok · v${PKG_VERSION} · ${expected.length} tools (incl. analyze_profile) + keyless trial and batch-key guard + remote-path refusals + batch guards`);
459
+ console.log(`selftest ok · v${PKG_VERSION} · ${expected.length} tools (incl. analyze_profile) + keyless trial and batch-key guard + remote-path refusals + batch guards + measureStatus and round on by default`);
431
460
  process.exit(0);
432
461
  }
433
462
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@audiolabtools/mcp-server",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "mcpName": "tools.audiolab/audiolab",
5
5
  "description": "MCP server for AudioLab, loudness (EBU R128 / BS.1770-4), true-peak, voice-quality, and signal analysis for AI agents (Claude, Cursor, any MCP client), via the AudioLab hosted API. No local audio engine required.",
6
6
  "type": "module",