zendbot-line-mcp-server
by MNGCS10
README.md
# zendbot-line-mcp-server
Remote MCP server that lets Claude (Cowork / claude.ai) send and inspect LINE OA
messages for ทัวริสอัส, by proxying the *already-deployed* `zendbot-line-console`
Worker instead of talking to the LINE Messaging API directly.
```
Claude / Cowork ──MCP (Streamable HTTP)──▶ zendbot-line-mcp-server (this repo)
│ HTTPS + X-Console-Password
▼
zendbot-line-console Worker (existing)
│ Bearer <LINE token>
▼
LINE Messaging API
```
No new LINE channel token, no duplicated sending logic — this is a thin,
auth-gated adapter in front of the console you already run in production.
## Tools exposed
| Tool | Type | What it does |
|---|---|---|
| `line_get_dashboard` | read-only | Quota/usage/followers/estimated cost |
| `line_list_contacts` | read-only | Known contacts (userId, name, last seen) |
| `line_get_profile` | read-only | Look up one user's display name by userId |
| `line_send_push_message` | write | Text message to ONE user |
| `line_send_multicast_message` | write | Text message to a specific list of userIds |
| `line_send_broadcast_message` | write, **destructive** | Text message to ALL followers — requires `confirm: true`, no confirm = nothing is sent |
All five map onto the console's existing `/api/dashboard`, `/api/contacts`,
`/api/profile`, and `/api/send` (push/multicast/broadcast) routes.
## 1. Configure
Edit `wrangler.jsonc` → `vars.CONSOLE_BASE_URL` to your deployed
`zendbot-line-console` Worker URL (the same one the console's frontend calls),
e.g.:
```jsonc
"vars": {
"CONSOLE_BASE_URL": "https://zendbot-line-console.<your-account>.workers.dev"
}
```
## 2. Install & set secrets
```bash
npm install
# Bearer token Cowork/claude.ai will present to THIS server.
# Generate one yourself, e.g.: openssl rand -hex 32
npx wrangler secret put MCP_AUTH_TOKEN
# Same value as the CONSOLE_PASSWORD secret already set on zendbot-line-console.
npx wrangler secret put CONSOLE_PASSWORD
```
These are two *different* secrets on purpose:
- `MCP_AUTH_TOKEN` protects this MCP server from anyone else calling it.
- `CONSOLE_PASSWORD` is what this server forwards to the console — it never
touches the LINE channel access token itself, which stays only on the
console Worker as today.
## 3. Deploy
```bash
npx wrangler deploy
```
Note the URL it prints, e.g. `https://zendbot-line-mcp-server.<account>.workers.dev`.
The MCP endpoint is the Worker root (no `/mcp` suffix needed — the whole
`fetch` handler is the MCP handler).
## 4. Test locally (optional but recommended)
```bash
npx wrangler dev
```
In another terminal:
```bash
npx @modelcontextprotocol/inspector
```
Point the Inspector at `http://localhost:8787` with a Streamable HTTP
transport and an `Authorization: Bearer <MCP_AUTH_TOKEN>` header, then try
`line_get_dashboard` first (read-only, safe) before any send tool.
## 5. Register as a custom connector in claude.ai / Cowork
1. claude.ai → Settings → Connectors → Add custom connector
2. URL: the Worker URL from step 3
3. Auth: Bearer token = the `MCP_AUTH_TOKEN` you set in step 2
4. Save, then enable it for the chat/session you want to use it in
Cowork will then list `line_get_dashboard`, `line_send_push_message`, etc. as
callable tools.
## Safety notes
- `line_send_broadcast_message` will refuse to send unless `confirm: true` is
explicitly passed — treat this the same as any other "post publicly"
action: get explicit approval for the exact message text before approving
that confirm flag.
- Nothing here reads or stores the LINE channel access token — it stays on
`zendbot-line-console` exactly as today (CLEARKEY principle preserved).
- Rotate `MCP_AUTH_TOKEN` any time by re-running
`npx wrangler secret put MCP_AUTH_TOKEN` and updating the connector in
claude.ai.
## Extending
Natural next tools to add (same pattern — wrap another `/api/*` route):
`line_send_flex_message` (booking/quote/invoice worksheets), `line_send_sticker`
(official or brand stickers), `line_list_followers`. Add each as a
`server.registerTool(...)` block in `src/index.ts` following the existing ones.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo issues