diff --git a/eslint.config.mjs b/eslint.config.mjs index 5d015d1..eda1eff 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -180,6 +180,7 @@ export const baseRules = { // react "react/react-in-jsx-scope": 0, + "no-console": 2, }; const languageOptions = { diff --git a/src/program.ts b/src/program.ts index 928d01a..58fc1a1 100644 --- a/src/program.ts +++ b/src/program.ts @@ -41,7 +41,6 @@ program .option('--config ', 'Path to the configuration file.') .action(async options => { const config = await resolveConfig(options); - console.error(config); const serverList = new ServerList(() => createServer(config)); setupExitWatchdog(serverList); diff --git a/src/transport.ts b/src/transport.ts index 266dcf1..9038972 100644 --- a/src/transport.ts +++ b/src/transport.ts @@ -49,7 +49,10 @@ async function handleSSE(req: http.IncomingMessage, res: http.ServerResponse, ur const server = await serverList.create(); res.on('close', () => { sessions.delete(transport.sessionId); - serverList.close(server).catch(e => console.error(e)); + serverList.close(server).catch(e => { + // eslint-disable-next-line no-console + console.error(e); + }); }); return await server.connect(transport); } @@ -113,15 +116,19 @@ export function startHttpTransport(port: number, hostname: string | undefined, s resolvedHost = 'localhost'; url = `http://${resolvedHost}:${resolvedPort}`; } - console.log(`Listening on ${url}`); - console.log('Put this in your client config:'); - console.log(JSON.stringify({ - 'mcpServers': { - 'playwright': { - 'url': `${url}/sse` + const message = [ + `Listening on ${url}`, + 'Put this in your client config:', + JSON.stringify({ + 'mcpServers': { + 'playwright': { + 'url': `${url}/sse` + } } - } - }, undefined, 2)); - console.log('If your client supports streamable HTTP, you can use the /mcp endpoint instead.'); + }, undefined, 2), + 'If your client supports streamable HTTP, you can use the /mcp endpoint instead.', + ].join('\n'); + // eslint-disable-next-line no-console + console.log(message); }); }