ShortURLMCP
ShortURLMCP
一个用于 URL 缩短的 Model Context Protocol (MCP) 服务器,通过 AceDataCloud API 使用 Short URL API。
直接从 Claude、VS Code 或任何兼容 MCP 的客户端创建简短、可共享的 URL。
功能特性
URL 缩短 - 将长 URL 转换为简短、可共享的链接
批量缩短 - 一次缩短多个 URL(每批最多 10 个)
免费服务 - 每次请求零积分消耗
永久链接 - 短链接永不过期
surl.id 域名 - 短链接使用简洁的
surl.id域名Bearer 认证 - 通过令牌认证实现安全的 API 访问
工具参考
工具 | 描述 |
| 从长 URL 创建短 URL。 |
| 在单个批次中为多个长 URL 创建短 URL。 |
| 获取使用 ShortURL 工具的综合指南。 |
| 获取有关 ShortURL API 服务的信息。 |
快速入门
1. 获取您的 API 令牌
在 AceDataCloud 平台 注册
前往 API 文档页面
点击 “Acquire” 获取您的 API 令牌
复制令牌以供下方使用
2. 使用托管服务器(推荐)
AceDataCloud 托管了一个受管理的 MCP 服务器 —— 无需本地安装。
端点: https://shorturl.mcp.acedata.cloud/mcp
所有请求都需要 Bearer 令牌。请使用第 1 步中的 API 令牌。
Claude.ai
通过 OAuth 直接在 Claude.ai 上连接 —— 无需 API 令牌:
前往 Claude.ai 设置 → 集成 → 添加更多
输入服务器 URL:
https://shorturl.mcp.acedata.cloud/mcp完成 OAuth 登录流程
开始在对话中使用这些工具
Claude Desktop
添加到您的配置中(macOS 上为 ~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"shorturl": {
"type": "streamable-http",
"url": "https://shorturl.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}Cursor / Windsurf
添加到您的 MCP 配置(.cursor/mcp.json 或 .windsurf/mcp.json):
{
"mcpServers": {
"shorturl": {
"type": "streamable-http",
"url": "https://shorturl.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}VS Code (Copilot)
添加到您的 VS Code MCP 配置(.vscode/mcp.json):
{
"servers": {
"shorturl": {
"type": "streamable-http",
"url": "https://shorturl.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}或者为 VS Code 安装 Ace Data Cloud MCP 扩展,该扩展捆绑了所有 15 个 MCP 服务器,支持一键设置。
JetBrains IDEs
前往 设置 → 工具 → AI Assistant → Model Context Protocol (MCP)
点击 添加 → HTTP
粘贴:
{
"mcpServers": {
"shorturl": {
"url": "https://shorturl.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}Claude Code
Claude Code 原生支持 MCP 服务器:
claude mcp add shorturl --transport http https://shorturl.mcp.acedata.cloud/mcp \
-h "Authorization: Bearer YOUR_API_TOKEN"或者添加到您项目的 .mcp.json 中:
{
"mcpServers": {
"shorturl": {
"type": "streamable-http",
"url": "https://shorturl.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}Cline
添加到 Cline 的 MCP 设置(.cline/mcp_settings.json):
{
"mcpServers": {
"shorturl": {
"type": "streamable-http",
"url": "https://shorturl.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}Amazon Q Developer
添加到您的 MCP 配置:
{
"mcpServers": {
"shorturl": {
"type": "streamable-http",
"url": "https://shorturl.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}Roo Code
添加到 Roo Code MCP 设置:
{
"mcpServers": {
"shorturl": {
"type": "streamable-http",
"url": "https://shorturl.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}Continue.dev
添加到 .continue/config.yaml:
mcpServers:
- name: shorturl
type: streamable-http
url: https://shorturl.mcp.acedata.cloud/mcp
headers:
Authorization: "Bearer YOUR_API_TOKEN"Zed
添加到 Zed 的设置(~/.config/zed/settings.json):
{
"language_models": {
"mcp_servers": {
"shorturl": {
"url": "https://shorturl.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}
}cURL 测试
# Health check (no auth required)
curl https://shorturl.mcp.acedata.cloud/health
# MCP initialize
curl -X POST https://shorturl.mcp.acedata.cloud/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}'3. 或在本地运行(替代方案)
如果您更喜欢在自己的机器上运行服务器:
# Install from PyPI
pip install mcp-shorturl
# or
uvx mcp-shorturl
# Set your API token
export ACEDATACLOUD_API_TOKEN="your_token_here"
# Run (stdio mode for Claude Desktop / local clients)
mcp-shorturl
# Run (HTTP mode for remote access)
mcp-shorturl --transport http --port 8000Claude Desktop (本地)
{
"mcpServers": {
"shorturl": {
"command": "uvx",
"args": ["mcp-shorturl"],
"env": {
"ACEDATACLOUD_API_TOKEN": "your_token_here"
}
}
}
}Docker (自托管)
docker pull ghcr.io/acedatacloud/mcp-shorturl:latest
docker run -p 8000:8000 ghcr.io/acedatacloud/mcp-shorturl:latest客户端使用各自的 Bearer 令牌进行连接 —— 服务器会从每个请求的 Authorization 标头中提取令牌。
可用工具
URL 缩短工具
工具 | 描述 |
| 缩短单个 URL |
| 一次缩短多个 URL(最多 10 个) |
信息工具
工具 | 描述 |
| 获取综合使用指南 |
| 获取 API 详情和错误代码 |
使用示例
缩短单个 URL
User: Shorten this URL: https://platform.acedata.cloud/documents/a2303356-6672-4eb8-9778-75f55c998fe9
Claude: I'll shorten that URL for you.
[Calls shorturl_create with url="https://platform.acedata.cloud/documents/a2303356-6672-4eb8-9778-75f55c998fe9"]
Result: https://surl.id/1uHCs01xa5批量缩短多个 URL
User: Shorten these URLs for my social media posts:
- https://example.com/blog/very-long-article-title-about-ai
- https://example.com/products/new-release-2024
Claude: I'll shorten both URLs at once.
[Calls shorturl_batch_create with urls=[...]]为文档创建链接
User: I need clean short links for these reference URLs in my doc.
Claude: I'll create short links for all your references.
[Calls shorturl_batch_create with the list of URLs]响应结构
成功响应
{
"success": true,
"data": {
"url": "https://surl.id/1uHCs01xa5"
}
}错误响应
{
"success": false,
"error": {
"code": "api_error",
"message": "fetch failed"
},
"trace_id": "2cf86e86-22a4-46e1-ac2f-032c0f2a4e89"
}配置
环境变量
变量 | 描述 | 默认值 |
| 来自 AceDataCloud 的 API 令牌 | 必需 |
| API 基础 URL |
|
| OAuth 客户端 ID(托管模式) | — |
| 平台基础 URL |
|
| 请求超时(秒) |
|
| 日志级别 |
|
命令行选项
mcp-shorturl --help
Options:
--version Show version
--transport Transport mode: stdio (default) or http
--port Port for HTTP transport (default: 8000)开发
设置开发环境
# Clone repository
git clone https://github.com/AceDataCloud/ShortURLMCP.git
cd ShortURLMCP
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # or `.venv\Scripts\activate` on Windows
# Install with dev dependencies
pip install -e ".[dev,test]"运行测试
# Run unit tests
pytest
# Run with coverage
pytest --cov=core --cov=tools
# Run integration tests (requires API token)
pytest tests/test_integration.py -m integration代码质量
# Format code
ruff format .
# Lint code
ruff check .
# Type check
mypy core tools构建与发布
# Install build dependencies
pip install -e ".[release]"
# Build package
python -m build
# Upload to PyPI
twine upload dist/*项目结构
ShortURLMCP/
├── core/ # Core modules
│ ├── __init__.py
│ ├── client.py # HTTP client for ShortURL API
│ ├── config.py # Configuration management
│ ├── exceptions.py # Custom exceptions
│ └── server.py # MCP server initialization
├── tools/ # MCP tool definitions
│ ├── __init__.py
│ ├── shorturl_tools.py # URL shortening tools
│ └── info_tools.py # Information tools
├── prompts/ # MCP prompt templates
│ └── __init__.py
├── tests/ # Test suite
│ ├── conftest.py
│ ├── test_client.py
│ ├── test_config.py
│ └── test_integration.py
├── deploy/ # Deployment configs
│ ├── run.sh
│ └── production/
│ ├── deployment.yaml
│ ├── ingress.yaml
│ └── service.yaml
├── .env.example # Environment template
├── .gitignore
├── .ruff.toml # Ruff linter configuration
├── CHANGELOG.md
├── Dockerfile # Docker image for HTTP mode
├── docker-compose.yaml # Docker Compose config
├── LICENSE
├── main.py # Entry point
├── pyproject.toml # Project configuration
└── README.mdAPI 参考
此服务器封装了 AceDataCloud 短 URL API:
端点:
POST /shorturl输入:
{ "content": "https://long-url.example.com/..." }输出:
{ "success": true, "data": { "url": "https://surl.id/..." } }定价: 免费(0 积分)
认证: Bearer 令牌
完整 API 文档:AceDataCloud 平台
许可证
MIT 许可证 - 详情请参阅 LICENSE。
Latest Blog Posts
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/AceDataCloud/MCPShortURL'
If you have feedback or need assistance with the MCP directory API, please join our Discord server