Log Reader MCP

Log Reader MCP

An MCP server that provides AI assistants with direct access to application logs for on-demand searching, filtering, and analysis. It enables tools like Cursor to summarize log entries and identify errors within the development environment to streamline debugging.

Category
Visit Server

README

πŸš€ Log Reader Mcp

npm build License: MIT

πŸš€ Stop wasting time copy-pasting logs!<br> 🧠 Let Cursor's AI instantly access, search, and explain your logs β€” no more manual work, just answers.

πŸ“š Table of Contents


✨ Why Log Reader Mcp?

  • πŸ€– AI-powered log access: Give your AI assistant (Cursor, etc.) direct, on-demand access to your app logs.
  • 🧠 Smarter debugging: Let the AI analyze, summarize, and explain logs as you code.
  • ⏱️ Save hours: No more switching terminals, tailing files, or hunting for errorsβ€”get instant feedback and context.
  • πŸ›‘οΈ Safe & isolated: Never pollutes your project, robust CLI and test coverage.
  • ⚑ Plug & Play: One command, zero config, works everywhere.

πŸ‘€ Who is it for?

  • Backend & frontend developers
  • DevOps & SREs
  • Teams using AI-powered editors (Cursor, etc.)
  • Anyone who wants faster, smarter log analysis!

πŸ“¦ Installation

πŸš€ Automatic (recommended)

npx log-reader-mcp init
  • Installs everything, creates .cursor/mcp.json and workflow rules, and sets up your logs folder automatically.

πŸ› οΈ Manual

  1. Install the package

    npm install --save-dev log-reader-mcp
    
  2. Create the config file

    • At the root of your project, create a folder named .cursor (if it doesn't exist).
    • Inside .cursor/, create a file named mcp.json with:
    {
      "mcpServers": {
        "log-reader-mcp": {
          "command": "npx",
          "args": ["-y", "log-reader-mcp"]
        }
      },
      "mcp.enabled": true,
      "mcp.autoStart": true,
      "mcp.showStatusBar": true,
      "mcp.logLevel": "info"
    }
    
    • This tells your editor (Cursor, VSCode, etc.) how to launch and connect to the log reader mcp server for your project.

πŸ–ΌοΈ What does it do?

Log Reader Mcp exposes your application's logs to your AI assistant/editor (like Cursor) via the Model Control Protocol (MCP). This means:

  • The AI can read, filter, and analyze your logs on demand (not streaming)
  • You can ask the AI to fetch logs for a specific period, number of lines, error level, etc.
  • Makes onboarding, debugging, and incident response dramatically faster

πŸ”§ Key Features

  • Simplified Interface: No logPath parameter needed - always uses logs/logs.log in your working directory
  • Automatic Detection: The server automatically finds and reads your log file
  • Time-based Filtering: Filter logs by specific time ranges using ISO 8601 format
  • Line-based Reading: Read the last N lines with automatic validation
  • Structured JSON: Full support for structured logging with metadata

πŸ’‘ Example Prompts for Cursor

Here are some real-world prompts you can use in Cursor (or any MCP-enabled AI) to interact with your logs:

Use Case Example Prompt to Cursor AI
πŸ”’ Last N logs Show me the last 100 log entries
πŸ•’ Logs by time Get all logs between 2024-06-01 and 2024-06-02
⏩ Logs since date Show all logs since 2024-06-01
🚨 Errors only Show only ERROR or CRITICAL logs from the last 50 entries
πŸ” Search message Find all logs containing "database connection failed"
πŸ§‘β€πŸ’» User-specific Show all logs for user_id 12345 in the last 24 hours
πŸ“Š Summary Summarize the main issues found in today's logs
🧹 Clear context Clear the log context and start a new analysis

Note: The tool automatically uses logs/logs.log in your current working directory. The logPath parameter has been removed for maximum simplicity - no need to specify any file path!

Tip: You can combine filters, time ranges, and keywords in your prompts. The AI will use Log Reader Mcp to fetch and analyze the relevant log data for you!


πŸ’‘ Use Cases

Use Case How Log Reader Mcp Helps Time Saved
🐞 Real-time debugging See errors & warnings instantly in Cursor, with AI context Minutes per bug
πŸ” AI log analysis Let the AI summarize, filter, and explain log events Hours per incident
🚦 Incident response Quickly surface critical issues to the whole team Days per outage
πŸ‘©β€πŸ’» Onboarding New devs get instant, readable log feedback in their editor Weeks per new hire
πŸ“Š Audit & compliance Structured logs, easy to export and review Countless hours

βš™οΈ MCP Configuration Example

{
  "mcpServers": {
    "log-reader-mcp": {
      "command": "npx",
      "args": ["-y", "log-reader-mcp"]
    }
  },
  "mcp.enabled": true,
  "mcp.autoStart": true,
  "mcp.showStatusBar": true,
  "mcp.logLevel": "info"
}
  • πŸ“ Place this in .cursor/mcp.json
  • Your editor will auto-detect and use the log server

πŸ–₯️ CLI Usage

Command Effect
npx log-reader-mcp init Initialize MCP config and log workflow
npx log-reader-mcp -h/--help Show help and CLI options
npx log-reader-mcp -v/--version Show the current package version
npx log-reader-mcp Start the MCP log server (default mode)

πŸ“ Log Format (JSON per line)

Each line in logs/logs.log should be a JSON object:

{
  "level": "INFO|WARN|ERROR|DEBUG|CRITICAL",
  "timestamp": "2024-06-01T12:34:56.789Z",
  "message": "User login succeeded",
  "service_name": "auth",
  "user_id": "12345",
  "context": { "ip": "192.168.1.10" },
  "event": { "action": "login" }
}

πŸ§‘β€πŸ’» Developer Guide

  • Release & Versioning: Automated with semantic-release, changelog, and version auto-sync
  • CI/CD: GitHub Actions (.github/workflows/)
  • Testing: 100% coverage, CLI test isolation, robust integration
  • Project Structure:
    • src/ β€” TypeScript sources
    • bin/cli.js β€” CLI entry point
    • templates/ β€” MCP config & workflow templates
    • .github/workflows/ β€” CI/CD

πŸ† Key Advantages

  • πŸ”’ Zero config, zero risk: Never pollutes your project
  • πŸ§ͺ 100% tested: Full test isolation, robust CI
  • πŸ—οΈ AI-ready: Structured logs, perfect for automated analysis
  • πŸš€ Plug & Play: Works with all MCP editors, no setup required
  • ⏳ Massive time savings: Focus on code, not on chasing logs

🀝 Contributing

  1. Fork & create a branch
  2. Use conventional commits
  3. npm run build to compile
  4. npm test to verify
  5. Open a clear, detailed PR

πŸ“„ License

MIT


πŸ“ Cursor Rule (Workflow)

To help Cursor (or any MCP-compatible AI) understand your log structure and best practices, you can add a workflow rule file:

How to add the Cursor rule

  1. Copy the template

    • Use the command: npx log-reader-mcp init (recommended)
    • Or manually copy templates/mcp-log-server/workflow.mdc to .cursor/log-reader-mcp/workflow.mdc at the root of your project.
  2. What does this rule do?

    • It describes the log file location, format, and usage standards for your project.
    • It helps the AI agent (Cursor, etc.) understand how to read, filter, and analyze your logs.
    • It documents best practices for logging, security, and debugging for your team.

Example (excerpt)

---
description: Guide for using log-reader-mcp
globs: **/*
alwaysApply: true
---

# MCP Logging Workflow

- Log folder: `logs/`
- Log file: `logs.log` (one JSON object per line)
- Example log entry:

  {
    "level": "INFO",
    "timestamp": "2024-06-01T12:34:56.789Z",
    "message": "User login succeeded",
    ...
  }

- Use the `read_log` tool to fetch logs by line count or time range
- Never include sensitive data in logs
- Always validate log format before writing

Why add this rule?

  • 🧠 For the AI: It enables Cursor to provide smarter, context-aware log analysis and suggestions.
  • πŸ‘©β€πŸ’» For developers: It ensures everyone follows the same standards and makes onboarding easier.
  • πŸ”’ For security: It reminds everyone not to log sensitive data and to validate log structure.

Tip: Keeping this rule up to date helps both humans and AI work better with your logs!


❓ FAQ

Q: Is it compatible with VSCode or only Cursor?
A: Any editor supporting MCP can use it, including Cursor and future tools.

Q: Can I use multiple MCP servers?
A: Yes, just add more entries in .cursor/mcp.json.

Q: What log formats are supported?
A: Only structured JSON logs (one object per line) are supported for full AI analysis.

Q: Is it safe for production?
A: Yes! The tool never modifies your logs, only reads them, and is fully tested.


πŸ’¬ Getting Help


Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured