pushfa-mcp 1.2.0 → 2.0.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/LICENSE +21 -0
- package/README.md +40 -17
- package/package.json +15 -6
- package/pushfa-mcp.mjs +9 -40
- package/src/client.mjs +2 -2
- package/src/config.mjs +0 -1
- package/src/index.mjs +1 -1
- package/src/schemas.mjs +1 -1
- package/src/tools.mjs +7 -33
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pushfa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
<div dir="rtl" lang="fa">
|
|
2
|
+
|
|
1
3
|
# MCP پوشفا
|
|
2
4
|
|
|
3
|
-
MCP رسمی پوشفا برای خواندن راهنمای نصب وب، اندروید و iOS و کار با وبسرویسهای یک سرویس پوشفا. روی سیستم شما با
|
|
5
|
+
MCP رسمی پوشفا برای خواندن راهنمای نصب وب، اندروید و iOS و کار با وبسرویسهای یک سرویس پوشفا. روی سیستم شما با <code dir="ltr">stdio</code> اجرا میشود و برای دریافت راهنما و عملیات سرویس به <code dir="ltr">pushfa.com</code> متصل میشود.
|
|
4
6
|
|
|
5
7
|
[بسته در npm](https://www.npmjs.com/package/pushfa-mcp) · [صفحهٔ نصب و دانلود](https://pushfa.com/mcp) · [مستندات فنی MCP](https://pushfa.com/index/doc/mcp)
|
|
6
8
|
|
|
7
9
|
## نصب
|
|
8
10
|
|
|
9
|
-
به Node.js نسخهٔ ۲۲ یا بالاتر و کلاینتی با پشتیبانی از MCP محلی نیاز دارید. برای اجرا از npm، این تنظیم را در کلاینتهای دارای قالب
|
|
11
|
+
به Node.js نسخهٔ ۲۲ یا بالاتر و کلاینتی با پشتیبانی از MCP محلی نیاز دارید. برای اجرا از npm، این تنظیم را در کلاینتهای دارای قالب <code dir="ltr">mcpServers</code> وارد کنید.
|
|
12
|
+
|
|
13
|
+
<div dir="ltr">
|
|
10
14
|
|
|
11
15
|
```json
|
|
12
16
|
{
|
|
@@ -19,25 +23,38 @@ MCP رسمی پوشفا برای خواندن راهنمای نصب وب، ان
|
|
|
19
23
|
}
|
|
20
24
|
```
|
|
21
25
|
|
|
22
|
-
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
برای اجرا از GitHub، مقدار فیلد <code dir="ltr">args</code> را با آرایهٔ زیر جایگزین کنید.
|
|
23
29
|
|
|
24
|
-
|
|
30
|
+
<div dir="ltr">
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
[
|
|
34
|
+
"--yes",
|
|
35
|
+
"--package=git+https://github.com/ehsan-coder/pushfa-mcp.git",
|
|
36
|
+
"pushfa-mcp"
|
|
37
|
+
]
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
برای نصب دستی، [فایل یکپارچه](https://pushfa.com/downloads/pushfa-mcp.mjs) را بگیرید و در تنظیمات کلاینت، فرمان <code dir="ltr">node</code> و مسیر کامل فایل را وارد کنید. اگر مخزن را کلون یا ZIP آن را استخراج کردهاید، <code dir="ltr">node src/index.mjs</code> نیز از ریشهٔ پروژه اجرا میشود. اجرای کد به نصب وابستگی نیاز ندارد.
|
|
25
43
|
|
|
26
44
|
## کلیدها و دسترسیها
|
|
27
45
|
|
|
28
|
-
برای خواندن راهنماها هیچ کلیدی لازم نیست. برای کار با سرویس، متغیرها را در بخش
|
|
46
|
+
برای خواندن راهنماها هیچ کلیدی لازم نیست. برای کار با سرویس، متغیرها را در بخش <code dir="ltr">env</code> تنظیمات محلی اتصال وارد کنید و اتصال را دوباره راهاندازی کنید.
|
|
29
47
|
|
|
30
48
|
| متغیر | کاربرد |
|
|
31
49
|
| --- | --- |
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
|
|
|
36
|
-
| `PUSHFA_MCP_ENABLE_IDENTITY` | مقدار رشتهای `true` برای پوشباکس و Auth Push |
|
|
50
|
+
| <code dir="ltr">PUSHFA_API_PUBLIC_KEY</code> | کلید عمومی سرویس |
|
|
51
|
+
| <code dir="ltr">PUSHFA_API_PRIVATE_KEY</code> | کلید خصوصی همان سرویس |
|
|
52
|
+
| <code dir="ltr">PUSHFA_MCP_ENABLE_SEND</code> | مقدار رشتهای <code dir="ltr">true</code> برای فعالکردن ارسال |
|
|
53
|
+
| <code dir="ltr">PUSHFA_MCP_ENABLE_MANAGEMENT</code> | مقدار رشتهای <code dir="ltr">true</code> برای عملیات مدیریتی |
|
|
37
54
|
|
|
38
55
|
با هر دو کلید، ابزارهای استعلامِ وضعیت اعلان و اشتراک، Alias، براکتها و اطلاعات تاپیک فعال میشوند. ابزارهای ارسال به شناسهٔ مخاطب، توکن FCM، Alias، Custom Alias و تاپیک، بسته به نوع اعلان و وبسرویس درخواستی، دسترسی ارسال را میخواهند. ابزارهای مدیریتی شامل تغییر Alias و براکت، عضویت تاپیک، کاربر آزمایشی و ثبت پروفایل و رویداد RetenX هستند.
|
|
39
56
|
|
|
40
|
-
دستیار ابتدا یک پیشنمایش با
|
|
57
|
+
دستیار ابتدا یک پیشنمایش با <code dir="ltr">pushfa_prepare_*</code> میگیرد. پس از تأیید شما، <code dir="ltr">pushfa_send_notification</code> ارسال را ثبت میکند و <code dir="ltr">pushfa_confirm_management</code> پیشنمایش مدیریتی را اجرا میکند. شناسهٔ پیشنمایش پنج دقیقه در همان پردازش معتبر است و فقط یک بار میتوان برای اجرای عملیات از آن استفاده کرد. کلید خصوصی را در تنظیمات محلی نگه دارید. امکانات سرویس و هزینهها طبق پلن و تعرفهٔ پوشفا محاسبه میشوند.
|
|
41
58
|
|
|
42
59
|
## نمونه درخواست
|
|
43
60
|
|
|
@@ -49,10 +66,16 @@ MCP رسمی پوشفا برای خواندن راهنمای نصب وب، ان
|
|
|
49
66
|
|
|
50
67
|
| مسیر | مسئولیت |
|
|
51
68
|
| --- | --- |
|
|
52
|
-
|
|
|
53
|
-
|
|
|
54
|
-
|
|
|
55
|
-
|
|
|
56
|
-
|
|
|
69
|
+
| <code dir="ltr">src/index.mjs</code> | ورودی برنامه و پروتکل MCP روی stdin و stdout |
|
|
70
|
+
| <code dir="ltr">src/tools.mjs</code> و <code dir="ltr">src/schemas.mjs</code> | تعریف ابزارها و اعتبارسنجی ورودی |
|
|
71
|
+
| <code dir="ltr">src/client.mjs</code> و <code dir="ltr">src/config.mjs</code> | اتصال به API پوشفا و تنظیم دسترسی ابزارها |
|
|
72
|
+
| <code dir="ltr">src/guides.mjs</code> و <code dir="ltr">src/drafts.mjs</code> | خواندن راهنماها و مدیریت پیشنمایشهای یکبارمصرف |
|
|
73
|
+
| <code dir="ltr">pushfa-mcp.mjs</code> | خروجی یکپارچه برای دانلود و اجرای مستقیم |
|
|
74
|
+
|
|
75
|
+
بعد از تغییر کد در <code dir="ltr">src/</code>، با <code dir="ltr">npm ci</code> و سپس <code dir="ltr">npm run build</code> فایل یکپارچه را دوباره تولید کنید.
|
|
76
|
+
|
|
77
|
+
## مجوز
|
|
78
|
+
|
|
79
|
+
کد این مخزن با [مجوز MIT](LICENSE) منتشر میشود.
|
|
57
80
|
|
|
58
|
-
|
|
81
|
+
</div>
|
package/package.json
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pushfa-mcp",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Official Pushfa MCP server for installation guides, push notifications and service operations.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"license": "
|
|
7
|
-
"engines": {
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=22"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"pushfa-mcp": "src/index.mjs"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"src",
|
|
15
|
+
"pushfa-mcp.mjs"
|
|
16
|
+
],
|
|
10
17
|
"homepage": "https://pushfa.com/mcp",
|
|
11
18
|
"repository": {
|
|
12
19
|
"type": "git",
|
|
@@ -16,5 +23,7 @@
|
|
|
16
23
|
"start": "node src/index.mjs",
|
|
17
24
|
"build": "esbuild src/index.mjs --bundle --platform=node --format=esm --target=node22 --charset=utf8 --outfile=pushfa-mcp.mjs --banner:js=\"// Generated by npm run build.\""
|
|
18
25
|
},
|
|
19
|
-
"devDependencies": {
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"esbuild": "0.25.12"
|
|
28
|
+
}
|
|
20
29
|
}
|
package/pushfa-mcp.mjs
CHANGED
|
@@ -12,8 +12,7 @@ var serviceConfigured = Boolean(publicKey && privateKey);
|
|
|
12
12
|
var enabled = {
|
|
13
13
|
read: serviceConfigured,
|
|
14
14
|
send: serviceConfigured && process.env.PUSHFA_MCP_ENABLE_SEND === "true",
|
|
15
|
-
manage: serviceConfigured && process.env.PUSHFA_MCP_ENABLE_MANAGEMENT === "true"
|
|
16
|
-
identity: serviceConfigured && process.env.PUSHFA_MCP_ENABLE_IDENTITY === "true"
|
|
15
|
+
manage: serviceConfigured && process.env.PUSHFA_MCP_ENABLE_MANAGEMENT === "true"
|
|
17
16
|
};
|
|
18
17
|
|
|
19
18
|
// src/schemas.mjs
|
|
@@ -186,12 +185,12 @@ function unexpectedResponse(kind = "read", httpStatus) {
|
|
|
186
185
|
}
|
|
187
186
|
return new ToolError("MCP_API_UNAVAILABLE", "Could not obtain a valid response from Pushfa.", details);
|
|
188
187
|
}
|
|
189
|
-
async function callApi(endpoint, payload, {
|
|
188
|
+
async function callApi(endpoint, payload, { kind = "read", raw } = {}) {
|
|
190
189
|
let response;
|
|
191
190
|
let result;
|
|
192
191
|
try {
|
|
193
192
|
response = await fetch(apiUrl + endpoint, {
|
|
194
|
-
method,
|
|
193
|
+
method: "POST",
|
|
195
194
|
headers: { Accept: "application/json", "Content-Type": "application/json" },
|
|
196
195
|
body: JSON.stringify({ ...payload, api_public_key: publicKey, api_private_key: privateKey }),
|
|
197
196
|
redirect: "error",
|
|
@@ -501,35 +500,6 @@ apiTool("prepare_record_retenx_event", "retention/events", "Record a RetenX even
|
|
|
501
500
|
}, ["event_name"]),
|
|
502
501
|
not: { required: ["subscriber_id", "fcm_token"] }
|
|
503
502
|
}, { kind: "manage", raw: (result) => result.status === "success" });
|
|
504
|
-
apiTool("prepare_upsert_consumer_binding", "consumer-bindings/upsert", "Link a subscriber to a mobile number in Push Box.", input({
|
|
505
|
-
subscriber_id: profileId,
|
|
506
|
-
mobile: string
|
|
507
|
-
}), { kind: "identity", raw: (result) => Number.isInteger(result.binding_id) && typeof result.consumer_uuid === "string" });
|
|
508
|
-
apiTool("prepare_delete_consumer_binding", "consumer-bindings", "Revoke a Push Box binding by subscriber ID or all service bindings for one mobile number.", exactlyOne(input({
|
|
509
|
-
subscriber_id: profileId,
|
|
510
|
-
mobile: string
|
|
511
|
-
}, []), "subscriber_id", "mobile"), { kind: "identity", method: "DELETE", raw: (result) => result.ok === true });
|
|
512
|
-
apiTool("prepare_auth_push_bind", "auth-push/bind", "Bind a trusted subscriber device to an Auth Push identity.", input({
|
|
513
|
-
subscriber_id: uuid,
|
|
514
|
-
auth_identity: text(191, "Auth Push identity."),
|
|
515
|
-
expires_at: string
|
|
516
|
-
}, ["subscriber_id", "auth_identity"]), { kind: "identity" });
|
|
517
|
-
apiTool("prepare_auth_push_unbind", "auth-push/unbind", "Remove a subscriber’s trusted Auth Push binding.", input({
|
|
518
|
-
subscriber_id: uuid
|
|
519
|
-
}), { kind: "identity" });
|
|
520
|
-
apiTool("prepare_auth_push_challenge", "auth-push/challenges", "Create an approval or OTP challenge for an Auth Push identity. The client token is intended for the requesting device.", input({
|
|
521
|
-
auth_identity: text(191, "Auth Push identity."),
|
|
522
|
-
requester_subscriber_id: uuid,
|
|
523
|
-
mode: choice("approval", "otp"),
|
|
524
|
-
expires_in: integer(60, 300),
|
|
525
|
-
reference: text(191, "Application reference."),
|
|
526
|
-
context: input({ ip: string, device: text(191, "Device."), location: text(191, "Location.") }, [])
|
|
527
|
-
}, ["auth_identity", "requester_subscriber_id"]), { kind: "identity" });
|
|
528
|
-
apiTool("prepare_auth_push_consume_grant", "auth-push/grants/consume", "Consume a verified Auth Push grant once.", input({
|
|
529
|
-
challenge_id: uuid,
|
|
530
|
-
grant: { type: "string", pattern: "^[a-zA-Z0-9]{64}$" },
|
|
531
|
-
auth_identity: text(191, "Auth Push identity.")
|
|
532
|
-
}), { kind: "identity" });
|
|
533
503
|
if (enabled.send) {
|
|
534
504
|
tools.push({
|
|
535
505
|
name: "pushfa_send_notification",
|
|
@@ -539,23 +509,22 @@ if (enabled.send) {
|
|
|
539
509
|
run: ({ draft_id }) => confirmDraft(draft_id, ["send"])
|
|
540
510
|
});
|
|
541
511
|
}
|
|
542
|
-
if (enabled.manage
|
|
512
|
+
if (enabled.manage) {
|
|
543
513
|
tools.push({
|
|
544
|
-
name: "
|
|
545
|
-
description: "Execute a management
|
|
514
|
+
name: "pushfa_confirm_management",
|
|
515
|
+
description: "Execute a management draft after the user explicitly approves it. Each draft permits one attempt.",
|
|
546
516
|
inputSchema: input({ draft_id: uuid }),
|
|
547
517
|
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
|
|
548
|
-
run: ({ draft_id }) => confirmDraft(draft_id, ["manage"
|
|
518
|
+
run: ({ draft_id }) => confirmDraft(draft_id, ["manage"])
|
|
549
519
|
});
|
|
550
520
|
}
|
|
551
521
|
function apiTool(name, endpoint, description, inputSchema, {
|
|
552
522
|
kind = "read",
|
|
553
|
-
method = "POST",
|
|
554
523
|
raw,
|
|
555
524
|
project = asToolData
|
|
556
525
|
} = {}) {
|
|
557
526
|
if (!enabled[kind]) return;
|
|
558
|
-
const operation = { endpoint, kind,
|
|
527
|
+
const operation = { endpoint, kind, raw, project };
|
|
559
528
|
const preparing = kind !== "read";
|
|
560
529
|
tools.push({
|
|
561
530
|
name: `pushfa_${name}`,
|
|
@@ -572,7 +541,7 @@ function asToolData(data) {
|
|
|
572
541
|
// src/index.mjs
|
|
573
542
|
var modernVersion = "2026-07-28";
|
|
574
543
|
var legacyVersions = ["2025-11-25", "2025-06-18", "2025-03-26"];
|
|
575
|
-
var serverInfo = { name: "pushfa", title: "Pushfa", version: "
|
|
544
|
+
var serverInfo = { name: "pushfa", title: "Pushfa", version: "2.0.1" };
|
|
576
545
|
var capabilities = { tools: {} };
|
|
577
546
|
var instructions = [
|
|
578
547
|
"For a Pushfa installation or SDK upgrade, inspect the project and use pushfa_read_installation_guide to read the current guide for its platform before changing files. Read the relevant sections and adapt them to the existing integration. Keep private API keys, Firebase service accounts and APNs private keys out of client code.",
|
package/src/client.mjs
CHANGED
|
@@ -12,12 +12,12 @@ function unexpectedResponse(kind = 'read', httpStatus) {
|
|
|
12
12
|
return new ToolError('MCP_API_UNAVAILABLE', 'Could not obtain a valid response from Pushfa.', details);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
async function callApi(endpoint, payload, {
|
|
15
|
+
async function callApi(endpoint, payload, { kind = 'read', raw } = {}) {
|
|
16
16
|
let response;
|
|
17
17
|
let result;
|
|
18
18
|
try {
|
|
19
19
|
response = await fetch(apiUrl + endpoint, {
|
|
20
|
-
method,
|
|
20
|
+
method: 'POST',
|
|
21
21
|
headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
|
|
22
22
|
body: JSON.stringify({ ...payload, api_public_key: publicKey, api_private_key: privateKey }),
|
|
23
23
|
redirect: 'error',
|
package/src/config.mjs
CHANGED
|
@@ -6,7 +6,6 @@ const enabled = {
|
|
|
6
6
|
read: serviceConfigured,
|
|
7
7
|
send: serviceConfigured && process.env.PUSHFA_MCP_ENABLE_SEND === 'true',
|
|
8
8
|
manage: serviceConfigured && process.env.PUSHFA_MCP_ENABLE_MANAGEMENT === 'true',
|
|
9
|
-
identity: serviceConfigured && process.env.PUSHFA_MCP_ENABLE_IDENTITY === 'true',
|
|
10
9
|
};
|
|
11
10
|
|
|
12
11
|
export { apiUrl, publicKey, privateKey, enabled };
|
package/src/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { tools } from './tools.mjs';
|
|
|
8
8
|
|
|
9
9
|
const modernVersion = '2026-07-28';
|
|
10
10
|
const legacyVersions = ['2025-11-25', '2025-06-18', '2025-03-26'];
|
|
11
|
-
const serverInfo = { name: 'pushfa', title: 'Pushfa', version: '
|
|
11
|
+
const serverInfo = { name: 'pushfa', title: 'Pushfa', version: '2.0.1' };
|
|
12
12
|
const capabilities = { tools: {} };
|
|
13
13
|
const instructions = [
|
|
14
14
|
'For a Pushfa installation or SDK upgrade, inspect the project and use pushfa_read_installation_guide to read the current guide for its platform before changing files. Read the relevant sections and adapt them to the existing integration. Keep private API keys, Firebase service accounts and APNs private keys out of client code.',
|
package/src/schemas.mjs
CHANGED
|
@@ -154,7 +154,7 @@ function validateObject(value, schema, field) {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
export {
|
|
157
|
-
isObject, uuidPattern, uuid, text, list, input,
|
|
157
|
+
isObject, uuidPattern, uuid, text, list, input, string, bool, choice, integer, fcmToken,
|
|
158
158
|
deviceInput, topicId, groupInput, message, actions, reports, webhook, audience, aliasAudience,
|
|
159
159
|
profileId, keyName, scalarMap, profileFields, ToolError, invalidArgument, validate,
|
|
160
160
|
};
|
package/src/tools.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { enabled } from './config.mjs';
|
|
|
3
3
|
import { confirmDraft, prepareDraft } from './drafts.mjs';
|
|
4
4
|
import { guideUrls, readInstallationGuide } from './guides.mjs';
|
|
5
5
|
import {
|
|
6
|
-
actions, aliasAudience, audience, bool, choice, deviceInput,
|
|
6
|
+
actions, aliasAudience, audience, bool, choice, deviceInput, fcmToken, groupInput, input,
|
|
7
7
|
integer, isObject, keyName, list, message, profileFields, profileId, reports, scalarMap, string, text,
|
|
8
8
|
topicId, uuid, uuidPattern, webhook,
|
|
9
9
|
} from './schemas.mjs';
|
|
@@ -150,32 +150,6 @@ apiTool('prepare_record_retenx_event', 'retention/events', 'Record a RetenX even
|
|
|
150
150
|
not: { required: ['subscriber_id', 'fcm_token'] },
|
|
151
151
|
}, { kind: 'manage', raw: result => result.status === 'success' });
|
|
152
152
|
|
|
153
|
-
apiTool('prepare_upsert_consumer_binding', 'consumer-bindings/upsert', 'Link a subscriber to a mobile number in Push Box.', input({
|
|
154
|
-
subscriber_id: profileId, mobile: string,
|
|
155
|
-
}), { kind: 'identity', raw: result => Number.isInteger(result.binding_id) && typeof result.consumer_uuid === 'string' });
|
|
156
|
-
apiTool('prepare_delete_consumer_binding', 'consumer-bindings', 'Revoke a Push Box binding by subscriber ID or all service bindings for one mobile number.', exactlyOne(input({
|
|
157
|
-
subscriber_id: profileId, mobile: string,
|
|
158
|
-
}, []), 'subscriber_id', 'mobile'), { kind: 'identity', method: 'DELETE', raw: result => result.ok === true });
|
|
159
|
-
apiTool('prepare_auth_push_bind', 'auth-push/bind', 'Bind a trusted subscriber device to an Auth Push identity.', input({
|
|
160
|
-
subscriber_id: uuid, auth_identity: text(191, 'Auth Push identity.'), expires_at: string,
|
|
161
|
-
}, ['subscriber_id', 'auth_identity']), { kind: 'identity' });
|
|
162
|
-
apiTool('prepare_auth_push_unbind', 'auth-push/unbind', 'Remove a subscriber’s trusted Auth Push binding.', input({
|
|
163
|
-
subscriber_id: uuid,
|
|
164
|
-
}), { kind: 'identity' });
|
|
165
|
-
apiTool('prepare_auth_push_challenge', 'auth-push/challenges', 'Create an approval or OTP challenge for an Auth Push identity. The client token is intended for the requesting device.', input({
|
|
166
|
-
auth_identity: text(191, 'Auth Push identity.'),
|
|
167
|
-
requester_subscriber_id: uuid,
|
|
168
|
-
mode: choice('approval', 'otp'),
|
|
169
|
-
expires_in: integer(60, 300),
|
|
170
|
-
reference: text(191, 'Application reference.'),
|
|
171
|
-
context: input({ ip: string, device: text(191, 'Device.'), location: text(191, 'Location.') }, []),
|
|
172
|
-
}, ['auth_identity', 'requester_subscriber_id']), { kind: 'identity' });
|
|
173
|
-
apiTool('prepare_auth_push_consume_grant', 'auth-push/grants/consume', 'Consume a verified Auth Push grant once.', input({
|
|
174
|
-
challenge_id: uuid,
|
|
175
|
-
grant: { type: 'string', pattern: '^[a-zA-Z0-9]{64}$' },
|
|
176
|
-
auth_identity: text(191, 'Auth Push identity.'),
|
|
177
|
-
}), { kind: 'identity' });
|
|
178
|
-
|
|
179
153
|
if (enabled.send) {
|
|
180
154
|
tools.push({
|
|
181
155
|
name: 'pushfa_send_notification',
|
|
@@ -186,22 +160,22 @@ if (enabled.send) {
|
|
|
186
160
|
});
|
|
187
161
|
}
|
|
188
162
|
|
|
189
|
-
if (enabled.manage
|
|
163
|
+
if (enabled.manage) {
|
|
190
164
|
tools.push({
|
|
191
|
-
name: '
|
|
192
|
-
description: 'Execute a management
|
|
165
|
+
name: 'pushfa_confirm_management',
|
|
166
|
+
description: 'Execute a management draft after the user explicitly approves it. Each draft permits one attempt.',
|
|
193
167
|
inputSchema: input({ draft_id: uuid }),
|
|
194
168
|
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
|
|
195
|
-
run: ({ draft_id }) => confirmDraft(draft_id, ['manage'
|
|
169
|
+
run: ({ draft_id }) => confirmDraft(draft_id, ['manage']),
|
|
196
170
|
});
|
|
197
171
|
}
|
|
198
172
|
|
|
199
173
|
function apiTool(name, endpoint, description, inputSchema, {
|
|
200
|
-
kind = 'read',
|
|
174
|
+
kind = 'read', raw, project = asToolData,
|
|
201
175
|
} = {}) {
|
|
202
176
|
if (!enabled[kind]) return;
|
|
203
177
|
|
|
204
|
-
const operation = { endpoint, kind,
|
|
178
|
+
const operation = { endpoint, kind, raw, project };
|
|
205
179
|
const preparing = kind !== 'read';
|
|
206
180
|
tools.push({
|
|
207
181
|
name: `pushfa_${name}`,
|