Protect YuE2 Studio MCP with token authentication
YuE2 Studio accepts connections to its internal MCP entrance without an app-specific token by default. You can require a Bearer token so every client, including Lares, must authenticate before calling YuE2 Studio tools.
This guide enables the token requirement and updates an existing Lares connection. The same token applies to other clients that use the YuE2 Studio MCP & API entrance.
Learning objectives
In this guide, you will learn how to:
- Enable token authentication for the YuE2 Studio MCP entrance.
- Find the token generated by the app.
- Add the token to Lares or another MCP client.
- Return the entrance to token-free access.
Prerequisites
Enable token authentication
- Open Olares Settings > Applications > YuE2 Studio.
- Under Environment variables, click Manage environment variables.
- Set
MCP_AUTH_ENABLEDtotrue. - Click Confirm, then click Apply. Wait for YuE2 Studio to restart.
- Open Files and go to Application > Data > yue2studio > config.
- Open
mcp-tokenas text and copy the complete line. If Files cannot preview it, download the file and open it in a text editor.
Keep this token out of chat prompts and shared screenshots.
Add the token to Lares
Open Lares and go to Settings > MCP.
Edit the
yue2studioserver.Replace Headers with the JSON below. Replace
<your-token>with the complete line frommcp-tokenand keep one space afterBearer.json{ "Authorization": "Bearer <your-token>" }Click Save.
Start a conversation with Qwen3.8-27B (llama.cpp) and check the music engine.
Token authentication applies to every client that uses this entrance. In another MCP client, add the same Authorization header to its Streamable HTTP connection.
Disable token authentication
- Open the YuE2 Studio application environment variables in Olares Settings.
- Set
MCP_AUTH_ENABLEDtofalse, then click Confirm and Apply. - Wait for YuE2 Studio to restart.
- Edit the
yue2studioserver in Lares and set Headers to{}.
Troubleshoot authentication
Why does the client return HTTP 401?
The YuE2 Studio entrance did not receive the expected token. Copy the complete line from mcp-token and check that the header starts with Bearer followed by one space.
Why is mcp-token missing?
Wait for YuE2 Studio to finish restarting after you apply MCP_AUTH_ENABLED=true, then open the config folder again.
Learn more
- Create and edit a song with YuE2 Studio: Install Studio, download a model set, and create music in the app.
- Create a song with YuE2 Studio through Lares: Connect the MCP entrance and generate a song from a conversation.
- Manage application environment variables: Change an application setting and apply the restart.