oscerd commented on code in PR #25020:
URL: https://github.com/apache/camel/pull/25020#discussion_r3636820419


##########
dsl/camel-jbang/camel-jbang-mcp/src/main/java/org/apache/camel/dsl/jbang/core/commands/mcp/McpAuditLogger.java:
##########
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dsl.jbang.core.commands.mcp;
+
+import java.time.Instant;
+
+import jakarta.enterprise.context.ApplicationScoped;
+
+import org.jboss.logging.Logger;
+
+/**
+ * Structured audit logger for MCP tool invocations.
+ * <p>
+ * Produces single-line JSON log entries to a dedicated logger category, 
allowing operators to route audit logs
+ * independently via Quarkus logging configuration.
+ */
+@ApplicationScoped
+public class McpAuditLogger {
+
+    static final String AUDIT_LOGGER_NAME = 
"org.apache.camel.mcp.security.audit";
+
+    private static final Logger AUDIT_LOG = 
Logger.getLogger(AUDIT_LOGGER_NAME);
+
+    public void logToolCall(
+            String tool, String connectionId, String clientName,
+            String accessLevel, String arguments) {
+        AUDIT_LOG.infof(
+                
"{\"event\":\"tool_call\",\"tool\":\"%s\",\"connectionId\":\"%s\","

Review Comment:
   Fixed — `logAccessDenied()` is now called from `McpAccessFilter.test()` when 
a tool is filtered out due to insufficient access level. Also attempts to 
extract `connectionId` and `clientName` from the `FilterContext` (with fallback 
to empty strings if not available).
   
   _Claude Code on behalf of oscerd_



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to