Repository avatar
AI Tools
v0.1.0
active

linkledger

io.github.CloudCorpRecords/linkledger

Manage your Linkly short links, domains, webhooks and click analytics.

Documentation

linkledger

Your Linkly workspace, reachable from your own machine. linkledger is a local forwarding client for the hosted Linkly MCP service: it answers tools/list locally from the captured tool definitions and forwards every call to Linkly, returning the results exactly as the service sends them back. Nothing about your links is stored or computed here — the package is a ledger-keeper's pipe, not the ledger.

The surface covers the whole of a Linkly workspace: short links (create, read, update, delete, batch delete, search), custom domains and their favicons, webhook subscriptions at both workspace and per-link level, and click analytics (raw clicks, aggregated analytics, grouped analytics, CSV-style export). A ping health check and a test_authentication probe round it out.

The tools

Links:

  • create_link — Shorten a URL. url is required; optional fields cover a name, note, custom domain and slug, UTM parameters, Open Graph title/description/image, tracking IDs (Facebook pixel, GA4, GTM), cloaking, parameter forwarding, bot blocking, referrer hiding, and an expiry date with a fallback destination.
  • update_link — Change an existing link (link_id required); the same optional fields as creation are available.
  • get_link — Fetch one link by link_id.
  • delete_link — Remove one link by link_id.
  • batchDeleteLinks — Remove many links at once; ids is an array of link IDs.
  • list_links — Page through the workspace's links, with optional search text and sorting.
  • search_links — Find links matching a query.

Analytics:

  • get_clicks — Click records, optionally narrowed to one link_id.
  • get_analytics — Aggregated analytics with optional date range, link, frequency, country, platform, browser, unique-visitor and bot filters.
  • get_analytics_by — Analytics grouped by a counter (required), with the same style of filters.
  • export_clicks — Export click data over an optional date range and filter set.

Domains and webhooks:

  • list_domains — List the workspace's custom domains.
  • create_domain — Add a custom domain by name.
  • delete_domain — Remove a domain by domain_id.
  • update_domain_favicon — Set a domain's favicon from a favicon_url.
  • list_webhooks / subscribe_webhook / unsubscribe_webhook — Manage workspace-level webhook subscriptions by URL.
  • list_link_webhooks / subscribe_link_webhook / unsubscribe_link_webhook — The same, scoped to a single link_id.

Workspace:

  • list_workspaces — Details of the authenticated workspace.
  • update_workspace — Update workspace settings (name, webhooks).
  • test_authentication — Check that the upstream credentials authenticate.
  • ping — Health check; send a message, get it echoed by the service.

Several tools take no required arguments at all — the captured schemas carry an empty required list for them, and linkledger serves those schemas exactly as captured.

Install and run

As an MCP server via npm:

npx -y @reneturcios/linkledger mcp

MCP client configuration:

{
  "mcpServers": {
    "linkledger": {
      "command": "npx",
      "args": ["-y", "@reneturcios/linkledger", "mcp"],
      "env": { "LINKLY_API_KEY": "your Linkly API key" }
    }
  }
}

As a container:

docker run -i ghcr.io/cloudcorprecords/linkledger
docker run --rm ghcr.io/cloudcorprecords/linkledger ping '{"message":"hello"}'

CLI

One binary serves both the command line and the MCP server. Each tool is a subcommand taking a single JSON string with that tool's arguments:

linkledger create_link '{"url":"https://example.com/a/very/long/page","slug":"launch"}'
linkledger get_analytics '{"frequency":"day","unique":true}'
linkledger list_links '{"page":1,"page_size":20}'
linkledger --version

Exit codes: 0 when the forwarded call succeeds, 1 when the upstream result is an error, and 2 for usage problems such as an unknown subcommand or a malformed JSON argument.

Configuration

  • LINKLY_API_KEY — Your Linkly API key. When set, linkledger sends it upstream as an Authorization: Bearer <key> header on every request; when unset, no key header is sent and calls go out keyless. (The Linkly registry record declares no headers on its remote; this forwarding behaviour is a reconstruction added by this rebuild, matching how the authenticated workspace surface is meant to be reached.)
  • LINKLY_MCP_URL — Overrides the upstream endpoint. The default is the pinned hosted endpoint, https://mcp.linklyhq.com. (The override variable is likewise a reconstruction.)

Upstream failures — a JSON-RPC error from the service, a non-2xx response, an unreadable body, or a request that fails outright — are reported to the caller as an error result whose text starts with linkledger error:.

How forwarding works

The first forwarded call opens a session: an initialize request (protocol version 2025-03-26), followed by a notifications/initialized notification, then the tools/call itself. If the service answers the initialize request with an Mcp-Session-Id header, that value is carried on every later request, and the open session is reused for the rest of the process. Replies are accepted either as plain JSON or as server-sent events. Successful results pass through verbatim, including any isError flag and any extra fields the service includes.

Development

npm install
npm run build   # tsc -> dist/ (dist/cli.js is the bin)
npm test        # tsx --test test/*.test.ts — stubbed upstream, no network
npm run dev     # run the CLI from source

The test suite checks the served tool list against the captured surface tool for tool, exercises the session handshake and its reuse, asserts the API-key header behaviour (absent when LINKLY_API_KEY is unset, Bearer form when set), and verifies that arguments go upstream untouched and results come back untouched.

License

MIT — see LICENSE. Copyright (c) 2026 Rene Turcios.

NPM
@reneturcios/linkledger
Install Command
npm install @reneturcios/linkledger
Runtime: npx
OCI
ghcr.io/cloudcorprecords/linkledger:0.1.0
Install Command
docker pull ghcr.io/cloudcorprecords/linkledger:0.1.0:undefined
Runtime: docker