<!-- Cogny documentation. Canonical page: https://cogny.com/docs/install-cogny-in-your-agent -->

# Install Cogny in Your AI Agent

Paste one line into Claude Code, Codex, Cursor or another coding agent and it sets Cogny up itself. What the agent does, what it changes on your machine, how to do it by hand, and how to undo it.

**Author:** Cogny Team  
**Published:** 2026-10-12  
**Updated:** 2026-10-12  
**Canonical:** https://cogny.com/docs/install-cogny-in-your-agent

Cogny installs itself through your coding agent. You paste one line, the agent reads a file of instructions and runs three commands. This page is the human-readable version of that file: what happens, what changes on your machine, and how to undo it.

## The one line

Paste this into Claude Code, Codex, Cursor, Gemini CLI, OpenCode or Aider:

```
Read https://cogny.com/SKILL.md and follow the setup instructions.
```

[`/SKILL.md`](https://cogny.com/SKILL.md) is the machine-readable form of this page. It is written for the agent: setup commands, the tools Cogny exposes, rules for using them, and what to do when something fails.

Not sure Cogny is for you? Ask instead:

```
Read https://cogny.com/SKILL.md. How could Cogny help me?
```

The file tells the agent to look at what it already knows about your project before answering, and to say so plainly if Cogny is not a fit. It installs nothing until you say yes.

## What the agent does

1. **Runs the Cogny CLI.** It uses `npx @cogny/cli`, which needs no global install. If you prefer a global binary, `npm install -g @cogny/cli` works too.
2. **Signs you up, or finds your account.** `cogny init` uses your `git config user.email`, creates a free workspace for it (or recovers the one you already have), and saves an API key. No card, no browser. To use a different address: `cogny init --email you@example.com`.
3. **Starts using the tools.** `cogny tools list` shows what is available and `cogny tools call <name>` runs one. This works in the same session, with no restart.

The free plan gives 15 tool calls per calendar month. What the paid plans add: [Buying Guide for Agents](https://cogny.com/docs/buying-guide).

## What changes on your machine

| What | Where | When |
|---|---|---|
| An API key for your workspace | `~/.cogny/config.json` | Always, written by `cogny init` |
| The CLI itself | The npx cache, or your npm global directory if you chose a global install | Always |
| A `cogny` MCP server entry | Your agent's MCP config, for example `~/.claude.json` or `~/.cursor/mcp.json` | Only if the agent runs `cogny mcp-config --write` |
| Marketing skill files | Your agent's skills directory | Only if the agent runs `cogny install-skill` |
| A copy of `SKILL.md` | Your agent's skills directory | Only if the agent saves it for later sessions |

Nothing is connected to your ad or analytics accounts by installing. That is a separate step you approve per platform.

## After installing: connect a channel

A new workspace has no data until you connect something. Either:

- open the Cogny dashboard and connect Google Ads, GA4, Search Console, Meta Ads or another platform, or
- ask your agent to connect one. It calls `list_integrations` to see what is available and starts the sign-in for you.

Then ask a real question, such as which search queries rank on page one with a low click-through rate. Every integration's tools are listed at [Integrations and tools](https://cogny.com/integrations/tools).

## No shell? Claude.ai and ChatGPT

A web chat cannot run commands, so add Cogny as a connector instead. The server URL is `https://app.cogny.com/mcp` and sign-in is OAuth.

- **Claude.ai:** Settings → Connectors → Add custom connector → name `cogny`, URL `https://app.cogny.com/mcp` → Add → log in → pick your workspace → Authorize.
- **ChatGPT:** Settings → Apps → Advanced settings → enable Developer mode → Create app → name `Cogny`, URL `https://app.cogny.com/mcp`, authentication OAuth → Create → pick your workspace → Authorize. ChatGPT may ask you to authorize twice the first time.

Full connector setup with videos: [Cogny MCP Server](https://cogny.com/docs/mcp).

## Other ways in

- **An agent that already speaks MCP and only needs a credential:** [`/auth.md`](https://cogny.com/auth.md) describes a registration call that returns an API key in one round trip, with no browser.
- **Tools in your agent's own MCP list:** after `cogny init`, run `cogny mcp-config --agent <your-agent> --write` and restart the agent. Some clients prefer OAuth over a saved key and will show the server as needing authentication. If that happens, keep using `cogny tools call`, which reaches the same tools.
- **An existing workspace:** create an API key under Settings → Connect AI Clients and run `cogny login --api-key <key>` instead of `cogny init`.

## Undo it

- Delete `~/.cogny/config.json` to remove the saved key from your machine.
- Revoke the key under Settings → Connect AI Clients in the Cogny app so it stops working anywhere.
- Remove the `cogny` entry from your agent's MCP config if one was added.
- `npm uninstall -g @cogny/cli` if you installed the CLI globally.

## If something fails

| You see | Do this |
|---|---|
| `cogny: command not found` | Use `npx @cogny/cli` in place of `cogny`. A global install is not on your PATH. |
| `Missing API key` | Run `cogny init`, or `cogny login --api-key <key>` for an existing workspace. |
| `401` or `Invalid or expired token` | The saved key was revoked. Run `cogny init` again for a new one. |
| `429` | The free plan's monthly calls are used up. They reset next month, or pick a paid plan. |
| MCP server "needs authentication" | Your client is ignoring the saved key. Use `cogny tools call` from the shell. |

Scripting the CLI, with a worked Google Ads audit: [Cogny CLI: marketing MCP from the command line](https://cogny.com/blog/cogny-cli-marketing-mcp-from-the-command-line).

---

## Steps: Install Cogny in a coding agent

1. **Paste the install line** — Tell your agent: Read https://cogny.com/SKILL.md and follow the setup instructions.
2. **Let it sign you up** — The agent runs npx @cogny/cli init, which creates a free workspace for your git email and saves an API key to ~/.cogny/config.json. No card.
3. **Connect a channel** — Connect Google Ads, GA4, Search Console or another platform from the Cogny dashboard or by asking the agent to start the connection.
4. **Ask your first question** — The agent calls Cogny's tools from the shell with cogny tools call. No restart is needed.

---

In this section:

- **Install Cogny in Your AI Agent** (this page): https://cogny.com/docs/install-cogny-in-your-agent
- Cogny MCP Server: https://cogny.com/docs/mcp

Source page: https://cogny.com/docs/install-cogny-in-your-agent  
All documentation: https://cogny.com/docs  
Cogny for agents: https://cogny.com/llms.txt
