home / mcp / trae rules generator mcp server

Trae Rules Generator MCP Server

Provides automated generation, reading, saving, and updating of Trae AI project rule files via MCP with multi-language support.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "xiaochenwin-trae-rules-mcp": {
      "command": "python3",
      "args": [
        "-m",
        "trae_rules_mcp.main"
      ],
      "env": {
        "PYTHONPATH": "."
      }
    }
  }
}

You can run Trae Rules Generator as an MCP server to automatically generate, read, and manage rules for Trae AI projects. It supports local execution via Python and a separate runtime entry through UV, enabling you to tailor rule files for Web, API, AI, and other project types with multilingual support.

How to use

You interact with the MCP server through your Trae AI client by configuring an MCP server entry and invoking the provided tools. The server can read existing rules, generate new project rules based on type and features, and save or update rule files. Use the two runtime options shown below to run the MCP server locally.

How to install

Prerequisites you need before starting: Python 3.8 or newer, and a compatible package manager. If you plan to install from a published package, you will use pip to install the MCP server package and then wire it into Trae AI.

Configured MCP servers

The MCP servers provided by Trae Rules Generator include two local runtime options. Use one entry per configuration and place them in your Trae AI MCP settings.

Supported MCP server configurations

1) Local Python module execution (published package) 2) Local UV-driven execution (source-based runtime)

Examples of MCP server configurations

{
  "mcpServers": {
    "trae_rules_mcp": {
      "command": "python3",
      "args": ["-m", "trae_rules_mcp.main"],
      "env": {
        "PYTHONPATH": "."
      }
    },
    "trae_rules_generator": {
      "command": "uv",
      "args": ["run", "python", "main.py"],
      "cwd": "/path/to/trae-rules-mcp",
      "env": {
        "PYTHONPATH": "/path/to/trae-rules-mcp"
      }
    }
  }
}

Available tools

read_existing_rules

Reads and returns details about existing rule files, including structure and content previews.

generate_project_rules

Generates new project-specific rule files based on project type and features.

save_rules_file

Saves generated rule content to a specified file path.

update_existing_rules

Updates an existing rule file with provided changes.