File tree Expand file tree Collapse file tree 3 files changed +31
-13
lines changed Expand file tree Collapse file tree 3 files changed +31
-13
lines changed Original file line number Diff line number Diff line change 2
2
FROM node:lts-alpine AS builder
3
3
WORKDIR /app
4
4
5
- # Copy package and configuration
6
- COPY package.json pnpm-lock.yaml tsconfig.json ./
5
+ # Copy package files first for dependency caching
6
+ COPY package.json pnpm-lock.yaml ./
7
+ RUN corepack enable && pnpm install --frozen-lockfile
7
8
8
- # Copy source code
9
+ # Copy configuration and source code
10
+ COPY tsconfig.json ./
9
11
COPY src ./src
10
-
11
- # Copy config files
12
12
COPY config.d.ts index.d.ts ./
13
13
14
- # Install dependencies and build
15
- RUN corepack enable && pnpm install --frozen-lockfile && pnpm build
14
+ # Build the application
15
+ RUN pnpm build
16
16
17
17
# ----- Production Stage -----
18
18
FROM node:lts-alpine
19
19
WORKDIR /app
20
20
21
- # Copy package.json and install production dependencies
21
+ # Copy package files and install production dependencies
22
22
COPY package.json pnpm-lock.yaml ./
23
23
RUN corepack enable && pnpm install --prod --frozen-lockfile --ignore-scripts
24
24
Original file line number Diff line number Diff line change @@ -40,7 +40,8 @@ export type Config = {
40
40
persist ?: boolean ;
41
41
} ;
42
42
/**
43
- *
43
+ * The viewport of the browser
44
+ * @default { browserWidth: 1024, browserHeight: 768 }
44
45
*/
45
46
viewPort ?: {
46
47
/**
@@ -58,16 +59,30 @@ export type Config = {
58
59
*/
59
60
cookies ?: Cookie [ ] ;
60
61
/**
61
- * Whether or not to port to a server
62
+ * Server configuration for MCP transport layer
63
+ *
64
+ * Controls how the MCP server binds and listens for connections.
65
+ * When port is specified, the server will start an SHTTP transport.
66
+ * When both port and host are undefined, the server uses stdio transport.
62
67
*
68
+ * Security considerations:
69
+ * - Use localhost (default) for local development
70
+ * - Use 0.0.0.0 only when you need external access and have proper security measures
71
+ * - Consider firewall rules and network security when exposing the server
63
72
*/
64
73
server ?: {
65
74
/**
66
75
* The port to listen on for SHTTP or MCP transport.
76
+ * If undefined, uses stdio transport instead of HTTP.
77
+ *
78
+ * @example 3000
67
79
*/
68
80
port ?: number ;
69
81
/**
70
- * The host to bind the server to. Default is localhost. Use 0.0.0.0 to bind to all interfaces.
82
+ * The host to bind the server to.
83
+ *
84
+ * @default "localhost" - Only accepts local connections
85
+ * @example "0.0.0.0" - Accepts connections from any interface (use with caution)
71
86
*/
72
87
host ?: string ;
73
88
} ;
Original file line number Diff line number Diff line change @@ -85,8 +85,11 @@ program
85
85
function setupExitWatchdog ( serverList : ServerList ) {
86
86
const handleExit = async ( ) => {
87
87
setTimeout ( ( ) => process . exit ( 0 ) , 15000 ) ;
88
- await stagehandStore . removeAll ( ) ;
89
- await serverList . closeAll ( ) ;
88
+ try {
89
+ await Promise . all ( [ stagehandStore . removeAll ( ) , serverList . closeAll ( ) ] ) ;
90
+ } catch ( error ) {
91
+ console . error ( "Error during cleanup:" , error ) ;
92
+ }
90
93
process . exit ( 0 ) ;
91
94
} ;
92
95
You can’t perform that action at this time.
0 commit comments