Skip to content

Commit e99d25b

Browse files
committed
debug: write logs to /tmp/mcp_debug.log
1 parent 1ea7e20 commit e99d25b

2 files changed

Lines changed: 24 additions & 6 deletions

File tree

mcp/dist/index.js

Lines changed: 15 additions & 4 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, fs11, exportName) {
6804+
function addFormats(ajv, list, fs12, 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, fs11[f]);
6809+
ajv.addFormat(f, fs12[f]);
68106810
}
68116811
module.exports = exports = formatsPlugin;
68126812
Object.defineProperty(exports, "__esModule", { value: true });
@@ -19049,6 +19049,10 @@ var nonWindows = async (options = {}) => {
1904919049
var psList = process4.platform === "win32" ? windows : nonWindows;
1905019050
var ps_list_default = psList;
1905119051

19052+
// server.ts
19053+
import fs11 from "fs";
19054+
import os from "os";
19055+
1905219056
// tools/delete_cell.ts
1905319057
import * as fs2 from "fs/promises";
1905419058
async function deleteCell(notebookPath, cellIndex) {
@@ -19377,8 +19381,15 @@ ${traceback}
1937719381
// server.ts
1937819382
var args = process.argv.slice(2);
1937919383
var mode = args.find((a) => a.startsWith("--mode="))?.split("=")[1];
19380-
console.error(`[MCP Server] process.argv: ${JSON.stringify(process.argv)}`);
19381-
console.error(`[MCP Server] parsed mode: ${mode}`);
19384+
var logPath = path3.join(os.tmpdir(), "mcp_debug.log");
19385+
try {
19386+
fs11.appendFileSync(logPath, `[${(/* @__PURE__ */ new Date()).toISOString()}] process.argv: ${JSON.stringify(process.argv)}
19387+
`);
19388+
fs11.appendFileSync(logPath, `[${(/* @__PURE__ */ new Date()).toISOString()}] parsed mode: ${mode}
19389+
`);
19390+
} catch (e) {
19391+
console.error("Failed to write to log file:", e);
19392+
}
1938219393
var server = new Server(
1938319394
{
1938419395
name: mode === "visualization" ? "visualization" : "notebook",

mcp/server.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import { spawn } from 'child_process';
2222
import path from 'path';
2323
import { fileURLToPath } from 'url';
2424
import psList from 'ps-list';
25+
import fs from 'fs';
26+
import os from 'os';
2527

2628
import {
2729
CallToolRequestSchema,
@@ -41,8 +43,13 @@ import {getCellOutputs} from './tools/get_cell_outputs.js';
4143
const args = process.argv.slice(2);
4244
const mode = args.find(a => a.startsWith('--mode='))?.split('=')[1];
4345

44-
console.error(`[MCP Server] process.argv: ${JSON.stringify(process.argv)}`);
45-
console.error(`[MCP Server] parsed mode: ${mode}`);
46+
const logPath = path.join(os.tmpdir(), 'mcp_debug.log');
47+
try {
48+
fs.appendFileSync(logPath, `[${new Date().toISOString()}] process.argv: ${JSON.stringify(process.argv)}\n`);
49+
fs.appendFileSync(logPath, `[${new Date().toISOString()}] parsed mode: ${mode}\n`);
50+
} catch (e) {
51+
console.error('Failed to write to log file:', e);
52+
}
4653

4754
const server = new Server(
4855
{

0 commit comments

Comments
 (0)