Chronosfy MCP — Node.js
تثبيت @modelcontextprotocol/sdk. استخدام مفتاح API نطاق (crm:write لهذا المثال)، أو الإنسان JWT الحصول مع POST /auth/login. نفس الترخيص رأس يعمل على HTTP و MCP.
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
const base = 'https://chronosfy.com/api';
const authorization = process.env.CHRONOSFY_AUTH; // e.g. 'ApiKey ...'; never hardcode secrets
const request_key = 'person:customer-42:v1'; // preserve across retries/restarts
const person = {"name":"Alice","email":"[email protected]","external_id":"customer-42","metadata":{"source":"integration"}};
const client = new Client({ name: 'integration', version: '1' });
await client.connect(new StreamableHTTPClientTransport(new URL(base + '/mcp'), {
requestInit: { headers: { Authorization: authorization } },
}));
try {
const result = await client.callTool({ name: 'create_person', arguments: { ...person, request_key } });
if (result.isError) throw new Error(JSON.stringify(result.structuredContent ?? result.content));
const replay = await fetch(base + '/crm/persons', { method: 'POST',
headers: { Authorization: authorization, 'Content-Type': 'application/json', 'Idempotency-Key': request_key },
body: JSON.stringify(person) });
if (!replay.ok) throw new Error(await replay.text());
// Both results identify the same person.
} finally {
await client.close();
}اكتشاف الأدوات مع tools/list أو GET /mcp/tools. كلاهما يستخدم نفس الأسماء والمخططات.
الاستخدام create_checkout_session و get_checkout_session لنظم المعلومات الجغرافية المستضافة أو المتكاملة one-off )ب( الدفع، واﻻلتحاق المتكرر، وتخزين البطاقات. /docs/quickstart/checkout.
create_person, create_action و create_recurrence قبول اختياري request_key (8–128 letters/digits/._:-).
تُرسل الرسائل الدورية إلى عنوان البريد الإلكتروني المسجّل للشخص أو الشركة المحددة وقت الإرسال.
`subject_type: "company"` · `subject_id`
يتطلبه create_payment_link. إعادة استخدام المفتاح فقط لنفس الطلب المنطقي والحمولة.
create_payment_link توافق عليها save_payment_method و set_as_defaultوتتطلب المدفوعات: الإعداد وكذلك المدفوعة: الروابط.
قراءة payment_method_status بمعزل عن حالة الدفع. create_recurrence يقبل first_run_at؛
الحد الأدنى التلقائي المستمر له يبقى على قيد الحياة عند التوقف/الاستئناف والتحرير. انظر /docs/quickstart/renewals للحصول على التدفق الكامل.
execute_action و trigger_recurrence احتفظوا بحقوقهم المنفصلة المطلوبة 8–200 عقد الشخصية.
فشل الأدوات set isError=true؛ content[0].text يحتوي على JSON ويحتوي structuredContent على error، message، status_code واختيار الحقول/التفاصيل. HTTP 200 على نقل MCP ليس نجاحًا تجاريًا.
وتعد أخطاء البروتوكول هي JSON-RPC غير الصحيحة، والأدوات المجهولة وطلبات المهام غير المدعومة.
أدوات دعم البرامج: get_payment_settings, list_payment_providers, get_payment_webhook_url و set_payment_settings وتتطلب ملكا بشريا حاليا. reauth_token من POST /auth/reauth مع
operation="PUT /settings/payment" ونقلها إلى set_payment_settings باستخدام نفس تسجيل الدخول JWT.
اللجنة الفرعية five-minute الدليل يستهلك مرة واحدة، بما في ذلك الحفظ الفاشل. API لا يمكن للمفاتيح/رموز الخدمة إدارة وثائق تفويض مقدمي الخدمات.
لا تدرج أبداً الأسرار في النصائح، السجلات أو تاريخ المحادثات المشتركة؛ استخدم عميل موثوق لتقديم بيانات الاعتماد.
RSVP organizers use /mcp with rsvp:read or rsvp:write. Create an event with create_rsvp_event, open it with update_rsvp_event, then use add_rsvp_invitees and send_rsvp_invitations.
Provide request_key on MCP sends or Idempotency-Key on REST sends. Reuse the same key and guest IDs on a network retry. The receipt lists each guest's dispatch state. A dispatching or unknown delivery needs reconciliation before explicitly sending a new batch.
A guest can connect to POST /rsvp/guest/mcp using the invitation UUID as a bearer credential.
open_rsvp_invitation, respond_to_rsvp_invitation and open_rsvp_pass return the guest's private URL.
The person confirms or declines there. The organizer scans the pass with check_in_rsvp_qr.
For email delivery, use get_email_stats and list_email_recipients with action_id, page and limit for the list.
Platform operators connect to POST /admin/mcp using their named X-Platform-Admin-Token header.
GET /admin/mcp/tools and GET /admin/openapi.json return only the operations granted to that operator.
## مزود الدفع الافتراضي
يحافظ حفظ بيانات الاعتماد على الخيار الحالي حتى عند إضافة أول مزود. لاختيار حساب المدفوعات الجديدة، يختار مالك الحساب حسابًا محفوظًا ويؤكد التغيير. ويمكن تحديد مزود صراحة عند الدفع قبل اختيار المزود الافتراضي.
GET /api/settings/payment
Authorization: Bearer <owner_access_token>
POST /api/auth/reauth
Authorization: Bearer <owner_access_token>
Content-Type: application/json
{"password":"<password>","operation":"PUT /settings/payment/default"}
PUT /api/settings/payment/default
Authorization: Bearer <owner_access_token>
X-Reauth-Token: <reauth_token>
Content-Type: application/json
{"config_id":"<configurations[].config_id>"}MCP: set_default_payment_provider({config_id, reauth_token})