Chronosfy MCP — Node.js
Install @modelcontextprotocol/sdk. Use a scoped API key (crm:write for this example), or a human JWT obtained with POST /auth/login. The same Authorization header works on HTTP and 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();
}Discover tools with tools/list or GET /mcp/tools. Both use the same names and schemas.
Use create_checkout_session and get_checkout_session for hosted or embedded one-off payment, recurring enrollment and card storage. See /docs/quickstart/checkout.
create_person, create_action and create_recurrence accept optional request_key (8–128 letters/digits/._:-).
Recurring emails use the current email address of the selected person or company.
`subject_type: "company"` · `subject_id`
create_payment_link requires it. Reuse a key only for the same logical request and payload.
create_payment_link accepts save_payment_method and set_as_default, requiring payments:setup as well as payments:links.
Read payment_method_status separately from payment status. create_recurrence accepts first_run_at;
its persisted automatic lower bound survives pause/resume and edits. See /docs/quickstart/renewals for the complete flow.
execute_action and trigger_recurrence retain their separate required 8–200 character contract.
Tool failures set isError=true; content[0].text contains JSON and structuredContent contains error, message, status_code and optional fields/details. HTTP 200 on the MCP transport is not business success.
Malformed JSON-RPC, unknown tools and unsupported task requests are protocol errors.
PSP tools: get_payment_settings, list_payment_providers, get_payment_webhook_url and set_payment_settings require a current human owner. To save, obtain reauth_token from POST /auth/reauth with
operation="PUT /settings/payment" and pass it to set_payment_settings using the same login JWT.
The five-minute proof is consumed once, including failed saves. API keys/service tokens cannot administer PSP credentials.
Never include secrets in prompts, logs or shared conversation history; use a trusted client to supply credentials.
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.
## Default payment provider
Saving credentials keeps the default unchanged, even for the first provider. To choose the account for new payments, the tenant owner selects a saved account and confirms the change. An explicit provider can be used before choosing a 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})