- Home
- MCP servers
- Log Inspector
Log Inspector
- python
0
GitHub Stars
python
Language
4 months ago
First Indexed
3 weeks ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"thhart-log-mcp": {
"command": "log-mcp",
"args": [],
"env": {
"LOG_MCP_DIR": "/var/log:/tmp/logs:$XDG_RUNTIME_DIR/log",
"XDG_RUNTIME_DIR": "/run/user/1000"
}
}
}
}You set up an MCP server that gives an AI assistant access to your runtime log files across one or more directories. This lets the AI inspect logs to diagnose errors, troubleshoot issues, and provide proactive guidance based on actual diagnostics, without you copying logs back and forth.
How to use
When you run an MCP client that talks to the log inspector, you configure the client to connect to the local or remote MCP endpoint. The server exposes tools that let the AI list available log files, read log content, paginate large files, and search for patterns to pinpoint problems. You can monitor multiple log directories, and you can start the local MCP server in various ways (direct binary, or via a launcher such as uvx). When you describe a problem, the AI will automatically check logs and propose targeted debugging steps.
How to install
Prerequisites you need on your system include Python 3.10 or newer for the MCP server, and optionally the uvx launcher for running the local server. Ensure you have a runtime log directory configured and accessible by the server and any tools you use to run the AI assistant.
# Install via source (development)
git clone <repository-url>
cd log-mcp
pip install -e .
# Install from PyPI (when published)
pip install log-inspector-mcp
Multiple ways to run the server
You can run the MCP server locally using the default log directory or specify custom directories. The server supports running directly, or via the uvx launcher for easier process management.
# Standalone with default directory
log-mcp
# Standalone with a single custom directory
log-mcp --log-dir /var/log
# Standalone with multiple directories
log-mcp --log-dir /var/log --log-dir /tmp/logs
# Using environment variable (colon-separated)
LOG_MCP_DIR=/var/log:/tmp/logs log-mcp
# Using uvx (recommended)
uvx log-mcp --log-dir /var/log
Configuration highlights
Configure your client to connect to the MCP server as described in the usage guide. The server reads logs from the configured directories and exposes tools for listing files, reading content, paginated reads, and regex searches. Ensure your log directory paths are readable by the process running the MCP server.
Security and notes
Only provide the AI access to the log directories you intend to share for debugging. Limit access to sensitive files and consider running the MCP server in a restricted environment or with appropriate permissions to protect sensitive data.
Troubleshooting tips
If the AI seems not to see any log files, verify that the server’s configured log directories exist and are readable, and confirm the server process has permission to access those paths. Check that the MCP client is connected to the correct server endpoint and that the log files are being written as expected.
Notes
You can monitor multiple log directories simultaneously. The server will report all log files found across configured directories when you run the list operation.
Supported tools and endpoints
The MCP server provides the following capabilities to inspect logs and help you debug: list_log_files, get_log_content, read_log_paginated, search_log_file, and runtime-logs prompts that guide the AI on when to inspect logs.
Configuration example snippets
{
"mcpServers": {
"log_inspector": {
"command": "log-mcp",
"args": []
}
}
}
Managing multiple directories with different runtimes
You can specify several log directories in a single configuration. For example, you can include system logs, application logs, and test logs so the AI has a broad view for debugging.
Usage with a Claude Desktop client
To connect the MCP server with an AI assistant you would add the log inspector to your client configuration so the AI can proactively inspect logs when users report issues.
Examples of common commands for administrators
Use the following to run the server in different environments and to pass log directories to the MCP server.
Available tools
list_log_files
Lists all log files found in the configured log directories. Returns the full paths to each file.
get_log_content
Reads and returns the entire content of a specific log file. Use this for small logs.
read_log_paginated
Reads a portion of a large log file with token-based pagination. Includes file modification detection to ensure you’re not reading outdated content.
search_log_file
Searches a log file with a regex pattern and returns matching lines with surrounding context for quick pinpointing of issues.
runtime-logs
Prompts the AI with guidance on how and when to inspect runtime logs for debugging.