Trae is an AI-native integrated development environment (AI IDE) launched by ByteDance, deeply integrated with AI, providing intelligent Q&A, code auto-completion, and Agent-based AI automatic programming capabilities.
Quick Start
Launch Trae IDE
# 使用 Homebrew 启动
brew services start trae-cn
# 或者直接启动应用
open -a "Trae"
Trae SOLO Mode
Trae's SOLO mode can understand developer needs and automatically execute programming tasks:
# 进入项目目录后启动 Solo 模式
cd your-project
trae solo --task "帮我优化这个函数的性能"
Main Features
1. AI Programming Assistant
- Intelligent Q&A: Ask AI directly in the IDE
- Code Generation: Describe requirements, automatically generate code
- Code Explanation: Select code, AI explains the logic
- Unit Testing: Automatically generate test cases
- Intelligent Fixing: AI automatically fixes bugs
2. MCP Integration (Model Context Protocol)
MCP is a protocol that enables AI tools to understand and access external knowledge bases or services.
Configure MCP Server
Configure MCP in Trae:
- Open Trae IDE
- Go to Settings → MCP
- Add MCP Server configuration
Built-in MCP Server
Trae has built-in commonly used MCP Servers:
- File System: File read and write operations
- Database: Database queries
- API Calls: HTTP requests
- Web Automation: Playwright integration
Custom MCP Server
# 安装 MCP Server
npm install -g @modelcontextprotocol/server-filesystem
# 配置到 Trae
trae config add-mcp @modelcontextprotocol/server-filesystem
3. Agent Mode
Use Agent mode to let AI automatically complete complex tasks:
# 启动 Agent
trae agent --task "创建一个 React 组件,包含表单验证功能"
# 带上下文
trae agent --task "分析这个项目的架构" --context ./project
Common Commands
Project Management
# 创建新项目
trae create --template react my-project
# 打开项目
trae open ./my-project
# 克隆并打开项目
trae clone https://github.com/user/repo.git
Code Operations
# 代码生成
trae generate --prompt "创建一个用户登录组件"
# 代码重构
trae refactor --file ./src/App.tsx --task "将类组件改为函数组件"
# 代码审查
trae review --file ./src/utils.ts
AI Conversation
# 启动对话
trae chat
# 带系统提示
trae chat --system "你是一个 Python 专家"
# 引用代码对话
trae chat --file ./script.py "解释这段代码"
MCP Operations
# 列出已配置的 MCP Server
trae mcp list
# 添加 MCP Server
trae mcp add filesystem -- npx @modelcontextprotocol/server-filesystem ./projects
# 移除 MCP Server
trae mcp remove filesystem
Integration with OpenClaw
Using Trae MCP Server
In OpenClaw, you can call Trae through the MCP protocol:
# Python 示例:使用 Trae MCP Server
import requests
# 调用 Trae MCP 文件系统操作
response = requests.post(
"http://localhost:3000/mcp/file",
json={
"action": "read",
"path": "./src/App.tsx"
}
)
OpenClaw Trae Skill
Using OpenClaw's trae-cn Skill:
# 在 OpenClaw 中使用
@trae-cn help
# 创建项目
@trae-cn create-project --name my-app --template react
# 运行代码生成
@trae-cn generate --prompt "创建一个登录表单"
Configuration Options
Environment Variables
# API Key 配置
export TRAE_API_KEY="your-api-key"
# 模型选择
export TRAE_MODEL="deepseek-v3" # 默认
# 或 claude-sonnet, gpt-4
# MCP Server 默认路径
export TRAE_MCP_PATH="./mcp-servers"
Configuration File
The Trae configuration file is located at ~/.trae/config.json:
{
"model": {
"provider": "deepseek",
"model": "deepseek-v3",
"temperature": 0.7
},
"mcp": {
"enabled": true,
"servers": ["filesystem", "database"]
},
"theme": "dark",
"shortcuts": {
"chat": "cmd+shift+l",
"generate": "cmd+shift+g"
}
}
Use Cases
Scenario 1: Rapid Prototyping
# 1. 创建项目
trae create --template nextjs my-saas
# 2. 进入项目
cd my-saas
# 3. 启动开发
trae dev
# 4. AI 生成代码
trae generate --prompt "创建一个用户仪表盘页面"
Scenario 2: Code Review and Optimization
# 1. 打开项目
trae open ./my-project
# 2. AI 审查代码
trae review --file ./src/critical.ts
# 3. AI 优化
trae refactor --file ./src/critical.ts --task "性能优化"
Scenario 3: Integrating External Tools
# 1. 配置 MCP Server
trae mcp add weather -- npx @modelcontextprotocol/server-weather
# 2. 在对话中使用
trae chat "北京今天天气怎么样?"
Scenario 4: Team Collaboration
# 1. 克隆项目
trae clone https://github.com/team/project.git
# 2. 设置上下文
trae context set ./project-docs
# 3. AI 理解项目
trae chat "根据项目文档,帮我生成 API 文档"
FAQ
Q: What is the difference between Trae and VS Code? A: Trae is a native AI IDE, deeply integrated with AI, supporting Agent mode and the MCP protocol, with stronger AI capabilities than VS Code.
Q: Which programming languages does Trae support? A: It supports all mainstream languages, including Python, JavaScript/TypeScript, Go, Rust, Java, C++, etc.
Q: How do I configure a custom MCP Server? A: Refer to the official documentation:https://docs.trae.com.cn/ide/model-context-protocol
Q: Is Trae free? A: Trae offers a free version and a professional version. The free version includes basic AI features, and the professional version provides more advanced features.
Q: How do I switch AI models?
A: Configure in settings or use environment variables TRAE_MODEL
Reference Links
- Official Website: https://www.trae.com.cn
- Documentation: https://docs.trae.com.cn
- GitHub: https://github.com/trae-ai
- Download: https://www.trae.com.cn/download