Dokumentasi pengembang

Chronosfy MCP — Node.js

Pasang @modelcontextprotocol/sdk. Gunakan tombol API yang dikungkung (crm:tulis untuk contoh ini), atau JWT manusia yang diperoleh dengan POST /auth/login. Header otorisasi yang sama bekerja pada HTTP dan 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();
}
Temukan alat-alat dengan/daftar atau GET /mcp/tools. Keduanya menggunakan nama dan skema yang sama. Gunakan create_checkout_session dan get_checkout_session untuk hosted atau embed one-off pembayaran, pendaftaran berulang dan penyimpanan kartu. Lihat /docs/quickstart/checkout. create_person, create_action dan create_recurrence terima opsional request_key (8–128 letters/digits/._:-). Setiap email berkala dikirim ke alamat email yang tercatat untuk orang atau perusahaan yang dipilih saat pengiriman. `subject_type: "company"` · `subject_id` create_payment_link membutuhkannya. Gunakan kembali kunci hanya untuk permintaan logis yang sama dan tagihan. create_payment_link terima save_payment_method dan set_as_default, membutuhkan pembayaran:setup serta pembayaran:links. Baca payment_method_status terpisah dari status pembayaran. create_recurrence terima first_run_at; Batas bawah otomatis bertahan jeda/ulang dan sunting. Lihat /docs/quickstart/renewals untuk aliran lengkap. execute_action dan trigger_recurrence mempertahankan terpisah mereka diperlukan 8–200 kontrak karakter. Perkakas gagal ditata isError=true; isi[0].text berisi JSON dan structuredContent berisi kesalahan, pesan, status_code dan opsional field/details. HTTP 200 pada MCP transportasi tidak sukses bisnis. Salah bentuk JSON-RPC, alat yang tidak diketahui dan permintaan tugas yang tidak didukung adalah galat protokol. Alat PSP: get_payment_settings, list_payment_providers, get_payment_webhook_url dan set_payment_settings membutuhkan pemilik manusia saat ini. Untuk menyimpan, mendapatkan reauth_token dari POST /auth/reauth dengan operasi="PUT /settings/payment" dan lulus ke set_payment_settings menggunakan login yang sama JWT. The five-minute bukti dikonsumsi sekali, termasuk menyelamatkan gagal. API token kunci/service tidak dapat memberikan kredensial PSP. Jangan pernah menyertakan rahasia dalam prompt, catatan atau riwayat percakapan bersama; gunakan klien terpercaya untuk menyediakan kredensial. 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. ## Penyedia pembayaran default Menyimpan kredensial mempertahankan pilihan default, termasuk untuk penyedia pertama. Untuk menentukan akun bagi pembayaran baru, pemilik tenant memilih akun tersimpan lalu mengonfirmasi perubahan. Penyedia juga dapat ditentukan saat checkout sebelum ada pilihan default.
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})