# Nonaki & AI

With Nonaki 2.1.0 you can manage your links from an AI chat. Ask Claude or
ChatGPT something like "which links are broken?" or "create a link called *bonus* that
goes to *affiliate URL*", and it does the work on your website for you.

This page explains how to set that up. If you are a developer using a coding
tool such as Claude Code, skip to
[Coding agents and developer tools](https://docs.affkraft.com/nonaki/ai#coding-agents-and-developer-tools).

***

## Manage your website from a chat with an AI agent

### How it works

An AI assistant doesn't log in to your dashboard and click around like you do.
Instead, your website gives it a list of specific tasks it is allowed to do,
such as "list links", "update a link" or "run the link checker". WordPress calls
these tasks **abilities**.

To make this work you need three things:

1. **Nonaki** provides the abilities for your links, tags, click and impression
   stats, the link checker and Nonaki settings. You choose which ones to offer
   on the **Nonaki → AI & Abilities** tab.
2. **"[MCP Adapter](https://wordpress.org/plugins/mcp-adapter/)"**, a free
   plugin, lets AI apps connect to your website and use those abilities.
3. **"[Enable Abilities for MCP](https://wordpress.org/plugins/enable-abilities-for-mcp/)"**,
   a free plugin, adds the sign-in. When you connect a chat app, you log in to
   your WordPress website and approve the connection, much like "Sign in with
   Google" on other websites.

The assistant then works as the WordPress user you signed in with. If that user
isn't allowed to do something, the assistant can't do it either. All Nonaki
abilities need an Administrator account, the same users who can open the
Nonaki screen.

> **Warning**
>
> AI abilities need WordPress 6.9 or newer. On older versions the
> **AI & Abilities** tab shows a notice; update WordPress to use them. The rest of
> Nonaki works on WordPress 6.0 and newer.
>
> Your website must also be online and use HTTPS, because the chat app connects
> to it over the internet. A local website, or a staging website behind a
> password, won't work.

### Set it up

1. **Install the plugins.** Go to **Nonaki** and open the **AI & Abilities** tab
   in the header. The **Status** box has buttons to install and activate both
   plugins.
2. **Choose what the assistant can do.** On the same tab, turn on **Expose
   Nonaki abilities to AI agents**, then choose the groups you want and click
   **Save Changes**. The default groups let the assistant read and edit links
   and tags, run the link checker and change Nonaki settings, but not move
   links to the trash or delete tags.
3. **Turn on sign-in.** Go to **Settings → WP Abilities**, open the
   **Connection** tab and turn on the OAuth connector.
4. **Connect your chat app.** In your chat app, add a *custom connector* and
   paste your website address. You'll be sent to your WordPress login page:
   sign in with an Administrator account and approve.
5. **Try it.** Start a new chat, make sure the connector is switched on for it,
   and ask "list my five most recent Nonaki links".

Where to add a custom connector depends on the app. Menu names change often, so
treat these as a guide:

| App | Where |
| --- | --- |
| Claude | **Settings → Connectors → Add custom connector** |
| ChatGPT | Turn on Developer Mode in **Settings → Apps & Connectors → Advanced settings**, then create a connector with your website address and OAuth sign-in. Paid plans only, at the time of writing. |
| Gemini | **Settings → Connected Apps → Add a custom app**. Available to personal accounts in the US only, at the time of writing. |

> **Tip**
>
> "Enable Abilities for MCP" also comes with its own abilities for posts, pages,
> media and more. Nonaki doesn't need them, so turn on only the ones you want on
> its **Abilities** tab.

### The AI & Abilities tab

**Status** tells you whether everything is ready. A green tick means that part
is fine; a warning icon tells you what's missing, usually with a button to fix
it.

* **MCP Adapter** and **Chat app sign-in (OAuth)** show whether the two plugins
  are active. When MCP Adapter is active, its endpoint address is shown too.
* **Nonaki abilities** shows how many tasks the assistant can currently use,
  and from how many groups.
* **Hidden elsewhere** only appears if "Enable Abilities for MCP" has switched
  off some of Nonaki's abilities on its own screen. Turn them back on there if
  you want to use them.

**Ability Groups** starts with the main switch, **Expose Nonaki abilities to AI
agents**. It is off by default, and while it's off, Nonaki offers nothing to
assistants, whatever the other settings say. Once it's on, the groups appear
below it, each with a short description of what it allows.

**Individual abilities (advanced)** appears once the main switch is on. It is
collapsed by default: click it to open. Untick an ability to switch off just
that one inside a group you turned on. For example, you can let the assistant
edit links but not change the redirect slug. Two labels help you spot the
risky ones:

* **Cannot be undone** marks abilities whose changes are permanent, such as
  **Delete tag**.
* **Use with care** marks abilities with wide effects that you can still undo,
  such as **Set redirect slug**.

### Ability groups

"Who can use it" means which WordPress users the assistant can sign in as to
use that group.

| Group | What it can do | Abilities | Who can use it | Default |
| --- | --- | --- | --- | --- |
| Links: read | List and search links, view a link, list tags, and read click and impression stats. Read-only | `nonaki/list-links`, `nonaki/get-link`, `nonaki/list-tags`, `nonaki/get-link-stats`, `nonaki/list-link-clicks` | Administrators | On |
| Links: edit | Create and update links, add or remove tags on links, and create or rename tags | `nonaki/create-link`, `nonaki/update-link`, `nonaki/add-link-tags`, `nonaki/remove-link-tags`, `nonaki/create-tag`, `nonaki/update-tag` | Administrators | On |
| Link checker | Run the broken link checker and read its results | `nonaki/check-links`, `nonaki/get-link-check-results` | Administrators | On |
| Links: trash | Move links to the trash and restore them, and delete tags. Never deletes links permanently | `nonaki/trash-link`, `nonaki/restore-link`, `nonaki/delete-tag` | Administrators | Off |
| Nonaki settings | Read and update Nonaki settings: the redirect slug, GeoIP auto-update and the link checker | `nonaki/get-settings`, `nonaki/update-settings`, `nonaki/set-slug` | Administrators | On |

### The 19 abilities

| Ability | What it does |
| --- | --- |
| `nonaki/list-links` | Lists links with their key, destination URL, redirect type, link checker status, click and impression counts and tags. Filters by search text (matches the key or the destination URL), status (active or trashed), tag or link checker result, and sorts by date, key or clicks. Up to 100 links per page. |
| `nonaki/get-link` | Returns one link by ID, active or trashed, with its tags and counters. |
| `nonaki/list-tags` | Lists every link tag with its ID, name, slug and the number of links that have it. |
| `nonaki/get-link-stats` | Returns the analytics summary for one link over the last 7 to 365 days (30 by default) or all time: total clicks and impressions, daily clicks and impressions, and the top 10 devices, browsers, operating systems, countries, referrers and pages the link was viewed on. |
| `nonaki/list-link-clicks` | Lists the individual clicks on one link, newest first, with time, device type, browser, operating system, country and referrer. Also says how many clicks are still queued for processing; they appear within a few minutes. |
| `nonaki/create-link` | Creates an active link with a link key, destination URL, redirect type (301, 302 or 307; 302 by default) and tags. Fails if the link key is already used, also by a trashed link. |
| `nonaki/update-link` | Changes a link's key, destination URL, redirect type or tags. Only the values passed change, but a new tag list replaces the link's whole tag list. |
| `nonaki/add-link-tags` | Adds tags to one or more links (up to 500 at a time), keeping the tags they already have. |
| `nonaki/remove-link-tags` | Removes tags from one or more links (up to 500 at a time). The tags themselves are kept. |
| `nonaki/create-tag` | Creates a link tag. Fails if a tag with the same slug already exists. |
| `nonaki/update-tag` | Renames a link tag; its slug follows the new name. Links keep the tag. |
| `nonaki/check-links` | Checks the destination URL of every active link now and marks each one `ok` or `broken`, and returns how many are newly broken. |
| `nonaki/get-link-check-results` | Returns when the link checker last ran, whether the daily check is on, and the active links it found broken (or `ok`, or not checked yet). |
| `nonaki/trash-link` | Moves a link to the trash. A trashed link stops redirecting until it is restored. Its stats are kept. |
| `nonaki/restore-link` | Restores a trashed link so it redirects again. |
| `nonaki/delete-tag` | Permanently deletes a link tag and removes it from every link. The links themselves are kept. This cannot be undone. |
| `nonaki/get-settings` | Returns the redirect slug (and whether it is fixed in code), the GeoIP auto-update and link checker switches, whether a MaxMind license key is set, the GeoIP database status, and when the link checker last ran. |
| `nonaki/update-settings` | Turns GeoIP auto-update, the daily link checker and its email on or off. Only the settings passed change. |
| `nonaki/set-slug` | Changes the redirect slug, the path in front of every link key. Fails when the slug is fixed in code by the `nonaki_slug` filter. |

### Keeping it safe

* **Start with the default groups** and turn on more only when you need them.
  Moving links to the trash and deleting tags are off by default.
* **Links are never deleted for good.** "Trash link" only moves a link to the
  [Trash](https://docs.affkraft.com/nonaki/links#trash), where you can restore it, and its stats are
  kept. Deleting a tag, however, can't be undone (the links themselves are
  kept).
* **Some things stay in the dashboard only.** The assistant can't permanently
  delete links, import or export links, or clear analytics data.
* **Your keys stay private.** The assistant can't read or change your Links and
  Stats API keys or your MaxMind license key, only whether a MaxMind key is set.
* **Some changes affect your public links.** Changing a link's key changes its
  public URL, so old links to it stop working. Changing the redirect slug
  changes the URL of every link at once, and nothing redirects the old slug, so
  old links stop working until you set the slug back.
* **Ask to see changes first**, especially for bulk edits: "show me the changes
  before saving".

> **Tip**
>
> `nonaki/check-links` checks every active link in one go, waiting up to 10
> seconds for each destination to answer. On a website with many links it can
> take a while, so give it time, or ask for the latest results with "which links
> did the link checker find broken?" instead. The daily check is described on the
> [Link Checker](https://docs.affkraft.com/nonaki/link-checker) page.

### Things you can ask

* "Which of my links are broken?"
* "Run the link checker and tell me what's newly broken."
* "Create a link with the key *bonus* that goes to *affiliate URL*, with a 301
  redirect."
* "Change the destination of the *bonus* link to *new affiliate URL*."
* "Tag every link that points to *example.com* with *casino*."
* "Which links had the most clicks in the last 30 days, and from which
  countries?"
* "Show me the last 20 clicks on the *bonus* link."
* "Turn on the daily link checker email."

***

## Coding agents and developer tools

Tools such as Claude Code, Codex or Cursor don't need the chat-app sign-in, so
"Enable Abilities for MCP" isn't required. You still turn on the abilities in
**Nonaki → AI & Abilities**.

### MCP over HTTP

Needs the "MCP Adapter" plugin and a WordPress
[Application Password](https://wordpress.org/documentation/article/application-passwords/)
(**Users → Profile**) for an Administrator. The
`@automattic/mcp-wordpress-remote` proxy connects to the endpoint. For Claude
Code:

```bash
claude mcp add wordpress \
  --env WP_API_URL=https://example.com/wp-json/mcp/mcp-adapter-default-server \
  --env WP_API_USERNAME=your-user \
  --env WP_API_PASSWORD="xxxx xxxx xxxx xxxx xxxx xxxx" \
  -- npx -y @automattic/mcp-wordpress-remote@latest
```

### MCP over WP-CLI

On a local site, or over SSH, you can skip HTTP and run the MCP server through
WP-CLI (STDIO):

```bash
wp mcp-adapter list
wp mcp-adapter serve --server=mcp-adapter-default-server --user=admin
```

### WordPress REST API

Abilities with REST enabled are also listed by WordPress itself at
`/wp-json/wp-abilities/v1/abilities`. Nonaki's abilities are in the `nonaki`
category. For the regular Nonaki REST API with API keys, see
[Integrations](https://docs.affkraft.com/nonaki/integrations).

### Letting other roles use the abilities

Every Nonaki ability needs the `manage_options` capability. To hand a group to
a lower role, use the `nonaki_ability_capability` filter. It receives the
capability and the group key (`read`, `edit`, `check`, `trash` or `settings`).
For example, to let Editors read links and stats:

```php
add_filter('nonaki_ability_capability', function ($capability, $group) {
    return $group === 'read' ? 'edit_pages' : $capability;
}, 10, 2);
```

***

## AI writing helpers in the editor

The official WordPress AI plugin adds writing helpers inside the Block Editor,
such as titles, excerpts and alt text. It works alongside Nonaki and is a
different thing from managing your website from a chat assistant.
