Skip to main content
Glama
kessenma

repack-logs-mcp

by kessenma

repack-logs-mcp

An MCP (Model Context Protocol) server for tailing Re.Pack/Rspack dev server logs. Enables AI assistants like Claude to query build logs, find errors, and monitor compilation status.

How It Works

This package provides three components:

  1. RepackLogsPlugin - An Rspack/Webpack plugin that writes build logs to a JSON file

  2. MCP Server - Watches the log file and provides tools for AI assistants to query logs

  3. Client Logger - A lightweight logger for React Native apps that sends runtime logs to the MCP server

Related MCP server: log-mcp

Installation

npm install -g repack-logs-mcp
# or use directly with npx
npx repack-logs-mcp /path/to/.repack-logs.json

Setup

Step 1: Add the Plugin to Your Rspack Config

Add the RepackLogsPlugin to your rspack.config.mjs (or rspack.config.js):

import { RepackLogsPlugin } from 'repack-logs-mcp/plugin';

export default {
  // ... your existing config
  plugins: [
    // ... your existing plugins
    new RepackLogsPlugin({
      // Path to write logs (default: '.repack-logs.json')
      outputPath: '/absolute/path/to/.repack-logs.json',
      // Clear logs on each build start (default: true)
      clearOnStart: true,
    }),
  ],
};

Example with Re.Pack:

import * as Repack from '@callstack/repack';
import { RepackLogsPlugin } from 'repack-logs-mcp/plugin';

export default Repack.defineRspackConfig({
  // ... your config
  plugins: [
    new Repack.RepackPlugin(),
    new RepackLogsPlugin({
      outputPath: '/Users/yourname/project/.repack-logs.json',
    }),
  ],
});

Step 2: Add Runtime Logging (Optional)

To capture runtime logs (console.log from your app), you need to add a small client script that intercepts console calls and sends them to the MCP server.

Step 2a: Create the client file

Create a file called mcp-client.js in your React Native app's root directory (next to index.js):

/**
 * MCP Console Capture Client
 * Intercepts console.log/warn/error and sends to MCP server
 */

var SERVER_URL = 'http://localhost:9090';
var logBuffer = [];
var flushTimer = null;
var BATCH_INTERVAL = 1000;
var originalConsole = {
  log: console.log,
  warn: console.warn,
  error: console.error,
  debug: console.debug,
  info: console.info
};

function flushLogs() {
  if (flushTimer) {
    clearTimeout(flushTimer);
    flushTimer = null;
  }
  if (logBuffer.length === 0) return;

  var logs = logBuffer.slice();
  logBuffer = [];

  fetch(SERVER_URL + '/logs', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ logs: logs })
  }).catch(function() {});
}

function formatArg(arg) {
  if (typeof arg === 'string') return arg;
  if (arg instanceof Error) return arg.name + ': ' + arg.message;
  try {
    return JSON.stringify(arg);
  } catch (e) {
    return String(arg);
  }
}

function createInterceptor(type, original) {
  return function() {
    var args = Array.prototype.slice.call(arguments);
    original.apply(console, args);

    var tag = 'console';
    var message = args.map(formatArg).join(' ');

    if (typeof args[0] === 'string') {
      var match = args[0].match(/^\[([^\]]+)\]/);
      if (match) tag = match[1];
    }

    var entry = {
      type: type,
      message: message,
      tag: tag,
      timestamp: new Date().toISOString()
    };

    if (args.length > 1) {
      try {
        entry.data = args.length === 2 ? args[1] : args.slice(1);
      } catch (e) {}
    }

    logBuffer.push(entry);
    if (!flushTimer) {
      flushTimer = setTimeout(flushLogs, BATCH_INTERVAL);
    }
  };
}

function enableConsoleCapture(options) {
  options = options || {};
  if (options.serverUrl) SERVER_URL = options.serverUrl;

  console.log = createInterceptor('info', originalConsole.log);
  console.info = createInterceptor('info', originalConsole.info);
  console.warn = createInterceptor('warn', originalConsole.warn);
  console.error = createInterceptor('error', originalConsole.error);
  console.debug = createInterceptor('debug', originalConsole.debug);
}

function disableConsoleCapture() {
  console.log = originalConsole.log;
  console.info = originalConsole.info;
  console.warn = originalConsole.warn;
  console.error = originalConsole.error;
  console.debug = originalConsole.debug;
}

module.exports = {
  enableConsoleCapture: enableConsoleCapture,
  disableConsoleCapture: disableConsoleCapture
};

Step 2b: Enable capture in your app

Add this to your index.js (before AppRegistry.registerComponent):

// Enable console.log capture for MCP debugging (only in dev)
if (__DEV__) {
  try {
    const { enableConsoleCapture } = require('./mcp-client');
    enableConsoleCapture();
  } catch (e) {
    // MCP client not available, skip
  }
}

Step 2c: Check the runtime server port

Run get_status to see which port the runtime server is using:

Runtime Log Server:
  Port: 9090
  URL: http://localhost:9090

If the port is different from 9090 (e.g., 9093), update SERVER_URL in mcp-client.js to match.

That's it! Now ALL your existing console.log calls are automatically sent to the MCP server.

The capture:

  • Intercepts console.log, console.warn, console.error, console.debug

  • Extracts tags from [TagName] patterns (e.g., console.log('[MyComponent] hello'))

  • Still outputs to Metro console (so you see logs there too)

  • Batches logs for efficiency (sends every 1 second)

  • Only runs in development mode

Step 3: Configure the MCP Server

Point the MCP server to the same log file path used in your plugin config.

Tools Provided

Tool

Description

get_build_logs

Get recent build logs with filters (type, limit, time, issuer, search)

get_runtime_logs

Get runtime logs from the React Native app (console.log output)

get_errors

Get only errors and warnings

clear_logs

Clear the in-memory buffer

get_status

Show watcher status, runtime server port, and statistics

Configuration

The log file path can be set via:

  1. CLI argument (highest priority):

    npx repack-logs-mcp /path/to/.repack-logs.json
  2. Environment variable:

    REPACK_LOG_FILE=/path/to/.repack-logs.json npx repack-logs-mcp
  3. Default: .repack-logs.json in current directory

Plugin Options

Option

Description

Default

outputPath

Path to the log file

.repack-logs.json

clearOnStart

Clear log file on each build start

true

Environment Variables (MCP Server)

Variable

Description

Default

REPACK_LOG_FILE

Path to the build log file

.repack-logs.json

REPACK_MAX_LOGS

Maximum logs to keep in memory

1000

REPACK_RUNTIME_PORT

HTTP port for runtime log server

9090

Claude Code Integration

Add to your Claude Code MCP settings (~/.claude/settings.json or project settings):

{
  "mcpServers": {
    "repack-logs": {
      "command": "npx",
      "args": ["repack-logs-mcp", "/path/to/your/project/.repack-logs.json"]
    }
  }
}

Then ask Claude things like:

  • "What are the recent build logs?"

  • "Show me the runtime logs"

  • "Are there any build errors?"

  • "Show me warnings from the last build"

  • "What's the status of the log watcher?"

Usage Examples

Get recent logs

Tool: get_build_logs
Args: { "limit": 10 }

Filter by type

Tool: get_build_logs
Args: { "types": ["error", "warn"], "limit": 20 }

Search logs

Tool: get_build_logs
Args: { "search": "Cannot find module" }

Get errors only

Tool: get_errors
Args: { "limit": 10 }

Get runtime logs

Tool: get_runtime_logs
Args: { "limit": 50 }

Filter runtime logs by tag

Tool: get_runtime_logs
Args: { "tag": "MyComponent", "limit": 20 }

Search runtime logs

Tool: get_runtime_logs
Args: { "search": "error", "types": ["error", "warn"] }

Development

# Install dependencies
npm install

# Build
npm run build

# Test with MCP Inspector
npx @modelcontextprotocol/inspector node dist/index.js .repack-logs.json

License

MIT

Available Tools

5 tools
clear_logsA

Clear all logs from the in-memory buffer

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It discloses that the tool destroys logs and that logs are stored in-memory, but it does not explicitly warn that the action is irreversible or describe any side effects. Basic behavioral disclosure is present, but richer context is missing for a destructive operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single, front-loaded sentence that uses specific action language. No filler, no repetition of schema information, and appropriately sized for the tool's simplicity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no params, no output schema, and no annotations, the description adequately covers the core effect. It names the resource and location, indicating it clears all log types. It could mention that the action is irreversible, but the tool's triviality makes the description sufficient.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters and schema coverage is 100% vacuously, so the description need not explain parameters. The baseline for 0 parameters is 4, and the description adds no parameter-related confusion.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Clear'), the resource ('all logs'), and the scope ('in-memory buffer'). This distinctively differentiates it from sibling read-only tools like get_build_logs and get_runtime_logs, which are all getters.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies clear usage context: use this tool when you need to discard logs from memory. It does not explicitly name alternatives or exclusions, but the contrast with get_* siblings and the verb 'clear' provide unambiguous guidance for this simple tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_build_logsB

Get recent Re.Pack build logs with optional filtering

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of logs to return (default: 50)
sinceNoOnly logs after this ISO timestamp
typesNoFilter by log type(s)
issuerNoFilter by issuer/source name
searchNoSearch in log messages

TDQS

B3.4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description bears full responsibility. It only says 'Get' and 'optional filtering,' but does not disclose return format, pagination, retention behavior, or any side effects. This is minimal compared to the burden.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence that wastes no words. It communicates the essential purpose without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With 5 optional parameters, no output schema, and no annotations, the description is too minimal. It doesn't describe what a log entry looks like, how results are ordered, or any behavioral nuances. For an agent to correctly invoke the tool and interpret results, more details are needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, with each parameter well-documented in the schema. The description adds no parameter-specific semantics beyond the schema, so baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get'), the resource ('Re.Pack build logs'), and scope ('recent' with optional filtering). This distinguishes it from sibling tools like get_runtime_logs and get_errors, which target different log categories.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool vs alternatives; the description does not reference sibling tools or exclusions. Usage is implied by the resource name, but there is no stated context or alternative differentiation beyond the name.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_errorsA

Get only errors and warnings from Re.Pack build logs

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of errors to return (default: 20)

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of disclosing behavior. It states the core function (filtering errors/warnings from build logs) and implies a read-only operation via 'get', but does not disclose return format, pagination behavior, or side effects. The description adds some context beyond the schema but lacks depth expected for an unannotated tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence that front-loads the key action and scope. Every word earns its place, with no redundancy or fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with one optional parameter and no output schema, the description is mostly complete. It clearly differentiates from siblings and covers the core purpose, but could optionally mention return format or severity levels to be fully complete. Given the simplicity, it is adequate without those details.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 100% description coverage for the single 'limit' parameter, so the description does not need to explain parameters. The baseline is 3, and the description adds no additional meaning beyond what the schema already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb 'Get' and identifies the resource as 'errors and warnings from Re.Pack build logs', clearly distinguishing it from sibling tools like get_build_logs (which likely returns all logs) and get_runtime_logs (which targets runtime). The phrase 'only errors and warnings' emphasizes the filtering scope.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies when to use this tool—when you need only errors and warnings from build logs rather than full logs or runtime logs—but does not explicitly state exclusions or alternatives. The sibling names provide context, but the description itself does not reference them. This qualifies as clear context without exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_runtime_logsA

Get runtime logs from the React Native app (console.log output)

ParametersJSON Schema
NameRequiredDescriptionDefault
tagNoFilter by log tag/component name
limitNoMaximum number of logs to return (default: 50)
typesNoFilter by log type(s)
searchNoSearch in log messages

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It only states that logs are retrieved, offering no details about potential performance impact, log retention, filtering behavior, or what happens when the limit is reached. That is insufficient for a tool with no annotation support.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence that states the tool's purpose without waste. It is concise and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple read tool, the description is adequate but leaves gaps: there is no output schema, and the description does not explain the structure of returned logs or any special filtering behavior. It gives the basic purpose but could be more informative for an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema describes all four parameters with 100% coverage, so the description adds no additional meaning beyond what the schema already provides. A baseline score of 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves runtime logs from a React Native app, specifically console.log output. It distinguishes this from sibling tools like get_build_logs (build logs) and get_errors (error logs).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for accessing app runtime console output, but it does not explicitly state when to use this tool over alternatives, nor does it mention any exclusions. The context is clear enough to infer the scope, but guidance is not explicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_statusA

Get the current status of the log watcher and runtime server

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden of behavioral disclosure, but it only restates the tool's name. It does not mention side effects, permissions, rate limits, or what status data is returned.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence that communicates the purpose clearly without any wasted words or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter tool with no output schema or annotations, the description is minimally viable but lacks details about what 'status' includes or how the response is structured. It would benefit from a brief mention of the returned data type or fields.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, and the schema coverage is 100%, so the baseline of 4 applies. The description adds no parameter details, but none are needed.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb 'Get' and identifies a clear resource ('current status of the log watcher and runtime server'). This clearly distinguishes it from sibling tools like get_build_logs and get_errors, which focus on logs rather than overall system status.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No usage guidance is provided. The description does not indicate when to use this tool versus siblings, nor does it mention any prerequisites, exclusions, or alternative tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 5 tool updatesv1.1.2
    • First observedclear_logs
    • First observedget_build_logs
    • First observedget_errors
    • First observedget_runtime_logs
    • First observedget_status

TDQS

A4/5.0
Disambiguation5/5

Each tool has a clear, distinct purpose: build logs, error/warning filtering, runtime logs, clearing, and status. The overlap between get_build_logs and get_errors is explicitly resolved by the description, so no ambiguity.

Naming Consistency5/5

All tool names follow a consistent verb_snake_case pattern. Retrieval operations all start with 'get_', and the clear action uses 'clear_', which is predictable and readable.

Tool Count5/5

Five tools is a well-scoped count for a log viewer server, covering the essential operations without unnecessary bloat. Each tool serves a clear purpose in the log lifecycle.

Completeness5/5

The server covers the core workflows of retrieving build logs, retrieving runtime logs, viewing only errors/warnings, clearing logs, and checking status. No major gaps are apparent for the stated purpose of managing Re.Pack logs.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    F
    maintenance
    An MCP server that enables programmatic management and monitoring of development servers through a unified interface and interactive TUI. It provides tools for process control, log streaming, and experimental browser automation via Playwright.
    1
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    MCP server for log file analysis. Gives LLMs the ability to efficiently analyze large log files without loading them into context.
    7
    99
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Runtime feedback MCP server for AI coding agents. It watches dev server logs, parses errors, and exposes them as MCP tools so AI agents can instantly verify code changes.
    22
    3
    AGPL 3.0
  • A
    license
    Not graded
    quality
    C
    maintenance
    Creates and manages an MCP server integrated with build tools (Rollup, Vite, Webpack, etc.) to enable AI assistants to analyze, inspect, and control the build process.
    3,607
    31
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kessenma/repack-logs-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server