machani/log-mcp-server
3.2
If you are the rightful owner of log-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
An MCP server designed to efficiently read, search, and manage log files with support for log rotation.
Tools
3
Resources
0
Prompts
0
Log MCP Server
An MCP server to read and search log files, with support for log rotation.
Features
- Read Logs: Read the last N lines of a log file.
- Tail Logs: Read chunks of a log file from a specific offset.
- Search Logs: Search for text or regex patterns in log files.
- Rotation Support: Automatically handles rotated log files (e.g.,
app.log,app.log.1,app.log.2) when reading history.
Installation
From Source
- Clone the repository.
- Install dependencies (if any, e.g.,
mcp).pip install mcp
Usage
Running the Server
You can run the server directly using python:
# Add src to python path if needed, or install in editable mode
export PYTHONPATH=$PYTHONPATH:$(pwd)/src
python -m log_mcp_server
Inspector
Use the MCP Inspector to test the server:
npx @modelcontextprotocol/inspector \
python -m src.log_mcp_server
Tools
read_log(path: str, lines: int = 100): Reads the last N lines.read_log_chunk(path: str, offset: int, max_bytes: int = 4096): Reads a chunk from an offset.search_log(path: str, pattern: str, is_regex: bool = False): Searches for patterns.