whallysson/log-viewer-mcp 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

whallysson/log-viewer-mcp

最新稳定版本:v1.0.1

Composer 安装命令:

composer require whallysson/log-viewer-mcp

包简介

MCP Server for opcodesio/log-viewer - expose log analysis tools to AI agents via Laravel MCP

README 文档

README

Tests Latest Version on Packagist PHP Version License

An MCP (Model Context Protocol) server that exposes opcodesio/log-viewer to AI agents. Let Claude, GPT, and other AI assistants read, search, and analyze your Laravel application logs.

Built on top of the official laravel/mcp package using STDIO transport.

Why?

When debugging production issues with AI, the agent needs to see your logs. Instead of copy-pasting stack traces, this package gives your AI assistant direct access to your log files — with search, filtering, and structured output.

4 tools, zero config. Install the package and your AI agent can immediately:

  • List all available log files
  • Search logs by text or severity level
  • Get full details of any log entry (stack trace, context, extra data)
  • Get a health overview with error counts and recent failures

Requirements

Installation

composer require whallysson/log-viewer-mcp

The package auto-discovers its service provider. No additional setup required.

Publish Configuration (Optional)

php artisan vendor:publish --tag=log-viewer-mcp-config

Configuration

// config/log-viewer-mcp.php

return [
    // Enable or disable the MCP server
    'enabled' => env('LOG_VIEWER_MCP_ENABLED', true),

    // Maximum results per search page
    'max_results' => 50,

    // Truncate full log text (stack traces) longer than this
    'max_log_text_length' => 10000,
];

Available Tools

list_log_files

Discover available log files with metadata (name, size, date range, type).

Parameter Type Required Description
folder string No Folder identifier to filter by

search_logs

Search logs by text query and/or severity level with pagination.

Parameter Type Required Description
file string No* File identifier from list_log_files
query string No* Text to search (case-insensitive regex)
level string No Severity: emergency, alert, critical, error, warning, notice, info, debug
per_page integer No Results per page (default: 15, max: 50)
page integer No Page number (default: 1)

*At least file or query is required.

get_log_entry

Get full details of a specific log entry including stack trace, context, and extra data.

Parameter Type Required Description
file string Yes File identifier
index integer Yes Log entry index from search results

get_error_summary

Get a high-level health overview: counts per severity level and most recent errors.

Parameter Type Required Description
file string No File identifier (omit for overview of all files)
recent_errors_count integer No Number of recent errors to include (default: 5, max: 20)

Usage with Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "log-viewer": {
      "command": "php",
      "args": ["artisan", "mcp:start", "log-viewer"],
      "cwd": "/path/to/your/laravel/app"
    }
  }
}

Then ask Claude things like:

  • "Check my application logs for recent errors"
  • "Search for any SQLSTATE errors in the last log file"
  • "Give me a health summary of the application"
  • "Show me the full stack trace for that error"

Suggested Workflow

The tools are designed to be used in sequence:

1. list_log_files      → discover what log files exist
2. get_error_summary   → quick health check
3. search_logs         → find specific errors
4. get_log_entry       → get full details + stack trace

Testing

composer test

Code Style

This package uses Laravel Pint for code style.

# Check for style issues
composer lint

# Fix style issues
composer lint:fix

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Contributions are welcome! Please see the pull request template for details.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/new-tool)
  3. Ensure tests pass (composer test) and code style is clean (composer lint)
  4. Submit a pull request

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 24
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固