pushfa-mcp 2.0.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 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 و کار با وب‌سرویس‌های یک سرویس پوشفا. روی سیستم شما با `stdio` اجرا می‌شود و برای دریافت راهنما و عملیات سرویس به `pushfa.com` متصل می‌شود.
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، این تنظیم را در کلاینت‌های دارای قالب `mcpServers` وارد کنید.
11
+ به Node.js نسخهٔ ۲۲ یا بالاتر و کلاینتی با پشتیبانی از MCP محلی نیاز دارید. برای اجرا از npm، این تنظیم را در کلاینت‌های دارای قالب <code dir="ltr">mcpServers</code> وارد کنید.
12
+
13
+ <div dir="ltr">
10
14
 
11
15
  ```json
12
16
  {
@@ -19,24 +23,38 @@ MCP رسمی پوشفا برای خواندن راهنمای نصب وب، ان
19
23
  }
20
24
  ```
21
25
 
22
- برای اجرا از GitHub، آرگومان‌ها را به `["--yes", "--package=git+https://github.com/ehsan-coder/pushfa-mcp.git", "pushfa-mcp"]` تغییر دهید.
26
+ </div>
27
+
28
+ برای اجرا از GitHub، مقدار فیلد <code dir="ltr">args</code> را با آرایهٔ زیر جایگزین کنید.
23
29
 
24
- برای نصب دستی، [فایل یکپارچه](https://pushfa.com/downloads/pushfa-mcp.mjs) را بگیرید و در تنظیمات کلاینت، فرمان `node` و مسیر کامل فایل را وارد کنید. اگر مخزن را کلون یا ZIP آن را استخراج کرده‌اید، `node src/index.mjs` نیز از ریشهٔ پروژه اجرا می‌شود. اجرای کد به نصب وابستگی نیاز ندارد.
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
- برای خواندن راهنماها هیچ کلیدی لازم نیست. برای کار با سرویس، متغیرها را در بخش `env` تنظیمات محلی اتصال وارد کنید و اتصال را دوباره راه‌اندازی کنید.
46
+ برای خواندن راهنماها هیچ کلیدی لازم نیست. برای کار با سرویس، متغیرها را در بخش <code dir="ltr">env</code> تنظیمات محلی اتصال وارد کنید و اتصال را دوباره راه‌اندازی کنید.
29
47
 
30
48
  | متغیر | کاربرد |
31
49
  | --- | --- |
32
- | `PUSHFA_API_PUBLIC_KEY` | کلید عمومی سرویس |
33
- | `PUSHFA_API_PRIVATE_KEY` | کلید خصوصی همان سرویس |
34
- | `PUSHFA_MCP_ENABLE_SEND` | مقدار رشته‌ای `true` برای فعال‌کردن ارسال |
35
- | `PUSHFA_MCP_ENABLE_MANAGEMENT` | مقدار رشته‌ای `true` برای عملیات مدیریتی |
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> برای عملیات مدیریتی |
36
54
 
37
55
  با هر دو کلید، ابزارهای استعلامِ وضعیت اعلان و اشتراک، Alias، براکت‌ها و اطلاعات تاپیک فعال می‌شوند. ابزارهای ارسال به شناسهٔ مخاطب، توکن FCM، Alias، Custom Alias و تاپیک، بسته به نوع اعلان و وب‌سرویس درخواستی، دسترسی ارسال را می‌خواهند. ابزارهای مدیریتی شامل تغییر Alias و براکت، عضویت تاپیک، کاربر آزمایشی و ثبت پروفایل و رویداد RetenX هستند.
38
56
 
39
- دستیار ابتدا یک پیش‌نمایش با `pushfa_prepare_*` می‌گیرد. پس از تأیید شما، `pushfa_send_notification` ارسال را ثبت می‌کند و `pushfa_confirm_management` پیش‌نمایش مدیریتی را اجرا می‌کند. شناسهٔ پیش‌نمایش پنج دقیقه در همان پردازش معتبر است و فقط یک بار می‌توان برای اجرای عملیات از آن استفاده کرد. کلید خصوصی را در تنظیمات محلی نگه دارید. امکانات سرویس و هزینه‌ها طبق پلن و تعرفهٔ پوشفا محاسبه می‌شوند.
57
+ دستیار ابتدا یک پیش‌نمایش با <code dir="ltr">pushfa_prepare_*</code> می‌گیرد. پس از تأیید شما، <code dir="ltr">pushfa_send_notification</code> ارسال را ثبت می‌کند و <code dir="ltr">pushfa_confirm_management</code> پیش‌نمایش مدیریتی را اجرا می‌کند. شناسهٔ پیش‌نمایش پنج دقیقه در همان پردازش معتبر است و فقط یک بار می‌توان برای اجرای عملیات از آن استفاده کرد. کلید خصوصی را در تنظیمات محلی نگه دارید. امکانات سرویس و هزینه‌ها طبق پلن و تعرفهٔ پوشفا محاسبه می‌شوند.
40
58
 
41
59
  ## نمونه درخواست
42
60
 
@@ -48,10 +66,16 @@ MCP رسمی پوشفا برای خواندن راهنمای نصب وب، ان
48
66
 
49
67
  | مسیر | مسئولیت |
50
68
  | --- | --- |
51
- | `src/index.mjs` | ورودی برنامه و پروتکل MCP روی stdin و stdout |
52
- | `src/tools.mjs` و `src/schemas.mjs` | تعریف ابزارها و اعتبارسنجی ورودی |
53
- | `src/client.mjs` و `src/config.mjs` | اتصال به API پوشفا و تنظیم دسترسی ابزارها |
54
- | `src/guides.mjs` و `src/drafts.mjs` | خواندن راهنماها و مدیریت پیش‌نمایش‌های یک‌بارمصرف |
55
- | `pushfa-mcp.mjs` | خروجی یکپارچه برای دانلود و اجرای مستقیم |
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) منتشر می‌شود.
56
80
 
57
- بعد از تغییر کد در `src/`، با `npm ci` و سپس `npm run build` فایل یکپارچه را دوباره تولید کنید.
81
+ </div>
package/package.json CHANGED
@@ -1,12 +1,19 @@
1
1
  {
2
2
  "name": "pushfa-mcp",
3
- "version": "2.0.0",
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": "UNLICENSED",
7
- "engines": { "node": ">=22" },
8
- "bin": { "pushfa-mcp": "src/index.mjs" },
9
- "files": ["src", "pushfa-mcp.mjs"],
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": { "esbuild": "0.25.12" }
26
+ "devDependencies": {
27
+ "esbuild": "0.25.12"
28
+ }
20
29
  }
package/pushfa-mcp.mjs CHANGED
@@ -541,7 +541,7 @@ function asToolData(data) {
541
541
  // src/index.mjs
542
542
  var modernVersion = "2026-07-28";
543
543
  var legacyVersions = ["2025-11-25", "2025-06-18", "2025-03-26"];
544
- var serverInfo = { name: "pushfa", title: "Pushfa", version: "2.0.0" };
544
+ var serverInfo = { name: "pushfa", title: "Pushfa", version: "2.0.1" };
545
545
  var capabilities = { tools: {} };
546
546
  var instructions = [
547
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/drafts.mjs CHANGED
@@ -1,63 +1,63 @@
1
- import { randomUUID } from 'node:crypto';
2
-
3
- import { callApi, unexpectedResponse } from './client.mjs';
4
- import { invalidArgument, reports, ToolError, uuidPattern } from './schemas.mjs';
5
-
6
- const draftLifetimeMs = 5 * 60 * 1000;
7
- const drafts = new Map();
8
-
9
- function prepareDraft(operation, schema, args) {
10
- const payload = { ...args };
11
- if (operation.kind === 'send') {
12
- payload.title = args.title.trim();
13
- payload.body = args.body.trim();
14
- if (payload.topic !== undefined) payload.topic = payload.topic.trim();
15
- if (payload.subscriber_id !== undefined) payload.subscriber_id = payload.subscriber_id.toLowerCase();
16
- payload.send_time ??= 'current';
17
- if ((payload.send_time === 'delay') !== (payload.time !== undefined)) {
18
- throw invalidArgument('Provide time exactly when send_time is delay.');
19
- }
20
- for (const field of Object.keys(reports)) {
21
- if (Object.hasOwn(schema.properties, field)) payload[field] ??= false;
22
- }
23
- }
24
-
25
- const now = Date.now();
26
- for (const [id, draft] of drafts) {
27
- if (draft.expiresAt <= now) drafts.delete(id);
28
- }
29
- if (drafts.size >= 20) {
30
- throw new ToolError('MCP_DRAFT_LIMIT', 'There are 20 pending previews. Use an approved draft or wait for it to expire.');
31
- }
32
-
33
- const id = randomUUID();
34
- const expiresAt = now + draftLifetimeMs;
35
- drafts.set(id, { operation, payload, expiresAt });
36
- const preview = Object.hasOwn(payload, 'grant') ? { ...payload, grant: '[redacted]' } : payload;
37
- return { draft_id: id, expires_at: new Date(expiresAt).toISOString(), operation: operation.endpoint, preview };
38
- }
39
-
40
- async function confirmDraft(draftId, kinds) {
41
- const id = draftId.toLowerCase();
42
- const draft = drafts.get(id);
43
- if (!draft || draft.expiresAt <= Date.now()) {
44
- drafts.delete(id);
45
- throw new ToolError('MCP_DRAFT_UNAVAILABLE', 'This preview has expired, was already used, or belongs to a different MCP process.');
46
- }
47
- const { operation, payload } = draft;
48
- if (!kinds.includes(operation.kind)) {
49
- throw invalidArgument('Use the confirmation tool for this draft’s operation type.');
50
- }
51
-
52
- // Consume before the network request, even if the outcome is unknown.
53
- drafts.delete(id);
54
- const data = await callApi(operation.endpoint, payload, operation);
55
- if (operation.kind === 'send') {
56
- const singleId = typeof data?.notification_id === 'string' && uuidPattern.test(data.notification_id);
57
- if (!singleId && !Array.isArray(data?.notification_ids)) throw unexpectedResponse('send');
58
- }
59
-
60
- return { ...operation.project(data), accepted: true };
61
- }
62
-
63
- export { prepareDraft, confirmDraft };
1
+ import { randomUUID } from 'node:crypto';
2
+
3
+ import { callApi, unexpectedResponse } from './client.mjs';
4
+ import { invalidArgument, reports, ToolError, uuidPattern } from './schemas.mjs';
5
+
6
+ const draftLifetimeMs = 5 * 60 * 1000;
7
+ const drafts = new Map();
8
+
9
+ function prepareDraft(operation, schema, args) {
10
+ const payload = { ...args };
11
+ if (operation.kind === 'send') {
12
+ payload.title = args.title.trim();
13
+ payload.body = args.body.trim();
14
+ if (payload.topic !== undefined) payload.topic = payload.topic.trim();
15
+ if (payload.subscriber_id !== undefined) payload.subscriber_id = payload.subscriber_id.toLowerCase();
16
+ payload.send_time ??= 'current';
17
+ if ((payload.send_time === 'delay') !== (payload.time !== undefined)) {
18
+ throw invalidArgument('Provide time exactly when send_time is delay.');
19
+ }
20
+ for (const field of Object.keys(reports)) {
21
+ if (Object.hasOwn(schema.properties, field)) payload[field] ??= false;
22
+ }
23
+ }
24
+
25
+ const now = Date.now();
26
+ for (const [id, draft] of drafts) {
27
+ if (draft.expiresAt <= now) drafts.delete(id);
28
+ }
29
+ if (drafts.size >= 20) {
30
+ throw new ToolError('MCP_DRAFT_LIMIT', 'There are 20 pending previews. Use an approved draft or wait for it to expire.');
31
+ }
32
+
33
+ const id = randomUUID();
34
+ const expiresAt = now + draftLifetimeMs;
35
+ drafts.set(id, { operation, payload, expiresAt });
36
+ const preview = Object.hasOwn(payload, 'grant') ? { ...payload, grant: '[redacted]' } : payload;
37
+ return { draft_id: id, expires_at: new Date(expiresAt).toISOString(), operation: operation.endpoint, preview };
38
+ }
39
+
40
+ async function confirmDraft(draftId, kinds) {
41
+ const id = draftId.toLowerCase();
42
+ const draft = drafts.get(id);
43
+ if (!draft || draft.expiresAt <= Date.now()) {
44
+ drafts.delete(id);
45
+ throw new ToolError('MCP_DRAFT_UNAVAILABLE', 'This preview has expired, was already used, or belongs to a different MCP process.');
46
+ }
47
+ const { operation, payload } = draft;
48
+ if (!kinds.includes(operation.kind)) {
49
+ throw invalidArgument('Use the confirmation tool for this draft’s operation type.');
50
+ }
51
+
52
+ // Consume before the network request, even if the outcome is unknown.
53
+ drafts.delete(id);
54
+ const data = await callApi(operation.endpoint, payload, operation);
55
+ if (operation.kind === 'send') {
56
+ const singleId = typeof data?.notification_id === 'string' && uuidPattern.test(data.notification_id);
57
+ if (!singleId && !Array.isArray(data?.notification_ids)) throw unexpectedResponse('send');
58
+ }
59
+
60
+ return { ...operation.project(data), accepted: true };
61
+ }
62
+
63
+ export { prepareDraft, confirmDraft };
package/src/guides.mjs CHANGED
@@ -1,72 +1,72 @@
1
- import { createHash } from 'node:crypto';
2
-
3
- import { invalidArgument, ToolError } from './schemas.mjs';
4
-
5
- const guideUrls = {
6
- web: 'https://pushfa.com/index/doc/download/pushfa-web-push-complete-guide-fa.md',
7
- android: 'https://pushfa.com/index/doc/download/pushfa-android-push-complete-guide-fa.md',
8
- ios: 'https://pushfa.com/index/doc/download/pushfa-ios-push-complete-guide-fa.md',
9
- };
10
- const guidePageSize = 4000;
11
-
12
- async function fetchGuide(url) {
13
- let response;
14
- try {
15
- response = await fetch(url, {
16
- headers: { Accept: 'text/markdown' },
17
- cache: 'no-store',
18
- redirect: 'error',
19
- signal: AbortSignal.timeout(20_000),
20
- });
21
- const contentType = response.headers.get('content-type')?.split(';', 1)[0].trim().toLowerCase();
22
- if (response.ok && contentType === 'text/markdown') {
23
- const markdown = await response.text();
24
- if (markdown.trim()) return markdown;
25
- } else {
26
- await response.body?.cancel();
27
- }
28
- } catch {
29
- // Report the official source even when the download fails.
30
- }
31
-
32
- throw new ToolError('MCP_GUIDE_UNAVAILABLE', 'Could not read the current Pushfa guide from its official URL.', {
33
- url, http_status: response?.status,
34
- });
35
- }
36
-
37
- async function readInstallationGuide({ platform, offset = 0, revision }) {
38
- if (offset > 0 && revision === undefined) {
39
- throw invalidArgument('Use the returned revision when requesting a guide page or section.');
40
- }
41
-
42
- const url = guideUrls[platform];
43
- const markdown = await fetchGuide(url);
44
- const currentRevision = createHash('sha256').update(markdown).digest('hex');
45
- if (revision !== undefined && revision !== currentRevision) {
46
- throw new ToolError('MCP_GUIDE_CHANGED', 'The guide changed. Restart reading with the platform only to get the updated sections.', { url });
47
- }
48
- if (offset >= markdown.length) throw invalidArgument('The guide offset is out of range.');
49
-
50
- let end = Math.min(offset + guidePageSize, markdown.length);
51
- if (end < markdown.length) {
52
- const newline = markdown.lastIndexOf('\n', end - 1);
53
- if (newline >= offset) end = newline + 1;
54
- else if (markdown.codePointAt(end - 1) > 0xffff) end--;
55
- }
56
-
57
- const page = {
58
- platform,
59
- url,
60
- revision: currentRevision,
61
- markdown: markdown.slice(offset, end),
62
- next_offset: end < markdown.length ? end : null,
63
- };
64
- if (offset === 0) {
65
- page.sections = Array.from(markdown.matchAll(/^##[ \t]+(.+)$/gm), heading => ({
66
- title: heading[1].trim(), offset: heading.index,
67
- }));
68
- }
69
- return page;
70
- }
71
-
72
- export { guideUrls, readInstallationGuide };
1
+ import { createHash } from 'node:crypto';
2
+
3
+ import { invalidArgument, ToolError } from './schemas.mjs';
4
+
5
+ const guideUrls = {
6
+ web: 'https://pushfa.com/index/doc/download/pushfa-web-push-complete-guide-fa.md',
7
+ android: 'https://pushfa.com/index/doc/download/pushfa-android-push-complete-guide-fa.md',
8
+ ios: 'https://pushfa.com/index/doc/download/pushfa-ios-push-complete-guide-fa.md',
9
+ };
10
+ const guidePageSize = 4000;
11
+
12
+ async function fetchGuide(url) {
13
+ let response;
14
+ try {
15
+ response = await fetch(url, {
16
+ headers: { Accept: 'text/markdown' },
17
+ cache: 'no-store',
18
+ redirect: 'error',
19
+ signal: AbortSignal.timeout(20_000),
20
+ });
21
+ const contentType = response.headers.get('content-type')?.split(';', 1)[0].trim().toLowerCase();
22
+ if (response.ok && contentType === 'text/markdown') {
23
+ const markdown = await response.text();
24
+ if (markdown.trim()) return markdown;
25
+ } else {
26
+ await response.body?.cancel();
27
+ }
28
+ } catch {
29
+ // Report the official source even when the download fails.
30
+ }
31
+
32
+ throw new ToolError('MCP_GUIDE_UNAVAILABLE', 'Could not read the current Pushfa guide from its official URL.', {
33
+ url, http_status: response?.status,
34
+ });
35
+ }
36
+
37
+ async function readInstallationGuide({ platform, offset = 0, revision }) {
38
+ if (offset > 0 && revision === undefined) {
39
+ throw invalidArgument('Use the returned revision when requesting a guide page or section.');
40
+ }
41
+
42
+ const url = guideUrls[platform];
43
+ const markdown = await fetchGuide(url);
44
+ const currentRevision = createHash('sha256').update(markdown).digest('hex');
45
+ if (revision !== undefined && revision !== currentRevision) {
46
+ throw new ToolError('MCP_GUIDE_CHANGED', 'The guide changed. Restart reading with the platform only to get the updated sections.', { url });
47
+ }
48
+ if (offset >= markdown.length) throw invalidArgument('The guide offset is out of range.');
49
+
50
+ let end = Math.min(offset + guidePageSize, markdown.length);
51
+ if (end < markdown.length) {
52
+ const newline = markdown.lastIndexOf('\n', end - 1);
53
+ if (newline >= offset) end = newline + 1;
54
+ else if (markdown.codePointAt(end - 1) > 0xffff) end--;
55
+ }
56
+
57
+ const page = {
58
+ platform,
59
+ url,
60
+ revision: currentRevision,
61
+ markdown: markdown.slice(offset, end),
62
+ next_offset: end < markdown.length ? end : null,
63
+ };
64
+ if (offset === 0) {
65
+ page.sections = Array.from(markdown.matchAll(/^##[ \t]+(.+)$/gm), heading => ({
66
+ title: heading[1].trim(), offset: heading.index,
67
+ }));
68
+ }
69
+ return page;
70
+ }
71
+
72
+ export { guideUrls, readInstallationGuide };
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: '2.0.0' };
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.',