← Back to Blog
·6 min read

URL Shortener for AI Agents: Connecting y.hn via MCP (Claude, Cursor & Automation)

Modern marketing, developer advocacy, and operations workflows are increasingly executed by AI agents—writing release notes, drafting social threads, generating campaign reports, and preparing customer onboarding messages. Yet most URL shorteners were built a decade ago strictly for point-and-click dashboards.

y.hn is built API-first and agent-native, with both a clean REST API and a Model Context Protocol (MCP) integration so Claude, Cursor, Windsurf, and custom AI agents can create, inspect, and analyze short links directly.

What Can an AI Agent Do with y.hn?

Once connected to y.hn, your AI assistant can handle repetitive link operations autonomously:

  • Shorten & brand URLs on the fly while drafting newsletters, changelogs, or social posts.
  • Attach structured UTM parameters consistently across every campaign without human typos.
  • Pull real-time click analytics (top countries, referrers, devices, bot-filtered human clicks) directly into weekly performance summaries.
  • Audit or update destination URLs when a launch page moves or a promo expires.

Quick Example: Shorten a Link via REST API

Every y.hn account can generate an API key from the dashboard and call POST /api/v1/links:


curl -X POST https://y.hn/api/v1/links \


  -H "Authorization: Bearer YOUR_YHN_API_KEY" \


  -H "Content-Type: application/json" \


  -d '{


    "url": "https://example.com/launch?utm_source=agent&utm_medium=newsletter",


    "slug": "launch26"


  }'


Response:


{


  "shortUrl": "https://y.hn/launch26",


  "slug": "launch26",


  "targetUrl": "https://example.com/launch?utm_source=agent&utm_medium=newsletter"


}


Connecting via MCP (Model Context Protocol)

Rather than writing glue scripts for every AI client, you can expose y.hn's link shortening and analytics tools directly via MCP. Visit our Agent & MCP Hub and API Documentation for the latest endpoint configuration, schema definitions, and copy-paste setup snippets.

Security & Safety Built In

When AI agents generate links automatically, URL safety matters even more:

  • Automated Safe Browsing checks block phishing and malicious destinations before redirects go live.
  • Scoped API keys let you rotate credentials anytime from your dashboard.
  • Transparent rate limits keep both free and paid tiers fast and reliable.

Explore the full Agent & MCP integration guide or check Creator & Growth API quotas.

#mcp url shortener#ai agent url shortener#claude mcp tools#url shortener api

Ready to try the shortest links on earth?

Create your first short link in seconds. No signup required.