Skip to content

Commit 3983ae7

Browse files
authored
chore: remove logging logic from server.ts (#25)
* chore: remove logging logic from server.ts * chore: update compiled index.js --------- Co-authored-by: snehshah22 <snehshah22@users.noreply.github.com>
1 parent f5f9d6f commit 3983ae7

2 files changed

Lines changed: 3 additions & 38 deletions

File tree

mcp/dist/index.js

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6801,12 +6801,12 @@ var require_dist = __commonJS({
68016801
throw new Error(`Unknown format "${name}"`);
68026802
return f;
68036803
};
6804-
function addFormats(ajv, list, fs9, exportName) {
6804+
function addFormats(ajv, list, fs8, exportName) {
68056805
var _a;
68066806
var _b;
68076807
(_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
68086808
for (const f of list)
6809-
ajv.addFormat(f, fs9[f]);
6809+
ajv.addFormat(f, fs8[f]);
68106810
}
68116811
module.exports = exports = formatsPlugin;
68126812
Object.defineProperty(exports, "__esModule", { value: true });
@@ -18782,7 +18782,6 @@ var StdioClientTransport = class {
1878218782
// server.ts
1878318783
import path from "path";
1878418784
import { fileURLToPath } from "url";
18785-
import fs8 from "fs";
1878618785

1878718786
// tools/delete_cell.ts
1878818787
import * as fs from "fs/promises";
@@ -19266,52 +19265,36 @@ async function startStandaloneServer() {
1926619265
}
1926719266
async function run() {
1926819267
const ideName = process.env.DATA_CLOUD_CURR_IDE_NAME;
19269-
const logPath = "/tmp/mcp_debug.log";
19270-
const log = (msg) => {
19271-
fs8.appendFileSync(logPath, `[${(/* @__PURE__ */ new Date()).toISOString()}] ${msg}
19272-
`);
19273-
console.error(msg);
19274-
};
19275-
log(`Server started. DATA_CLOUD_CURR_IDE_NAME=${ideName}`);
1927619268
if (ideName) {
19277-
log(`IDE environment detected via env var (${ideName}).`);
1927819269
const proxyCmd = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../bin/mcp_proxy_bundle.cjs");
1927919270
try {
19280-
log(`Spawning Notebooks proxy...`);
1928119271
const notebookTransport = new StdioClientTransport({
1928219272
command: process.execPath,
1928319273
args: [proxyCmd, `notebooks-${ideName.toLowerCase()}`],
1928419274
env: process.env
1928519275
});
1928619276
notebookClient = new Client({ name: "notebook-client", version: "0.1.0" }, { capabilities: {} });
1928719277
await notebookClient.connect(notebookTransport);
19288-
log("Connected to Notebooks proxy");
1928919278
} catch (e) {
19290-
log(`Failed to connect to Notebooks proxy: ${e}`);
1929119279
notebookClient = null;
1929219280
}
1929319281
try {
19294-
log(`Spawning Visualization proxy...`);
1929519282
const vizTransport = new StdioClientTransport({
1929619283
command: process.execPath,
1929719284
args: [proxyCmd, `visualization-${ideName.toLowerCase()}`],
1929819285
env: process.env
1929919286
});
1930019287
vizClient = new Client({ name: "viz-client", version: "0.1.0" }, { capabilities: {} });
1930119288
await vizClient.connect(vizTransport);
19302-
log("Connected to Visualization proxy");
1930319289
} catch (e) {
19304-
log(`Failed to connect to Visualization proxy: ${e}`);
1930519290
vizClient = null;
1930619291
}
1930719292
if (!notebookClient && !vizClient) {
19308-
log("Both proxies failed. Falling back to standalone server");
1930919293
await startStandaloneServer();
1931019294
return;
1931119295
}
1931219296
const transport = new StdioServerTransport();
1931319297
await server.connect(transport);
19314-
log("Master aggregator server running on stdio");
1931519298
return;
1931619299
}
1931719300
await startStandaloneServer();

mcp/server.ts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'
2121
import { spawn } from 'child_process';
2222
import path from 'path';
2323
import { fileURLToPath } from 'url';
24-
import fs from 'fs';
24+
2525
import {
2626
CallToolRequestSchema,
2727
ListToolsRequestSchema,
@@ -339,63 +339,45 @@ async function startStandaloneServer() {
339339

340340
async function run() {
341341
const ideName = process.env.DATA_CLOUD_CURR_IDE_NAME;
342-
const logPath = '/tmp/mcp_debug.log';
343-
344-
const log = (msg: string) => {
345-
fs.appendFileSync(logPath, `[${new Date().toISOString()}] ${msg}\n`);
346-
console.error(msg);
347-
};
348-
349-
log(`Server started. DATA_CLOUD_CURR_IDE_NAME=${ideName}`);
350-
351342
if (ideName) {
352-
log(`IDE environment detected via env var (${ideName}).`);
353343

354344
const proxyCmd = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../bin/mcp_proxy_bundle.cjs');
355345

356346
// Connect to Notebooks proxy
357347
try {
358-
log(`Spawning Notebooks proxy...`);
359348
const notebookTransport = new StdioClientTransport({
360349
command: process.execPath,
361350
args: [proxyCmd, `notebooks-${ideName.toLowerCase()}`],
362351
env: process.env
363352
});
364353
notebookClient = new Client({ name: 'notebook-client', version: '0.1.0' }, { capabilities: {} });
365354
await notebookClient.connect(notebookTransport);
366-
log('Connected to Notebooks proxy');
367355
} catch (e) {
368-
log(`Failed to connect to Notebooks proxy: ${e}`);
369356
notebookClient = null;
370357
}
371358

372359
// Connect to Visualization proxy
373360
try {
374-
log(`Spawning Visualization proxy...`);
375361
const vizTransport = new StdioClientTransport({
376362
command: process.execPath,
377363
args: [proxyCmd, `visualization-${ideName.toLowerCase()}`],
378364
env: process.env
379365
});
380366
vizClient = new Client({ name: 'viz-client', version: '0.1.0' }, { capabilities: {} });
381367
await vizClient.connect(vizTransport);
382-
log('Connected to Visualization proxy');
383368
} catch (e) {
384-
log(`Failed to connect to Visualization proxy: ${e}`);
385369
vizClient = null;
386370
}
387371

388372
// Fallback strategy Scenario 4: Both fail -> Standalone
389373
if (!notebookClient && !vizClient) {
390-
log('Both proxies failed. Falling back to standalone server');
391374
await startStandaloneServer();
392375
return;
393376
}
394377

395378
// Start the master server on stdio
396379
const transport = new StdioServerTransport();
397380
await server.connect(transport);
398-
log('Master aggregator server running on stdio');
399381
return;
400382
}
401383

0 commit comments

Comments
 (0)