feat(mastra): add Stagehand code-mode MCP example - #2627
Conversation
|
There was a problem hiding this comment.
1 issue found and verified against the latest diff
Confidence score: 5/5
- In
packages/integrations/examples/mastra/package.json, an unused@browserbasehq/stagehand-integrationsdependency can cause confusion about required setup and add avoidable install/maintenance overhead for this example—either remove it or add the intended import usage to keep the example aligned withexamples/vercel.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/integrations/examples/mastra/package.json">
<violation number="1" location="packages/integrations/examples/mastra/package.json:11">
P3: The `@browserbasehq/stagehand-integrations` dependency is declared here but never imported anywhere in this example. Unlike the sibling `examples/vercel` package (whose `agent.ts` does `import ... from "@browserbasehq/stagehand-integrations/..."`), the Mastra example launches the already-built stdio server by direct file URL (`../../../dist/codemode/stdio-server.mjs`) and only imports `@mastra/core` and `@mastra/mcp`. This `workspace:*` entry is therefore unused at runtime and only pins a package that is not referenced. If it's kept to document the build dependency on the integrations dist output, a comment would help, but as-is it reads as a dead dependency.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| "typecheck": "tsc --noEmit" | ||
| }, | ||
| "dependencies": { | ||
| "@browserbasehq/stagehand-integrations": "workspace:*", |
There was a problem hiding this comment.
P3: The @browserbasehq/stagehand-integrations dependency is declared here but never imported anywhere in this example. Unlike the sibling examples/vercel package (whose agent.ts does import ... from "@browserbasehq/stagehand-integrations/..."), the Mastra example launches the already-built stdio server by direct file URL (../../../dist/codemode/stdio-server.mjs) and only imports @mastra/core and @mastra/mcp. This workspace:* entry is therefore unused at runtime and only pins a package that is not referenced. If it's kept to document the build dependency on the integrations dist output, a comment would help, but as-is it reads as a dead dependency.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/integrations/examples/mastra/package.json, line 11:
<comment>The `@browserbasehq/stagehand-integrations` dependency is declared here but never imported anywhere in this example. Unlike the sibling `examples/vercel` package (whose `agent.ts` does `import ... from "@browserbasehq/stagehand-integrations/..."`), the Mastra example launches the already-built stdio server by direct file URL (`../../../dist/codemode/stdio-server.mjs`) and only imports `@mastra/core` and `@mastra/mcp`. This `workspace:*` entry is therefore unused at runtime and only pins a package that is not referenced. If it's kept to document the build dependency on the integrations dist output, a comment would help, but as-is it reads as a dead dependency.</comment>
<file context>
@@ -0,0 +1,23 @@
+ "typecheck": "tsc --noEmit"
+ },
+ "dependencies": {
+ "@browserbasehq/stagehand-integrations": "workspace:*",
+ "@mastra/core": "catalog:",
+ "@mastra/mcp": "catalog:"
</file context>
…into shrey/stg-2765-codemode-mastra # Conflicts: # .github/workflows/codemode-framework-examples.yml # packages/integrations/README.md # pnpm-lock.yaml # pnpm-workspace.yaml
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
…rowserbase/stagehand into shrey/stg-2765-codemode-mastra
There was a problem hiding this comment.
All reported issues were addressed across 6 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 5 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Why
Agent frameworks should consume the code-mode MCP through the Vercel Sandbox security boundary, not launch the browser runtime inside the outer agent process. This layer makes Mastra a thin authenticated Streamable HTTP client of the exact package-installed sandbox from #2626.
Stack
code_execute, executor, configuration, and runtime tests@browserbasehq/stagehand-codemodepackageWhat changed
code_executeand uses its canonical description as agent instructionsOPENAI_API_KEYin the outer process; the sandbox receives only its explicit Browserbase configurationProof matrix
pnpm --filter @browserbasehq/stagehand-integrations-example-mastra typecheck@mastra/core@1.56.0and@mastra/mcp@1.15.1.pnpm checkcode_executetwice and requires the same page ID and DOM marker.code_execute, modify the existing page, and exposes the selected tool call in Mastra's step trace.OPENAI_API_KEYnor a Mastra host-only marker.Changeset
None. This remains a private integration example.