Skip to content

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 ​

  1. Open Olares Settings > Applications > YuE2 Studio.
  2. Under Environment variables, click Manage environment variables.
  3. Set MCP_AUTH_ENABLED to true.
  4. Click Confirm, then click Apply. Wait for YuE2 Studio to restart.
  5. Open Files and go to Application > Data > yue2studio > config.
  6. Open mcp-token as 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 ​

  1. Open Lares and go to Settings > MCP.

  2. Edit the yue2studio server.

  3. Replace Headers with the JSON below. Replace <your-token> with the complete line from mcp-token and keep one space after Bearer.

    json
    {
      "Authorization": "Bearer <your-token>"
    }
  4. Click Save.

  5. 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 ​

  1. Open the YuE2 Studio application environment variables in Olares Settings.
  2. Set MCP_AUTH_ENABLED to false, then click Confirm and Apply.
  3. Wait for YuE2 Studio to restart.
  4. Edit the yue2studio server 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 ​