@proof-holdings/mcp-server 1.0.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/LICENSE +21 -0
- package/README.md +345 -0
- package/dist/http.d.ts +34 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +117 -0
- package/dist/http.js.map +1 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +76 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/api-keys.d.ts +4 -0
- package/dist/tools/api-keys.d.ts.map +1 -0
- package/dist/tools/api-keys.js +71 -0
- package/dist/tools/api-keys.js.map +1 -0
- package/dist/tools/assets.d.ts +4 -0
- package/dist/tools/assets.d.ts.map +1 -0
- package/dist/tools/assets.js +57 -0
- package/dist/tools/assets.js.map +1 -0
- package/dist/tools/auth.d.ts +4 -0
- package/dist/tools/auth.d.ts.map +1 -0
- package/dist/tools/auth.js +41 -0
- package/dist/tools/auth.js.map +1 -0
- package/dist/tools/billing.d.ts +4 -0
- package/dist/tools/billing.d.ts.map +1 -0
- package/dist/tools/billing.js +16 -0
- package/dist/tools/billing.js.map +1 -0
- package/dist/tools/dns-credentials.d.ts +4 -0
- package/dist/tools/dns-credentials.d.ts.map +1 -0
- package/dist/tools/dns-credentials.js +44 -0
- package/dist/tools/dns-credentials.js.map +1 -0
- package/dist/tools/domains.d.ts +4 -0
- package/dist/tools/domains.d.ts.map +1 -0
- package/dist/tools/domains.js +235 -0
- package/dist/tools/domains.js.map +1 -0
- package/dist/tools/emails.d.ts +4 -0
- package/dist/tools/emails.d.ts.map +1 -0
- package/dist/tools/emails.js +96 -0
- package/dist/tools/emails.js.map +1 -0
- package/dist/tools/phones.d.ts +4 -0
- package/dist/tools/phones.d.ts.map +1 -0
- package/dist/tools/phones.js +69 -0
- package/dist/tools/phones.js.map +1 -0
- package/dist/tools/profiles.d.ts +4 -0
- package/dist/tools/profiles.d.ts.map +1 -0
- package/dist/tools/profiles.js +183 -0
- package/dist/tools/profiles.js.map +1 -0
- package/dist/tools/projects.d.ts +4 -0
- package/dist/tools/projects.d.ts.map +1 -0
- package/dist/tools/projects.js +159 -0
- package/dist/tools/projects.js.map +1 -0
- package/dist/tools/proofs.d.ts +4 -0
- package/dist/tools/proofs.d.ts.map +1 -0
- package/dist/tools/proofs.js +60 -0
- package/dist/tools/proofs.js.map +1 -0
- package/dist/tools/public-profiles.d.ts +4 -0
- package/dist/tools/public-profiles.d.ts.map +1 -0
- package/dist/tools/public-profiles.js +38 -0
- package/dist/tools/public-profiles.js.map +1 -0
- package/dist/tools/sessions.d.ts +4 -0
- package/dist/tools/sessions.d.ts.map +1 -0
- package/dist/tools/sessions.js +50 -0
- package/dist/tools/sessions.js.map +1 -0
- package/dist/tools/settings.d.ts +4 -0
- package/dist/tools/settings.d.ts.map +1 -0
- package/dist/tools/settings.js +66 -0
- package/dist/tools/settings.js.map +1 -0
- package/dist/tools/templates.d.ts +4 -0
- package/dist/tools/templates.d.ts.map +1 -0
- package/dist/tools/templates.js +115 -0
- package/dist/tools/templates.js.map +1 -0
- package/dist/tools/twofa.d.ts +4 -0
- package/dist/tools/twofa.d.ts.map +1 -0
- package/dist/tools/twofa.js +71 -0
- package/dist/tools/twofa.js.map +1 -0
- package/dist/tools/user-domain-verify.d.ts +4 -0
- package/dist/tools/user-domain-verify.d.ts.map +1 -0
- package/dist/tools/user-domain-verify.js +46 -0
- package/dist/tools/user-domain-verify.js.map +1 -0
- package/dist/tools/user-requests.d.ts +4 -0
- package/dist/tools/user-requests.d.ts.map +1 -0
- package/dist/tools/user-requests.js +103 -0
- package/dist/tools/user-requests.js.map +1 -0
- package/dist/tools/verification-requests.d.ts +4 -0
- package/dist/tools/verification-requests.d.ts.map +1 -0
- package/dist/tools/verification-requests.js +101 -0
- package/dist/tools/verification-requests.js.map +1 -0
- package/dist/tools/verifications.d.ts +4 -0
- package/dist/tools/verifications.d.ts.map +1 -0
- package/dist/tools/verifications.js +191 -0
- package/dist/tools/verifications.js.map +1 -0
- package/dist/tools/webhook-deliveries.d.ts +4 -0
- package/dist/tools/webhook-deliveries.d.ts.map +1 -0
- package/dist/tools/webhook-deliveries.js +68 -0
- package/dist/tools/webhook-deliveries.js.map +1 -0
- package/dist/types.d.ts +24 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +35 -0
- package/dist/types.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { jsonResult, errorResult } from '../types.js';
|
|
3
|
+
import { ApiError } from '../http.js';
|
|
4
|
+
export function registerTools(tool, http) {
|
|
5
|
+
tool('validate_proof', 'Validate a proof token online. Checks the token signature, expiry, and revocation status against the server.', {
|
|
6
|
+
proof_token: z.string().describe('The JWT proof token to validate'),
|
|
7
|
+
identifier: z.string().optional().describe('Expected identifier (phone/email/domain) to match against the proof'),
|
|
8
|
+
}, async (args) => {
|
|
9
|
+
try {
|
|
10
|
+
const result = await http.post('/api/v1/proofs/validate', args);
|
|
11
|
+
return jsonResult(result);
|
|
12
|
+
}
|
|
13
|
+
catch (e) {
|
|
14
|
+
if (e instanceof ApiError)
|
|
15
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
16
|
+
throw e;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
tool('get_proof_status', 'Get the status of a proof by verification ID. Returns whether the proof is active, expired, or revoked.', {
|
|
20
|
+
id: z.string().describe('Verification ID'),
|
|
21
|
+
}, async ({ id }) => {
|
|
22
|
+
try {
|
|
23
|
+
const result = await http.get(`/api/v1/proofs/${encodeURIComponent(id)}/status`);
|
|
24
|
+
return jsonResult(result);
|
|
25
|
+
}
|
|
26
|
+
catch (e) {
|
|
27
|
+
if (e instanceof ApiError)
|
|
28
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
29
|
+
throw e;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
tool('revoke_proof', 'Revoke a proof by verification ID. The proof token will no longer validate. This action is irreversible.', {
|
|
33
|
+
id: z.string().describe('Verification ID'),
|
|
34
|
+
reason: z.string().optional().describe('Reason for revocation'),
|
|
35
|
+
}, async ({ id, reason }) => {
|
|
36
|
+
try {
|
|
37
|
+
const result = await http.post(`/api/v1/proofs/${encodeURIComponent(id)}/revoke`, {
|
|
38
|
+
...(reason !== undefined ? { reason } : {}),
|
|
39
|
+
});
|
|
40
|
+
return jsonResult(result);
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
if (e instanceof ApiError)
|
|
44
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
45
|
+
throw e;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
tool('list_revoked_proofs', 'Get the revocation list for offline proof validation. Returns a signed list of all revoked proof IDs, cacheable for 5 minutes.', {}, async () => {
|
|
49
|
+
try {
|
|
50
|
+
const result = await http.get('/api/v1/proofs/revoked');
|
|
51
|
+
return jsonResult(result);
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
if (e instanceof ApiError)
|
|
55
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
56
|
+
throw e;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=proofs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proofs.js","sourceRoot":"","sources":["../../src/tools/proofs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,UAAU,aAAa,CAAC,IAAmB,EAAE,IAAgB;IACjE,IAAI,CACF,gBAAgB,EAChB,8GAA8G,EAC9G;QACE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iCAAiC,C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AAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,wBAAgB,aAAa,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,QAwClE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { jsonResult, errorResult } from '../types.js';
|
|
3
|
+
import { ApiError } from '../http.js';
|
|
4
|
+
export function registerTools(tool, http) {
|
|
5
|
+
tool('claim_username', 'Claim a unique username for the authenticated user\'s public profile. Usernames must be 3-30 characters, alphanumeric and underscores only.', {
|
|
6
|
+
username: z.string().min(3).max(30).regex(/^[a-zA-Z0-9_]+$/).describe('Username to claim (3-30 chars, alphanumeric and underscores)'),
|
|
7
|
+
}, async (args) => {
|
|
8
|
+
try {
|
|
9
|
+
const result = await http.post('/api/v1/profiles/me/username', args);
|
|
10
|
+
return jsonResult(result);
|
|
11
|
+
}
|
|
12
|
+
catch (e) {
|
|
13
|
+
if (e instanceof ApiError)
|
|
14
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
15
|
+
throw e;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
tool('update_public_proofs', 'Update which verified proofs are visible on the user\'s public profile, including visibility, masking, and display order.', {
|
|
19
|
+
proofs: z.array(z.object({
|
|
20
|
+
asset_id: z.string().describe('Asset ID to display'),
|
|
21
|
+
is_visible: z.boolean().optional().describe('Whether the proof is visible on the public profile'),
|
|
22
|
+
mask_level: z.enum(['full', 'partial', 'hidden']).optional().describe('How much of the proof value to show'),
|
|
23
|
+
display_order: z.number().int().min(0).optional().describe('Display position (0-based)'),
|
|
24
|
+
label: z.string().max(50).optional().describe('Custom label for the proof'),
|
|
25
|
+
})).max(50).describe('Array of proof display configurations (max 50)'),
|
|
26
|
+
}, async (args) => {
|
|
27
|
+
try {
|
|
28
|
+
const result = await http.put('/api/v1/profiles/me/proofs', args);
|
|
29
|
+
return jsonResult(result);
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
if (e instanceof ApiError)
|
|
33
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
34
|
+
throw e;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=public-profiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-profiles.js","sourceRoot":"","sources":["../../src/tools/public-profiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,UAAU,aAAa,CAAC,IAAmB,EAAE,IAAgB;IACjE,IAAI,CACF,gBAAgB,EAChB,6IAA6I,EAC7I;QACE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,QAAQ,CAAC,8DAA8D,CAAC;KACtI,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,8BAA8B,EAAE,IAAI,CAAC,CAAC;YACrE,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,YAAY,QAAQ;gBAAE,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YACzE,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC,CACF,CAAC;IAEF,IAAI,CACF,sBAAsB,EACtB,2HAA2H,EAC3H;QACE,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;YACvB,QAAQ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AAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,wBAAgB,aAAa,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,QA6DlE"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { jsonResult, errorResult, pollUntilTerminal } from '../types.js';
|
|
3
|
+
import { ApiError } from '../http.js';
|
|
4
|
+
export function registerTools(tool, http) {
|
|
5
|
+
tool('create_session', 'Create a new phone verification session. Sessions provide a hosted verification flow with callbacks.', {
|
|
6
|
+
channel: z.enum(['sms', 'whatsapp', 'telegram']).describe('Verification channel'),
|
|
7
|
+
phone_number: z.string().describe('Phone number in E.164 format'),
|
|
8
|
+
callback_url: z.string().optional().describe('URL to redirect after verification'),
|
|
9
|
+
external_user_id: z.string().optional().describe('Your application user ID'),
|
|
10
|
+
template_id: z.string().optional().describe('Custom template ID'),
|
|
11
|
+
metadata: z.record(z.string()).optional().describe('Custom key-value metadata'),
|
|
12
|
+
}, async (args) => {
|
|
13
|
+
try {
|
|
14
|
+
const result = await http.post('/api/v1/sessions', args);
|
|
15
|
+
return jsonResult(result);
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
if (e instanceof ApiError)
|
|
19
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
20
|
+
throw e;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
tool('get_session', 'Get a session by ID. Returns the session status, verification details, and proof token if verified.', {
|
|
24
|
+
id: z.string().describe('Session ID'),
|
|
25
|
+
}, async ({ id }) => {
|
|
26
|
+
try {
|
|
27
|
+
const result = await http.get(`/api/v1/sessions/${encodeURIComponent(id)}`);
|
|
28
|
+
return jsonResult(result);
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
if (e instanceof ApiError)
|
|
32
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
33
|
+
throw e;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
tool('wait_for_session', 'Poll a session until it reaches a terminal state (verified, failed, or expired). Checks every 2 seconds up to the timeout.', {
|
|
37
|
+
id: z.string().describe('Session ID to poll'),
|
|
38
|
+
timeout_seconds: z.number().int().min(1).max(300).optional().describe('Maximum wait time in seconds (default: 60, max: 300)'),
|
|
39
|
+
}, async ({ id, timeout_seconds }) => {
|
|
40
|
+
try {
|
|
41
|
+
return await pollUntilTerminal(() => http.get(`/api/v1/sessions/${encodeURIComponent(id)}`), ['verified', 'failed', 'expired'], timeout_seconds ?? 60, `session ${id}`);
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
if (e instanceof ApiError)
|
|
45
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
46
|
+
throw e;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=sessions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessions.js","sourceRoot":"","sources":["../../src/tools/sessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,UAAU,aAAa,CAAC,IAAmB,EAAE,IAAgB;IACjE,IAAI,CACF,gBAAgB,EAChB,sGAAsG,EACtG;QACE,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QACjF,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;QACjE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;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from 'zod';
|
|
2
|
+
import { jsonResult, errorResult } from '../types.js';
|
|
3
|
+
import { ApiError } from '../http.js';
|
|
4
|
+
export function registerTools(tool, http) {
|
|
5
|
+
tool('get_usage', 'Get usage metrics for the authenticated account. Shows verification counts, API calls, and quota usage.', {
|
|
6
|
+
period: z.string().regex(/^\d{4}-\d{2}$/).optional().describe('Month to query in YYYY-MM format (e.g. 2026-01)'),
|
|
7
|
+
months: z.number().int().min(1).max(12).optional().describe('Number of months of history'),
|
|
8
|
+
}, async (args) => {
|
|
9
|
+
try {
|
|
10
|
+
const query = {};
|
|
11
|
+
if (args.period !== undefined)
|
|
12
|
+
query.period = args.period;
|
|
13
|
+
if (args.months !== undefined)
|
|
14
|
+
query.months = args.months;
|
|
15
|
+
const result = await http.get('/api/v1/me/usage', query);
|
|
16
|
+
return jsonResult(result);
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
if (e instanceof ApiError)
|
|
20
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
21
|
+
throw e;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
tool('get_settings', 'Get account settings including branding configuration (business name, logo, colors, support email, email theme).', {}, async () => {
|
|
25
|
+
try {
|
|
26
|
+
const result = await http.get('/api/v1/me/settings');
|
|
27
|
+
return jsonResult(result);
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
if (e instanceof ApiError)
|
|
31
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
32
|
+
throw e;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
tool('update_settings', 'Update account settings. Currently supports branding configuration.', {
|
|
36
|
+
branding: z.object({
|
|
37
|
+
business_name: z.string().max(100).optional().describe('Business name displayed in verifications'),
|
|
38
|
+
logo_url: z.string().url().refine((u) => u.startsWith('https://'), { message: 'Logo URL must use HTTPS' }).optional().nullable().describe('HTTPS URL to business logo'),
|
|
39
|
+
primary_color: z.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe('Primary brand color (hex, e.g. #FF5733)'),
|
|
40
|
+
support_email: z.string().email().optional().describe('Support email shown in verification messages'),
|
|
41
|
+
email_theme: z.enum(['dark', 'light']).optional().describe('Email template theme'),
|
|
42
|
+
}).optional().describe('Branding settings to update'),
|
|
43
|
+
}, async (args) => {
|
|
44
|
+
try {
|
|
45
|
+
const result = await http.patch('/api/v1/me/settings', args);
|
|
46
|
+
return jsonResult(result);
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
if (e instanceof ApiError)
|
|
50
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
51
|
+
throw e;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
tool('export_data', 'Export all account data (GDPR Article 20 - Right to Data Portability). Rate limited to 1 export per 24 hours.', {}, async () => {
|
|
55
|
+
try {
|
|
56
|
+
const result = await http.get('/api/v1/me/export');
|
|
57
|
+
return jsonResult(result);
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
if (e instanceof ApiError)
|
|
61
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
62
|
+
throw e;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/tools/settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,UAAU,aAAa,CAAC,IAAmB,EAAE,IAAgB;IACjE,IAAI,CACF,WAAW,EACX,yGAAyG,EACzG;QACE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAA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C,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YACzE,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC,CACF,CAAC;IAEF,IAAI,CACF,aAAa,EACb,+GAA+G,EAC/G,EAAE,EACF,KAAK,IAAI,EAAE;QACT,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;YACnD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,YAAY,QAAQ;gBAAE,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YACzE,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/tools/templates.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,wBAAgB,aAAa,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,QAyIlE"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { jsonResult, errorResult } from '../types.js';
|
|
3
|
+
import { ApiError } from '../http.js';
|
|
4
|
+
export function registerTools(tool, http) {
|
|
5
|
+
tool('list_templates', 'List all custom message templates for the authenticated account. Returns templates organized by channel and message type.', {}, async () => {
|
|
6
|
+
try {
|
|
7
|
+
const result = await http.get('/api/v1/templates');
|
|
8
|
+
return jsonResult(result);
|
|
9
|
+
}
|
|
10
|
+
catch (e) {
|
|
11
|
+
if (e instanceof ApiError)
|
|
12
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
13
|
+
throw e;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
tool('get_default_templates', 'Get all default message templates. These are the built-in templates used when no custom template is set.', {}, async () => {
|
|
17
|
+
try {
|
|
18
|
+
const result = await http.get('/api/v1/templates/defaults');
|
|
19
|
+
return jsonResult(result);
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
if (e instanceof ApiError)
|
|
23
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
24
|
+
throw e;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
tool('get_template', 'Get a specific template by channel and message type. Returns the custom template if set, otherwise the default.', {
|
|
28
|
+
channel: z.enum(['telegram', 'whatsapp', 'sms', 'email']).describe('Message channel'),
|
|
29
|
+
message_type: z.string().describe('Message type (e.g. verification_request, login_request)'),
|
|
30
|
+
}, async ({ channel, message_type }) => {
|
|
31
|
+
try {
|
|
32
|
+
const result = await http.get(`/api/v1/templates/${encodeURIComponent(channel)}/${encodeURIComponent(message_type)}`);
|
|
33
|
+
return jsonResult(result);
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
if (e instanceof ApiError)
|
|
37
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
38
|
+
throw e;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
tool('update_template', 'Create or update a custom template for a specific channel and message type. Replaces the default template.', {
|
|
42
|
+
channel: z.enum(['telegram', 'whatsapp', 'sms', 'email']).describe('Message channel'),
|
|
43
|
+
message_type: z.string().describe('Message type (e.g. verification_request, login_request)'),
|
|
44
|
+
subject: z.string().max(200).optional().describe('Email subject line (email channel only)'),
|
|
45
|
+
body: z.string().min(1).max(2000).describe('Template body text with variable placeholders'),
|
|
46
|
+
button_text: z.string().max(50).optional().describe('Button text (email channel only)'),
|
|
47
|
+
button_url_template: z.string().max(500).optional().describe('Button URL template with placeholders'),
|
|
48
|
+
}, async ({ channel, message_type, ...body }) => {
|
|
49
|
+
try {
|
|
50
|
+
const result = await http.put(`/api/v1/templates/${encodeURIComponent(channel)}/${encodeURIComponent(message_type)}`, body);
|
|
51
|
+
return jsonResult(result);
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
if (e instanceof ApiError)
|
|
55
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
56
|
+
throw e;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
tool('delete_template', 'Delete a custom template, reverting to the default template for that channel and message type.', {
|
|
60
|
+
channel: z.enum(['telegram', 'whatsapp', 'sms', 'email']).describe('Message channel'),
|
|
61
|
+
message_type: z.string().describe('Message type (e.g. verification_request, login_request)'),
|
|
62
|
+
}, async ({ channel, message_type }) => {
|
|
63
|
+
try {
|
|
64
|
+
const result = await http.del(`/api/v1/templates/${encodeURIComponent(channel)}/${encodeURIComponent(message_type)}`);
|
|
65
|
+
return jsonResult(result);
|
|
66
|
+
}
|
|
67
|
+
catch (e) {
|
|
68
|
+
if (e instanceof ApiError)
|
|
69
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
70
|
+
throw e;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
tool('preview_template', 'Preview a template with sample data before saving. Shows how the message will look with placeholder variables filled in.', {
|
|
74
|
+
channel: z.enum(['telegram', 'whatsapp', 'sms', 'email']).describe('Message channel'),
|
|
75
|
+
message_type: z.enum([
|
|
76
|
+
'verification_request', 'verification_success', 'verification_expired',
|
|
77
|
+
'login_request', 'login_success', '2fa_request', '2fa_success',
|
|
78
|
+
]).describe('Message type'),
|
|
79
|
+
subject: z.string().max(200).optional().describe('Email subject line'),
|
|
80
|
+
body: z.string().min(1).max(2000).describe('Template body text'),
|
|
81
|
+
button_text: z.string().max(50).optional().describe('Button text'),
|
|
82
|
+
button_url_template: z.string().max(500).optional().describe('Button URL template'),
|
|
83
|
+
}, async (args) => {
|
|
84
|
+
try {
|
|
85
|
+
const result = await http.post('/api/v1/templates/preview', args);
|
|
86
|
+
return jsonResult(result);
|
|
87
|
+
}
|
|
88
|
+
catch (e) {
|
|
89
|
+
if (e instanceof ApiError)
|
|
90
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
91
|
+
throw e;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
tool('render_template', 'Render a template with provided variables. Returns the fully rendered message content.', {
|
|
95
|
+
channel: z.enum(['telegram', 'whatsapp', 'sms', 'email']).describe('Message channel'),
|
|
96
|
+
message_type: z.string().describe('Message type'),
|
|
97
|
+
variables: z.object({
|
|
98
|
+
code: z.string().optional().describe('Verification or login code'),
|
|
99
|
+
expires_in: z.string().optional().describe('Expiry duration text (e.g. "10 minutes")'),
|
|
100
|
+
user_identifier: z.string().optional().describe('User identifier (phone, email, or domain)'),
|
|
101
|
+
callback_url: z.string().optional().describe('Callback URL for the action'),
|
|
102
|
+
}).optional().describe('Variables to substitute into the template'),
|
|
103
|
+
}, async (args) => {
|
|
104
|
+
try {
|
|
105
|
+
const result = await http.post('/api/v1/templates/render', args);
|
|
106
|
+
return jsonResult(result);
|
|
107
|
+
}
|
|
108
|
+
catch (e) {
|
|
109
|
+
if (e instanceof ApiError)
|
|
110
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
111
|
+
throw e;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/tools/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,UAAU,aAAa,CAAC,IAAmB,EAAE,IAAgB;IACjE,IAAI,CACF,gBAAgB,EAChB,2HAA2H,EAC3H,EAAE,EACF,KAAK,IAAI,EA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AC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,wBAAgB,aAAa,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,QAiFlE"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { jsonResult, errorResult } from '../types.js';
|
|
3
|
+
import { ApiError } from '../http.js';
|
|
4
|
+
export function registerTools(tool, http) {
|
|
5
|
+
tool('start_2fa', 'Start a two-factor authentication challenge for a sensitive operation. Sends a verification code via the chosen channel. Returns a session ID to verify with.', {
|
|
6
|
+
action_type: z.enum([
|
|
7
|
+
'api_key_view',
|
|
8
|
+
'api_key_create',
|
|
9
|
+
'api_key_revoke',
|
|
10
|
+
'api_key_regenerate',
|
|
11
|
+
'phone_add',
|
|
12
|
+
'phone_remove',
|
|
13
|
+
'email_add',
|
|
14
|
+
'email_remove',
|
|
15
|
+
'account_delete',
|
|
16
|
+
]).describe('The sensitive action requiring 2FA'),
|
|
17
|
+
channel: z.enum(['telegram', 'whatsapp', 'sms', 'email']).describe('Channel to receive the verification code'),
|
|
18
|
+
email_id: z.string().optional().describe('Specific email ID for email channel (optional)'),
|
|
19
|
+
}, async (args) => {
|
|
20
|
+
try {
|
|
21
|
+
const result = await http.post('/api/v1/me/2fa/start', args);
|
|
22
|
+
return jsonResult(result);
|
|
23
|
+
}
|
|
24
|
+
catch (e) {
|
|
25
|
+
if (e instanceof ApiError)
|
|
26
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
27
|
+
throw e;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
tool('get_2fa_status', 'Check the status of a 2FA session by session ID. Returns whether the challenge has been completed, is pending, or has expired.', {
|
|
31
|
+
session_id: z.string().describe('2FA session ID'),
|
|
32
|
+
}, async ({ session_id }) => {
|
|
33
|
+
try {
|
|
34
|
+
const result = await http.get(`/api/v1/me/2fa/${encodeURIComponent(session_id)}`);
|
|
35
|
+
return jsonResult(result);
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
if (e instanceof ApiError)
|
|
39
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
40
|
+
throw e;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
tool('verify_2fa', 'Submit a verification code to complete a 2FA challenge. Rate limited to 10 attempts per minute.', {
|
|
44
|
+
session_id: z.string().describe('2FA session ID'),
|
|
45
|
+
code: z.string().min(1).max(10).describe('Verification code'),
|
|
46
|
+
}, async ({ session_id, code }) => {
|
|
47
|
+
try {
|
|
48
|
+
const result = await http.post(`/api/v1/me/2fa/${encodeURIComponent(session_id)}/verify`, { code });
|
|
49
|
+
return jsonResult(result);
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
if (e instanceof ApiError)
|
|
53
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
54
|
+
throw e;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
tool('verify_2fa_magic_link', 'Complete a 2FA challenge using a magic link token (received via email). No code submission needed — the token itself is the proof.', {
|
|
58
|
+
token: z.string().describe('Magic link token from the verification email'),
|
|
59
|
+
}, async ({ token }) => {
|
|
60
|
+
try {
|
|
61
|
+
const result = await http.post(`/api/v1/me/2fa/magic/${encodeURIComponent(token)}`);
|
|
62
|
+
return jsonResult(result);
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
if (e instanceof ApiError)
|
|
66
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
67
|
+
throw e;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=twofa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"twofa.js","sourceRoot":"","sources":["../../src/tools/twofa.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,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,EAAE;QAClB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,wBAAwB,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACpF,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,YAAY,QAAQ;gBAAE,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YACzE,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-domain-verify.d.ts","sourceRoot":"","sources":["../../src/tools/user-domain-verify.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,wBAAgB,aAAa,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,QAoDlE"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { jsonResult, errorResult } from '../types.js';
|
|
3
|
+
import { ApiError } from '../http.js';
|
|
4
|
+
export function registerTools(tool, http) {
|
|
5
|
+
tool('start_user_domain_verification', 'Start a self-service domain verification session. The user proves ownership of a domain via DNS or HTTP challenge.', {
|
|
6
|
+
domain: z.string().min(1).max(255).describe('Domain name to verify (e.g. example.com)'),
|
|
7
|
+
channel: z.enum(['dns', 'http']).optional().describe('Verification channel (default: dns)'),
|
|
8
|
+
}, async (args) => {
|
|
9
|
+
try {
|
|
10
|
+
const result = await http.post('/api/v1/me/verify/domain', args);
|
|
11
|
+
return jsonResult(result);
|
|
12
|
+
}
|
|
13
|
+
catch (e) {
|
|
14
|
+
if (e instanceof ApiError)
|
|
15
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
16
|
+
throw e;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
tool('get_user_domain_verification_status', 'Get the current status of a domain verification session, including challenge details.', {
|
|
20
|
+
session_id: z.string().describe('Domain verification session ID'),
|
|
21
|
+
}, async ({ session_id }) => {
|
|
22
|
+
try {
|
|
23
|
+
const result = await http.get(`/api/v1/me/verify/domain/${encodeURIComponent(session_id)}`);
|
|
24
|
+
return jsonResult(result);
|
|
25
|
+
}
|
|
26
|
+
catch (e) {
|
|
27
|
+
if (e instanceof ApiError)
|
|
28
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
29
|
+
throw e;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
tool('check_user_domain_verification', 'Trigger a check on the domain verification challenge. Call after placing DNS record or HTTP file.', {
|
|
33
|
+
session_id: z.string().describe('Domain verification session ID'),
|
|
34
|
+
}, async ({ session_id }) => {
|
|
35
|
+
try {
|
|
36
|
+
const result = await http.post(`/api/v1/me/verify/domain/${encodeURIComponent(session_id)}/check`);
|
|
37
|
+
return jsonResult(result);
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
if (e instanceof ApiError)
|
|
41
|
+
return errorResult(`${e.code}: ${e.message}`);
|
|
42
|
+
throw e;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=user-domain-verify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-domain-verify.js","sourceRoot":"","sources":["../../src/tools/user-domain-verify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,UAAU,aAAa,CAAC,IAAmB,EAAE,IAAgB;IACjE,IAAI,CACF,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