← All connections

Connect to Lovable

Lovable — NewAlgorithm as a source of SAP context while the app is generated.

Before you start, create your free account.Create account

Which MCP will you connect? The commands below change according to your choice.

  1. 1

    Generate your API key

    Sign in to app.newalgorithm.io with your account, open Keys & apps and generate a key. It is shown only once: copy it and store it somewhere safe.

    Key format
    na_live_xxxxxxxxxxxxxxxxx
  2. 2

    Open the project integrations

    In the Lovable project, go to Settings → Integrations and look for the option to add a custom MCP server.

  3. 3

    Register the endpoint and the header

    Enter the server URL and the authorization header. It's the same pair used in any other client:

    URL and header
    https://totvs.mcp.newalgorithm.io/mcp
    Authorization: Bearer na_live_xxxxxxxxxxxxxxxxx
  4. 4

    Confirm in the project chat

    Ask for something that depends on SAP knowledge. The agent should query NewAlgorithm before generating the code, instead of inventing table names and rules.

  5. 5

    If you'd rather consume it from the generated code

    Since Lovable generates a real application, you can call NewAlgorithm from inside it. Always do this on the server side — a Supabase edge function, for example — reading the key from a secret.

    const r = await fetch("https://totvs.mcp.newalgorithm.io/mcp", {
      method: "POST",
      headers: {
        "Authorization": `Bearer ${Deno.env.get("NA_API_KEY")}`,
        "Content-Type": "application/json",
        "Accept": "application/json, text/event-stream",
      },
      body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "tools/list" }),
    })

Never leave the API key in the front-end code that Lovable publishes — any visitor can read it. Use the project secrets and keep the call on the server.

Authentication and tool details in the Docs.