Skip to content

shrtnr

Self-hosted URL shortener with a REST API, typed SDKs and an MCP server, on Workers, D1 and Cloudflare Access

shrtnr dashboard with 30-day click totals, a clicks-over-time chart, top countries, most clicked links and top domains

Short links in shrtnr belong to the person who created them, can answer on several slugs, and roll up into bundles with combined click analytics. Links, slugs and bundles can be managed from code through a REST API with an OpenAPI spec, SDKs for TypeScript, Python and Dart, and an MCP server that AI assistants reach through Cloudflare Access OAuth.

Oddbit built shrtnr for its own use and released it as open source. Each deployment publishes an OpenAPI 3.1 spec at /_/api/openapi.json with an interactive reference at /_/api/docs, and issues Bearer API keys scoped to read, create or both. The TypeScript, Python and Dart SDKs are generated from that spec. The MCP server on an mcp. subdomain gives Claude, Copilot and other MCP clients tools for links, slugs, bundles, QR codes and analytics, and every tool call runs as the signed-in user. Identity comes from Cloudflare Access, so each teammate signs in as themselves. Creators own their links and bundles, everyone can read everything, and anyone can add a slug to a link or a link to a bundle. Random slugs start at three characters, and custom slugs sit beside them. A link with recorded clicks can only be disabled, not deleted. Links can also be set to expire. Analytics split clicks by country, referrer, device, operating system and browser, count QR scans apart from link clicks, and filter bots by default. The dashboard is available in English, Indonesian and Swedish. Redirects read slugs from a KV cache in front of D1 and record the click after the response goes out. A SQLite-backed Durable Object hosts the MCP server, and the Worker applies database migrations itself on the first request. Browser extensions for Chrome and Firefox shorten the current tab against your deployment.

Built for: Developers and teams who want a scriptable, self-hosted link shortener with per-person ownership through Cloudflare Access

What you can use it for

  • Share one link shortener across a team while each person controls their own links
  • Report on a campaign by bundling its links into one click total
  • Create short links from an app with the TypeScript, Python or Dart SDK
  • Let Claude or Copilot create and query links over MCP
  • Track QR code scans separately from link clicks

Deploy

  • One-click

    Forks the repository, provisions D1 and KV and deploys through Workers Builds; the schema is created on the first request. Then enable Cloudflare Access and set the ACCESS_AUD and ACCESS_JWKS_URL secrets.

Turning on Access for the workers.dev URL takes one click in the dashboard; a custom domain needs a self-hosted Access application for /_/admin/*.

What it needs to run

  • D1 databasesshrtnr-db
  • Durable ObjectsShrtnrMCP
  • KV namespacesSLUG_KV

Good to know

Cloudflare Access is required for the admin UI; until ACCESS_AUD and ACCESS_JWKS_URL are set, admin pages show a setup page while short links keep redirecting. The MCP endpoint needs a dedicated mcp. subdomain on a Cloudflare zone, a second Access application with Managed OAuth, the MCP_ACCESS_AUD secret, and the Block AI bots rule turned off for the zone. There is no read-only MCP scope yet, so anyone allowed by the Access policy can call destructive tools on links they own. Not yet available: password-protected links, import and export, routing by device or country, tags, social preview overrides and click webhooks. UTM parameters are stored but not reported.

Cost on Cloudflare

Likely fits the free plan

The README states that shrtnr runs inside the Cloudflare free tier. Workers Free covers 100,000 requests a day, D1 allows 100,000 rows written a day and KV 1,000 writes a day; every redirect is a Worker request and every click is recorded.

Source

The estimate is based on Cloudflare’s documented limits and the app’s configuration. What you pay depends on your usage and plan.

Where this comes from

An alternative to Bitly, Cuttly, TinyURL.

Listing history

  • Oct 2, 2026 · shrtnr listed
  • OpenShort.link homepage with Deploy to Cloudflare and View on GitHub buttons

    Branded short links on your own domain, routed by country or device, with QR codes and click analytics

    Deploy
    One-click
    License
    AGPL-3.0
    GitHub stars
    107 stars
    Last commit