Emit audit events for MCP tool calls
What does this MR do and why?
Emit audit events for MCP tool calls
CallTool#invoke already calls two no-op CE hooks around every tool, so auditing attaches there and no individual tool changes. A successful call is fully described by ai_tool_invoked; only a failure adds a second event. Auditing never raises, because a governance gap is preferable to breaking the tool call.
Audit scope is resolved separately from telemetry scope. The two have different requirements: telemetry attribution is unauthorized by design, while an audit event's scope decides which customer's SIEM stream receives the record, so it is permission checked. Resolution is delegated to the tool, which declares the argument carrying its container - get_pipeline spells it id where get_project spells it project_id - so a call is scoped to the resource it touched rather than to the two argument names telemetry happens to know.
Behind the disabled mcp_session_audit_events flag, with storage still gated by ai_audit_events_storage_enabled.
Changelog: added EE: true
References
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.