Skip to main content
Glama
@nextanalytica/mcp

@nextanalytica/mcp

Official
README.md
# @nextanalytica/mcp

nextanalytica's web analytics for MCP clients that run only local servers. Your agent starts this package on your
computer, and it passes every message to nextanalytica's MCP server at `https://mcp.nextanalytica.app/mcp`: the same
tools, the same answers.

If your client connects to remote MCP servers, you don't need this package: add `https://mcp.nextanalytica.app/mcp`
instead. See [Any MCP client](https://nextanalytica.app/docs/model-context-protocol/other-clients).

## How do I add it?

Add this to your client's MCP settings. Without a key, the first start opens your browser to sign in to nextanalytica,
and the sign-in is kept on this computer.

```json
{
  "mcpServers": {
    "nextanalytica": {
      "command": "npx",
      "args": ["-y", "@nextanalytica/mcp"]
    }
  }
}
```

## Can I connect without a browser?

Yes, with an agent key. Make one in nextanalytica under **Site** > **For developers** > **Keys**, then put it in the
server's environment. With a key, the package never opens a browser and keeps nothing on disk.

```json
{
  "mcpServers": {
    "nextanalytica": {
      "command": "npx",
      "args": ["-y", "@nextanalytica/mcp"],
      "env": { "NEXTANALYTICA_KEY": "na_key_…" }
    }
  }
}
```

See [Agent keys and OAuth](https://nextanalytica.app/docs/model-context-protocol/agent-keys).

## What does it keep on my computer?

Only the browser sign-in: the registered client and its tokens, in `~/.config/nextanalytica/mcp-auth.json`
(`%APPDATA%\nextanalytica\mcp-auth.json` on Windows), readable by you alone. Two agents on one computer share it and
sign in once. To forget it:

```sh
npx -y @nextanalytica/mcp logout
```

## What if something goes wrong?

The package writes one line to your client's log (stderr) and answers your agent in the same words:

| Message | What to do |
| --- | --- |
| nextanalytica refused the key in NEXTANALYTICA_KEY | Make a new agent key, or remove `NEXTANALYTICA_KEY` to sign in in the browser. |
| Your nextanalytica sign-in ended | Restart your MCP client; it signs in again. |
| nextanalytica can't be reached | Check your connection and try again. |

## Source and license

MIT. Source: [nextanalytica-app/nextanalytica-mcp](https://github.com/nextanalytica-app/nextanalytica-mcp). Docs:
[nextanalytica.app/docs](https://nextanalytica.app/docs).