@audiolabtools/mcp-server 0.3.1 → 0.3.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 +5 -1
- package/hosted-server.mjs +20 -4
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
<!-- Built by scripts/build-public-mcp-repo.mjs in the AudioLab monorepo.
|
|
2
|
+
Edit mcp/README.md there, not this copy. -->
|
|
3
|
+
|
|
1
4
|
# @audiolabtools/mcp-server
|
|
2
5
|
|
|
3
6
|
MCP ([Model Context Protocol](https://modelcontextprotocol.io)) server that gives any
|
|
@@ -63,7 +66,7 @@ Example asks to your AI:
|
|
|
63
66
|
|---|---|---|
|
|
64
67
|
| `AUDIOLAB_API_KEY` | — (required) | Your API key. |
|
|
65
68
|
| `AUDIOLAB_API_BASE` | `https://audiolab.tools/v1` | Override the API base (must be `https://`). |
|
|
66
|
-
| `AUDIOLAB_TIMEOUT_MS` | `
|
|
69
|
+
| `AUDIOLAB_TIMEOUT_MS` | `330000` | Per-request timeout in milliseconds (long files and batches stream server-side and can legitimately take minutes). |
|
|
67
70
|
|
|
68
71
|
## Privacy
|
|
69
72
|
|
|
@@ -77,6 +80,7 @@ machine, don't use a hosted analyser.
|
|
|
77
80
|
## Limits
|
|
78
81
|
|
|
79
82
|
- Local files: up to **50 MB** (host bigger ones at a public URL).
|
|
83
|
+
- Duration: loudness routes (`analyze_loudness`, `check_target`, `analyze_timeseries`, `get_spectrum`) handle **long files** (podcast episodes, full sets — up to ~3 h) via server-side streaming; voice/signal routes are limited to ~7 minutes.
|
|
80
84
|
- One file per call (agents loop for many); one-shot (no streaming/realtime).
|
|
81
85
|
- Rate and monthly limits are enforced by the API, per key.
|
|
82
86
|
|
package/hosted-server.mjs
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
// "env": { "AUDIOLAB_API_KEY": "al_live_yourkey" } } } }
|
|
22
22
|
//
|
|
23
23
|
// Env: AUDIOLAB_API_KEY (required at call time for stdio mode), AUDIOLAB_API_BASE
|
|
24
|
-
// (default https://audiolab.tools/v1, must be https), AUDIOLAB_TIMEOUT_MS (default
|
|
24
|
+
// (default https://audiolab.tools/v1, must be https), AUDIOLAB_TIMEOUT_MS (default 330000).
|
|
25
25
|
// Smoke test (no network): node hosted-server.mjs --selftest
|
|
26
26
|
|
|
27
27
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
@@ -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;
|
|
@@ -45,7 +52,10 @@ const apiBase = () => {
|
|
|
45
52
|
return base;
|
|
46
53
|
};
|
|
47
54
|
|
|
48
|
-
|
|
55
|
+
// Just above the API's own 300 s ceiling: since long files stream server-side
|
|
56
|
+
// (a 25-min track ≈ 10-30 s, batches of them add up), a 60 s client default
|
|
57
|
+
// made the client give up while the server was still happily working.
|
|
58
|
+
const timeoutMs = () => Number(process.env.AUDIOLAB_TIMEOUT_MS) || 330_000;
|
|
49
59
|
|
|
50
60
|
function requireKey(key) {
|
|
51
61
|
const k = key || process.env.AUDIOLAB_API_KEY;
|
|
@@ -194,7 +204,7 @@ const sourceShape = (local) => local
|
|
|
194
204
|
: { url: z.string().url().describe('Public https URL to the audio file.') };
|
|
195
205
|
|
|
196
206
|
export function buildServer({ apiKey, local = false } = {}) {
|
|
197
|
-
const server = new McpServer({ name: 'audiolab', version:
|
|
207
|
+
const server = new McpServer({ name: 'audiolab', version: PKG_VERSION });
|
|
198
208
|
const toolNames = [];
|
|
199
209
|
const tool = (name, def, handler) => { server.registerTool(name, def, handler); toolNames.push(name); };
|
|
200
210
|
const src = sourceShape(local);
|
|
@@ -313,7 +323,13 @@ if (isMain && process.argv.includes('--selftest')) {
|
|
|
313
323
|
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
324
|
if (prev) process.env.AUDIOLAB_API_KEY = prev; else delete process.env.AUDIOLAB_API_KEY;
|
|
315
325
|
|
|
316
|
-
|
|
326
|
+
// The version announced over MCP drifted from the published package once already
|
|
327
|
+
// (server said 0.3.0, npm had 0.3.1). Now it is read from package.json, and this
|
|
328
|
+
// asserts the read actually resolved rather than silently yielding undefined.
|
|
329
|
+
assert.equal(typeof PKG_VERSION, 'string', 'version resolves from package.json');
|
|
330
|
+
assert.match(PKG_VERSION, /^\d+\.\d+\.\d+/, 'version looks like a semver');
|
|
331
|
+
|
|
332
|
+
console.log(`selftest ok · v${PKG_VERSION} · 9 tools (incl. analyze_batch) + missing-key guard + remote-path refusals + batch guards`);
|
|
317
333
|
process.exit(0);
|
|
318
334
|
}
|
|
319
335
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@audiolabtools/mcp-server",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
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": {
|