AI Rule
After connecting with ServBay MCP, AI tools may be able to invoke ServBay, but they might not know when or how to use it. AI Rule serves as an instruction manual for AI, telling it when handling issues related to local services, websites, domains, HTTPS, ports, databases, backups, and more, it should prioritize using ServBay MCP for inspection and operations, rather than changing application code to bypass environmental issues. This article explains how to install AI Rules.
What Problems Do AI Rules Solve?
- Ensures AI prioritizes MCP — When faced with local environment issues like "site won’t open / 502 errors / port conflicts / certificate errors", AI will first use ServBay MCP to check the status instead of blindly modifying code.
- Defines security boundaries — AI is instructed to explain and confirm before making destructive or write operations, and not to request or paste sensitive information such as keys in conversations.
- Reduces repeated explanations — Rules persist, so every AI session adheres to consistent behavioral guidelines.
Prerequisites
- ServBay has been installed and is running.
- It's recommended to have completed ServBay MCP integration.
Workspace-Level vs Global-Level
AI Rules can be installed at two levels:
- Workspace-Level — The rule file is written to a project directory, impacting only that project. Ideal for project-specific customization.
- Global-Level — Rules are added to the user-level configuration of an AI tool and apply to all projects. Currently, only Claude Code and Codex support global-level rules.
Installing AI Rules
Go to ServBay Settings → IDE Integrations, and in the relevant client row, click Install AI Rule. For workspace-level installation, select the target project directory first. ServBay will create or update the appropriate rule file. To remove, click Remove AI Rule.
Workspace-Level Rule File Locations
| Client | Rule File (relative to project root) |
|---|---|
| VS Code | .github/instructions/servbay-mcp.instructions.md |
| Cursor | .cursor/rules/servbay-mcp.mdc |
| Codex | AGENTS.md |
| Claude Code | CLAUDE.md |
Global-Level Rule File Locations
| Client | Rule File |
|---|---|
| Claude Code | ~/.claude/CLAUDE.md (official user memory, loaded at session start) |
| Codex | ~/.codex/AGENTS.md (official global memory) |
Merge Strategy: Preserving Your Content
ServBay uses a marker-based merge to write rules: ServBay-managed rule content is wrapped within specific marker comments, and only this section is updated—your existing content in the same file is preserved. This means it's safe to write rules into pre-existing CLAUDE.md / AGENTS.md files—your content won’t be lost. When removing AI Rules, only the managed area is deleted.
FAQ
- Q: Will installing AI Rules overwrite my existing
CLAUDE.mdorAGENTS.mdfiles?- A: No. ServBay only updates the managed area wrapped by its markers; your other content remains unchanged.
- Q: Why does my client not show a "global rule" option?
- A: Currently, only Claude Code and Codex support global-level rules. For other clients, please use workspace-level installation.
- Q: What’s the relationship between AI Rules and MCP integration?
- A: MCP integration enables AI tools to invoke ServBay, while AI Rules tell AI when and how to invoke it. They work best together.
- Q: Will rule files in Cursor/VS Code projects be committed to Git?
- A: Rules are stored as files in your project directory. Whether they are included in version control depends on your
.gitignoresettings—handle according to your team’s conventions.
- A: Rules are stored as files in your project directory. Whether they are included in version control depends on your
Summary
AI Rules are the "user manual" for ServBay MCP, ensuring AI utilizes ServBay first, correctly, and safely when handling local development environment issues. Both workspace and global levels are supported, with a marker-based merge strategy to protect your existing content. With AI Rules installed, your AI tool can truly become a powerful assistant for your local environment.
