File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
packages/mcp-server/src/mcp Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -21,8 +21,8 @@ export async function handle({ event, resolve }) {
2121 // only add analytics in production
2222 track : dev
2323 ? undefined
24- : async ( session_id , event , slug ) => {
25- await track ( event , { session_id, ...( slug ? { slug } : { } ) } ) ;
24+ : async ( session_id , event , extra ) => {
25+ await track ( event , { session_id, ...( extra ? { extra } : { } ) } ) ;
2626 } ,
2727 } ) ;
2828 // we are deploying on vercel the SSE connection will timeout after 5 minutes...for
Original file line number Diff line number Diff line change @@ -26,11 +26,16 @@ export const server = new McpServer(
2626 } ,
2727) . withContext < {
2828 db : LibSQLDatabase < Schema > ;
29- track ?: ( sessionId : string , event : string , slug ?: string ) => Promise < void > ;
29+ track ?: ( sessionId : string , event : string , extra ?: string ) => Promise < void > ;
3030} > ( ) ;
3131
3232export type SvelteMcp = typeof server ;
3333
3434setup_tools ( server ) ;
3535setup_resources ( server ) ;
3636setup_prompts ( server ) ;
37+
38+ server . on ( 'initialize' , async ( { clientInfo : client_info } ) => {
39+ if ( ! server . ctx . custom ?. track || ! server . ctx . sessionId ) return ;
40+ server . ctx . custom . track ( server . ctx . sessionId , 'initialize' , client_info . name ) ;
41+ } ) ;
You can’t perform that action at this time.
0 commit comments