Skip to main content
Glama
README.md
# KeepOrganizedAI MCP

A local stdio server for the KeepOrganizedAI browser extension. It exposes 22 tools for reading, organizing and backing up bookmarks in **one explicitly paired browser profile**. Start with a disposable profile. The published extension is not a substitute for the MCP-enabled build in the sibling checkout.

## Pair a local development build

1. From this directory, use Node 22.12+ and npm:

   ```sh
   npm ci
   npm run build
   npm --prefix ../keeporganizedai-extension run build
   ```

   The extension command assumes its dependencies are installed.

2. In the test browser profile, open `chrome://extensions`, enable **Developer mode**, select **Load unpacked**, and choose `../keeporganizedai-extension/dist`. If it was already loaded, click **Reload** so Chrome grants the new `nativeMessaging` permission. Use the public **extension ID** shown on the card for both setup and the MCP client:

   ```sh
   export KEEPORGANIZEDAI_EXTENSION_ID=YOUR_UNPACKED_EXTENSION_ID
   NODE_ENV=development node dist/index.js setup chrome
   ```

   Choose `edge`, `brave`, or `chromium` instead for those browsers. For the production ID, simply run `node dist/index.js setup`. Setup preserves the private credential, registers a per-user native helper, and does not contact any browser profile. The helper needs the installed Node executable and package to stay at the registered paths.

3. Start one local client. For [OpenCode V2](https://opencode.ai/docs/mcp-servers), from this directory (replace `YOUR_UNPACKED_EXTENSION_ID`):

   ```sh
   opencode mcp add keeporganizedai --env NODE_ENV=development \
     --env KEEPORGANIZEDAI_EXTENSION_ID="$KEEPORGANIZEDAI_EXTENSION_ID" \
     -- "$(command -v node)" "$PWD/dist/index.js"
   ```

   Use `/mcps` in the project to check or connect the server. A connected **client** means stdio is ready; it does not mean Chrome has paired. The released extension ID is the default outside development. See [other clients](#cursor-and-claude-desktop) for alternative setups.

4. Open KeepOrganizedAI's **main side panel** and click **Pair this profile**. Chrome launches the allowlisted helper and transfers the port and credential over its private native messaging pipe. The extension saves both locally, resets writes to off, and authenticates to the running MCP server. No Settings visit or secret copy is needed. Keep the browser and client running.

5. Ask the client to call `get_connection_status`. Expect `connected: true`, `protocolVersion: 1`, and the read-only capabilities. Try `list_folder` with `folderId: "1"`. Enable writes in **Settings → AI integrations · MCP**. Moves do not open a review window. Deletion and restore return a `pending_approval` ticket instead of a result: ask the user in the client conversation, then call `respond_to_pending_approval` with the returned `approvalId`, `hash`, and the user's decision. The ticket expires after one minute and can be used once; nothing changes until it is confirmed.

Before each MCP mutation (one snapshot per bulk operation), the extension saves the entire pre-change bookmark tree as a JSON file under **KeepOrganizedAI/Backups/** in the browser's configured downloads directory. It waits for the download to finish; a failed or interrupted save blocks the change. The recent snapshots are also available via `list_backups`; disk files remain until you remove them and can be imported using the extension’s JSON import.

For “organize all my bookmarks,” first ask the user how they want the result organized:

- **Style:** broad, balanced, or detailed categories.
- **Nesting:** top-level only, at most one subfolder level, or deeper nesting.
- **Existing folders:** preserve where practical or reorganize.

If the user has no preference, recommend **balanced categories, at most one subfolder level, and preserving existing folders where practical**—but get agreement before planning. Collect all destinations in **one** `preview_bulk_move` request, using `groups: [{parentId, ids}, {parentId, newFolderTitle, ids}, …]` for existing and new destination folders. For grouped organization, the MCP server now gates the preview: if preferences have not been selected, it asks through an MCP form when supported or returns a chat prompt and sends no preview to the extension. If it returns `preferences_selected`, rebuild the plan using those choices and call preview again. Show the complete folder hierarchy and item moves from the read-only preview, and wait for the user to explicitly confirm before calling `apply_bulk_move`. If apply returns `CONFLICT`, the old plan is invalid; reread and re-preview using the same preferences, then show the revised plan and get confirmation again. Apply saves one backup before the first folder creation or move, then broadcasts a refresh to the open extension side panel. Do not call `create_backup` first. If the panel still shows stale data, call `refresh_bookmarks`; it creates no backup or download. A plan can cover up to 100 destinations and 2,000 distinct source items; a moved folder counts as one item with its contents. If the plan exceeds those limits, report that before applying rather than silently splitting it into multiple downloads.

For cleanup, collect all folder IDs in one `preview_delete_folders` call, show the returned folder list and descendant count, and wait for confirmation before calling `apply_delete_folders`. It saves one backup before the first deletion, deletes each folder only after revalidation, and refreshes the side panel. Reuse this instead of looping `preview_delete_folder`/`apply_delete_folder`; those remain for a single folder and each creates its own backup. Overlapping parent/child selections are rejected with `INVALID_INPUT`.

### Claude Code, Cursor, and Codex

**Single-backup rule:** use one grouped preview and one apply. For organization that is `preview_bulk_move` + `apply_bulk_move`; for deleting several folders it is `preview_delete_folders` + `apply_delete_folders`. The automatic pre-change snapshot is the intended single download; do not call `create_backup` first or split the job into individual creates, moves, renames or deletes. Show the full plan and get explicit confirmation before apply. A failed apply that already saved a snapshot may generate another download on retry; report this before retrying. This is agent guidance, not a session-wide download cap. The extension still requires a verified backup for every mutation operation.

Use one of these local stdio configurations. Replace the paths and unpacked extension ID; omit the development environment variables for a production extension.

For [Claude Code](https://code.claude.com/docs/en/mcp), run this from the MCP project directory:

```sh
claude mcp add --scope user --transport stdio \
  --env NODE_ENV=development \
  --env KEEPORGANIZEDAI_EXTENSION_ID="$KEEPORGANIZEDAI_EXTENSION_ID" \
  keeporganizedai -- "$(command -v node)" "$PWD/dist/index.js"
```

For [Cursor](https://cursor.com/docs/mcp), merge into `~/.cursor/mcp.json` (global) or `.cursor/mcp.json` (project):

```json
{
  "mcpServers": {
    "keeporganizedai": {
      "type": "stdio",
      "command": "/absolute/path/to/node",
      "args": ["/absolute/path/to/mcp/dist/index.js"],
      "env": {
        "NODE_ENV": "development",
        "KEEPORGANIZEDAI_EXTENSION_ID": "YOUR_UNPACKED_EXTENSION_ID"
      }
    }
  }
}
```

For [Codex](https://developers.openai.com/codex/mcp), add to `~/.codex/config.toml`:

```toml
[mcp_servers.keeporganizedai]
command = "/absolute/path/to/node"
args = ["/absolute/path/to/mcp/dist/index.js"]

[mcp_servers.keeporganizedai.env]
NODE_ENV = "development"
KEEPORGANIZEDAI_EXTENSION_ID = "YOUR_UNPACKED_EXTENSION_ID"
```

Claude Desktop continues to use its **Settings → Developer → Edit Config** `mcpServers` format; omit the `type` field there and fully quit/reopen the app. For organization preferences, OpenCode and Claude Code support MCP form elicitation; other clients receive an instruction to ask the same choices in chat when they do not advertise form support. Client integrations still need hands-on verification.

### Troubleshooting and rollback

| Symptom | What to check |
| --- | --- |
| Client cannot start the server | Use `node -p process.execPath` for the Node path and an absolute path to the built `dist/index.js`. Launch Node directly, not `npm start`. |
| Pair button reports failure | Rerun `setup` for the actual browser and ID after moving Node or the package. Check the extension was reloaded. For a custom Linux/macOS user-data directory, set `KEEPORGANIZEDAI_BROWSER_DATA_DIR` for setup to the browser's native-host lookup root (not the `Default` profile folder). |
| Tools listed, browser disconnected | Run setup before launching the server; use the same unpacked ID for setup and the client. Reconnect the client process and click **Pair this profile**. Reconnect attempts may take a minute. |
| Port already in use | Close the other client/Inspector instance. To change ports, edit `port` in `~/.keeporganizedai/mcp.json`, relaunch the server and pair again. |
| `CONFLICT` or `OUTCOME_UNKNOWN` | Read the current tree. Make a new preview if needed. Never blindly repeat a timed-out write. Recovery backup IDs appear in partial-failure messages. |
| Approval expired or replayed | Restart the destructive tool. Approval tickets last one minute and each decision is consumed once; do not reuse an `approvalId`/`hash` pair. |
| Stop access | **Disable** disconnects. **Revoke pairing** also clears the extension credential. After `node dist/index.js rotate`, reconnect the server process and click **Pair this profile** again. For rollback, disable the integration before reverting either build. |

The bridge uses authenticated, **unencrypted** WebSockets on `127.0.0.1`. Software with access to the OS account or secret is inside the trust boundary. On POSIX, setup creates a `0700` directory and `0600` file; on Windows, verify the directory ACL permits only the intended account. Use `KEEPORGANIZEDAI_CONFIG_DIR` to select a different private directory for both setup and the server. The bridge adds no telemetry. Your AI client may transmit returned titles, URLs or exports to its provider.

To uninstall the helper after revoking pairing: remove `com.keeporganizedai.pairing.json` from the selected browser's `NativeMessagingHosts` directory on macOS/Linux, or remove the `com.keeporganizedai.pairing` key under `HKCU\Software\<browser vendor/product>\NativeMessagingHosts` on Windows. Remove that browser's launcher directory under `~/.keeporganizedai/native/`. No administrator access is needed.

## Develop and verify

```sh
npm test                                      # build + Node/stdio/bridge tests
npm run dev                                   # TypeScript watch
npm run sync:protocol                         # copy src/protocol.ts into sibling extension
npm --prefix ../keeporganizedai-extension test -- src/mcp
npm --prefix ../keeporganizedai-extension run build
CHROMIUM_BINARY=/path/to/chromium node scripts/browser-smoke.mjs
```

The browser smoke requires a Linux Chromium build supporting `--load-extension`. It creates and removes its own profile and instrumented copy of the extension; it does not use personal bookmarks. See [release evidence and open gates](docs/release.md) and the [checklist](docs/task.md).

### Try it with Inspector

With the other MCP client stopped, use these from this directory. Inspector 2.16.0 requires Node `^22.23.4`, `^24.22.1` or `>=26.12.1`. For a paired unpacked build, pass the same two development environment settings to the Inspector child (`-e NAME=value`).

```sh
npx --yes @modelcontextprotocol/inspector@2.16.0 --cli node dist/index.js --method tools/list
npx --yes @modelcontextprotocol/inspector@2.16.0 --cli node dist/index.js --method tools/call --tool-name get_connection_status
```

## License

MIT. See [LICENSE](LICENSE).

TDQS

B3.3/5.0

Scored across 25 tools

Disambiguation4/5

Most tools have distinct purposes, and the preview/apply pairs are explicitly framed (e.g. 'use preview_delete_folders instead when cleaning up several folders'). The weak spot is the cluster of preview_delete_folder / preview_delete_folders / apply_delete_folder / apply_delete_folders, which differ only by singular/plural and require careful reading to select correctly.

Naming Consistency4/5

Nearly every tool follows a clear snake_case verb_noun pattern (get_*, create_*, delete_*, list_*, preview_*, apply_*, restore_*). Minor deviations: respond_to_pending_approval breaks the verb_noun shape, and the singular/plural split between apply_delete_folder and apply_delete_folders is inconsistent with the preview side.

Tool Count3/5

25 tools is at the heavy end for a bookmark organizer, largely because safety flows are split into separate preview and apply tools for each operation (bulk move, single folder delete, multi folder delete). Several of these could be consolidated into one tool accepting an array of IDs, which would reduce surface area without losing safety.

Completeness4/5

The surface covers CRUD for bookmarks and folders, search, tree reads, bulk move, backup create/list/restore, export, duplicate detection, and the approval lifecycle. Minor gaps remain: no folder rename/update operation, no bulk delete for multiple bookmarks (only bulk folder deletion), and folder locks are read-only.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues