Skip to content

[STG-634] add user metadata into session create #102

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

Merged

Conversation

Kylejeong2
Copy link
Collaborator

what

Adding user metadata into session create so we can track which stagehand sessions were created by MCP.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR adds session tracking metadata to the Browserbase MCP server by introducing a hardcoded userMetadata object with mcp: true to all sessions created through the StagehandStore. The change is implemented in src/stagehandStore.ts where the userMetadata field is added to the browserbaseSessionCreateParams object passed to the Stagehand constructor.

This modification enables the Browserbase platform to distinguish between sessions created through the MCP server versus other Stagehand integrations or direct API usage. The metadata gets attached to every session at creation time, providing valuable analytics and debugging capabilities for understanding usage patterns specific to MCP server sessions.

The implementation fits naturally into the existing session creation flow in the StagehandStore class, which already manages session instances and their configuration parameters. The change is non-breaking and transparent to end users, as it only adds internal tracking metadata without affecting the public API or session functionality.

Confidence score: 5/5

  • This PR is extremely safe to merge with virtually no risk of production issues.
  • The change is minimal, well-contained, and adds only tracking metadata without modifying core functionality.
  • No files need additional attention - the single change is straightforward and self-contained.

1 file reviewed, no comments

Edit Code Review Bot Settings | Greptile

@Kylejeong2 Kylejeong2 merged commit 78e986d into main Jul 29, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants