Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployment: Dockerfile and Smithery config #14

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions stagehand/Dockerfile
Original file line number Diff line number Diff line change
@@ -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=<YOUR_BROWSERBASE_API_KEY>
ENV BROWSERBASE_PROJECT_ID=<YOUR_BROWSERBASE_PROJECT_ID>
ENV OPENAI_API_KEY=<YOUR_OPENAI_API_KEY>

# Set the entry point for the application
ENTRYPOINT ["node", "dist/index.js"]
10 changes: 10 additions & 0 deletions stagehand/README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
27 changes: 27 additions & 0 deletions stagehand/smithery.yaml
Original file line number Diff line number Diff line change
@@ -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}})