@zyphr-dev/mcp-server 0.1.0 → 0.1.1
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/package.json +5 -6
- package/src/client.ts +0 -25
- package/src/config.test.ts +0 -64
- package/src/config.ts +0 -33
- package/src/index.ts +0 -24
- package/src/integration/quickstart/email.ts +0 -646
- package/src/integration/quickstart/inbox.ts +0 -222
- package/src/integration/quickstart/index.ts +0 -45
- package/src/integration/quickstart/push.ts +0 -216
- package/src/integration/quickstart/quickstart.test.ts +0 -108
- package/src/integration/quickstart/sms.ts +0 -205
- package/src/integration/quickstart/webhook.ts +0 -664
- package/src/integration/quickstart-types.ts +0 -31
- package/src/integration/sdk-snippets.test.ts +0 -63
- package/src/integration/sdk-snippets.ts +0 -248
- package/src/result.test.ts +0 -107
- package/src/result.ts +0 -65
- package/src/schemas.ts +0 -231
- package/src/server.ts +0 -26
- package/src/tools/index.ts +0 -7
- package/src/tools/integration.ts +0 -54
- package/src/tools/send.ts +0 -153
- package/src/tools/subscribers.ts +0 -126
- package/src/tools/templates.ts +0 -87
- package/src/tools/webhooks.ts +0 -82
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import type { QuickstartChannelMap } from '../quickstart-types.js';
|
|
2
|
-
|
|
3
|
-
const DOCS = 'https://docs.zyphr.dev/channels/sms';
|
|
4
|
-
const ENV: string[] = ['ZYPHR_API_KEY'];
|
|
5
|
-
const NEXT_STEPS = [
|
|
6
|
-
'Add ZYPHR_API_KEY to your .env file.',
|
|
7
|
-
'Recipients MUST be in E.164 format (e.g. +14155551234).',
|
|
8
|
-
'Provision your SMS sender (phone number or alphanumeric sender ID) in the Zyphr dashboard.',
|
|
9
|
-
];
|
|
10
|
-
|
|
11
|
-
export const smsChannel: QuickstartChannelMap = {
|
|
12
|
-
node: {
|
|
13
|
-
sdk: {
|
|
14
|
-
channel: 'sms',
|
|
15
|
-
language: 'node',
|
|
16
|
-
framework: null,
|
|
17
|
-
variant: 'sdk',
|
|
18
|
-
files: [
|
|
19
|
-
{
|
|
20
|
-
path: 'src/services/sms.ts',
|
|
21
|
-
purpose: 'Send an SMS through Zyphr',
|
|
22
|
-
contents:
|
|
23
|
-
"import { Zyphr } from '@zyphr-dev/node-sdk';\n\n" +
|
|
24
|
-
'const zyphr = new Zyphr({ apiKey: process.env.ZYPHR_API_KEY! });\n\n' +
|
|
25
|
-
'export async function sendOtp(to: string, code: string) {\n' +
|
|
26
|
-
' return await zyphr.sms.sendSms({\n' +
|
|
27
|
-
' to,\n' +
|
|
28
|
-
' body: `Your verification code is ${code}. Expires in 5 minutes.`,\n' +
|
|
29
|
-
' });\n' +
|
|
30
|
-
'}\n',
|
|
31
|
-
overwrite: false,
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
envVarsNeeded: ENV,
|
|
35
|
-
nextSteps: NEXT_STEPS,
|
|
36
|
-
docsUrl: DOCS,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
python: {
|
|
40
|
-
sdk: {
|
|
41
|
-
channel: 'sms',
|
|
42
|
-
language: 'python',
|
|
43
|
-
framework: null,
|
|
44
|
-
variant: 'sdk',
|
|
45
|
-
files: [
|
|
46
|
-
{
|
|
47
|
-
path: 'app/sms.py',
|
|
48
|
-
purpose: 'Send an SMS through Zyphr',
|
|
49
|
-
contents:
|
|
50
|
-
'from .zyphr_client import zyphr_request\n\n' +
|
|
51
|
-
'def send_otp(to: str, code: str) -> dict:\n' +
|
|
52
|
-
' return zyphr_request("POST", "/sms", json={\n' +
|
|
53
|
-
' "to": to,\n' +
|
|
54
|
-
' "body": f"Your verification code is {code}. Expires in 5 minutes.",\n' +
|
|
55
|
-
' })\n',
|
|
56
|
-
overwrite: false,
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
envVarsNeeded: ENV,
|
|
60
|
-
nextSteps: NEXT_STEPS,
|
|
61
|
-
docsUrl: DOCS,
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
ruby: {
|
|
65
|
-
sdk: {
|
|
66
|
-
channel: 'sms',
|
|
67
|
-
language: 'ruby',
|
|
68
|
-
framework: null,
|
|
69
|
-
variant: 'sdk',
|
|
70
|
-
files: [
|
|
71
|
-
{
|
|
72
|
-
path: 'app/services/sms_service.rb',
|
|
73
|
-
purpose: 'Send an SMS through Zyphr',
|
|
74
|
-
contents:
|
|
75
|
-
'class SmsService\n' +
|
|
76
|
-
' def self.send_otp(to:, code:)\n' +
|
|
77
|
-
' Zyphr::SMSApi.new.send_sms(\n' +
|
|
78
|
-
' Zyphr::SendSmsRequest.new(\n' +
|
|
79
|
-
' to: to,\n' +
|
|
80
|
-
" body: \"Your verification code is #{code}. Expires in 5 minutes.\"\n" +
|
|
81
|
-
' )\n' +
|
|
82
|
-
' )\n' +
|
|
83
|
-
' end\n' +
|
|
84
|
-
'end\n',
|
|
85
|
-
overwrite: false,
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
envVarsNeeded: ENV,
|
|
89
|
-
nextSteps: NEXT_STEPS,
|
|
90
|
-
docsUrl: DOCS,
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
go: {
|
|
94
|
-
sdk: {
|
|
95
|
-
channel: 'sms',
|
|
96
|
-
language: 'go',
|
|
97
|
-
framework: null,
|
|
98
|
-
variant: 'sdk',
|
|
99
|
-
files: [
|
|
100
|
-
{
|
|
101
|
-
path: 'internal/notify/sms.go',
|
|
102
|
-
purpose: 'Send an SMS through Zyphr',
|
|
103
|
-
contents:
|
|
104
|
-
'package notify\n\n' +
|
|
105
|
-
'import "yourapp/internal/zyphr"\n\n' +
|
|
106
|
-
'func SendOtp(client *zyphr.Client, to, code string) ([]byte, error) {\n' +
|
|
107
|
-
'\treturn client.Do("POST", "/sms", map[string]any{\n' +
|
|
108
|
-
'\t\t"to": to,\n' +
|
|
109
|
-
'\t\t"body": "Your verification code is " + code + ". Expires in 5 minutes.",\n' +
|
|
110
|
-
'\t})\n' +
|
|
111
|
-
'}\n',
|
|
112
|
-
overwrite: false,
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
envVarsNeeded: ENV,
|
|
116
|
-
nextSteps: NEXT_STEPS,
|
|
117
|
-
docsUrl: DOCS,
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
php: {
|
|
121
|
-
sdk: {
|
|
122
|
-
channel: 'sms',
|
|
123
|
-
language: 'php',
|
|
124
|
-
framework: null,
|
|
125
|
-
variant: 'sdk',
|
|
126
|
-
files: [
|
|
127
|
-
{
|
|
128
|
-
path: 'app/Services/SmsService.php',
|
|
129
|
-
purpose: 'Send an SMS through Zyphr',
|
|
130
|
-
contents:
|
|
131
|
-
'<?php\n\n' +
|
|
132
|
-
'namespace App\\Services;\n\n' +
|
|
133
|
-
'use GuzzleHttp\\Client;\n\n' +
|
|
134
|
-
'class SmsService\n' +
|
|
135
|
-
'{\n' +
|
|
136
|
-
' public function sendOtp(string $to, string $code): array\n' +
|
|
137
|
-
' {\n' +
|
|
138
|
-
" $http = new Client([\n" +
|
|
139
|
-
" 'base_uri' => 'https://api.zyphr.dev/v1/',\n" +
|
|
140
|
-
" 'headers' => [\n" +
|
|
141
|
-
" 'X-API-Key' => getenv('ZYPHR_API_KEY'),\n" +
|
|
142
|
-
" 'Content-Type' => 'application/json',\n" +
|
|
143
|
-
' ],\n' +
|
|
144
|
-
" ]);\n" +
|
|
145
|
-
" $r = $http->post('sms', ['json' => [\n" +
|
|
146
|
-
" 'to' => $to,\n" +
|
|
147
|
-
" 'body' => \"Your verification code is {$code}. Expires in 5 minutes.\",\n" +
|
|
148
|
-
' ]]);\n' +
|
|
149
|
-
" return json_decode((string) $r->getBody(), true);\n" +
|
|
150
|
-
' }\n' +
|
|
151
|
-
'}\n',
|
|
152
|
-
overwrite: false,
|
|
153
|
-
},
|
|
154
|
-
],
|
|
155
|
-
envVarsNeeded: ENV,
|
|
156
|
-
nextSteps: NEXT_STEPS,
|
|
157
|
-
docsUrl: DOCS,
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
csharp: {
|
|
161
|
-
sdk: {
|
|
162
|
-
channel: 'sms',
|
|
163
|
-
language: 'csharp',
|
|
164
|
-
framework: null,
|
|
165
|
-
variant: 'sdk',
|
|
166
|
-
files: [
|
|
167
|
-
{
|
|
168
|
-
path: 'Services/SmsService.cs',
|
|
169
|
-
purpose: 'Send an SMS through Zyphr',
|
|
170
|
-
contents:
|
|
171
|
-
'using ZyphrDev.SDK.Api;\n' +
|
|
172
|
-
'using ZyphrDev.SDK.Client;\n' +
|
|
173
|
-
'using ZyphrDev.SDK.Model;\n\n' +
|
|
174
|
-
'namespace YourApp.Services;\n\n' +
|
|
175
|
-
'public class SmsService\n' +
|
|
176
|
-
'{\n' +
|
|
177
|
-
' private readonly SMSApi _sms;\n' +
|
|
178
|
-
' public SmsService()\n' +
|
|
179
|
-
' {\n' +
|
|
180
|
-
' var config = new Configuration\n' +
|
|
181
|
-
' {\n' +
|
|
182
|
-
' ApiKey = new Dictionary<string, string>\n' +
|
|
183
|
-
' {\n' +
|
|
184
|
-
' { "X-API-Key", Environment.GetEnvironmentVariable("ZYPHR_API_KEY")! }\n' +
|
|
185
|
-
' }\n' +
|
|
186
|
-
' };\n' +
|
|
187
|
-
' _sms = new SMSApi(config);\n' +
|
|
188
|
-
' }\n\n' +
|
|
189
|
-
' public Task<SendSmsResponse> SendOtpAsync(string to, string code)\n' +
|
|
190
|
-
' {\n' +
|
|
191
|
-
' return _sms.SendSmsAsync(new SendSmsRequest(\n' +
|
|
192
|
-
' to: to,\n' +
|
|
193
|
-
' body: $"Your verification code is {code}. Expires in 5 minutes."\n' +
|
|
194
|
-
' ));\n' +
|
|
195
|
-
' }\n' +
|
|
196
|
-
'}\n',
|
|
197
|
-
overwrite: false,
|
|
198
|
-
},
|
|
199
|
-
],
|
|
200
|
-
envVarsNeeded: ENV,
|
|
201
|
-
nextSteps: NEXT_STEPS,
|
|
202
|
-
docsUrl: DOCS,
|
|
203
|
-
},
|
|
204
|
-
},
|
|
205
|
-
};
|