@@ -10,7 +10,7 @@ import {logger} from '../logger.js';
1010
1111import type { LocalState , Persistence } from './persistence.js' ;
1212import { FilePersistence } from './persistence.js' ;
13- import { type FlagUsage , WatchdogMessageType , OsType } from './types.js' ;
13+ import { McpClient , type FlagUsage , WatchdogMessageType , OsType } from './types.js' ;
1414import { WatchdogClient } from './WatchdogClient.js' ;
1515
1616const MS_PER_DAY = 24 * 60 * 60 * 1000 ;
@@ -31,6 +31,7 @@ function detectOsType(): OsType {
3131export class ClearcutLogger {
3232 #persistence: Persistence ;
3333 #watchdog: WatchdogClient ;
34+ #mcpClient: McpClient ;
3435
3536 constructor ( options : {
3637 appVersion : string ;
@@ -53,6 +54,18 @@ export class ClearcutLogger {
5354 clearcutForceFlushIntervalMs : options . clearcutForceFlushIntervalMs ,
5455 clearcutIncludePidHeader : options . clearcutIncludePidHeader ,
5556 } ) ;
57+ this . #mcpClient = McpClient . MCP_CLIENT_UNSPECIFIED ;
58+ }
59+
60+ setClientName ( clientName : string ) : void {
61+ const lowerName = clientName . toLowerCase ( ) ;
62+ if ( lowerName . includes ( 'claude' ) ) {
63+ this . #mcpClient = McpClient . MCP_CLIENT_CLAUDE_CODE ;
64+ } else if ( lowerName . includes ( 'gemini' ) ) {
65+ this . #mcpClient = McpClient . MCP_CLIENT_GEMINI_CLI ;
66+ } else {
67+ this . #mcpClient = McpClient . MCP_CLIENT_OTHER ;
68+ }
5669 }
5770
5871 async logToolInvocation ( args : {
@@ -63,6 +76,7 @@ export class ClearcutLogger {
6376 this . #watchdog. send ( {
6477 type : WatchdogMessageType . LOG_EVENT ,
6578 payload : {
79+ mcp_client : this . #mcpClient,
6680 tool_invocation : {
6781 tool_name : args . toolName ,
6882 success : args . success ,
@@ -76,6 +90,7 @@ export class ClearcutLogger {
7690 this . #watchdog. send ( {
7791 type : WatchdogMessageType . LOG_EVENT ,
7892 payload : {
93+ mcp_client : this . #mcpClient,
7994 server_start : {
8095 flag_usage : flagUsage ,
8196 } ,
@@ -99,6 +114,7 @@ export class ClearcutLogger {
99114 this . #watchdog. send ( {
100115 type : WatchdogMessageType . LOG_EVENT ,
101116 payload : {
117+ mcp_client : this . #mcpClient,
102118 daily_active : {
103119 days_since_last_active : daysSince ,
104120 } ,
0 commit comments