@@ -32,61 +32,87 @@ const cookieSchema = z.object({
3232} ) ;
3333
3434// Configuration schema for Smithery - matches existing Config interface
35- export const configSchema = z . object ( {
36- browserbaseApiKey : z . string ( ) . describe ( "The Browserbase API Key to use" ) ,
37- browserbaseProjectId : z
38- . string ( )
39- . describe ( "The Browserbase Project ID to use" ) ,
40- proxies : z
41- . boolean ( )
42- . optional ( )
43- . describe ( "Whether or not to use Browserbase proxies" ) ,
44- advancedStealth : z
45- . boolean ( )
46- . optional ( )
47- . describe (
48- "Use advanced stealth mode. Only available to Browserbase Scale Plan users" ,
49- ) ,
50- context : z
51- . object ( {
52- contextId : z . string ( ) . optional ( ) . describe ( "The ID of the context to use" ) ,
53- persist : z
54- . boolean ( )
55- . optional ( )
56- . describe ( "Whether or not to persist the context" ) ,
57- } )
58- . optional ( ) ,
59- viewPort : z
60- . object ( {
61- browserWidth : z . number ( ) . optional ( ) . describe ( "The width of the browser" ) ,
62- browserHeight : z
63- . number ( )
64- . optional ( )
65- . describe ( "The height of the browser" ) ,
66- } )
67- . optional ( ) ,
68- cookies : z
69- . array ( cookieSchema )
70- . optional ( )
71- . describe ( "Cookies to inject into the Browserbase context" ) ,
72- server : z
73- . object ( {
74- port : z
75- . number ( )
76- . optional ( )
77- . describe ( "The port to listen on for SSE or MCP transport" ) ,
78- host : z
79- . string ( )
80- . optional ( )
81- . describe (
82- "The host to bind the server to. Default is localhost. Use 0.0.0.0 to bind to all interfaces" ,
83- ) ,
84- } )
85- . optional ( ) ,
86- modelName : AvailableModelSchema . optional ( ) . describe (
87- "The model to use for Stagehand (default: google/gemini-2.0-flash)" ,
88- ) , // Already an existing Zod Enum
89- } ) ;
35+ export const configSchema = z
36+ . object ( {
37+ browserbaseApiKey : z . string ( ) . describe ( "The Browserbase API Key to use" ) ,
38+ browserbaseProjectId : z
39+ . string ( )
40+ . describe ( "The Browserbase Project ID to use" ) ,
41+ proxies : z
42+ . boolean ( )
43+ . optional ( )
44+ . describe ( "Whether or not to use Browserbase proxies" ) ,
45+ advancedStealth : z
46+ . boolean ( )
47+ . optional ( )
48+ . describe (
49+ "Use advanced stealth mode. Only available to Browserbase Scale Plan users" ,
50+ ) ,
51+ context : z
52+ . object ( {
53+ contextId : z
54+ . string ( )
55+ . optional ( )
56+ . describe ( "The ID of the context to use" ) ,
57+ persist : z
58+ . boolean ( )
59+ . optional ( )
60+ . describe ( "Whether or not to persist the context" ) ,
61+ } )
62+ . optional ( ) ,
63+ viewPort : z
64+ . object ( {
65+ browserWidth : z
66+ . number ( )
67+ . optional ( )
68+ . describe ( "The width of the browser" ) ,
69+ browserHeight : z
70+ . number ( )
71+ . optional ( )
72+ . describe ( "The height of the browser" ) ,
73+ } )
74+ . optional ( ) ,
75+ cookies : z
76+ . array ( cookieSchema )
77+ . optional ( )
78+ . describe ( "Cookies to inject into the Browserbase context" ) ,
79+ server : z
80+ . object ( {
81+ port : z
82+ . number ( )
83+ . optional ( )
84+ . describe ( "The port to listen on for SSE or MCP transport" ) ,
85+ host : z
86+ . string ( )
87+ . optional ( )
88+ . describe (
89+ "The host to bind the server to. Default is localhost. Use 0.0.0.0 to bind to all interfaces" ,
90+ ) ,
91+ } )
92+ . optional ( ) ,
93+ modelName : AvailableModelSchema . optional ( ) . describe (
94+ "The model to use for Stagehand (default: google/gemini-2.0-flash)" ,
95+ ) , // Already an existing Zod Enum
96+ modelApiKey : z
97+ . string ( )
98+ . optional ( )
99+ . describe (
100+ "API key for the custom model provider. Required when using a model other than the default google/gemini-2.0-flash" ,
101+ ) ,
102+ } )
103+ . refine (
104+ ( data ) => {
105+ // If any model is explicitly specified, API key is required
106+ if ( data . modelName ) {
107+ return data . modelApiKey !== undefined && data . modelApiKey . length > 0 ;
108+ }
109+ return true ;
110+ } ,
111+ {
112+ message : "modelApiKey is required when specifying a custom model" ,
113+ path : [ "modelApiKey" ] ,
114+ } ,
115+ ) ;
90116
91117// Default function for Smithery
92118export default function ( { config } : { config : z . infer < typeof configSchema > } ) {
0 commit comments