Short links, fast.

A self-hosted URL shortener built with Go. REST API, CLI, and MCP tools out of the box. Own your data. Deploy anywhere.

Built for developers

REST API

Full-featured HTTP API with JSON responses. Create, list, update, delete, and batch-shorten links. QR code generation and link preview fetching included.

CLI Tool

Built with Cobra. Create and manage links from your terminal with goshort-cli. Scriptable, pipeline-friendly, and config-file driven.

MCP Tools

7 tools, 3 resources, 2 prompts. Let Claude, Cursor, or any MCP-compatible agent shorten URLs, fetch metadata, and manage your link collection.

Secure by Default

Private IP blocking, Google Safe Browsing v4, per-IP rate limiting, and constant-time API key comparison. Parameterized queries throughout. No tracking. No cookies. MIT licensed.

See it in action

curl -X POST https://goshort.app/api/v1/urls/public \
  -H "Content-Type: application/json" \
  -d '{"url":"https://github.com/anIcedAntFA/goshort"}'

# 201 Created
{
  "short_code": "k7Xm2p",
  "short_url": "https://goshort.app/k7Xm2p",
  "original_url": "https://github.com/anIcedAntFA/goshort",
  "expires_at": "2026-06-13T00:00:00Z"
}
# Install (requires Go 1.22+)
go install github.com/anIcedAntFA/goshort/cmd/cli@latest

# Create a short link
goshort-cli shorten https://github.com/anIcedAntFA/goshort
# Short URL: https://goshort.app/k7Xm2p

# List all links
goshort-cli list

# Authenticated commands use GOSHORT_API_KEY env var
export GOSHORT_API_KEY=your-secret-key
# Add to claude_desktop_config.json (stdio transport)
{
  "mcpServers": {
    "goshort": {
      "command": "goshort",
      "args": ["--mcp"],
      "env": { "GOSHORT_API_KEY": "your-secret-key" }
    }
  }
}

# Or connect via HTTP (Streamable HTTP transport)
# MCP endpoint: https://goshort.app/mcp

# Example tool call: create_url
# { "url": "https://github.com/anIcedAntFA/goshort", "expires_in": "7d" }
# → { "short_url": "https://goshort.app/k7Xm2p" }

Self-host in minutes

1

Download

Grab the latest binary or install from source:

# Binary (GitHub Releases)
curl -L https://github.com/anIcedAntFA/goshort/releases/latest/download/goshort_linux_amd64.tar.gz | tar xz

# Or build from source (Go 1.22+)
go install github.com/anIcedAntFA/goshort/cmd/server@latest
2

Configure

Create goshort.toml in your working directory:

[server]
port     = 8080
base_url = "https://your.domain.com"

[auth]
api_key = "your-secret-key"

[cache]
driver = "memory"
3

Shorten

Start the server and create your first short link:

# Start the server
goshort

# Create a short link
curl -X POST http://localhost:8080/api/v1/urls \
  -H "Authorization: Bearer your-secret-key" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://github.com/anIcedAntFA/goshort"}'