Tài liệu dành cho nhà phát triển

Chronosfy MCP — Node.js

Cài đặt @modelcontextprotocol/sdk. Dùng một khóa API có phạm vi (crm:write cho ví dụ này), hoặc JWT của con người được thu được với POST /auth/login. Tương tự Authorization header hoạt động trên HTTP và 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();
}
Khám phá các công cụ với tools/list hoặc GET /mcp/tools. Cả hai đều sử dụng cùng tên và kiểu dáng. Dùng create_checkout_session và get_checkout_session cho máy chủ hoặc nhúng one-off thanh toán, đăng ký và lưu trữ thẻ. Xem đi. /docs/quickstart/checkout. create_person, create_action và create_recurrence accept optional request_key (8–128 letters/digits/._:-). Mỗi email định kỳ được gửi đến địa chỉ email đang được ghi trong hồ sơ của cá nhân hoặc công ty đã chọn tại thời điểm gửi. `subject_type: "company"` · `subject_id` create_payment_link yêu cầu nó. Sử dụng lại một khóa chỉ cho cùng một yêu cầu logic và tải trọng. create_payment_link chấp nhận save_payment_method và set_as_default, yêu cầu payments:setup cũng như payments.links. Đọc payment_method_status riêng biệt với payment_status. create_recurrence accepts first_run_at; giới hạn thấp tự động của nó vẫn còn tồn tại khi tạm dừng/ tiếp tục và sửa đổi. Xem /docs/quickstart/renewals cho dòng hoàn chỉnh. execute_action và trigger_recurrence giữ lại những gì riêng biệt cần thiết 8–200 hợp đồng nhân vật. Công cụ thất bại được đặt là isError=true; content[0].text chứa JSON và structuredContent chứa lỗi, thông điệp, status_code và các trường/chi tiết tùy chọn. HTTP 200 trên giao thông MCP không phải là thành công kinh doanh. JSON-RPC bị hỏng, công cụ không biết và yêu cầu nhiệm vụ không được hỗ trợ là lỗi giao thức. Công cụ PSP: get_payment_settings, list_payment_providers, get_payment_webhook_url và set_payment_settings yêu cầu một chủ nhân hiện tại. Để cứu, lấy reauth_token từ POST /auth/reauth với operation="PUT /settings/payment" và truyền nó đến set_payment_settings bằng cách sử dụng cùng một tài khoản JWT. Chứng minh five-minute được tiêu thụ một lần, bao gồm cả các lệnh lưu thất bại. API key/service tokens cannot manage PSP credentials. Không bao giờ bao gồm bí mật trong lời nhắc, hồ sơ hoặc lịch sử trò chuyện chia sẻ; sử dụng một khách hàng tin cậy để cung cấp thông tin. 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. ## Nhà cung cấp thanh toán mặc định Lưu thông tin xác thực giữ nguyên lựa chọn mặc định, kể cả khi thêm nhà cung cấp đầu tiên. Để chọn tài khoản cho các khoản thanh toán mới, chủ sở hữu chọn một tài khoản đã lưu và xác nhận thay đổi. Có thể chỉ định nhà cung cấp khi thanh toán trước khi chọn mặc định.
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})