@audiolabtools/mcp-server 0.3.1 → 0.3.2

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.
Files changed (2) hide show
  1. package/hosted-server.mjs +15 -2
  2. package/package.json +2 -1
package/hosted-server.mjs CHANGED
@@ -29,8 +29,15 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
29
29
  import { readFile } from 'node:fs/promises';
30
30
  import { basename } from 'node:path';
31
31
  import { pathToFileURL } from 'node:url';
32
+ import { createRequire } from 'node:module';
32
33
  import { z } from 'zod';
33
34
 
35
+ // The version reported over MCP used to be a literal with a "keep in sync with
36
+ // package.json" comment next to it. It drifted anyway: the package shipped 0.3.1
37
+ // while every initialize response still announced 0.3.0. Read it instead, so the
38
+ // comment cannot be ignored and the two cannot disagree.
39
+ const { version: PKG_VERSION } = createRequire(import.meta.url)('./package.json');
40
+
34
41
  // Vercel serverless caps a raw request body at ~4.5 MB, so small files POST directly and
35
42
  // larger ones go through the signed-URL storage flow. The bucket policy caps at 50 MB.
36
43
  const RAW_MAX = 4 * 1024 * 1024;
@@ -194,7 +201,7 @@ const sourceShape = (local) => local
194
201
  : { url: z.string().url().describe('Public https URL to the audio file.') };
195
202
 
196
203
  export function buildServer({ apiKey, local = false } = {}) {
197
- const server = new McpServer({ name: 'audiolab', version: '0.3.0' }); // keep in sync with package.json
204
+ const server = new McpServer({ name: 'audiolab', version: PKG_VERSION });
198
205
  const toolNames = [];
199
206
  const tool = (name, def, handler) => { server.registerTool(name, def, handler); toolNames.push(name); };
200
207
  const src = sourceShape(local);
@@ -313,7 +320,13 @@ if (isMain && process.argv.includes('--selftest')) {
313
320
  await assert.rejects(() => batchSources({ urls: Array.from({ length: 21 }, (_, n) => `https://x/${n}.wav`) }, 'mixlab/analyze', {}, 'al_live_selftest', false), /max 20/, 'oversized batch rejected before network');
314
321
  if (prev) process.env.AUDIOLAB_API_KEY = prev; else delete process.env.AUDIOLAB_API_KEY;
315
322
 
316
- console.log('selftest ok · 9 tools (incl. analyze_batch) + missing-key guard + remote-path refusals + batch guards');
323
+ // The version announced over MCP drifted from the published package once already
324
+ // (server said 0.3.0, npm had 0.3.1). Now it is read from package.json, and this
325
+ // asserts the read actually resolved rather than silently yielding undefined.
326
+ assert.equal(typeof PKG_VERSION, 'string', 'version resolves from package.json');
327
+ assert.match(PKG_VERSION, /^\d+\.\d+\.\d+/, 'version looks like a semver');
328
+
329
+ console.log(`selftest ok · v${PKG_VERSION} · 9 tools (incl. analyze_batch) + missing-key guard + remote-path refusals + batch guards`);
317
330
  process.exit(0);
318
331
  }
319
332
 
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@audiolabtools/mcp-server",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
+ "mcpName": "tools.audiolab/audiolab",
4
5
  "description": "MCP server for AudioLab \u2014 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.",
5
6
  "type": "module",
6
7
  "bin": {