这是一个使用 Twilio API 发送 SMS 消息的 MCP(模型上下文协议)服务器,能有效集成 MCP 客户端,安全便捷地完成消息发送。
本服务器可直接使用 npx 运行,也可进行全局安装后使用。
npx 直接运行npx twilio-messaging-mcp-server
npm install -g twilio-messaging-mcp-server
twilio-messaging-mcp-server
服务器需要以下参数:
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 文档。
对于本地开发(当包未发布到 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 凭证:
你可以通过以下命令获取绝对路径:
# 在 macOS/Linux 上
echo "$(pwd)/build/index.js"
# 在 Windows(PowerShell 上)
Write-Output "$((Get-Location).Path)\build\index.js"
一旦包发布到 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"
]
}
}
}
--accountSid:你的 Twilio 账户 SID。--apiKey:你的 Twilio API Key。--apiSecret:你的 Twilio API Secret。--to:接收消息的电话号码。--message:要发送的消息。npm install
node build/index.js
node build/index.js AC123456789 SK0123456789 abcdefghijklmn +1234567890
[在此处添加许可证信息]