本项目是一个用于与 Dub.co 短链接服务集成的 Model Context Protocol (MCP) 服务器。借助该服务器,AI 助手能够运用 MCP 协议来创建、更新和删除短链接,为短链接管理提供了便捷的解决方案。
要使用此服务器,您需要做好以下准备:
npm install dub-mcp-server
git clone https://github.com/yourusername/dub-mcp-server.git
cd dub-mcp-server
npm install
在项目根目录下创建 config.json 文件:
{
"dubApiKey": "your_api_key_here",
"mcpEnabled": true,
"tools": {
"createLink": {
"enabled": true,
"description": "创建新的短链接"
},
"updateLink": {
"enabled": true,
"description": "更新现有短链接"
},
"deleteLink": {
"enabled": true,
"description": "删除短链接"
}
}
}
npm start
npm install --save-dev typescript @types/node ts-node
npx tsc --init
在 MCP 配置文件中添加以下内容:
{
"mcpServers": {
"dub": {
"command": "node",
"args": ["index.js"],
"env": {
"DUB_API_KEY": "your_api_key_here"
}
}
}
}
{
"url": "https://example.com",
"key": "custom-slug",
"externalId": "12345"
}
{
"linkId": "existingLinkId",
"url": "https://new-url.com"
}
{
"linkId": "existingLinkId"
}
git clone https://github.com/yourusername/dub-mcp-server.git
npm run dev
本项目使用 ISC 许可证,具体内容请参见 LICENSE 文件。
由 [Your Name] 开发,如需反馈请联系 [your.email@example.com]。
这个文档展示了如何使用 Dub 短链接服务 MCP 服务器,并提供了详细的配置和使用说明。