@zyphr-dev/mcp-server 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +117 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2315 -0
- package/dist/index.js.map +1 -0
- package/package.json +62 -0
- package/src/client.ts +25 -0
- package/src/config.test.ts +64 -0
- package/src/config.ts +33 -0
- package/src/index.ts +24 -0
- package/src/integration/quickstart/email.ts +646 -0
- package/src/integration/quickstart/inbox.ts +222 -0
- package/src/integration/quickstart/index.ts +45 -0
- package/src/integration/quickstart/push.ts +216 -0
- package/src/integration/quickstart/quickstart.test.ts +108 -0
- package/src/integration/quickstart/sms.ts +205 -0
- package/src/integration/quickstart/webhook.ts +664 -0
- package/src/integration/quickstart-types.ts +31 -0
- package/src/integration/sdk-snippets.test.ts +63 -0
- package/src/integration/sdk-snippets.ts +248 -0
- package/src/result.test.ts +107 -0
- package/src/result.ts +65 -0
- package/src/schemas.ts +231 -0
- package/src/server.ts +26 -0
- package/src/tools/index.ts +7 -0
- package/src/tools/integration.ts +54 -0
- package/src/tools/send.ts +153 -0
- package/src/tools/subscribers.ts +126 -0
- package/src/tools/templates.ts +87 -0
- package/src/tools/webhooks.ts +82 -0
package/README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# @zyphr-dev/mcp-server
|
|
2
|
+
|
|
3
|
+
Model Context Protocol (MCP) server for [Zyphr](https://zyphr.dev). Wraps the Zyphr API as MCP tools so any MCP-compatible client can send emails, push notifications, SMS, and in-app messages directly from inside an AI loop.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx -y @zyphr-dev/mcp-server
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The binary is also exposed as `zyphr-mcp` when installed globally or as a dependency.
|
|
12
|
+
|
|
13
|
+
## Configure
|
|
14
|
+
|
|
15
|
+
Add the following to your MCP client's server configuration:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"mcpServers": {
|
|
20
|
+
"zyphr": {
|
|
21
|
+
"command": "npx",
|
|
22
|
+
"args": ["-y", "@zyphr-dev/mcp-server"],
|
|
23
|
+
"env": {
|
|
24
|
+
"ZYPHR_API_KEY": "zy_test_..."
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
End users always point at production (`https://api.zyphr.dev/v1`) using either a `zy_test_*` or `zy_live_*` key from the Zyphr dashboard.
|
|
32
|
+
|
|
33
|
+
## Environment variables
|
|
34
|
+
|
|
35
|
+
| Variable | Required | Default | Notes |
|
|
36
|
+
| --- | --- | --- | --- |
|
|
37
|
+
| `ZYPHR_API_KEY` | Yes | — | `zy_live_*` or `zy_test_*` |
|
|
38
|
+
| `ZYPHR_BASE_URL` | No | `https://api.zyphr.dev/v1` | Override for non-production environments |
|
|
39
|
+
| `ZYPHR_READ_ONLY` | No | `false` | When `true`, mutating tools (sends, creates, updates) are not registered |
|
|
40
|
+
| `ZYPHR_ALLOWED_TOOLS` | No | _(all)_ | Comma-separated whitelist of tool names. Overrides `ZYPHR_READ_ONLY` |
|
|
41
|
+
|
|
42
|
+
The server fails fast with a clear stderr message if `ZYPHR_API_KEY` is missing.
|
|
43
|
+
|
|
44
|
+
## Tools
|
|
45
|
+
|
|
46
|
+
### Integration (zero-to-first-send helpers)
|
|
47
|
+
|
|
48
|
+
| Tool | Description |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| `get_sdk_install_for_language` | Return install commands + minimal init snippet + env vars for the chosen language (`node`, `python`, `ruby`, `go`, `php`, `csharp`). Optional `packageManager` override narrows to a single command (e.g. `yarn` instead of `npm`). |
|
|
51
|
+
| `get_quickstart_for_channel` | Return drop-in service file(s) for the chosen channel (`email`, `push`, `sms`, `inbox`, `webhook`) + language + optional framework (`express`, `nextjs`, `flask`, `fastapi`, `rails`, `laravel`, `aspnetcore`). Webhook handlers always verify the HMAC signature. Unrecognized frameworks fall back to plain SDK code. |
|
|
52
|
+
|
|
53
|
+
### Send
|
|
54
|
+
|
|
55
|
+
| Tool | Description |
|
|
56
|
+
| --- | --- |
|
|
57
|
+
| `send_email` | Send a transactional email. Supports inline `html`/`text` or `templateId`+`templateData`. |
|
|
58
|
+
| `send_push` | Send a push notification to a user, device, or subscriber. |
|
|
59
|
+
| `send_sms` | Send an SMS message (E.164 recipient). |
|
|
60
|
+
| `send_inbox_message` | Deliver an in-app inbox message to a subscriber. |
|
|
61
|
+
|
|
62
|
+
### Templates
|
|
63
|
+
|
|
64
|
+
| Tool | Description |
|
|
65
|
+
| --- | --- |
|
|
66
|
+
| `list_templates` | List templates in the account. |
|
|
67
|
+
| `get_template` | Fetch a single template by ID. |
|
|
68
|
+
| `render_template` | Preview a template with the given variables _without_ sending. Returns rendered subject/html/text. |
|
|
69
|
+
| `create_template` | Create a new template. |
|
|
70
|
+
|
|
71
|
+
### Subscribers
|
|
72
|
+
|
|
73
|
+
| Tool | Description |
|
|
74
|
+
| --- | --- |
|
|
75
|
+
| `find_subscriber` | Look up a subscriber by external ID. |
|
|
76
|
+
| `list_subscribers` | List subscribers (filter by status or email). |
|
|
77
|
+
| `create_subscriber` | Create a subscriber. |
|
|
78
|
+
| `update_subscriber` | Update a subscriber. Pass `null` for email/phone/name/avatarUrl to clear them. |
|
|
79
|
+
| `set_subscriber_preferences` | Set notification preferences for a subscriber. |
|
|
80
|
+
|
|
81
|
+
### Webhooks
|
|
82
|
+
|
|
83
|
+
| Tool | Description |
|
|
84
|
+
| --- | --- |
|
|
85
|
+
| `list_webhooks` | List configured webhook endpoints. |
|
|
86
|
+
| `create_webhook` | Register a new webhook endpoint subscribed to one or more event types. |
|
|
87
|
+
| `get_webhook_deliveries` | Inspect delivery history for a webhook (filter by status, event type, or date range). |
|
|
88
|
+
|
|
89
|
+
## Safety
|
|
90
|
+
|
|
91
|
+
Two environment variables let you scope what the AI is allowed to do:
|
|
92
|
+
|
|
93
|
+
- **`ZYPHR_READ_ONLY=true`** suppresses every mutating tool — sends, creates, updates. Only the read-only tools (`list_*`, `get_*`, `find_*`, `render_template`, `get_webhook_deliveries`) remain. Use this when you want the AI to investigate or report without touching state.
|
|
94
|
+
- **`ZYPHR_ALLOWED_TOOLS="tool_a,tool_b"`** is a comma-separated whitelist. When set, only those tools are registered. Whitelist takes precedence over `ZYPHR_READ_ONLY`, so you can explicitly allow a mutating tool inside an otherwise read-only profile.
|
|
95
|
+
|
|
96
|
+
No `delete_*` tools are exposed in this release. Destructive operations remain dashboard-only.
|
|
97
|
+
|
|
98
|
+
### Example prompts
|
|
99
|
+
|
|
100
|
+
Once the server is connected, your AI client can act on prompts like:
|
|
101
|
+
|
|
102
|
+
- "I'm starting a new Node project and want to use Zyphr — what do I install?" → calls `get_sdk_install_for_language`
|
|
103
|
+
- "Add Zyphr email to my Express app." → calls `get_quickstart_for_channel`, returns SDK singleton + Express route
|
|
104
|
+
- "Show me how to verify a Zyphr webhook in a FastAPI route." → calls `get_quickstart_for_channel`, returns a handler with HMAC verification and 5-minute replay tolerance
|
|
105
|
+
- "Send a welcome email to alice@example.com with subject 'Welcome to Acme' and a short HTML greeting."
|
|
106
|
+
- "Preview the welcome email template with name='Alice' and verify_link='https://example.com/v/abc'."
|
|
107
|
+
- "Look up the subscriber for external ID `user_123` and update their email preferences for marketing to false."
|
|
108
|
+
- "Push a notification titled 'Order shipped' to subscriber `usr_42`."
|
|
109
|
+
- "Send an SMS to +14155551234 letting them know their appointment is confirmed."
|
|
110
|
+
- "Drop an inbox message for subscriber `usr_42` with title 'New report ready' and an action URL to the report page."
|
|
111
|
+
- "Show me the last 20 webhook deliveries for webhook `whk_abc` that failed in the past hour and tell me why."
|
|
112
|
+
|
|
113
|
+
Errors from the Zyphr API are surfaced verbatim as MCP errors, so the AI can react to validation failures, rate limits, or auth problems without guessing.
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
|
|
117
|
+
MIT
|
package/dist/index.d.ts
ADDED