dub-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@dub-mcpCreate a short link for https://example.com with key 'home'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Dub MCP Server
A Model Context Protocol (MCP) server for Dub, the link shortening platform. This server exposes Dub's API functionality to MCP clients.
Tools
create_link - Create new short links
update_link - Modify existing short links
delete_link - Delete short links
get_link_analytics - Retrieve link analytics data
get_links - List and search existing links
Related MCP server: Shortcut MCP Server
Installation
Prerequisites
Node.js 18.0.0 or higher
A Dub account with API access
Dub API key from app.dub.co/settings/tokens
Setup
Clone this repository:
git clone <repository-url> cd dub-mcpInstall dependencies:
npm installSet up environment variables:
cp env.template .envEdit
.envand add your Dub API key:DUB_API_KEY=your_actual_api_key_hereBuild the server:
npm run build
Usage
Running the Server
Development mode:
npm run devProduction mode:
npm startMCP Client Configuration
Add this server to your MCP client configuration. For Claude Desktop:
{
"mcpServers": {
"dub": {
"command": "node",
"args": ["/path/to/dub-mcp/dist/index.js"],
"env": {
"DUB_API_KEY": "your_api_key_here"
}
}
}
}Tools Reference
create_link
Creates a new short link.
Parameters:
url(required): The destination URL to shortendomain(optional): Custom domain to usekey(optional): Custom short link slugtitle(optional): Title for the linktags(optional): Array of tags to associate with the linkexpiresAt(optional): Expiration date in ISO 8601 formatpassword(optional): Password to protect the linkpublicStats(optional): Whether to make stats public
Example:
{
"url": "https://example.com/my-long-url",
"domain": "yourdomain.com",
"key": "my-link",
"title": "My Example Link",
"tags": ["marketing", "campaign"],
"publicStats": true
}update_link
Updates an existing short link. Identify the link using linkId, shortUrl, or domain+key combination.
Parameters:
linkId(optional): The ID of the link to updateshortUrl(optional): The short URL to update (e.g., "https://dub.sh/abc123")domain(optional): The custom domain (for identification or update)key(optional): Custom short link slug (for identification or update)All other parameters from create_link are optional
Example:
{
"linkId": "clm2k8qr40000...",
"url": "https://newdestination.com",
"title": "Updated Title"
}delete_link
Deletes a short link permanently.
Parameters:
linkId(required): The ID of the link to delete
Example:
{
"linkId": "clm2k8qr40000..."
}get_link_analytics
Retrieves analytics data for links.
Parameters:
event(optional): Event type (clicks,leads,sales,composite)linkId(optional): Filter analytics for a specific linkdomain(optional): Filter analytics by domainkey(optional): Filter by short link key (with domain)interval(optional): Time interval (24h,7d,30d,90d,1y,mtd,qtd,ytd,all)groupBy(optional): Group data by dimension (e.g.,countries,cities,devices,browsers,utm_sources)start/end(optional): Custom date range (takes precedence over interval)timezone(optional): IANA timezone code (e.g., "America/New_York")country(optional): Filter by 2-letter country codedevice(optional): Filter by device typeAdditional geographic, UTM, and filtering options available
startDate/endDate(optional): Legacy date format (YYYY-MM-DD)
Examples:
Get overall analytics:
{
"interval": "7d"
}Get analytics for a specific link:
{
"linkId": "clm2k8qr40000...",
"interval": "30d"
}Get analytics grouped by country:
{
"groupBy": "country",
"interval": "7d"
}get_links
List and search existing links with filtering options.
Parameters:
domain(optional): Filter by domainkey(optional): Filter by keysearch(optional): Search links by URL, title, or descriptiontagId(optional): Filter by tag IDsort(optional): Sort order (createdAt,clicks,lastClicked)page(optional): Page number for paginationshowArchived(optional): Include archived linkswithTags(optional): Include tag information
Examples:
Search all links:
{
"search": "example"
}Get links for a specific domain:
{
"domain": "dub.sh",
"sort": "clicks"
}Configuration
Environment Variables
DUB_API_KEY(required): Your Dub API keyDUB_API_BASE_URL(optional): Override the default API base URL (defaults tohttps://api.dub.co)
Error Handling
The server handles the following error types:
Authentication errors (invalid API key)
Validation errors (missing or invalid parameters)
API errors (Dub API failures)
Network errors (connectivity issues)
All errors return descriptive messages.
Development
Project Structure
src/
├── index.ts # Main server entry point
├── dub-client.ts # Dub API client
└── tools/
├── index.ts # Tool exports
├── create-link.ts # Create link tool
├── update-link.ts # Update link tool
├── delete-link.ts # Delete link tool
├── get-links.ts # Get links tool
└── analytics.ts # Analytics toolScripts
npm run build- Build TypeScript to JavaScriptnpm run dev- Run in development modenpm run watch- Run with auto-restart on changesnpm start- Run the built server
Dependencies
@modelcontextprotocol/sdk- MCP SDK for building serversaxios- HTTP client for API requestsdotenv- Environment variable loadingzod- Runtime type validation
License
MIT License - see LICENSE file for details.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/iamperegrine/dub-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server