Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions internal/cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
// flags_difc.go getDefaultAllowOnlyOwner() → MCP_GATEWAY_ALLOWONLY_SCOPE_OWNER
// flags_difc.go getDefaultAllowOnlyRepo() → MCP_GATEWAY_ALLOWONLY_SCOPE_REPO
// flags_difc.go getDefaultAllowOnlyMinIntegrity() → MCP_GATEWAY_ALLOWONLY_MIN_INTEGRITY
// flags_tracing.go getDefaultOTLPEndpoint() → OTEL_EXPORTER_OTLP_ENDPOINT
// flags_tracing.go getDefaultOTLPServiceName() → OTEL_SERVICE_NAME
//
// This pattern is intentionally kept in individual feature files because:
// - Each helper names the specific environment variable it reads, making the
Expand Down
16 changes: 11 additions & 5 deletions internal/mcp/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,16 @@ func (c *Connection) callSDKMethodWithReconnect(method string, params interface{
return result, err
}

// logOutboundRPCRequest logs an outbound RPC request, optionally attaching agent DIFC tag snapshots.
// When shouldAttachTags is true, snapshot must be non-nil.
func logOutboundRPCRequest(serverID string, method string, payload []byte, shouldAttachTags bool, snapshot *AgentTagsSnapshot) {
if shouldAttachTags {
logger.LogRPCRequestWithAgentSnapshot(logger.RPCDirectionOutbound, serverID, method, payload, snapshot.Secrecy, snapshot.Integrity)
} else {
logger.LogRPCRequest(logger.RPCDirectionOutbound, serverID, method, payload)
}
}

// logInboundRPCResponse logs an inbound RPC response, optionally attaching agent DIFC tag snapshots.
// When shouldAttachTags is true, snapshot must be non-nil.
func logInboundRPCResponse(serverID string, payload []byte, err error, shouldAttachTags bool, snapshot *AgentTagsSnapshot) {
Expand Down Expand Up @@ -445,11 +455,7 @@ func (c *Connection) SendRequestWithServerID(ctx context.Context, method string,
"method": method,
"params": params,
})
if shouldAttachAgentTags {
logger.LogRPCRequestWithAgentSnapshot(logger.RPCDirectionOutbound, serverID, method, requestPayload, snapshot.Secrecy, snapshot.Integrity)
} else {
logger.LogRPCRequest(logger.RPCDirectionOutbound, serverID, method, requestPayload)
}
logOutboundRPCRequest(serverID, method, requestPayload, shouldAttachAgentTags, snapshot)

var result *Response
var err error
Expand Down
Loading