-
Notifications
You must be signed in to change notification settings - Fork 12
feat: audit logging #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Dennis Zhuang <[email protected]>
Signed-off-by: Dennis Zhuang <[email protected]>
Signed-off-by: Dennis Zhuang <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds comprehensive audit logging functionality for all MCP tool invocations to support security auditing and compliance requirements. The feature is configurable via environment variable or CLI flag and is enabled by default.
Key Changes:
- Implemented audit logging functions that capture tool name, parameters (truncated), success/failure status, duration, and error details
- Added a hook mechanism that wraps the MCP tool manager to intercept all tool calls
- Extended configuration with
audit_enabledboolean parameter (default: true)
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/greptimedb_mcp_server/utils.py |
Adds audit logging functions: audit_log, _truncate_value, and _format_audit_params for formatting and recording audit entries |
src/greptimedb_mcp_server/server.py |
Implements _install_audit_hook() that wraps the tool manager's call_tool method to log all invocations with timing |
src/greptimedb_mcp_server/config.py |
Adds audit_enabled boolean configuration parameter with CLI and environment variable support |
tests/test_server.py |
Updates test fixture to disable audit logging during tests |
src/greptimedb_mcp_server/__init__.py |
Adds exception handlers for KeyboardInterrupt and asyncio.CancelledError for graceful shutdown |
README.md |
Documents the audit logging feature with examples, log format, and configuration options |
pyproject.toml |
Bumps version from 0.3.1 to 0.4.0 to reflect the new feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Signed-off-by: Dennis Zhuang <[email protected]>
Signed-off-by: Dennis Zhuang <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.