thaibulksms
MCP server for ThaiBulkSMS and ThaiBulkMail APIs, enabling SMS, email, credit check, and OTP operations through natural language.
README
@thaibulksms/tbs
Zero-dependency MCP & CLI for ThaiBulkSMS and ThaiBulkMail APIs.
Install
npm install -g @thaibulksms/tbs
Quick Start
# 1. Save credentials (from developer.thaibulksms.com)
tbs login
# 2. Use it
tbs send 0812345678 "Hello" --sender OTP_SMS # Send SMS
tbs email a@b.com "Subject" --from s@d.com --template <uuid> # Send email
tbs credit # Check balance
tbs otp 0812345678 # SMS OTP
tbs email-otp a@b.com --template <uuid> # Email OTP
No install needed with npx:
npx @thaibulksms/tbs login
npx @thaibulksms/tbs send 0812345678 "Hello"
Add to AI Agent (MCP)
Claude Code
claude mcp add thaibulksms \
-e THAIBULKSMS_API_KEY=xxx \
-e THAIBULKSMS_API_SECRET=xxx \
-e THAIBULKSMS_OTP_KEY=xxx \
-e THAIBULKSMS_OTP_SECRET=xxx \
-- npx -y @thaibulksms/tbs
Or .mcp.json (project-scoped, commit to git):
{
"mcpServers": {
"thaibulksms": {
"command": "npx",
"args": ["-y", "@thaibulksms/tbs"],
"env": {
"THAIBULKSMS_API_KEY": "${THAIBULKSMS_API_KEY}",
"THAIBULKSMS_API_SECRET": "${THAIBULKSMS_API_SECRET}",
"THAIBULKSMS_OTP_KEY": "${THAIBULKSMS_OTP_KEY}",
"THAIBULKSMS_OTP_SECRET": "${THAIBULKSMS_OTP_SECRET}"
}
}
}
}
Gemini CLI
gemini mcp add thaibulksms -- npx -y @thaibulksms/tbs
OpenCode
{
"mcp": {
"thaibulksms": {
"type": "local",
"command": ["npx", "-y", "@thaibulksms/tbs"],
"environment": {
"THAIBULKSMS_API_KEY": "{env:THAIBULKSMS_API_KEY}",
"THAIBULKSMS_API_SECRET": "{env:THAIBULKSMS_API_SECRET}",
"THAIBULKSMS_OTP_KEY": "{env:THAIBULKSMS_OTP_KEY}",
"THAIBULKSMS_OTP_SECRET": "{env:THAIBULKSMS_OTP_SECRET}"
},
"enabled": true
}
}
}
OpenClaw
OpenClaw reads .mcp.json (same as Claude Code). Drop the .mcp.json file in your project root — OpenClaw picks it up automatically.
Claude Desktop
Config: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
{
"mcpServers": {
"thaibulksms": {
"command": "npx",
"args": ["-y", "@thaibulksms/tbs"],
"env": {
"THAIBULKSMS_API_KEY": "your_key",
"THAIBULKSMS_API_SECRET": "your_secret",
"THAIBULKSMS_OTP_KEY": "your_otp_key",
"THAIBULKSMS_OTP_SECRET": "your_otp_secret"
}
}
}
}
Then ask your agent: "Check my SMS credit balance"
CLI Commands
tbs login Save API credentials
tbs credit Check SMS + email credit
tbs send <to> <message> Send SMS
tbs email <to> <subject> Send email (template)
tbs otp <to> Request SMS OTP
tbs verify <token> <pin> Verify SMS OTP
tbs email-otp <to> Request email OTP
tbs email-verify <token> <code> Verify email OTP
tbs profiles List saved profiles
tbs help <command> Per-command help
Flags
| Flag | Description | Commands |
|---|---|---|
--sender <id> |
SMS sender ID (default: SMS.) |
send |
--from <email> |
Sender email address | email |
--template <uuid> |
Template UUID | email, email-otp |
--json |
Machine-readable output | all |
--profile <name> |
Use specific profile | all |
Examples
tbs send 0812345678 "Hello" --sender OTP_SMS
tbs send 0812345678 "Hello" --json
tbs email user@example.com "Subject" --from sender@domain.com --template <uuid>
tbs credit --json
tbs otp 0812345678
tbs verify <token> 1234
tbs email-otp user@example.com --template <uuid>
tbs email-verify <token> 733923
tbs login --profile production
tbs credit --profile production
MCP Tools (8)
| Tool | Description |
|---|---|
send_sms |
Send SMS to one Thai mobile number |
send_email |
Send email via ThaiBulkMail template |
check_sms_credit |
Check SMS credit balance |
check_email_credit |
Check email credit balance |
request_otp |
Send OTP PIN via SMS |
verify_otp |
Verify SMS OTP PIN |
request_email_otp |
Send OTP code via email |
verify_email_otp |
Verify email OTP code |
Credentials & Setup
API Keys
| What | Where to get it |
|---|---|
| SMS/Email API Key & Secret | Dashboard > Developer Settings |
| SMS OTP Key & Secret | OTP Manager |
| SMS Sender Name | Dashboard > Sender Name (must register before use) |
| Email Template | Dashboard > Email Templates (create and copy template UUID) |
| Email OTP Template | Dashboard > Email OTP (create and copy template UUID) |
Environment Variables
| Variable | For | Required |
|---|---|---|
THAIBULKSMS_API_KEY |
SMS, Email | Yes |
THAIBULKSMS_API_SECRET |
SMS, Email | Yes |
THAIBULKSMS_OTP_KEY |
SMS OTP | For OTP |
THAIBULKSMS_OTP_SECRET |
SMS OTP | For OTP |
Precedence: --profile flag > env vars > ~/.config/tbs/default.json
SMS/Email use HTTP Basic Auth. SMS OTP uses separate key/secret in request body. Email OTP uses the same Basic Auth as email.
Architecture
src/
index.ts Entry point — CLI commands or MCP (no args)
cli.ts Twilio-style CLI handlers
profile.ts Credential storage (~/.config/tbs/, chmod 0600)
transport.ts MCP JSON-RPC stdio transport (~80 lines)
server.ts MCP tool definitions (raw JSON Schema) + handlers
client.ts ThaiBulk HTTP client (fetch + Basic Auth)
validators.ts Phone/email validation (pure regex)
Zero runtime dependencies. No @modelcontextprotocol/sdk (26MB, 91 packages). Just ~80 lines of JSON-RPC stdio transport using Node.js built-ins.
Development
npm install # Dev deps only
npm test # Node.js
npm run test:bun # Bun
npm run build # Compile
Security
- Credentials in
~/.config/tbs/(chmod 0600) or env vars — never hardcoded - Single-recipient only — no bulk sends
- Thai mobile validation, email header injection prevention
- Human-in-the-loop for destructive MCP tools
- Zero runtime deps = zero supply chain risk
Links
- npm: npmjs.com/package/@thaibulksms/tbs
- GitHub: github.com/thaibulksms/tbs
- API Docs: developer.thaibulksms.com
License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。