record_safer_pro_mcp 1.0.0
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 +205 -0
- package/dist/api-client.d.ts +159 -0
- package/dist/api-client.d.ts.map +1 -0
- package/dist/api-client.js +991 -0
- package/dist/api-client.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/index.d.ts +12 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +235 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/resources/index.d.ts +7 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +59 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/resources/mixing-guide-content.d.ts +8 -0
- package/dist/resources/mixing-guide-content.d.ts.map +1 -0
- package/dist/resources/mixing-guide-content.js +194 -0
- package/dist/resources/mixing-guide-content.js.map +1 -0
- package/dist/runtime.d.ts +39 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +320 -0
- package/dist/runtime.js.map +1 -0
- package/dist/telemetry-schema.d.ts +39 -0
- package/dist/telemetry-schema.d.ts.map +1 -0
- package/dist/telemetry-schema.js +15 -0
- package/dist/telemetry-schema.js.map +1 -0
- package/dist/tools/core.d.ts +4 -0
- package/dist/tools/core.d.ts.map +1 -0
- package/dist/tools/core.js +360 -0
- package/dist/tools/core.js.map +1 -0
- package/dist/tools/devices.d.ts +10 -0
- package/dist/tools/devices.d.ts.map +1 -0
- package/dist/tools/devices.js +53 -0
- package/dist/tools/devices.js.map +1 -0
- package/dist/tools/levels.d.ts +11 -0
- package/dist/tools/levels.d.ts.map +1 -0
- package/dist/tools/levels.js +25 -0
- package/dist/tools/levels.js.map +1 -0
- package/dist/tools/markers.d.ts +17 -0
- package/dist/tools/markers.d.ts.map +1 -0
- package/dist/tools/markers.js +142 -0
- package/dist/tools/markers.js.map +1 -0
- package/dist/tools/monitor.d.ts +19 -0
- package/dist/tools/monitor.d.ts.map +1 -0
- package/dist/tools/monitor.js +232 -0
- package/dist/tools/monitor.js.map +1 -0
- package/dist/tools/recording.d.ts +12 -0
- package/dist/tools/recording.d.ts.map +1 -0
- package/dist/tools/recording.js +85 -0
- package/dist/tools/recording.js.map +1 -0
- package/dist/tools/settings.d.ts +10 -0
- package/dist/tools/settings.d.ts.map +1 -0
- package/dist/tools/settings.js +43 -0
- package/dist/tools/settings.js.map +1 -0
- package/dist/tools/storage.d.ts +10 -0
- package/dist/tools/storage.d.ts.map +1 -0
- package/dist/tools/storage.js +20 -0
- package/dist/tools/storage.js.map +1 -0
- package/dist/tools/system.d.ts +10 -0
- package/dist/tools/system.d.ts.map +1 -0
- package/dist/tools/system.js +53 -0
- package/dist/tools/system.js.map +1 -0
- package/dist/tools/tool-metadata.d.ts +19 -0
- package/dist/tools/tool-metadata.d.ts.map +1 -0
- package/dist/tools/tool-metadata.js +25 -0
- package/dist/tools/tool-metadata.js.map +1 -0
- package/dist/types.d.ts +456 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +80 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +336 -0
- package/dist/utils.js.map +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mixing-guide-content.js","sourceRoot":"","sources":["../../src/resources/mixing-guide-content.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0L9B,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Server as HttpServer } from "node:http";
|
|
2
|
+
import { createMcpExpressApp } from "@modelcontextprotocol/sdk/server/express.js";
|
|
3
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
|
+
export type TransportMode = "stdio" | "streamable-http";
|
|
6
|
+
export interface RuntimeConfig {
|
|
7
|
+
transport: TransportMode;
|
|
8
|
+
httpHost: string;
|
|
9
|
+
httpPort: number;
|
|
10
|
+
httpPath: string;
|
|
11
|
+
httpAllowedHosts: string[];
|
|
12
|
+
httpBearerToken: string | null;
|
|
13
|
+
}
|
|
14
|
+
export interface StdioRuntime {
|
|
15
|
+
mode: "stdio";
|
|
16
|
+
server: McpServer;
|
|
17
|
+
transport: StdioServerTransport;
|
|
18
|
+
close: () => Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export interface StreamableHttpRuntime {
|
|
21
|
+
mode: "streamable-http";
|
|
22
|
+
endpoint: string;
|
|
23
|
+
healthEndpoint: string;
|
|
24
|
+
httpServer: HttpServer;
|
|
25
|
+
close: () => Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
export declare function isLoopbackHost(host: string): boolean;
|
|
28
|
+
export declare function resolveRuntimeConfig(env?: NodeJS.ProcessEnv): RuntimeConfig;
|
|
29
|
+
export declare function validateRuntimeConfig(config: RuntimeConfig): void;
|
|
30
|
+
export declare function createConfiguredServer(): McpServer;
|
|
31
|
+
export declare function createStreamableHttpApp(config: RuntimeConfig): {
|
|
32
|
+
app: ReturnType<typeof createMcpExpressApp>;
|
|
33
|
+
closeSessions: () => Promise<void>;
|
|
34
|
+
sessionCount: () => number;
|
|
35
|
+
};
|
|
36
|
+
export declare function startStdioRuntime(): Promise<StdioRuntime>;
|
|
37
|
+
export declare function startStreamableHttpRuntime(config: RuntimeConfig): Promise<StreamableHttpRuntime>;
|
|
38
|
+
export declare function startRuntime(config?: RuntimeConfig): Promise<StdioRuntime | StreamableHttpRuntime>;
|
|
39
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,WAAW,CAAC;AAGtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAOjF,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,iBAAiB,CAAC;AAExD,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,aAAa,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,SAAS,CAAC;IAClB,SAAS,EAAE,oBAAoB,CAAC;IAChC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,iBAAiB,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAoID,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGpD;AAaD,wBAAgB,oBAAoB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,aAAa,CASxF;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAUjE;AAED,wBAAgB,sBAAsB,IAAI,SAAS,CAWlD;AAgCD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,aAAa,GAAG;IAC9D,GAAG,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;IAC5C,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,YAAY,EAAE,MAAM,MAAM,CAAC;CAC5B,CAwGA;AAqBD,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,YAAY,CAAC,CAa/D;AAED,wBAAsB,0BAA0B,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA+BtG;AAED,wBAAsB,YAAY,CAAC,MAAM,GAAE,aAAsC,GAAG,OAAO,CAAC,YAAY,GAAG,qBAAqB,CAAC,CAQhI"}
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { createMcpExpressApp } from "@modelcontextprotocol/sdk/server/express.js";
|
|
3
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
|
+
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
6
|
+
import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
|
|
7
|
+
import { registerPrompts } from "./prompts/index.js";
|
|
8
|
+
import { registerCoreTools } from "./tools/core.js";
|
|
9
|
+
const SERVER_DESCRIPTION = `Record Safer Pro MCP Server — Core recording assistant interface.
|
|
10
|
+
|
|
11
|
+
Core safety rule (DADAO Engine architecture):
|
|
12
|
+
- MCP may prepare the recording console via start_record_mcp.
|
|
13
|
+
- Actual recording start must remain an explicit action after the console is ready.
|
|
14
|
+
|
|
15
|
+
This slim surface intentionally exposes only the highest-frequency MCP actions:
|
|
16
|
+
- list_audio_devices
|
|
17
|
+
- start_record_mcp
|
|
18
|
+
- get_channels / get_mix / get_health / get_status
|
|
19
|
+
- list_tracks / list_markers / add_marker / rename_channel
|
|
20
|
+
- stop_recording
|
|
21
|
+
|
|
22
|
+
Precondition for most core tools:
|
|
23
|
+
The user must already have:
|
|
24
|
+
1. Either called start_record_mcp, or manually selected an audio device and parameters
|
|
25
|
+
2. Entered the recording console (session initialized and engine ready)
|
|
26
|
+
|
|
27
|
+
When the user asks for recording actions but the session is not initialized, either:
|
|
28
|
+
- resolve deviceId/audioFormat/channels first, resolving sample rate to the selected device's default/current rate and applying defaults of 24-bit / ~/Desktop only after disclosing them, then
|
|
29
|
+
- ask for one consolidated confirmation before start_record_mcp, and only after that call it.
|
|
30
|
+
|
|
31
|
+
Golden rule:
|
|
32
|
+
Always call get_status first and branch by state:
|
|
33
|
+
|
|
34
|
+
State A — Recording active (recording: true):
|
|
35
|
+
- Execute requests directly (add marker, stop recording, query status, inspect tracks/markers)
|
|
36
|
+
|
|
37
|
+
State B — Session initialized but not recording (ready: true, recording: false):
|
|
38
|
+
- Status queries and channel inspection are allowed
|
|
39
|
+
- The user can explicitly start recording in the app after console preparation
|
|
40
|
+
|
|
41
|
+
State C — Not initialized (ready: false):
|
|
42
|
+
- Extract parameters from the user message or uploaded document first
|
|
43
|
+
- Resolve device names into device IDs if needed
|
|
44
|
+
- Gather all missing items in one bundled turn, not one-by-one
|
|
45
|
+
- Present the final setup summary, require confirmation, then call start_record_mcp
|
|
46
|
+
- Only after the console is ready may rename or metadata tools run
|
|
47
|
+
|
|
48
|
+
Actions MCP must not perform implicitly:
|
|
49
|
+
1. Start recording without an explicit user instruction
|
|
50
|
+
2. Stop recording without an explicit user instruction
|
|
51
|
+
3. Reorder setup so that rename/metadata changes happen before the console is ready
|
|
52
|
+
|
|
53
|
+
Critical safety rule for stop_recording (irreversible):
|
|
54
|
+
1. User intent to stop recording must be explicit in the current message
|
|
55
|
+
2. Never infer stop action from context alone
|
|
56
|
+
3. If intent is ambiguous, ask explicit confirmation first
|
|
57
|
+
4. Only call stop_recording with userConfirmed=true after that confirmation`;
|
|
58
|
+
const DEFAULT_HTTP_HOST = "127.0.0.1";
|
|
59
|
+
const DEFAULT_HTTP_PORT = 3010;
|
|
60
|
+
const DEFAULT_HTTP_PATH = "/mcp";
|
|
61
|
+
function normalizeTransportMode(rawMode) {
|
|
62
|
+
const normalized = rawMode?.trim().toLowerCase();
|
|
63
|
+
if (!normalized || normalized === "stdio") {
|
|
64
|
+
return "stdio";
|
|
65
|
+
}
|
|
66
|
+
if (normalized === "streamable-http" || normalized === "streamable_http" || normalized === "http") {
|
|
67
|
+
return "streamable-http";
|
|
68
|
+
}
|
|
69
|
+
throw new Error(`Unsupported RECORD_SAFER_MCP_TRANSPORT: ${rawMode}. Expected "stdio" or "streamable-http".`);
|
|
70
|
+
}
|
|
71
|
+
function parseHttpPort(rawPort) {
|
|
72
|
+
if (!rawPort) {
|
|
73
|
+
return DEFAULT_HTTP_PORT;
|
|
74
|
+
}
|
|
75
|
+
const port = Number.parseInt(rawPort, 10);
|
|
76
|
+
if (!Number.isInteger(port) || port < 0 || port > 65535) {
|
|
77
|
+
throw new Error(`Invalid RECORD_SAFER_MCP_HTTP_PORT: ${rawPort}. Expected an integer between 0 and 65535.`);
|
|
78
|
+
}
|
|
79
|
+
return port;
|
|
80
|
+
}
|
|
81
|
+
function parseCsv(raw) {
|
|
82
|
+
if (!raw) {
|
|
83
|
+
return [];
|
|
84
|
+
}
|
|
85
|
+
return raw
|
|
86
|
+
.split(",")
|
|
87
|
+
.map((item) => item.trim())
|
|
88
|
+
.filter((item) => item.length > 0);
|
|
89
|
+
}
|
|
90
|
+
function sanitizeBearerToken(rawToken) {
|
|
91
|
+
const trimmed = rawToken?.trim();
|
|
92
|
+
return trimmed ? trimmed : null;
|
|
93
|
+
}
|
|
94
|
+
function normalizeHttpPath(rawPath) {
|
|
95
|
+
const trimmed = rawPath?.trim();
|
|
96
|
+
if (!trimmed) {
|
|
97
|
+
return DEFAULT_HTTP_PATH;
|
|
98
|
+
}
|
|
99
|
+
return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
100
|
+
}
|
|
101
|
+
export function isLoopbackHost(host) {
|
|
102
|
+
const normalized = host.trim().toLowerCase();
|
|
103
|
+
return normalized === "127.0.0.1" || normalized === "localhost" || normalized === "::1" || normalized === "[::1]";
|
|
104
|
+
}
|
|
105
|
+
function formatUrlHost(host) {
|
|
106
|
+
if (host.includes(":") && !host.startsWith("[")) {
|
|
107
|
+
return `[${host}]`;
|
|
108
|
+
}
|
|
109
|
+
return host;
|
|
110
|
+
}
|
|
111
|
+
function formatEndpointUrl(host, port, path) {
|
|
112
|
+
return `http://${formatUrlHost(host)}:${port}${path}`;
|
|
113
|
+
}
|
|
114
|
+
export function resolveRuntimeConfig(env = process.env) {
|
|
115
|
+
return {
|
|
116
|
+
transport: normalizeTransportMode(env.RECORD_SAFER_MCP_TRANSPORT),
|
|
117
|
+
httpHost: env.RECORD_SAFER_MCP_HTTP_HOST?.trim() || DEFAULT_HTTP_HOST,
|
|
118
|
+
httpPort: parseHttpPort(env.RECORD_SAFER_MCP_HTTP_PORT),
|
|
119
|
+
httpPath: normalizeHttpPath(env.RECORD_SAFER_MCP_HTTP_PATH),
|
|
120
|
+
httpAllowedHosts: parseCsv(env.RECORD_SAFER_MCP_HTTP_ALLOWED_HOSTS),
|
|
121
|
+
httpBearerToken: sanitizeBearerToken(env.RECORD_SAFER_MCP_HTTP_BEARER_TOKEN),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
export function validateRuntimeConfig(config) {
|
|
125
|
+
if (!config.httpPath.startsWith("/")) {
|
|
126
|
+
throw new Error(`Invalid MCP HTTP path: ${config.httpPath}. The path must start with "/".`);
|
|
127
|
+
}
|
|
128
|
+
if (config.transport === "streamable-http" && !isLoopbackHost(config.httpHost) && !config.httpBearerToken) {
|
|
129
|
+
throw new Error("Refusing to expose Streamable HTTP on a non-loopback host without RECORD_SAFER_MCP_HTTP_BEARER_TOKEN.");
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
export function createConfiguredServer() {
|
|
133
|
+
const server = new McpServer({
|
|
134
|
+
name: "record-safer-pro",
|
|
135
|
+
version: "2.1.0",
|
|
136
|
+
description: SERVER_DESCRIPTION,
|
|
137
|
+
});
|
|
138
|
+
registerCoreTools(server);
|
|
139
|
+
registerPrompts(server);
|
|
140
|
+
return server;
|
|
141
|
+
}
|
|
142
|
+
function writeJsonRpcError(res, statusCode, message) {
|
|
143
|
+
res.status(statusCode).json({
|
|
144
|
+
jsonrpc: "2.0",
|
|
145
|
+
error: {
|
|
146
|
+
code: -32000,
|
|
147
|
+
message,
|
|
148
|
+
},
|
|
149
|
+
id: null,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function writeUnauthorized(res) {
|
|
153
|
+
res.status(401).json({
|
|
154
|
+
error: "Unauthorized",
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
function getSessionId(req) {
|
|
158
|
+
const header = req.headers["mcp-session-id"];
|
|
159
|
+
if (typeof header === "string" && header.trim().length > 0) {
|
|
160
|
+
return header.trim();
|
|
161
|
+
}
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
function hasValidBearerToken(req, expectedToken) {
|
|
165
|
+
const authHeader = req.header("authorization");
|
|
166
|
+
return authHeader === `Bearer ${expectedToken}`;
|
|
167
|
+
}
|
|
168
|
+
export function createStreamableHttpApp(config) {
|
|
169
|
+
validateRuntimeConfig(config);
|
|
170
|
+
const app = createMcpExpressApp({
|
|
171
|
+
host: config.httpHost,
|
|
172
|
+
...(config.httpAllowedHosts.length > 0 ? { allowedHosts: config.httpAllowedHosts } : {}),
|
|
173
|
+
});
|
|
174
|
+
const sessions = new Map();
|
|
175
|
+
const closeSession = async (sessionId) => {
|
|
176
|
+
const session = sessions.get(sessionId);
|
|
177
|
+
if (!session) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
sessions.delete(sessionId);
|
|
181
|
+
await session.server.close().catch(() => { });
|
|
182
|
+
};
|
|
183
|
+
app.disable("x-powered-by");
|
|
184
|
+
app.get("/healthz", (_req, res) => {
|
|
185
|
+
res.json({
|
|
186
|
+
ok: true,
|
|
187
|
+
transport: "streamable-http",
|
|
188
|
+
path: config.httpPath,
|
|
189
|
+
authRequired: Boolean(config.httpBearerToken),
|
|
190
|
+
sessionCount: sessions.size,
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
if (config.httpBearerToken) {
|
|
194
|
+
app.use(config.httpPath, (req, res, next) => {
|
|
195
|
+
if (!hasValidBearerToken(req, config.httpBearerToken)) {
|
|
196
|
+
writeUnauthorized(res);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
next();
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
app.all(config.httpPath, async (req, res) => {
|
|
203
|
+
let createdSession = null;
|
|
204
|
+
try {
|
|
205
|
+
const sessionId = getSessionId(req);
|
|
206
|
+
let session = sessionId ? sessions.get(sessionId) ?? null : null;
|
|
207
|
+
if (sessionId && !session) {
|
|
208
|
+
writeJsonRpcError(res, 404, "MCP session not found.");
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
if (!session) {
|
|
212
|
+
const isInitialize = req.method === "POST" && isInitializeRequest(req.body);
|
|
213
|
+
if (!isInitialize) {
|
|
214
|
+
writeJsonRpcError(res, 400, "No valid MCP session. Send initialize first.");
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
const server = createConfiguredServer();
|
|
218
|
+
const transport = new StreamableHTTPServerTransport({
|
|
219
|
+
sessionIdGenerator: () => randomUUID(),
|
|
220
|
+
onsessioninitialized: (newSessionId) => {
|
|
221
|
+
sessions.set(newSessionId, { server, transport });
|
|
222
|
+
},
|
|
223
|
+
});
|
|
224
|
+
transport.onclose = () => {
|
|
225
|
+
const activeSessionId = transport.sessionId;
|
|
226
|
+
if (!activeSessionId) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
sessions.delete(activeSessionId);
|
|
230
|
+
};
|
|
231
|
+
await server.connect(transport);
|
|
232
|
+
session = { server, transport };
|
|
233
|
+
createdSession = session;
|
|
234
|
+
}
|
|
235
|
+
await session.transport.handleRequest(req, res, req.body);
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
if (createdSession) {
|
|
239
|
+
await createdSession.server.close().catch(() => { });
|
|
240
|
+
}
|
|
241
|
+
console.error("Error handling MCP Streamable HTTP request:", error);
|
|
242
|
+
if (!res.headersSent) {
|
|
243
|
+
writeJsonRpcError(res, 500, "Internal server error.");
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
return {
|
|
248
|
+
app,
|
|
249
|
+
closeSessions: async () => {
|
|
250
|
+
const sessionIds = [...sessions.keys()];
|
|
251
|
+
await Promise.all(sessionIds.map((sessionId) => closeSession(sessionId)));
|
|
252
|
+
},
|
|
253
|
+
sessionCount: () => sessions.size,
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
async function listen(app, host, port) {
|
|
257
|
+
return await new Promise((resolve, reject) => {
|
|
258
|
+
const httpServer = app.listen(port, host, () => resolve(httpServer));
|
|
259
|
+
httpServer.once("error", reject);
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
async function closeHttpServer(httpServer) {
|
|
263
|
+
await new Promise((resolve, reject) => {
|
|
264
|
+
httpServer.close((error) => {
|
|
265
|
+
if (error) {
|
|
266
|
+
reject(error);
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
resolve();
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
export async function startStdioRuntime() {
|
|
274
|
+
const server = createConfiguredServer();
|
|
275
|
+
const transport = new StdioServerTransport();
|
|
276
|
+
await server.connect(transport);
|
|
277
|
+
return {
|
|
278
|
+
mode: "stdio",
|
|
279
|
+
server,
|
|
280
|
+
transport,
|
|
281
|
+
close: async () => {
|
|
282
|
+
await server.close();
|
|
283
|
+
},
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
export async function startStreamableHttpRuntime(config) {
|
|
287
|
+
validateRuntimeConfig(config);
|
|
288
|
+
const { app, closeSessions } = createStreamableHttpApp(config);
|
|
289
|
+
const httpServer = await listen(app, config.httpHost, config.httpPort);
|
|
290
|
+
const address = httpServer.address();
|
|
291
|
+
if (!address || typeof address === "string") {
|
|
292
|
+
throw new Error("Unable to resolve MCP HTTP listening address.");
|
|
293
|
+
}
|
|
294
|
+
const resolvedAddress = address;
|
|
295
|
+
const endpoint = formatEndpointUrl(config.httpHost, resolvedAddress.port, config.httpPath);
|
|
296
|
+
const healthEndpoint = formatEndpointUrl(config.httpHost, resolvedAddress.port, "/healthz");
|
|
297
|
+
console.error(`Record Safer MCP Streamable HTTP listening on ${endpoint}`);
|
|
298
|
+
console.error(`Health endpoint: ${healthEndpoint}`);
|
|
299
|
+
if (config.httpBearerToken) {
|
|
300
|
+
console.error("HTTP bearer authentication is enabled for the MCP endpoint.");
|
|
301
|
+
}
|
|
302
|
+
return {
|
|
303
|
+
mode: "streamable-http",
|
|
304
|
+
endpoint,
|
|
305
|
+
healthEndpoint,
|
|
306
|
+
httpServer,
|
|
307
|
+
close: async () => {
|
|
308
|
+
await closeSessions();
|
|
309
|
+
await closeHttpServer(httpServer);
|
|
310
|
+
},
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
export async function startRuntime(config = resolveRuntimeConfig()) {
|
|
314
|
+
validateRuntimeConfig(config);
|
|
315
|
+
if (config.transport === "streamable-http") {
|
|
316
|
+
return await startStreamableHttpRuntime(config);
|
|
317
|
+
}
|
|
318
|
+
return await startStdioRuntime();
|
|
319
|
+
}
|
|
320
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runt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,CAAC,MAAM,CAAC,CAAC;IAClD,CAAC;IAED,OAAO,MAAM,iBAAiB,EAAE,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const telemetryDataSchema: z.ZodObject<{
|
|
3
|
+
timestamp: z.ZodString;
|
|
4
|
+
deviceChannelCount: z.ZodNullable<z.ZodNumber>;
|
|
5
|
+
sampleRate: z.ZodNullable<z.ZodNumber>;
|
|
6
|
+
bitDepth: z.ZodNullable<z.ZodEnum<["16-bit", "24-bit", "32-bit Float"]>>;
|
|
7
|
+
audioFormat: z.ZodEnum<["wav", "caf"]>;
|
|
8
|
+
activeChannelCount: z.ZodNumber;
|
|
9
|
+
recordingMode: z.ZodEnum<["safe", "studio"]>;
|
|
10
|
+
levelMeterBufferSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
11
|
+
configurationTimeSeconds: z.ZodNullable<z.ZodNumber>;
|
|
12
|
+
appVersion: z.ZodString;
|
|
13
|
+
telemetryConsent: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
}, "strict", z.ZodTypeAny, {
|
|
15
|
+
audioFormat: "wav" | "caf";
|
|
16
|
+
bitDepth: "16-bit" | "24-bit" | "32-bit Float" | null;
|
|
17
|
+
sampleRate: number | null;
|
|
18
|
+
timestamp: string;
|
|
19
|
+
deviceChannelCount: number | null;
|
|
20
|
+
activeChannelCount: number;
|
|
21
|
+
recordingMode: "safe" | "studio";
|
|
22
|
+
configurationTimeSeconds: number | null;
|
|
23
|
+
appVersion: string;
|
|
24
|
+
levelMeterBufferSize?: number | null | undefined;
|
|
25
|
+
telemetryConsent?: boolean | undefined;
|
|
26
|
+
}, {
|
|
27
|
+
audioFormat: "wav" | "caf";
|
|
28
|
+
bitDepth: "16-bit" | "24-bit" | "32-bit Float" | null;
|
|
29
|
+
sampleRate: number | null;
|
|
30
|
+
timestamp: string;
|
|
31
|
+
deviceChannelCount: number | null;
|
|
32
|
+
activeChannelCount: number;
|
|
33
|
+
recordingMode: "safe" | "studio";
|
|
34
|
+
configurationTimeSeconds: number | null;
|
|
35
|
+
appVersion: string;
|
|
36
|
+
levelMeterBufferSize?: number | null | undefined;
|
|
37
|
+
telemetryConsent?: boolean | undefined;
|
|
38
|
+
}>;
|
|
39
|
+
//# sourceMappingURL=telemetry-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-schema.d.ts","sourceRoot":"","sources":["../src/telemetry-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYrB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const telemetryDataSchema = z.object({
|
|
3
|
+
timestamp: z.string().min(1).max(64),
|
|
4
|
+
deviceChannelCount: z.number().int().nonnegative().nullable(),
|
|
5
|
+
sampleRate: z.number().int().positive().nullable(),
|
|
6
|
+
bitDepth: z.enum(["16-bit", "24-bit", "32-bit Float"]).nullable(),
|
|
7
|
+
audioFormat: z.enum(["wav", "caf"]),
|
|
8
|
+
activeChannelCount: z.number().int().nonnegative(),
|
|
9
|
+
recordingMode: z.enum(["safe", "studio"]),
|
|
10
|
+
levelMeterBufferSize: z.number().int().positive().nullable().optional(),
|
|
11
|
+
configurationTimeSeconds: z.number().int().nonnegative().nullable(),
|
|
12
|
+
appVersion: z.string().min(1).max(64),
|
|
13
|
+
telemetryConsent: z.boolean().optional(),
|
|
14
|
+
}).strict();
|
|
15
|
+
//# sourceMappingURL=telemetry-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry-schema.js","sourceRoot":"","sources":["../src/telemetry-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,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ORE_TOOL_NAMES: readonly ["list_audio_devices", "start_record_mcp", "get_channels", "get_mix", "get_health", "get_status", "stop_recording", "list_tracks", "list_markers", "add_marker", "rename_channel"];
|
|
3
|
+
export declare function registerCoreTools(server: McpServer): void;
|
|
4
|
+
//# sourceMappingURL=core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/tools/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAMpE,eAAO,MAAM,eAAe,6LAYlB,CAAC;AA8GX,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,QAuVlD"}
|