Documentation menuMCP clients: OpenCode

MCP clients

Connect OpenCode to Loogika with MCP

You connect OpenCode to Loogika by adding the address https://app.loogika.com/api/mcp as a remote server in opencode.json. OpenCode then signs in with OAuth in your browser, or sends an API key that it reads from your environment. After that it can check your traffic and set up goals and funnels from the terminal.

Last updated .

How do you connect OpenCode with OAuth?

Add the server to the opencode.json file at the root of your project, or to your global OpenCode config. The entry holds the address and no key.

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "loogika": {
      "type": "remote",
      "url": "https://app.loogika.com/api/mcp",
      "enabled": true
    }
  }
}

Then start the sign-in from your terminal:

opencode mcp auth loogika

Your browser opens. Log in to Loogika there and approve the access. The connection acts as you, with the role you hold in Loogika.

How do you sign out again?

Run opencode mcp logout loogika. The command removes the credential that OpenCode stored for Loogika.

How do you connect OpenCode with an API key?

The API key form adds a headers block, and the key in it comes from an environment variable. An API key fits runs where nobody can answer a browser sign-in. A key with scopes also lets you give OpenCode narrower access than your own.

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "loogika": {
      "type": "remote",
      "url": "https://app.loogika.com/api/mcp",
      "enabled": true,
      "headers": {
        "Authorization": "Bearer {env:LOOGIKA_API_KEY}"
      }
    }
  }
}

Set LOOGIKA_API_KEY in your environment to a key from Loogika. The API getting started page shows where you create a key and how scopes limit it.

Can you commit opencode.json to a repository?

Yes, in both forms shown on this page. The OAuth form holds the address alone. The API key form holds the name of an environment variable, and the key itself stays on each developer's machine.

How do you check that OpenCode is connected?

Run opencode mcp list. The command shows the loogika server and its sign-in status. Run opencode mcp debug loogika for detailed diagnostics when the server does not connect.

Then ask OpenCode a question about your data, for example:

List my Loogika sites and summarize last week's traffic for each.

OpenCode answers with the Loogika tools. The MCP overview lists every tool and marks the ones that change or delete data.

Which Loogika plan do you need?

The MCP server belongs to API access, which is part of the Business and Agency plans. That holds for a sign-in with OAuth as well as for an API key. On another plan, Loogika refuses the connection and replies that API access requires Business or Agency.