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 22FROM node:lts-alpine AS builder
33WORKDIR /app
44
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
78
8- # Copy source code
9+ # Copy configuration and source code
10+ COPY tsconfig.json ./
911COPY src ./src
10-
11- # Copy config files
1212COPY config.d.ts index.d.ts ./
1313
14- # Install dependencies and build
15- RUN corepack enable && pnpm install --frozen-lockfile && pnpm build
14+ # Build the application
15+ RUN pnpm build
1616
1717# ----- Production Stage -----
1818FROM node:lts-alpine
1919WORKDIR /app
2020
21- # Copy package.json and install production dependencies
21+ # Copy package files and install production dependencies
2222COPY package.json pnpm-lock.yaml ./
2323RUN corepack enable && pnpm install --prod --frozen-lockfile --ignore-scripts
2424
Original file line number Diff line number Diff line change @@ -40,7 +40,8 @@ export type Config = {
4040 persist ?: boolean ;
4141 } ;
4242 /**
43- *
43+ * The viewport of the browser
44+ * @default { browserWidth: 1024, browserHeight: 768 }
4445 */
4546 viewPort ?: {
4647 /**
@@ -58,16 +59,30 @@ export type Config = {
5859 */
5960 cookies ?: Cookie [ ] ;
6061 /**
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.
6267 *
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
6372 */
6473 server ?: {
6574 /**
6675 * The port to listen on for SHTTP or MCP transport.
76+ * If undefined, uses stdio transport instead of HTTP.
77+ *
78+ * @example 3000
6779 */
6880 port ?: number ;
6981 /**
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)
7186 */
7287 host ?: string ;
7388 } ;
Original file line number Diff line number Diff line change @@ -85,8 +85,11 @@ program
8585function setupExitWatchdog ( serverList : ServerList ) {
8686 const handleExit = async ( ) => {
8787 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+ }
9093 process . exit ( 0 ) ;
9194 } ;
9295
You can’t perform that action at this time.
0 commit comments