Skip to main content
Glama

Log Analyzer MCP

by djm81
CHANGELOG.md8.19 kB
# Changelog The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [0.1.8] - 2025-06-08 **Fixed:** - `logger_setup.py` to correctly find the project root directory and logs directory. ## [0.1.7] - 2025-06-01 **Changed:** - Updated `README.md` with comprehensive sections for Installation, Configuration, Running the MCP Server, and Testing, including links to relevant detailed guides. - Revised `docs/getting_started.md` to align with `README.md` updates, improving clarity and navigation for new users. - Added placeholders and notes in documentation for upcoming/missing files: `docs/configuration.md`, `docs/cli_usage_guide.md`, and `.env.template`. ## [0.1.6] - 2025-05-31 **Added:** - Script entry point `log-analyzer-mcp` in `pyproject.toml` to allow execution of the MCP server via `uvx log-analyzer-mcp`. ## [0.1.5] - 2025-05-30 **Added:** - API reference documentation in `docs/api_reference.md` for MCP server tools and CLI client commands. **Fixed:** - Missing `logger_instance` argument in `AnalysisEngine` constructor call within `src/log_analyzer_client/cli.py` by providing a basic CLI logger. **Changed:** - Updated `README.md` and `docs/README.md` to include links to the new API reference. **Removed:** - `src/log_analyzer_mcp/analyze_runtime_errors.py` and its corresponding test file `tests/log_analyzer_mcp/test_analyze_runtime_errors.py` as part of refactoring. - Commented out usage of `analyze_runtime_errors` in `tests/log_analyzer_mcp/test_log_analyzer_mcp_server.py`. ## [0.1.4] - 2025-05-30 **Added:** - `test_server_fixture_simple_ping` to `tests/log_analyzer_mcp/test_log_analyzer_mcp_server.py` to isolate and test the `server_session` fixture's behavior. - `request_server_shutdown` tool to `src/log_analyzer_mcp/log_analyzer_mcp_server.py` to facilitate controlled server termination from tests. **Fixed:** - Stabilized tests in `tests/log_analyzer_mcp/test_log_analyzer_mcp_server.py` by marking all 7 tests with `@pytest.mark.xfail` due to a persistent "Attempted to exit cancel scope in a different task" error in the `server_session` fixture teardown. This was deemed an underlying issue with `anyio` or `mcp` client library interaction during server shutdown. **Changed:** - Iteratively debugged and refactored the `server_session` fixture in `tests/log_analyzer_mcp/test_log_analyzer_mcp_server.py` to address `anyio` task scope errors. Attempts included: - Adding `await session.aclose()` (reverted as `aclose` not available). - Increasing `anyio.sleep()` duration in the fixture. - Refactoring `_run_tests` in `src/log_analyzer_mcp/log_analyzer_mcp_server.py` to use `anyio.run_process`. - Removing `anyio.sleep()` from the fixture. - Implementing and calling the `request_server_shutdown` tool using `asyncio.get_event_loop().call_later()` or `loop.call_soon_threadsafe()` and then `KeyboardInterrupt`. - Explicitly cancelling `session._task_group.cancel_scope` in the fixture. - Simplifying the fixture and adding sleep in the test after shutdown call. - Updated `_run_tests` in `src/log_analyzer_mcp/log_analyzer_mcp_server.py` to use `anyio.run_process` and addressed related linter errors (async, arguments, imports, decoding). ## [0.1.3] - 2025-05-28 **Fixed**: - Resolved `RuntimeError: Attempted to exit cancel scope in a different task than it was entered in` in the `server_session` fixture in `tests/log_analyzer_mcp/test_log_analyzer_mcp_server.py`. This involved reverting to a simpler fixture structure without an explicit `anyio.TaskGroup` and ensuring `anyio.fail_after` was correctly applied only around the `session.initialize()` call. - Addressed linter errors related to unknown import symbols in `src/log_analyzer_mcp/log_analyzer_mcp_server.py` by ensuring correct symbol availability after user reverted problematic `hatch fmt` changes. **Changed**: - Iteratively debugged and refactored the `server_session` fixture in `tests/log_analyzer_mcp/test_log_analyzer_mcp_server.py` to address `anyio` task scope errors, including attempts with `anyio.TaskGroup` before settling on the final fix. ## [0.1.2] - 2025-05-28 **Changed**: - Refactored `AnalysisEngine` to improve log file discovery, filtering logic (time, positional, content), and context extraction. - Updated `ConfigLoader` for robust handling of `.env` configurations and environment variables, including list parsing and type conversions. - Enhanced `test_log_parser.py` with refined regexes for `pytest` log analysis. - Implemented new MCP search tools (`search_log_all_records`, `search_log_time_based`, `search_log_first_n_records`, `search_log_last_n_records`) in `log_analyzer_mcp_server.py` using `AnalysisEngine`. - Updated Pydantic models for MCP tools to use default values instead of `Optional`/`Union`. - Developed `log_analyzer_client/cli.py` with `click` for command-line access to log search functionalities, mirroring MCP tools. - Added comprehensive tests for `AnalysisEngine` in `tests/log_analyzer_mcp/test_analysis_engine.py`, achieving high coverage for core logic. - Refactored `_run_tests` in `log_analyzer_mcp_server.py` to use `hatch test` directly, save full log output, and manage server integration test recursion. - Improved `create_coverage_report` MCP tool to correctly invoke `hatch` coverage scripts and resolve environment/path issues, ensuring reliable report generation. - Updated `pyproject.toml` to correctly define dependencies for `hatch` environments and scripts, including `coverage[toml]`. - Streamlined build and release scripts (`scripts/build.sh`, `scripts/publish.sh`, `scripts/release.sh`) for better version management and consistency. **Fixed**: - Numerous test failures in `test_analysis_engine.py` related to path handling, filter logic, timestamp parsing, and assertion correctness. - Issues with `create_coverage_report` MCP tool in `log_analyzer_mcp_server.py` failing due to `hatch` script command errors (e.g., 'command not found', `HATCH_PYTHON_PATH` issues). - Corrected `anyio` related errors and `xfail` markers for unstable server session tests in `test_log_analyzer_mcp_server.py`. - Addressed various Pylint warnings (e.g., `W0707`, `W1203`, `R1732`, `C0415`) across multiple files. - Resolved `TypeError` in `_apply_positional_filters` due to `None` timestamps during sorting. ## [0.1.1] - 2025-05-27 **Changed**: - Integrated `hatch` for project management, build, testing, and publishing. - Refactored `pyproject.toml` with updated metadata, dependencies, and `hatch` configurations. - Corrected internal import paths after moving from monorepo. - Added `src/log_analyzer_mcp/common/logger_setup.py`. - Replaced `run_all_tests.py` and `create_coverage_report.sh` with `hatch` commands. - Refactored `log_analyzer_mcp_server.py` to use `hatch test` for its internal test execution tools. - Updated test suite (`test_analyze_runtime_errors.py`, `test_log_analyzer_mcp_server.py`) for `pytest-asyncio` strict mode and improved assertions. - Implemented subprocess coverage collection using `COVERAGE_PROCESS_START`, `coverage.process_startup()`, and `SIGTERM` handling, achieving >80% on server and improved coverage on other scripts. - Added tests for `parse_coverage.py` (`test_parse_coverage_script.py`) and created `sample_coverage.xml`. - Updated `log_analyzer.py` with more robust `pytest` summary parsing. - Updated documentation: `docs/refactoring/log_analyzer_refactoring_v1.md`, `docs/refactoring/README.md`, main `README.md`, `docs/README.md`. - Refactored scripts in `scripts/` folder (`build.sh`, `cleanup.sh`, `run_log_analyzer_mcp_dev.sh`, `publish.sh`, `release.sh`) to use `hatch` and modern practices. **Fixed**: - Numerous test failures related to timeouts, `anyio` task scope errors, `ImportError` for `TextContent`, and `pytest`/`coverage` argument conflicts. - Code coverage issues for subprocesses. - `TypeError` in `test_parse_coverage_xml_no_line_rate`. ## [0.1.0] - 2025-05-26 **Added**: - Initial project structure for `log_analyzer_mcp`. - Basic MCP server setup. - Core log analysis functionalities.

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/djm81/log_analyzer_mcp'

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