Skip to main content
You’re likely using AI to write code, and there’s a right and wrong way to do it. This page is a collection of rules, configs, and copy‑paste snippets to allow your AI agents/assistants to write performant, Stagehand code as fast as possible.

Quickstart

Add MCP servers

Configure Browserbase (Stagehand), Context7, DeepWiki, and Stagehand Docs in your MCP client.

Pin editor rules

Drop in cursorrules and claude.md so AI agents/assistants always emit Stagehand patterns.

Using MCP Servers

MCP (Model Context Protocol) servers act as intermediaries that connect AI systems to external data sources and tools. These servers enable your coding assistant to access real-time information, execute tasks, and retrieve structured data to enhance code generation accuracy. The following MCP servers provide specialized access to Stagehand documentation and related resources:
Provides semantic search across documentation and codebase context. Context7 enables AI assistants to find relevant code patterns, examples, and implementation details from your project history. It maintains contextual understanding of your development workflow and can surface related solutions from previous work.Installation:
Offers deep indexing of GitHub repositories and documentation. DeepWiki allows AI agents to understand project architecture, API references, and best practices from the entire Stagehand ecosystem. It provides comprehensive knowledge about repository structure, code relationships, and development patterns.Installation:
Direct access to official Stagehand documentation. This MCP server provides AI assistants with up-to-date API references, configuration options, and usage examples for accurate code generation. Mintlify auto-generates this server from the official docs, ensuring your AI assistant always has the latest information.Usage:
How MCP Servers Enhance Your Development:
  • Real-time Documentation Access: AI assistants can query the latest Stagehand docs, examples, and best practices
  • Context-Aware Code Generation: Servers provide relevant code patterns and configurations based on your specific use case
  • Reduced Integration Overhead: Standardized protocol eliminates the need for custom integrations with each documentation source
  • Enhanced Accuracy: AI agents receive structured, up-to-date information rather than relying on potentially outdated training data
Prompting tip: Explicitly ask your coding agent/assistant to use these MCP servers to fetch relevant information from the docs so they have better context and know how to write proper Stagehand code.ie. “Use the stagehand-docs MCP to fetch the act/observe guidelines, then generate code that follows them. Prefer cached observe results.”

Editor rule files (copy‑paste)

Drop these in .cursorrules, windsurfrules, claude.md, or any agent rule framework:

Security notes

  • Do not embed secrets in docs or rule files; use env vars in MCP configs.
  • Avoid broad actions that may trigger unintended navigation; prefer observe first.

Resources/references