VS Code + 短網址 MCP

你寫了一篇技術博客,裡面引用了 7、8 個外部鏈接——GitHub Issue、Stack Overflow、RFC 文檔……每個 URL 都七八十個字符長。

貼到微信群或者釘釘裡?鏈接直接折行,點都點不準。放 PPT 上?占半個螢幕。

以前的做法:開一個 bit.ly 的標籤頁,一個一個粘貼、縮短、再拷回來。現在你可以在 VS Code 裡對 Copilot 說一句話,短網址 MCP 全程幫你搞定,不用切窗口。

第 1 步:獲取 API Key

打開 Ace Data Cloud 應用列表,進入可用的應用並複製 API Key。

獲取 Ace Data Cloud API Key

第 2 步:安裝插件

  1. 打開 VS Code 擴展市場(Cmd+Shift+X)
  2. 搜索 Short URL MCP,或直接搜索擴展 ID:acedatacloud.mcp-shorturl
  3. 點擊 Install,安裝後按提示重載窗口

第 3 步:填寫 API Key

  1. 按 Cmd+Shift+P,執行:Short URL MCP: Set Ace Data Cloud API Key
  2. 粘貼 API Key,回車保存(保存在 VS Code SecretStorage / 系統鑰匙串)

如果要換 Key,可執行 Short URL MCP: Clear Ace Data Cloud API Key 後重新設置。

第 4 步:驗證連接

  1. 打開 GitHub Copilot Chat,切到 Agent 模式
  2. 直接提需求並點名 shorturl,例如:用 shorturl 幫我完成這個任務
  3. 首次調用時會自動走到該插件並使用你保存的 API Key

進階:手動 mcp.json(可選)

如果你更偏好手動配置,也可以在項目裡寫 .vscode/mcp.json:

{
  "servers": {
    "shorturl": {
      "type": "http",
      "url": "https://shorturl.mcp.acedata.cloud/mcp",
      "headers": {
        "Authorization": "Bearer ${input:acedata-api-key}"
      }
    }
  },
  "inputs": [
    {
      "id": "acedata-api-key",
      "type": "promptString",
      "description": "Ace Data Cloud API Key",
      "password": true
    }
  ]
}

使用場景

API 文檔分享

你寫了一個接口文檔,要把鏈接發給前端同事。原始地址是一長串帶參數的 Notion 鏈接:

> 把這個鏈接縮短:https://www.notion.so/workspace/API-Documentation-v2-Final-Review-abc123def456...

shorturl_create 生成一個 https://surl.id/xxx 的短鏈接,乾淨利落。

Release Notes 裡的批量鏈接

你在寫版本發布說明,引用了 5 個 GitHub PR 鏈接、3 個 Issue 鏈接。讓 Copilot 幫你逐個處理:

> 幫我把下面這些鏈接全部轉成短鏈接:
> https://github.com/org/repo/pull/142
> https://github.com/org/repo/pull/145
> https://github.com/org/repo/issues/89

二維碼友好

短鏈接生成二維碼更小更易掃——尤其是放在 PPT 或海報上的時候。URL 越短,二維碼的密度越低,掃描成功率越高。

工具列表

工具 說明
shorturl_create 生成短鏈接
shorturl_batch_create 批量生成短鏈接(一次最多 10 個)

其他編輯器配置

  • Cursor — .cursor/mcp.json,mcpServers 下同樣配置
  • Claude Code — 終端命令行配置,詳見 Claude Code + Short URL MCP 教程
  • Claude Desktop — macOS: ~/Library/Application Support/Claude/claude_desktop_config.json;Windows: %APPDATA%\Claude\claude_desktop_config.json

相關鏈接