Skip to main content
Glama
Links Library MCP Server

Links Library MCP Server

by daviz00
README.md
# Links Library — an MCP bookmark library on Convex

A personal link library (links, notes, images and files, organised with nested tags and folders) that
lives in your own [Convex](https://convex.dev) deployment and is reachable by AI assistants through a
hosted [MCP](https://modelcontextprotocol.io) server. Use it from Claude on your phone, on the web, on
the desktop or in Claude Code, with no computer of yours needing to be awake.

It was built to move off [Anybox](https://anybox.app), whose MCP server only runs on the Mac while the
app is open, and includes a one-time importer for an Anybox library.

- **Tools for assistants:** `search_links`, `get_link`, `get_article`, `save_link`, `save_note`,
  `update_link`, `move_to_trash`, `restore_from_trash`, `list_tags`, `list_folders`, `library_status`.
  They mirror Anybox's own MCP tools, so assistants already know how to use them.
- **Full-text search** over titles, URLs, descriptions, comments, tags, notes and saved article text.
- **Article text for every link:** new saves are fetched in the background (title, description and
  readable text as Markdown); after an import, a throttled backfill does the same for the whole library.
- **Save from the iOS share sheet** with a small Shortcut ([docs/shortcut.md](docs/shortcut.md)).
- **Trash** keeps items for 30 days.
- **Sign-in:** OAuth 2.1 (dynamic client registration + PKCE) with one owner password, for Claude's
  custom connectors; plus a static API key for scripts, Claude Code and the Shortcut.

## Deploy your own

```bash
npm install
npx convex deploy
npx convex env set --prod OWNER_PASSWORD "$(openssl rand -base64 24 | tr '+/' '-_' | tr -d '=\n')"
npx convex env set --prod API_KEY "$(openssl rand -base64 32 | tr '+/' '-_' | tr -d '=\n')"
npx convex env set --prod JWT_SECRET "$(openssl rand -base64 48)"
```

Your MCP URL is `https://<your-deployment>.convex.site/mcp`. Read the generated values back with
`npx convex env get --prod OWNER_PASSWORD` (and `API_KEY`); keep them in your password manager. The
sign-in page locks for 15 minutes after 10 wrong passwords.

## Connect an assistant

- **Claude (iOS, web, desktop):** Settings → Connectors → Add custom connector → paste the MCP URL. A
  sign-in page opens; enter your `OWNER_PASSWORD`. Connectors added on claude.ai sync to the iOS app.
- **Claude Code:**
  `claude mcp add --transport http links https://<your-deployment>.convex.site/mcp --header "Authorization: Bearer <API_KEY>"`
- **Any other MCP client:** the same URL, with OAuth or `Authorization: Bearer <API_KEY>`.

## Import from Anybox

1. Open Anybox on your Mac, enable **Settings → MCP**, and copy the API key from **Settings → General**.
2. Run:

   ```bash
   ANYBOX_API_KEY=<anybox key> \
   LIBRARY_URL=https://<your-deployment>.convex.site \
   LIBRARY_API_KEY=<API_KEY> \
   node scripts/import-anybox.ts
   ```

The importer reads every item through Anybox's local MCP server (links, notes, image and file entries,
tags, folders, stars, comments, keywords, dates and saved article text) and prints counts only, never
titles or URLs. It is safe to run again: items already imported only gain new tags, and a link you also
saved from your phone in the meantime is merged rather than duplicated. When it finishes it starts the
article backfill (skip with `--no-backfill`); watch progress with the `library_status` tool.

**What doesn't come across:** items in Anybox's Trash, tags and folders with no items, smart lists, web
archives, and the contents of images and files (their names, tags and dates are imported, so they stay
findable).

## How it works

| Piece | Where |
| --- | --- |
| MCP endpoint, `/api/*` routes | `convex/http.ts`, tools in `convex/tools.ts` |
| OAuth 2.1 server, API key | `convex/auth.ts`, `convex/oauth.ts`, `src/pages.ts` |
| Library reads and writes | `convex/library.ts` |
| Anybox import (server side) | `convex/importer.ts`; client in `scripts/import-anybox.ts` |
| Article fetching, backfill, Trash purge | `convex/enrich.ts`, `convex/enrichQueue.ts`, `convex/crons.ts`, `src/extract.ts` |

Article text is stored in ~4,000-character chunks so searches and paged reads stay within Convex's
per-query limits; tag and folder counts are kept as counters for the same reason.

## Development

```bash
npm run dev        # convex dev against your dev deployment
npm test           # vitest + convex-test (synthetic data only)
npm run typecheck
```

## Licence

MIT