@chinchillaenterprises/mcp-dev-logger 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 ADDED
@@ -0,0 +1,250 @@
1
+ # MCP Dev Logger
2
+
3
+ A Model Context Protocol (MCP) server for capturing and streaming development server output. Perfect for monitoring `npm run dev`, `yarn dev`, `pnpm dev`, or any other development server commands across all frameworks (Next.js, Vite, Create React App, etc.).
4
+
5
+ ## Features
6
+
7
+ - **Universal Dev Server Logging**: Works with any development server command
8
+ - **Real-time Log Streaming**: Capture build errors, TypeScript errors, hot reload events
9
+ - **Persistent Logs**: All output saved to file for historical debugging
10
+ - **Process Management**: Start, stop, and restart dev servers
11
+ - **Log Filtering**: Search through logs with grep patterns
12
+ - **Framework Agnostic**: One tool for all development servers
13
+
14
+ ## Installation
15
+
16
+ ### From NPM (Recommended)
17
+ ```bash
18
+ claude mcp add dev-logger -s user -- npx @chinchillaenterprises/mcp-dev-logger
19
+ ```
20
+
21
+ ### For Development/Testing
22
+ ```bash
23
+ # Clone and build locally
24
+ git clone <repository-url>
25
+ cd mcp-dev-logger
26
+ npm install
27
+ npm run build
28
+
29
+ # Add to Claude Code (local development)
30
+ claude mcp add dev-logger-local -s user -- node $(pwd)/dist/index.js
31
+ ```
32
+
33
+ ## Tools Provided
34
+
35
+ ### 1. dev_start_log_streaming
36
+ Start a development server and stream its output to a log file.
37
+
38
+ **Parameters:**
39
+ - `command` (optional): Dev command to run (default: "npm run dev")
40
+ - `outputFile` (optional): File to write logs to (default: "dev-server-logs.txt")
41
+ - `cwd` (optional): Working directory
42
+ - `env` (optional): Environment variables to pass
43
+
44
+ **Example:**
45
+ ```json
46
+ {
47
+ "command": "npm run dev",
48
+ "outputFile": "frontend-logs.txt",
49
+ "cwd": "/path/to/project",
50
+ "env": {
51
+ "PORT": "3001",
52
+ "NODE_ENV": "development"
53
+ }
54
+ }
55
+ ```
56
+
57
+ ### 2. dev_stop_log_streaming
58
+ Stop the running development server and logging.
59
+
60
+ **No parameters required.**
61
+
62
+ ### 3. dev_restart_log_streaming
63
+ Restart the development server (useful when it crashes or hangs).
64
+
65
+ **Parameters:**
66
+ - `clearLogs` (optional): Whether to clear the log file on restart (default: false)
67
+
68
+ ### 4. dev_get_status
69
+ Check if the development server is running and get its status.
70
+
71
+ **Returns:**
72
+ - Running status
73
+ - Process ID (PID)
74
+ - Uptime
75
+ - Current command
76
+ - Log file location
77
+
78
+ ### 5. dev_tail_logs
79
+ Get the last N lines from the log file.
80
+
81
+ **Parameters:**
82
+ - `lines` (optional): Number of lines to return (default: 50)
83
+ - `filter` (optional): Grep pattern to filter logs
84
+
85
+ **Example:**
86
+ ```json
87
+ {
88
+ "lines": 100,
89
+ "filter": "ERROR"
90
+ }
91
+ ```
92
+
93
+ ### 6. dev_clear_logs
94
+ Clear the log file.
95
+
96
+ **Parameters:**
97
+ - `backup` (optional): Whether to backup logs before clearing (default: false)
98
+
99
+ ## Usage Examples
100
+
101
+ ### Start Next.js Development Server
102
+ ```typescript
103
+ // Start Next.js dev server
104
+ {
105
+ "command": "npm run dev",
106
+ "outputFile": "nextjs-dev.log"
107
+ }
108
+ ```
109
+
110
+ ### Monitor Vite Dev Server
111
+ ```typescript
112
+ // Start Vite with custom port
113
+ {
114
+ "command": "vite --port 3001",
115
+ "outputFile": "vite-dev.log",
116
+ "env": {
117
+ "NODE_ENV": "development"
118
+ }
119
+ }
120
+ ```
121
+
122
+ ### Check for TypeScript Errors
123
+ ```typescript
124
+ // Tail logs filtering for TypeScript errors
125
+ {
126
+ "lines": 200,
127
+ "filter": "TS\\d+"
128
+ }
129
+ ```
130
+
131
+ ### Debug Build Errors
132
+ ```typescript
133
+ // Get recent errors from build process
134
+ {
135
+ "lines": 100,
136
+ "filter": "ERROR|FAILED|error"
137
+ }
138
+ ```
139
+
140
+ ## Log Format
141
+
142
+ Logs are written with timestamps and error markers:
143
+
144
+ ```
145
+ [2024-01-15T10:30:45.123Z] Starting: npm run dev
146
+ [2024-01-15T10:30:46.456Z] > my-app@1.0.0 dev
147
+ [2024-01-15T10:30:46.457Z] > next dev
148
+ [2024-01-15T10:30:47.123Z] ▲ Next.js 14.0.0
149
+ [2024-01-15T10:30:47.124Z] - Local: http://localhost:3000
150
+ [2024-01-15T10:30:48.789Z] [ERROR] Error: Cannot find module './components/Header'
151
+ ```
152
+
153
+ ## Common Use Cases
154
+
155
+ ### 1. Debugging Build Failures
156
+ ```bash
157
+ # Start dev server
158
+ dev_start_log_streaming
159
+
160
+ # When build fails, check recent errors
161
+ dev_tail_logs { "filter": "ERROR", "lines": 100 }
162
+ ```
163
+
164
+ ### 2. Monitoring TypeScript Compilation
165
+ ```bash
166
+ # Start with TypeScript focus
167
+ dev_start_log_streaming { "command": "npm run dev", "outputFile": "ts-errors.log" }
168
+
169
+ # Check for TS errors
170
+ dev_tail_logs { "filter": "TS\\d+|typescript", "lines": 50 }
171
+ ```
172
+
173
+ ### 3. Port Conflicts
174
+ ```bash
175
+ # Start on different port
176
+ dev_start_log_streaming {
177
+ "command": "npm run dev",
178
+ "env": { "PORT": "3001" }
179
+ }
180
+ ```
181
+
182
+ ### 4. Clean Restart After Crash
183
+ ```bash
184
+ # Restart and clear old logs
185
+ dev_restart_log_streaming { "clearLogs": true }
186
+ ```
187
+
188
+ ## Troubleshooting
189
+
190
+ ### Dev Server Not Starting
191
+ 1. Check the log file for error messages
192
+ 2. Verify the command works when run directly in terminal
193
+ 3. Check working directory is correct
194
+ 4. Ensure all dependencies are installed
195
+
196
+ ### Logs Not Appearing
197
+ 1. Check the output file path is writable
198
+ 2. Some frameworks buffer output - logs may appear in chunks
199
+ 3. Use `dev_get_status` to verify server is running
200
+
201
+ ### Process Won't Stop
202
+ 1. Use `dev_stop_log_streaming` first
203
+ 2. If that fails, the process may have crashed - check system process manager
204
+ 3. Restart Claude Code to clean up orphaned processes
205
+
206
+ ## Limitations
207
+
208
+ - Only one dev server can be managed at a time (default instance)
209
+ - Process management is best-effort - some processes may not respond to signals
210
+ - Very large log files may impact performance of `dev_tail_logs`
211
+
212
+ ## Development
213
+
214
+ ### Building
215
+ ```bash
216
+ npm run build
217
+ ```
218
+
219
+ ### Watch Mode
220
+ ```bash
221
+ npm run dev
222
+ ```
223
+
224
+ ### Testing
225
+ ```bash
226
+ # Test with local installation
227
+ claude mcp add dev-logger-test -s user -- node $(pwd)/dist/index.js
228
+
229
+ # Start Claude and test tools
230
+ claude
231
+ > /mcp # Check if server is connected
232
+ ```
233
+
234
+ ## Contributing
235
+
236
+ 1. Fork the repository
237
+ 2. Create feature branch
238
+ 3. Make changes and test thoroughly
239
+ 4. Submit pull request with clear description
240
+
241
+ ## License
242
+
243
+ MIT License - see LICENSE file for details.
244
+
245
+ ## Support
246
+
247
+ For issues and questions:
248
+ - Open an issue in the repository
249
+ - Check existing issues for similar problems
250
+ - Include log samples when reporting bugs
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,555 @@
1
+ #!/usr/bin/env node
2
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { ListToolsRequestSchema, CallToolRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
5
+ import { z } from "zod";
6
+ import { spawn } from "child_process";
7
+ import { writeFileSync, readFileSync, existsSync, appendFileSync, copyFileSync } from "fs";
8
+ import { join, resolve } from "path";
9
+ import { tmpdir } from "os";
10
+ // Schema definitions
11
+ const StartLogStreamingArgsSchema = z.object({
12
+ command: z.string().optional().describe("Dev command to run (default: npm run dev)"),
13
+ outputFile: z.string().optional().describe("File to write logs to (default: dev-server-logs.txt)"),
14
+ cwd: z.string().optional().describe("Working directory"),
15
+ env: z.record(z.string()).optional().describe("Environment variables")
16
+ });
17
+ const RestartLogStreamingArgsSchema = z.object({
18
+ clearLogs: z.boolean().optional().describe("Clear logs on restart (default: false)")
19
+ });
20
+ const TailLogsArgsSchema = z.object({
21
+ lines: z.number().optional().describe("Number of lines to return (default: 50)"),
22
+ filter: z.string().optional().describe("Grep pattern to filter logs")
23
+ });
24
+ const ClearLogsArgsSchema = z.object({
25
+ backup: z.boolean().optional().describe("Backup logs before clearing (default: false)")
26
+ });
27
+ class DevLoggerServer {
28
+ server;
29
+ activeServers;
30
+ pidFile;
31
+ constructor() {
32
+ this.server = new Server({
33
+ name: "mcp-dev-logger",
34
+ version: "1.0.0",
35
+ }, {
36
+ capabilities: {
37
+ tools: {},
38
+ },
39
+ });
40
+ this.activeServers = new Map();
41
+ this.pidFile = join(tmpdir(), "mcp-dev-logger.json");
42
+ // Load any saved state
43
+ this.loadState();
44
+ this.setupHandlers();
45
+ }
46
+ loadState() {
47
+ try {
48
+ if (existsSync(this.pidFile)) {
49
+ const data = JSON.parse(readFileSync(this.pidFile, 'utf8'));
50
+ // Note: We can't restore the actual process objects, but we can track that they existed
51
+ console.error("Previous dev server sessions detected. Use dev_get_status to check.");
52
+ }
53
+ }
54
+ catch (error) {
55
+ // Ignore errors loading state
56
+ }
57
+ }
58
+ saveState() {
59
+ try {
60
+ const state = {};
61
+ for (const [id, info] of this.activeServers) {
62
+ state[id] = {
63
+ command: info.command,
64
+ cwd: info.cwd,
65
+ outputFile: info.outputFile,
66
+ startTime: info.startTime,
67
+ pid: info.pid
68
+ };
69
+ }
70
+ writeFileSync(this.pidFile, JSON.stringify(state, null, 2));
71
+ }
72
+ catch (error) {
73
+ // Ignore errors saving state
74
+ }
75
+ }
76
+ killAllProcesses() {
77
+ for (const [id, info] of this.activeServers) {
78
+ try {
79
+ if (info.process && info.pid) {
80
+ process.kill(info.pid, 'SIGTERM');
81
+ }
82
+ }
83
+ catch (error) {
84
+ // Process might already be dead
85
+ }
86
+ }
87
+ this.activeServers.clear();
88
+ }
89
+ setupHandlers() {
90
+ this.server.setRequestHandler(ListToolsRequestSchema, async () => {
91
+ const tools = [
92
+ {
93
+ name: "dev_start_log_streaming",
94
+ description: "Start development server and stream logs to file",
95
+ inputSchema: {
96
+ type: "object",
97
+ properties: {
98
+ command: {
99
+ type: "string",
100
+ description: "Dev command to run (default: npm run dev)"
101
+ },
102
+ outputFile: {
103
+ type: "string",
104
+ description: "File to write logs to (default: dev-server-logs.txt)"
105
+ },
106
+ cwd: {
107
+ type: "string",
108
+ description: "Working directory"
109
+ },
110
+ env: {
111
+ type: "object",
112
+ description: "Environment variables",
113
+ additionalProperties: {
114
+ type: "string"
115
+ }
116
+ }
117
+ }
118
+ }
119
+ },
120
+ {
121
+ name: "dev_stop_log_streaming",
122
+ description: "Stop development server and logging",
123
+ inputSchema: {
124
+ type: "object",
125
+ properties: {}
126
+ }
127
+ },
128
+ {
129
+ name: "dev_restart_log_streaming",
130
+ description: "Restart the development server",
131
+ inputSchema: {
132
+ type: "object",
133
+ properties: {
134
+ clearLogs: {
135
+ type: "boolean",
136
+ description: "Clear logs on restart (default: false)"
137
+ }
138
+ }
139
+ }
140
+ },
141
+ {
142
+ name: "dev_get_status",
143
+ description: "Get status of development server",
144
+ inputSchema: {
145
+ type: "object",
146
+ properties: {}
147
+ }
148
+ },
149
+ {
150
+ name: "dev_tail_logs",
151
+ description: "Get last N lines from log file",
152
+ inputSchema: {
153
+ type: "object",
154
+ properties: {
155
+ lines: {
156
+ type: "number",
157
+ description: "Number of lines to return (default: 50)"
158
+ },
159
+ filter: {
160
+ type: "string",
161
+ description: "Grep pattern to filter logs"
162
+ }
163
+ }
164
+ }
165
+ },
166
+ {
167
+ name: "dev_clear_logs",
168
+ description: "Clear the log file",
169
+ inputSchema: {
170
+ type: "object",
171
+ properties: {
172
+ backup: {
173
+ type: "boolean",
174
+ description: "Backup logs before clearing (default: false)"
175
+ }
176
+ }
177
+ }
178
+ }
179
+ ];
180
+ return { tools };
181
+ });
182
+ this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
183
+ try {
184
+ const { name, arguments: args } = request.params;
185
+ switch (name) {
186
+ case "dev_start_log_streaming": {
187
+ const validatedArgs = StartLogStreamingArgsSchema.parse(args);
188
+ // Kill any existing process first
189
+ this.killAllProcesses();
190
+ const command = validatedArgs.command || "npm run dev";
191
+ const outputFile = resolve(validatedArgs.outputFile || "dev-server-logs.txt");
192
+ const cwd = resolve(validatedArgs.cwd || process.cwd());
193
+ // Parse command into program and args
194
+ const [program, ...cmdArgs] = command.split(' ');
195
+ // Create or clear the output file
196
+ writeFileSync(outputFile, `[${new Date().toISOString()}] Starting: ${command}\n`);
197
+ try {
198
+ // Spawn the process
199
+ const devProcess = spawn(program, cmdArgs, {
200
+ cwd: cwd,
201
+ env: { ...process.env, ...validatedArgs.env },
202
+ shell: true,
203
+ detached: false
204
+ });
205
+ const serverId = "default";
206
+ const serverInfo = {
207
+ process: devProcess,
208
+ command: command,
209
+ cwd: cwd,
210
+ outputFile: outputFile,
211
+ startTime: new Date(),
212
+ pid: devProcess.pid
213
+ };
214
+ this.activeServers.set(serverId, serverInfo);
215
+ // Stream stdout to file
216
+ devProcess.stdout?.on('data', (data) => {
217
+ const timestamp = new Date().toISOString();
218
+ const logEntry = `[${timestamp}] ${data}`;
219
+ appendFileSync(outputFile, logEntry);
220
+ });
221
+ // Stream stderr to file
222
+ devProcess.stderr?.on('data', (data) => {
223
+ const timestamp = new Date().toISOString();
224
+ const logEntry = `[${timestamp}] [ERROR] ${data}`;
225
+ appendFileSync(outputFile, logEntry);
226
+ });
227
+ // Handle process exit
228
+ devProcess.on('exit', (code, signal) => {
229
+ const timestamp = new Date().toISOString();
230
+ const exitMessage = `[${timestamp}] Process exited with code ${code} and signal ${signal}\n`;
231
+ appendFileSync(outputFile, exitMessage);
232
+ this.activeServers.delete(serverId);
233
+ });
234
+ // Handle process errors
235
+ devProcess.on('error', (error) => {
236
+ const timestamp = new Date().toISOString();
237
+ const errorMessage = `[${timestamp}] Process error: ${error.message}\n`;
238
+ appendFileSync(outputFile, errorMessage);
239
+ });
240
+ this.saveState();
241
+ return {
242
+ content: [
243
+ {
244
+ type: "text",
245
+ text: JSON.stringify({
246
+ status: "started",
247
+ pid: devProcess.pid,
248
+ command: command,
249
+ cwd: cwd,
250
+ outputFile: outputFile,
251
+ message: `Dev server started. Logs streaming to ${outputFile}`
252
+ }, null, 2)
253
+ }
254
+ ]
255
+ };
256
+ }
257
+ catch (error) {
258
+ throw new Error(`Failed to start dev server: ${error instanceof Error ? error.message : String(error)}`);
259
+ }
260
+ }
261
+ case "dev_stop_log_streaming": {
262
+ const serverId = "default";
263
+ const serverInfo = this.activeServers.get(serverId);
264
+ if (!serverInfo) {
265
+ return {
266
+ content: [
267
+ {
268
+ type: "text",
269
+ text: JSON.stringify({
270
+ status: "not_running",
271
+ message: "No dev server is currently running"
272
+ }, null, 2)
273
+ }
274
+ ]
275
+ };
276
+ }
277
+ try {
278
+ if (serverInfo.pid) {
279
+ process.kill(serverInfo.pid, 'SIGTERM');
280
+ }
281
+ this.activeServers.delete(serverId);
282
+ this.saveState();
283
+ return {
284
+ content: [
285
+ {
286
+ type: "text",
287
+ text: JSON.stringify({
288
+ status: "stopped",
289
+ message: "Dev server stopped successfully"
290
+ }, null, 2)
291
+ }
292
+ ]
293
+ };
294
+ }
295
+ catch (error) {
296
+ throw new Error(`Failed to stop dev server: ${error instanceof Error ? error.message : String(error)}`);
297
+ }
298
+ }
299
+ case "dev_restart_log_streaming": {
300
+ const validatedArgs = RestartLogStreamingArgsSchema.parse(args);
301
+ const serverId = "default";
302
+ const serverInfo = this.activeServers.get(serverId);
303
+ if (!serverInfo) {
304
+ return {
305
+ content: [
306
+ {
307
+ type: "text",
308
+ text: JSON.stringify({
309
+ status: "error",
310
+ message: "No dev server to restart. Use dev_start_log_streaming first."
311
+ }, null, 2)
312
+ }
313
+ ]
314
+ };
315
+ }
316
+ // Save current configuration
317
+ const { command, cwd, outputFile } = serverInfo;
318
+ // Stop current process
319
+ try {
320
+ if (serverInfo.pid) {
321
+ process.kill(serverInfo.pid, 'SIGTERM');
322
+ }
323
+ }
324
+ catch (error) {
325
+ // Process might already be dead
326
+ }
327
+ // Clear logs if requested
328
+ if (validatedArgs.clearLogs && existsSync(outputFile)) {
329
+ writeFileSync(outputFile, '');
330
+ }
331
+ // Wait a moment for process to die
332
+ await new Promise(resolve => setTimeout(resolve, 1000));
333
+ // Restart with same configuration
334
+ const startArgs = {
335
+ command,
336
+ outputFile,
337
+ cwd
338
+ };
339
+ // Start new process
340
+ const [program, ...cmdArgs] = command.split(' ');
341
+ writeFileSync(outputFile, `[${new Date().toISOString()}] Restarting: ${command}\n`, { flag: 'a' });
342
+ const devProcess = spawn(program, cmdArgs, {
343
+ cwd: cwd,
344
+ env: process.env,
345
+ shell: true,
346
+ detached: false
347
+ });
348
+ const newServerInfo = {
349
+ process: devProcess,
350
+ command: command,
351
+ cwd: cwd,
352
+ outputFile: outputFile,
353
+ startTime: new Date(),
354
+ pid: devProcess.pid
355
+ };
356
+ this.activeServers.set("default", newServerInfo);
357
+ // Stream stdout to file
358
+ devProcess.stdout?.on('data', (data) => {
359
+ const timestamp = new Date().toISOString();
360
+ const logEntry = `[${timestamp}] ${data}`;
361
+ appendFileSync(outputFile, logEntry);
362
+ });
363
+ // Stream stderr to file
364
+ devProcess.stderr?.on('data', (data) => {
365
+ const timestamp = new Date().toISOString();
366
+ const logEntry = `[${timestamp}] [ERROR] ${data}`;
367
+ appendFileSync(outputFile, logEntry);
368
+ });
369
+ // Handle process exit
370
+ devProcess.on('exit', (code, signal) => {
371
+ const timestamp = new Date().toISOString();
372
+ const exitMessage = `[${timestamp}] Process exited with code ${code} and signal ${signal}\n`;
373
+ appendFileSync(outputFile, exitMessage);
374
+ this.activeServers.delete("default");
375
+ });
376
+ this.saveState();
377
+ return {
378
+ content: [
379
+ {
380
+ type: "text",
381
+ text: JSON.stringify({
382
+ status: "restarted",
383
+ pid: devProcess.pid,
384
+ command: command,
385
+ outputFile: outputFile,
386
+ message: "Dev server restarted successfully"
387
+ }, null, 2)
388
+ }
389
+ ]
390
+ };
391
+ }
392
+ case "dev_get_status": {
393
+ const serverId = "default";
394
+ const serverInfo = this.activeServers.get(serverId);
395
+ if (!serverInfo) {
396
+ return {
397
+ content: [
398
+ {
399
+ type: "text",
400
+ text: JSON.stringify({
401
+ status: "not_running",
402
+ message: "No dev server is currently running"
403
+ }, null, 2)
404
+ }
405
+ ]
406
+ };
407
+ }
408
+ const uptime = new Date().getTime() - serverInfo.startTime.getTime();
409
+ const uptimeSeconds = Math.floor(uptime / 1000);
410
+ const uptimeMinutes = Math.floor(uptimeSeconds / 60);
411
+ const uptimeHours = Math.floor(uptimeMinutes / 60);
412
+ return {
413
+ content: [
414
+ {
415
+ type: "text",
416
+ text: JSON.stringify({
417
+ status: "running",
418
+ pid: serverInfo.pid,
419
+ command: serverInfo.command,
420
+ cwd: serverInfo.cwd,
421
+ outputFile: serverInfo.outputFile,
422
+ startTime: serverInfo.startTime,
423
+ uptime: {
424
+ hours: uptimeHours,
425
+ minutes: uptimeMinutes % 60,
426
+ seconds: uptimeSeconds % 60
427
+ }
428
+ }, null, 2)
429
+ }
430
+ ]
431
+ };
432
+ }
433
+ case "dev_tail_logs": {
434
+ const validatedArgs = TailLogsArgsSchema.parse(args);
435
+ const serverId = "default";
436
+ const serverInfo = this.activeServers.get(serverId);
437
+ // Use the active server's log file if available, otherwise default
438
+ const outputFile = serverInfo?.outputFile || "dev-server-logs.txt";
439
+ if (!existsSync(outputFile)) {
440
+ return {
441
+ content: [
442
+ {
443
+ type: "text",
444
+ text: JSON.stringify({
445
+ status: "error",
446
+ message: `Log file not found: ${outputFile}`
447
+ }, null, 2)
448
+ }
449
+ ]
450
+ };
451
+ }
452
+ try {
453
+ // Read the file
454
+ const content = readFileSync(outputFile, 'utf8');
455
+ const lines = content.split('\n').filter(line => line.trim());
456
+ // Filter if pattern provided
457
+ let filteredLines = lines;
458
+ if (validatedArgs.filter) {
459
+ const pattern = new RegExp(validatedArgs.filter, 'i');
460
+ filteredLines = lines.filter(line => pattern.test(line));
461
+ }
462
+ // Get last N lines
463
+ const numLines = validatedArgs.lines || 50;
464
+ const lastLines = filteredLines.slice(-numLines);
465
+ return {
466
+ content: [
467
+ {
468
+ type: "text",
469
+ text: JSON.stringify({
470
+ status: "success",
471
+ file: outputFile,
472
+ totalLines: lines.length,
473
+ filteredLines: filteredLines.length,
474
+ returnedLines: lastLines.length,
475
+ logs: lastLines
476
+ }, null, 2)
477
+ }
478
+ ]
479
+ };
480
+ }
481
+ catch (error) {
482
+ throw new Error(`Failed to read logs: ${error instanceof Error ? error.message : String(error)}`);
483
+ }
484
+ }
485
+ case "dev_clear_logs": {
486
+ const validatedArgs = ClearLogsArgsSchema.parse(args);
487
+ const serverId = "default";
488
+ const serverInfo = this.activeServers.get(serverId);
489
+ // Use the active server's log file if available, otherwise default
490
+ const outputFile = serverInfo?.outputFile || "dev-server-logs.txt";
491
+ if (!existsSync(outputFile)) {
492
+ return {
493
+ content: [
494
+ {
495
+ type: "text",
496
+ text: JSON.stringify({
497
+ status: "error",
498
+ message: `Log file not found: ${outputFile}`
499
+ }, null, 2)
500
+ }
501
+ ]
502
+ };
503
+ }
504
+ try {
505
+ // Backup if requested
506
+ if (validatedArgs.backup) {
507
+ const backupFile = `${outputFile}.${new Date().getTime()}.backup`;
508
+ copyFileSync(outputFile, backupFile);
509
+ }
510
+ // Clear the file
511
+ writeFileSync(outputFile, '');
512
+ return {
513
+ content: [
514
+ {
515
+ type: "text",
516
+ text: JSON.stringify({
517
+ status: "success",
518
+ message: `Log file cleared: ${outputFile}`,
519
+ backup: validatedArgs.backup ? "Created backup" : "No backup created"
520
+ }, null, 2)
521
+ }
522
+ ]
523
+ };
524
+ }
525
+ catch (error) {
526
+ throw new Error(`Failed to clear logs: ${error instanceof Error ? error.message : String(error)}`);
527
+ }
528
+ }
529
+ default:
530
+ throw new Error(`Unknown tool: ${name}`);
531
+ }
532
+ }
533
+ catch (error) {
534
+ const errorMessage = error instanceof Error ? error.message : String(error);
535
+ return {
536
+ content: [
537
+ {
538
+ type: "text",
539
+ text: `Error: ${errorMessage}`
540
+ }
541
+ ],
542
+ isError: true
543
+ };
544
+ }
545
+ });
546
+ }
547
+ async run() {
548
+ const transport = new StdioServerTransport();
549
+ await this.server.connect(transport);
550
+ console.error("Dev Logger MCP server running on stdio");
551
+ }
552
+ }
553
+ const server = new DevLoggerServer();
554
+ server.run().catch(console.error);
555
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GAEtB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAc,YAAY,EAAE,MAAM,IAAI,CAAC;AACvG,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAE5B,qBAAqB;AACrB,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2CAA2C,CAAC;IACpF,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sDAAsD,CAAC;IAClG,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC;I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CAAC,SAAS,CAAC,CAAC;QACrC,OAAO,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC1D,CAAC;CACF;AAED,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;AACrC,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@chinchillaenterprises/mcp-dev-logger",
3
+ "version": "1.0.0",
4
+ "description": "MCP server for capturing and streaming development server output (npm run dev, etc.)",
5
+ "main": "dist/index.js",
6
+ "type": "module",
7
+ "bin": {
8
+ "mcp-dev-logger": "dist/index.js"
9
+ },
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "dev": "tsc --watch",
13
+ "start": "node dist/index.js"
14
+ },
15
+ "keywords": [
16
+ "mcp",
17
+ "dev-server",
18
+ "logging",
19
+ "npm",
20
+ "vite",
21
+ "nextjs",
22
+ "development"
23
+ ],
24
+ "author": "Chinchilla Enterprises",
25
+ "license": "MIT",
26
+ "dependencies": {
27
+ "@modelcontextprotocol/sdk": "^1.0.0",
28
+ "zod": "^3.22.0"
29
+ },
30
+ "devDependencies": {
31
+ "@types/node": "^20.0.0",
32
+ "typescript": "^5.0.0"
33
+ },
34
+ "files": [
35
+ "dist/**/*",
36
+ "README.md"
37
+ ],
38
+ "engines": {
39
+ "node": ">=18.0.0"
40
+ },
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "https://github.com/ChinchillaEnterprises/ChillMCP.git",
44
+ "directory": "mcp-dev-logger"
45
+ }
46
+ }