Model Context Protocol (MCP)
Through the Model Context Protocol (MCP), you can connect external tools and services to the Trae IDE for use.
What is MCP?
The Model Context Protocol (MCP) is a protocol that allows large language models (LLMs) to access custom tools and services. In Trae, agents act as MCP clients and can make requests to MCP servers to utilize the tools they provide. You can add MCP servers yourself and integrate them into custom agents for use. For more information, refer to the MCP's official documentation.
In Trae IDE, MCP servers support three transport types: stdio, SSE, and Streamable HTTP.
Disclaimer
MCP servers are built and maintained by third parties. Trae does not review or endorse these servers and is not responsible for their behaviour, any failures of MCP server calls, or the data they return.
Set up System Environment
To make sure MCP servers can be normally launched, you may need to install:
- npx: Requires Node.js version 18 or higher.
- uvx: A fast execution tool based on Python that needs to be installed manually.
- (Optional) Docker: Containerization platform for isolating and running applications, install the corresponding version based on your system version. To use GitHub MCP server, you need to install Docker.
Install Node.js
- Go to Node.js website, download Node.js 18 or a higher version.
- After installation, run the following commands in the terminal to confirm whether the installation was successful:
node -v
npx -vIf the installation is successful, the terminal will output the version number of Node.js installed, for example:
v18.19.0
10.2.0Install uvx (Python tool)
uvx is a command-line tool provided by uv for quickly running Python scripts.
- Go to Python official website to download and install Python 3.8 or a higher version.
- After installation, run the following command in the terminal to confirm whether the installation was successful:
python --versionIf the installation is successful, the terminal will output the version number of Python installed.
- Run the following command to install uv (which includes uvx). The installation script will automatically download uv and place it in the system's default path.
Command for macOS / Linux:
curl -LsSf https://astral.sh/uv/install.sh | shCommand for Windows (PowerShell):
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"- Run the following command to verify whether the installation was successful.
uvx --versionIf the installation is successful, the terminal will output the version number of uvx installed.
(Optional) Install Docker
To use GitHub MCP server, you need to install Docker. Use the following steps to install Docker Desktop:
| Operating System | Steps |
|---|---|
| macOS | Install manually: Go to the official Docker website or the Docker Store, then download the Docker Desktop installation package (.dmg file) for macOS, selecting the appropriate version to install based on your chip. Install with Homebrew: If Homebrew is already installed, you can use Homebrew Cask to install Docker Desktop with command brew install --cask docker. |
| Windows | Visit the official Docker website, download the Docker Desktop installer for Windows, and run it. Follow the prompts in the installation wizard to complete the installation, making sure to check the "Use the WSL 2 based engine" option. |
To verify if the installation is successful using the following methods:
- Open the terminal and enter the command
docker --version. If the installation is successful, it will display the version information of Docker. - Enter the command
docker infoto view detailed information about Docker. If the information is displayed, it means Docker has been installed and started successfully.
Configure MCP Server
You can add desired MCP servers directly from the marketplace or add them manually.
Method 1: Add from the Marketplace
The MCP marketplace offers popular MCP servers from the community. You can add them to your project.
- At the top right of the side chat box, click the Settings icon, and select MCP from the menu.
- The MCP tab appears.
- Click the + Add MCP Servers button, or click the + Add button and select Add from Marketplace from the menu.
- This directs you to the MCP marketplace.
- Find your desired MCP server.
- Click the + button at the right.
- In the pop-up window, fill the JSON configuration information for that MCP server.
Note: For MCP servers marked as "Local", NPX or UVX needs to be installed locally before they can be used.
- Replace the env information (such as API key, token, and access key) with the real information.
- Click the Confirm button.
Method 2: Add Manually
If you do not find desired MCP servers in the marketplace or you want to use the MCP servers developed by yourself, you can add them manually.
- At the top right of the side chat box, click the Settings icon, and select MCP from the menu.
- The MCP tab appears.
- Click the + Add button and select Add Manually from the menu.
- Configure the MCP server manually according to your requirements.