File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -62,3 +62,9 @@ if (STANDBY_MODE) {
6262 log . info ( `Pushed ${ datasetInfo ?. itemCount } items to the dataset` ) ;
6363 await Actor . exit ( ) ;
6464}
65+
66+ // So Ctrl+C works locally
67+ process . on ( 'SIGINT' , async ( ) => {
68+ log . info ( 'Received SIGINT, shutting down gracefully...' ) ;
69+ await Actor . exit ( ) ;
70+ } ) ;
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import {
1111 ErrorCode ,
1212 ListToolsRequestSchema ,
1313 McpError ,
14+ ServerNotificationSchema ,
1415} from '@modelcontextprotocol/sdk/types.js' ;
1516import type { ValidateFunction } from 'ajv' ;
1617import { type ActorCallOptions , ApifyApiError } from 'apify-client' ;
@@ -433,6 +434,22 @@ export class ActorsMcpServer {
433434 let client : Client | undefined ;
434435 try {
435436 client = await connectMCPClient ( serverTool . serverUrl , apifyToken ) ;
437+
438+ // TODO: for some reason the client does not receive notifications
439+ // we need to investigate this
440+ // Set up notification handlers for the client
441+ for ( const schema of ServerNotificationSchema . options ) {
442+ const method = schema . shape . method . value ;
443+ // Forward notifications from the proxy client to the server
444+ client . setNotificationHandler ( schema , async ( notification ) => {
445+ log . info ( 'Sending MCP notification' , {
446+ method,
447+ notification,
448+ } ) ;
449+ await extra . sendNotification ( notification ) ;
450+ } ) ;
451+ }
452+
436453 const res = await client . callTool ( {
437454 name : serverTool . originToolName ,
438455 arguments : args ,
You can’t perform that action at this time.
0 commit comments