Skip to main content
Glama
Kutt MCP Server

Kutt MCP Server

by reklis
README.md
# Kutt MCP Server

[![Docker](https://img.shields.io/badge/docker-ready-blue?logo=docker)](https://ghcr.io)
[![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue?logo=python&logoColor=white)](https://python.org)
[![FastMCP](https://img.shields.io/badge/FastMCP-2.0+-green)](https://github.com/jlowin/fastmcp)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server that provides AI agents with the ability to shorten URLs using [Kutt.it](https://kutt.it) - the modern, open-source URL shortener.

```
┌─────────────────┐      ┌─────────────────┐      ┌─────────────────┐
│   AI Agent      │ ──── │   Kutt MCP      │ ──── │   Kutt.it API   │
│  (Claude, etc)  │ MCP  │   Server        │ HTTP │                 │
└─────────────────┘      └─────────────────┘      └─────────────────┘
```

## Features

- **Full Kutt API Coverage** - Create, list, update, and delete short links
- **Link Analytics** - Get detailed statistics on link visits
- **Custom Domains** - Manage your own branded short domains
- **Password Protection** - Create secure, password-protected links
- **Link Expiration** - Set automatic expiry times
- **n8n Compatible** - Middleware handles extra args from n8n MCP client

## Quick Start

### Using Docker (Recommended)

```bash
docker run -d \
  -p 8000:8000 \
  -e KUTT_API_KEY=your-api-key \
  ghcr.io/OWNER/kutt-mcp:latest
```

### Using Docker Compose

```bash
# Copy environment template
cp .env.example .env

# Edit .env with your API key
vim .env

# Start the server
docker compose up -d
```

### Using uv (Local Development)

```bash
# Install dependencies
uv sync

# Set your API key
export KUTT_API_KEY=your-api-key

# Run the server
uv run python server.py
```

## Configuration

| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| `KUTT_API_KEY` | Yes | - | Your Kutt.it API key |
| `KUTT_BASE_URL` | No | `https://kutt.it/api/v2` | Kutt API endpoint (for self-hosted) |
| `MCP_HOST` | No | `0.0.0.0` | Server bind address |
| `MCP_PORT` | No | `8000` | Server port |

Get your API key from [kutt.it/settings](https://kutt.it/settings) or your self-hosted instance.

## Available Tools

| Tool | Description |
|------|-------------|
| `health_check` | Check Kutt API health status |
| `list_links` | List your shortened links with pagination |
| `create_link` | Create a new short link |
| `update_link` | Update an existing link |
| `delete_link` | Delete a link |
| `get_link_stats` | Get visit statistics for a link |
| `create_domain` | Add a custom domain |
| `delete_domain` | Remove a custom domain |
| `get_user_info` | Get authenticated user details |

### Example: Create a Short Link

```json
{
  "tool": "create_link",
  "arguments": {
    "target": "https://example.com/very/long/url",
    "customurl": "my-link",
    "description": "My awesome link",
    "expire_in": "7 days"
  }
}
```

### Example: Get Link Statistics

```json
{
  "tool": "get_link_stats",
  "arguments": {
    "link_id": "uuid-of-your-link"
  }
}
```

## Connecting to MCP Clients

### Claude Desktop

Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "kutt": {
      "url": "http://localhost:8000/mcp"
    }
  }
}
```

### n8n

Use the MCP Client node with:
- **Transport**: HTTP
- **URL**: `http://your-server:8000/mcp`

## Self-Hosted Kutt

If you're running your own Kutt instance, just point to your API:

```bash
KUTT_BASE_URL=https://your-kutt-instance.com/api/v2
```

## Development

```bash
# Clone the repo
git clone https://github.com/OWNER/kutt-mcp.git
cd kutt-mcp

# Install dependencies
uv sync

# Run locally
uv run python server.py
```

## License

MIT