Bitly MCP Server
官方将您的AI助手转变为数字营销中心,按需创建、整理和分析链接与二维码。
你可以用 Bitly MCP 做什么?
- 缩短长链接 — 让您的AI利用服务器的缩短功能,将任意长链接生成为Bitlink。
- 获取Bitlink详情 — 获取特定Bitlink的元数据、点击次数以及原始长链接。
- 列出可用的Bitly工具 — 让您的AI发现当前可通过MCP服务器访问的Bitly操作。
文档
Bitly MCP Server
欢迎阅读 Bitly MCP Server 指南。
如果你来到这里,可能已经知道什么是 MCP 服务器,但如果你需要入门介绍,请查看我们的“什么是 MCP?”页面。
Bitly MCP Server 提供你期望从 Bitly 界面获得的所有功能——如 Bitly API、bitly.com 网站、Bitly Chrome 扩展、Bitly 移动应用——但这次是为你所选的 AI 代理提供的。
想将 Bitly 与 ChatGPT 一起使用?Bitly MCP Server 或 Bitly 自定义 GPT。想将 Bitly 与 Claude 一起使用?Bitly MCP Server。想将 Bitly 与 Cursor、VSCode 或 Windsurf 一起使用?Bitly MCP Server。
快速设置
Bitly MCP Server 托管于 https://api-ssl.bitly.com/v4/mcp.
身份验证选项:
- OAuth 2.1(推荐) - 对于支持 OAuth 的客户端,这提供基于令牌的安全身份验证,并支持自动客户端注册
- API 令牌 - 对于更简单的设置或不支持 OAuth 的客户端,请使用来自 https://bitly.com/settings/api 的 Bitly API 令牌
以下是配置表格,附有详细说明的链接——如果我们缺少你使用的配置,你可以在“配置详情”页面找到指导。我们将随着时间的推移添加更多配置指南。
| AI 代理 | 配置说明 | 备注 |
|---|---|---|
| ChatGPT | 配置 ChatGPT | 使用动态客户端注册的 OAuth |
| Claude 网页界面 (claude.ai) | 配置 Claude 网页 | 使用动态客户端注册的 OAuth |
| Claude Desktop | 配置 Claude Desktop | 支持 OAuth 和 API 令牌 |
| Claude Code | 配置 Claude Code | HTTP 传输 – 支持 OAuth 和 API 令牌 |
| Cursor | 配置 Cursor | HTTP 传输 – 支持 OAuth 和 API 令牌 |
| VS Code | 配置 VS Code | HTTP 传输 – 支持 OAuth 和 API 令牌 |
| Windsurf | 配置 Windsurf | 使用 npx 代理进行本地连接 |
| 大多数其他兼容 HTTP 的代理 | 查看我们的配置部分 | 通用 HTTP 设置适用于大多数情况 |
配置
Claude Code
添加到 ~/.claude/mcp.json:
对于 OAuth(推荐):
{
"mcpServers": {
"Bitly": {
"type": "http",
"url": "https://api-ssl.bitly.com/v4/mcp"
}
}
}
对于 API 令牌:
{
"mcpServers": {
"Bitly": {
"type": "http",
"url": "https://api-ssl.bitly.com/v4/mcp",
"headers": {
"Authorization": "Bearer YOUR_BITLY_AUTH_TOKEN"
}
}
}
}
添加配置后重启 Claude Code。
Cursor
添加到 ~/.cursor/mcp.json:
添加配置后重启 Cursor。
Claude Desktop
添加到你的 Claude 配置文件:
macOS:~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"Bitly": {
"url": "https://api-ssl.bitly.com/v4/mcp"
}
}
}
对于 API 令牌(使用 npx 代理):
先决条件: 需要 Node.js 20 LTS 或更高版本,并支持
npx。
{
"mcpServers": {
"Bitly": {
"command": "npx",
"args": [
"mcp-remote",
"https://api-ssl.bitly.com/v4/mcp",
"--header",
"Authorization: Bearer ${AUTH_TOKEN}"
],
"env": {
"AUTH_TOKEN": "YOUR_BITLY_AUTH_TOKEN"
}
}
}
}
添加配置后重启 Claude Desktop。
VS Code
添加到工作区中的 ~/.vscode/mcp.json:
{
"servers": {
"Bitly": {
"type": "http",
"url": "https://api-ssl.bitly.com/v4/mcp"
}
}
}
{
"servers": {
"Bitly": {
"type": "http",
"url": "https://api-ssl.bitly.com/v4/mcp",
"headers": {
"Authorization": "Bearer YOUR_BITLY_AUTH_TOKEN"
}
}
}
}
Windsurf
添加到 ~/.windsurf/config.json:
### Claude Web
For Claude on the web (claude.ai), use OAuth authentication:
1. Navigate to your Claude workspace settings
2. Go to the MCP servers configuration section
3. Add the Bitly MCP Server:
* **Server URL:** `https://api-ssl.bitly.com/v4/mcp`
* **Authentication:** OAuth
When prompted, log in to your Bitly account and authorize the connection. Claude will handle the OAuth flow automatically using Dynamic Client Registration.
> **Note:** OAuth support in Claude Web requires Workspace Admin enablement for Team and Enterprise Plans.
### ChatGPT
For ChatGPT, use OAuth authentication:
1. In ChatGPT, go to **Settings > Apps & Connectors > Advanced Settings**
2. Toggle **Developer Mode** on
3. Go back and click **Create**
4. Add the Bitly MCP Server:
* **Server URL:** `https://api-ssl.bitly.com/v4/mcp`
* **Authentication:** OAuth
When prompted, log in to your Bitly account and authorize the connection. ChatGPT will handle the OAuth flow automatically using Dynamic Client Registration.
> **Note:** MCP support in ChatGPT requires Plus, Team, Enterprise, or Edu plans. For workspace plans, you must be an admin to access these settings.
## Authentication
The Bitly MCP Server supports two authentication methods:
### OAuth 2.1 with Dynamic Client Registration (Recommended)
For clients that support OAuth (like Claude Web, ChatGPT, and other modern AI assistants), OAuth provides:
* **Enhanced Security** \- No need to manually manage API tokens
* **Automatic Client Registration** \- Dynamic Client Registration (DCR) handles client setup automatically
* **Token Refresh** \- Automatic token renewal without manual intervention
When configuring OAuth, your AI client will:
1. Redirect you to Bitly's authorization page
2. Ask you to log in and authorize the connection
3. Automatically register as an OAuth client using DCR
4. Receive and manage access tokens transparently
### API Token (Alternative)
For simpler setups or clients without OAuth support:
1. Log in to your Bitly account at bitly.com
2. Navigate to Settings → API
3. Click Generate Access Token
4. Copy the token and store it securely
5. Use it in your MCP client configuration as shown in the examples above
## Test It Out
Once configured, try asking your AI:
"Bitly 有哪些可用工具?"
"请缩短此 URL:https://example.com/very-long-url"
完成这些后,你就一切就绪了!
---