A Model Context Protocol server for Shlink link shortening service
Project description
mcp-shlink
A Model Context Protocol (MCP) server for Shlink link shortening service. This server exposes Shlink's URL shortening, management, and tagging capabilities as MCP tools for AI assistants.
Features
- Create shortened URLs with custom slugs, tags, and expiration
- List all shortened URLs with pagination info
- Get details of specific URLs by short code
- Delete shortened URLs
- List and manage tags
- Full type safety with Pydantic models
- Built with the official MCP Python SDK
Requirements
- Python >= 3.10
- A Shlink instance with API access
Installation
pip install mcp-shlink
Configuration
Set these environment variables before running the server:
| Variable | Description | Required |
|---|---|---|
SHLINK_BASE_URL |
Your Shlink instance base URL (e.g., https://shlink.example.com) |
Yes |
SHLINK_API_KEY |
Your Shlink API key | Yes |
Generate an API key in Shlink:
shlink api-key:generate --name=my_api_key
Usage
Running as a standalone MCP server
SHLINK_BASE_URL=https://shlink.example.com SHLINK_API_KEY=your-key python -m mcp_shlink.server
Installing into Claude Desktop
uv run mcp install src/mcp_shlink/server.py --name "shlink"
Running with MCP Inspector
SHLINK_BASE_URL=https://shlink.example.com SHLINK_API_KEY=your-key uv run mcp dev src/mcp_shlink/server.py
Available Tools
| Tool | Description |
|---|---|
create_short_url |
Create a new shortened URL |
list_short_urls |
List all shortened URLs |
get_short_url |
Get details of a URL by short code |
delete_short_url |
Delete a shortened URL |
list_tags |
List all tags |
Development
# Clone the repository
git clone https://github.com/magnus919/mcp-shlink
cd mcp-shlink
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest
# Lint and format
ruff check .
ruff format .
# Type check
mypy src/
# Full verification
ruff check . && ruff format . --check && mypy src/ && pytest
Project Structure
src/mcp_shlink/
├── server.py # FastMCP server entry point
├── client.py # Shlink API client
├── tools.py # MCP tool definitions
└── models.py # Pydantic models for API requests/responses
tests/
├── test_tools.py # Unit tests for MCP tools
└── test_client.py # Unit tests for Shlink client
License
Apache 2.0. See LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_shlink-0.1.6.tar.gz.
File metadata
- Download URL: mcp_shlink-0.1.6.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c204beb20c36f66bb03d4133199c45cb21f3a94be078fda064469591d6a8e4a
|
|
| MD5 |
6e23ecef5c067ee0648978f67131c3e3
|
|
| BLAKE2b-256 |
475fcf45ca68b7d8c789e80e5f9c87c507cc0d61d5d23bda97d1d551d0fbafcd
|
Provenance
The following attestation bundles were made for mcp_shlink-0.1.6.tar.gz:
Publisher:
publish.yml on magnus919/mcp-shlink
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_shlink-0.1.6.tar.gz -
Subject digest:
2c204beb20c36f66bb03d4133199c45cb21f3a94be078fda064469591d6a8e4a - Sigstore transparency entry: 1341628365
- Sigstore integration time:
-
Permalink:
magnus919/mcp-shlink@2281f5d62accebdcafe6a903fc5b4c039f0d3252 -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/magnus919
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2281f5d62accebdcafe6a903fc5b4c039f0d3252 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mcp_shlink-0.1.6-py3-none-any.whl.
File metadata
- Download URL: mcp_shlink-0.1.6-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2be68eca88993fc2da5060cbe8351f80ad4b28777f3b01b7e5bf19d852e223dd
|
|
| MD5 |
d0d0eb7828d1bb408b8dae86ac2e0954
|
|
| BLAKE2b-256 |
b2600335a4dcd7dce6525e113632baa8ca8578db7cde0eed9dfd6c54a92c9efc
|
Provenance
The following attestation bundles were made for mcp_shlink-0.1.6-py3-none-any.whl:
Publisher:
publish.yml on magnus919/mcp-shlink
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_shlink-0.1.6-py3-none-any.whl -
Subject digest:
2be68eca88993fc2da5060cbe8351f80ad4b28777f3b01b7e5bf19d852e223dd - Sigstore transparency entry: 1341628366
- Sigstore integration time:
-
Permalink:
magnus919/mcp-shlink@2281f5d62accebdcafe6a903fc5b4c039f0d3252 -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/magnus919
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2281f5d62accebdcafe6a903fc5b4c039f0d3252 -
Trigger Event:
push
-
Statement type: