Skip to content

Commit

Permalink
Remove redundancy in zod types
Browse files Browse the repository at this point in the history
  • Loading branch information
andylouisqin committed Dec 22, 2024
1 parent 8107156 commit c3c3245
Showing 1 changed file with 15 additions and 23 deletions.
38 changes: 15 additions & 23 deletions src/commands/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@ const EnvVariable = z.object({
required: z.boolean().default(true).optional(),
})

const MCPConfig = z.record(
z.string(),
z.object({
command: z.string(),
args: z.array(z.string()),
env: z.record(z.string(), EnvVariable),
}),
)
const MCPConfig = z.object({
command: z.string(),
args: z.array(z.string()),
env: z.record(z.string(), EnvVariable),
})

const MCPServer = z.object({
id: z.string().regex(/^[a-z0-9-]+$/),
Expand Down Expand Up @@ -65,17 +62,15 @@ export default class Install extends Command {
license: 'MIT',
runtime: 'node',
config: {
'@browserbasehq/mcp-browserbase': {
command: 'npx',
args: ['-y', '@browserbasehq/mcp-browserbase'],
env: {
'BROWSERBASE_API_KEY': {
description: 'Your Browserbase API key. Find it at: https://www.browserbase.com/settings',
},
'BROWSERBASE_PROJECT_ID': {
description: 'Your Browserbase project ID. Find it at: https://www.browserbase.com/settings',
},
}
command: 'npx',
args: ['-y', '@browserbasehq/mcp-browserbase'],
env: {
'BROWSERBASE_API_KEY': {
description: 'Your Browserbase API key. Find it at: https://www.browserbase.com/settings',
},
'BROWSERBASE_PROJECT_ID': {
description: 'Your Browserbase project ID. Find it at: https://www.browserbase.com/settings',
},
}
}
},
Expand Down Expand Up @@ -178,10 +173,7 @@ export default class Install extends Command {

// Get server configuration from registry
const server = await this.validateServer(serverName)

// Get the first (and only) key from the config object
const packageKey = Object.keys(server.config)[0]
const serverConfig = server.config[packageKey]
const serverConfig = server.config

// Collect environment variables
const envVars = serverConfig.env
Expand Down

0 comments on commit c3c3245

Please sign in to comment.