Code formatting via Prettier
## Prettier MCP Server: Opinionated Code Formatting Engine The **Prettier MCP Server** integrates the industry-standard code formatter into Google Antigravity, ensuring consistent code style across your entire codebase with zero configuration and AI-assisted formatting workflows. ### Why Prettier MCP? - **Zero Configuration**: Beautiful, consistent formatting out of the box without endless style debates - **Multi-Language Support**: Format JavaScript, TypeScript, CSS, HTML, JSON, Markdown, and many more languages - **IDE Integration**: Seamless format-on-save integration that keeps your code clean as you write - **Custom Configurations**: Override defaults when needed with simple configuration options - **Git Integration**: Format staged files or entire commits to ensure consistent style in version control ### Key Features #### 1. Code Formatting ```python from anthropic import Anthropic client = Anthropic() response = client.messages.create( model="claude-sonnet-4-20250514", max_tokens=1024, messages=[{ "role": "user", "content": "Format all JavaScript files in the src/ directory using Prettier with default settings" }] ) ``` #### 2. Configuration Management ```python # Manage Prettier config response = client.messages.create( model="claude-sonnet-4-20250514", max_tokens=1024, messages=[{ "role": "user", "content": "Create a Prettier config with 2-space indentation, single quotes, and trailing commas" }] ) ``` #### 3. Selective Formatting ```python # Format specific files response = client.messages.create( model="claude-sonnet-4-20250514", max_tokens=1024, messages=[{ "role": "user", "content": "Format only the staged files before commit to ensure consistent style" }] ) ``` #### 4. Format Checking ```python # Check formatting status response = client.messages.create( model="claude-sonnet-4-20250514", max_tokens=1024, messages=[{ "role": "user", "content": "Check which files in the project are not formatted according to Prettier rules" }] ) ``` ### Configuration ```json { "mcpServers": { "prettier": { "command": "npx", "args": ["-y", "@anthropic/mcp-server-prettier"], "env": { "PRETTIER_CONFIG_PATH": ".prettierrc", "PRETTIER_FORMAT_ON_SAVE": "true" } } } } ``` ### Use Cases **Team Standardization**: Eliminate code style debates by adopting Prettier as the single source of truth for formatting. **Code Review Efficiency**: Remove formatting concerns from code reviews to focus on logic and architecture. **Legacy Cleanup**: Consistently format legacy codebases in preparation for modernization efforts. **CI/CD Quality Gates**: Enforce formatting standards in CI pipelines to prevent style inconsistencies. The Prettier MCP Server removes the cognitive overhead of manual formatting, letting developers focus on writing great code while maintaining beautiful, consistent style automatically.
{
"mcpServers": {
"prettier": {
"mcpServers": {
"prettier": {
"args": [
"-y",
"prettier-mcp-server"
],
"command": "npx"
}
}
}
}
}