File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change 11export const SERVER_NAME = 'apify-mcp-server' ;
22export const SERVER_VERSION = '0.1.0' ;
33
4+ export const HEADER_READINESS_PROBE = 'x-apify-container-server-readiness-probe' ;
5+
46export const defaults = {
57 actors : [
68 'apify/instagram-scraper' ,
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { Actor } from 'apify';
66import type { Request , Response } from 'express' ;
77import express from 'express' ;
88
9- import { Routes } from './const.js' ;
9+ import { HEADER_READINESS_PROBE , Routes } from './const.js' ;
1010import { processInput } from './input.js' ;
1111import { log } from './logger.js' ;
1212import { ApifyMcpServer } from './server.js' ;
@@ -46,6 +46,11 @@ async function processParamsAndUpdateTools(url: string) {
4646
4747app . route ( Routes . ROOT )
4848 . get ( async ( req : Request , res : Response ) => {
49+ if ( req . headers && req . get ( HEADER_READINESS_PROBE ) !== undefined ) {
50+ log . debug ( 'Received readiness probe' ) ;
51+ res . status ( 200 ) . json ( { message : 'Server is ready' } ) . end ( ) ;
52+ return ;
53+ }
4954 try {
5055 log . info ( `Received GET message at: ${ req . url } ` ) ;
5156 await processParamsAndUpdateTools ( req . url ) ;
You can’t perform that action at this time.
0 commit comments