From e079ae5e3eda69200e5d9a73b5d8aa9a1820d021 Mon Sep 17 00:00:00 2001 From: Henry Mao <1828968+calclavia@users.noreply.github.com> Date: Sat, 25 Jan 2025 10:39:34 +0800 Subject: [PATCH 1/3] Add Dockerfile --- stagehand/Dockerfile | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 stagehand/Dockerfile diff --git a/stagehand/Dockerfile b/stagehand/Dockerfile new file mode 100644 index 0000000..9c89353 --- /dev/null +++ b/stagehand/Dockerfile @@ -0,0 +1,39 @@ +# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile +# Use a Node.js image to build the MCP server +FROM node:22.12-alpine AS builder + +# Set the working directory +WORKDIR /app + +# Copy the package.json and package-lock.json for installing dependencies +COPY stagehand/package.json stagehand/package-lock.json ./ + +# Install the necessary dependencies +RUN --mount=type=cache,target=/root/.npm npm install + +# Copy the source code into the container +COPY stagehand/src ./src +COPY stagehand/tsconfig.json ./ + +# Build the project +RUN npm run build + +# Use a lighter Node.js image for the release +FROM node:22-alpine AS release + +# Set the working directory +WORKDIR /app + +# Copy the built files from the builder stage +COPY --from=builder /app/dist ./dist + +# Copy the package.json for running the application +COPY --from=builder /app/package.json ./ + +# Set environment variables required for the MCP server +ENV BROWSERBASE_API_KEY= +ENV BROWSERBASE_PROJECT_ID= +ENV OPENAI_API_KEY= + +# Set the entry point for the application +ENTRYPOINT ["node", "dist/index.js"] \ No newline at end of file From f97364d6dcff298a88681ef8165ab09748b53045 Mon Sep 17 00:00:00 2001 From: Henry Mao <1828968+calclavia@users.noreply.github.com> Date: Sat, 25 Jan 2025 10:39:35 +0800 Subject: [PATCH 2/3] Add Smithery configuration --- stagehand/smithery.yaml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 stagehand/smithery.yaml diff --git a/stagehand/smithery.yaml b/stagehand/smithery.yaml new file mode 100644 index 0000000..432872b --- /dev/null +++ b/stagehand/smithery.yaml @@ -0,0 +1,27 @@ +# Smithery configuration file: https://smithery.ai/docs/config#smitheryyaml + +build: + dockerBuildPath: ../.. +startCommand: + type: stdio + configSchema: + # JSON Schema defining the configuration options for the MCP. + type: object + required: + - browserbaseApiKey + - browserbaseProjectId + - openaiApiKey + properties: + browserbaseApiKey: + type: string + description: The API key for Browserbase. + browserbaseProjectId: + type: string + description: The project ID for Browserbase. + openaiApiKey: + type: string + description: The API key for OpenAI. + commandFunction: + # A function that produces the CLI command to start the MCP on stdio. + |- + (config) => ({command: 'node', args: ['dist/index.js'], env: {BROWSERBASE_API_KEY: config.browserbaseApiKey, BROWSERBASE_PROJECT_ID: config.browserbaseProjectId, OPENAI_API_KEY: config.openaiApiKey}}) \ No newline at end of file From 06e0d0ceaff872b4ec380d33d26d163ebe9ecf7e Mon Sep 17 00:00:00 2001 From: Henry Mao <1828968+calclavia@users.noreply.github.com> Date: Sat, 25 Jan 2025 10:39:36 +0800 Subject: [PATCH 3/3] Update README --- stagehand/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/stagehand/README.md b/stagehand/README.md index 23b0cbf..0790c34 100644 --- a/stagehand/README.md +++ b/stagehand/README.md @@ -1,11 +1,21 @@ # Stagehand MCP Server +[![smithery badge](https://smithery.ai/badge/@browserbasehq/mcp-stagehand)](https://smithery.ai/server/@browserbasehq/mcp-stagehand) ![cover](../assets/stagehand-mcp.png) A Model Context Protocol (MCP) server that provides AI-powered web automation capabilities using [Stagehand](https://github.com/browserbase/stagehand). This server enables LLMs to interact with web pages, perform actions, extract data, and observe possible actions in a real browser environment. ## Get Started +### Installing via Smithery + +To install Stagehand for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@browserbasehq/mcp-stagehand): + +```bash +npx -y @smithery/cli install @browserbasehq/mcp-stagehand --client claude +``` + +### Manual Installation 1. Run `npm install` to install the necessary dependencies, then run `npm run build` to get `dist/index.js`. 2. Set up your Claude Desktop configuration to use the server.