README
🚀 Twilio 消息服务 MCP 服务器
这是一个使用 Twilio API 发送 SMS 消息的 MCP(模型上下文协议)服务器,能有效集成 MCP 客户端,安全便捷地完成消息发送。
🚀 快速开始
本服务器可直接使用 npx 运行,也可进行全局安装后使用。
✨ 主要特性
- 通过 Twilio API 发送 SMS 消息。
- 集成与 Claude Desktop 等 MCP 客户端。
- 安全处理凭证,无需使用环境变量。
- 使用 Twilio API Keys 提高安全性。
📦 安装指南
使用 npx 直接运行
npx twilio-messaging-mcp-server <accountSid> <apiKey> <apiSecret> <number>
全局安装
npm install -g twilio-messaging-mcp-server
twilio-messaging-mcp-server <accountSid> <apiKey> <apiSecret> <number>
📚 详细文档
配置说明
服务器需要以下参数:
accountSid:你的 Twilio 账户 SID(必须以 "AC" 开头,会进行验证)。apiKey:你的 Twilio API Key(以 "SK" 开头)。apiSecret:你的 Twilio API Secret。number:用于发送消息的 Twilio 电话号码(E.164 格式,例如 +1234567890)。
安全注意事项
⚠️ 重要提示
此服务器使用 API Keys 和 Secret 而不是 Auth Tokens 提高安全性。这种做法提供更好的访问控制,并且可以在需要时 revoke 凭证。有关详细信息,请参阅 Twilio API Keys 文档。
与 Claude Desktop 的使用
本地开发
对于本地开发(当包未发布到 npm 时),将以下内容添加到你的 Claude Desktop 配置文件 (~/Library/Application Support/Claude/claude_desktop_config.json on macOS 或 %APPDATA%\Claude\claude_desktop_config.json on Windows):
{
"mcpServers": {
"twilio-messaging": {
"command": "node",
"args": [
"/PATHTONODE/twilio-messaging-mcp-server/build/index.js",
"your_account_sid_here",
"your_api_key_here",
"your_api_secret_here",
"+1234567890"
]
}
}
}
将值替换为你的实际 Twilio 凭证:
- 第一个参数:你的 Twilio 账户 SID(以 "AC" 开头)。
- 第二个参数:你的 Twilio API Key(以 "SK" 开头)。
- 第三个参数:你的 Twilio API Secret。
- 第四个参数:你的 Twilio 电话号码,E.164 格式。
你可以通过以下命令获取绝对路径:
# 在 macOS/Linux 上
echo "$(pwd)/build/index.js"
# 在 Windows(PowerShell 上)
Write-Output "$((Get-Location).Path)\build\index.js"
发布到 npm 后
一旦包发布到 npm,你可以使用以下配置:
{
"mcpServers": {
"twilio-messaging": {
"command": "node",
"args": [
"twilio-messaging-mcp-server/build/index.js",
"your_account_sid_here",
"your_api_key_here",
"your_api_secret_here",
"+1234567890"
]
}
}
}
可用工具
- send-sms:通过 Twilio API 发送 SMS 消息的工具。
- 参数:
--accountSid:你的 Twilio 账户 SID。--apiKey:你的 Twilio API Key。--apiSecret:你的 Twilio API Secret。--to:接收消息的电话号码。--message:要发送的消息。
- 参数:
开发说明
安装依赖项
npm install
运行测试服务器
node build/index.js <accountSid> <apiKey> <apiSecret> <number>
示例
node build/index.js AC123456789 SK0123456789 abcdefghijklmn +1234567890
📄 许可证
[在此处添加许可证信息]
Scan to contact