simplepractice-mcp 1.1.3 → 1.2.0

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.
@@ -6,14 +6,14 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "SimplePractice Client Portal tools for Claude",
9
- "version": "1.1.3"
9
+ "version": "1.2.0"
10
10
  },
11
11
  "plugins": [
12
12
  {
13
13
  "name": "simplepractice",
14
14
  "source": "./",
15
15
  "description": "Read a SimplePractice Client Portal — appointments, invoices and superbills, documents to sign, and practice announcements. Signs in with the portal's own passwordless emailed link; requests go straight to the portal's JSON:API over your own session.",
16
- "version": "1.1.3",
16
+ "version": "1.2.0",
17
17
  "author": {
18
18
  "name": "Chris Chall",
19
19
  "url": "https://github.com/chrischall"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simplepractice",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
4
4
  "description": "SimplePractice Client Portal — appointments, billing, documents, and announcements",
5
5
  "author": {
6
6
  "name": "Chris Chall",
package/README.md CHANGED
@@ -64,9 +64,11 @@ To have a fresh link sent rather than using one you already have, name the
64
64
  practice once:
65
65
 
66
66
  ```
67
- simplepractice_request_sign_in_link { email, practice: "achievebalancetherapy", confirm: true }
67
+ simplepractice_request_sign_in_link { email, practice: "achievebalancetherapy" }
68
68
  ```
69
69
 
70
+ Sending asks you to confirm first (see [Confirmations](#confirmations)).
71
+
70
72
  `practice` can be omitted whenever the server already knows the practice —
71
73
  from an earlier sign-in, or from `SIMPLEPRACTICE_PRACTICE`.
72
74
 
@@ -79,8 +81,8 @@ outside `*.clientsecure.me` is never adopted — the token is not sent there.
79
81
  Links are single-use — replaying one answers
80
82
  `401 "Authorization has already been used or expired"` — and last 24 hours. The
81
83
  request endpoint is rate-limited per address **and** per IP, which is why
82
- sending is confirm-gated: a retry loop locks you out of the only way in. There
83
- is no refresh token; when the session lapses, you sign in again.
84
+ sending asks for confirmation first: a retry loop locks you out of the only way
85
+ in. There is no refresh token; when the session lapses, you sign in again.
84
86
 
85
87
  The whole chain is verified end to end against a live portal — request, the
86
88
  emailed link, the exchange returning `verified` plus a session cookie, and an
@@ -89,6 +91,21 @@ authenticated read with that new session.
89
91
  Because that flow needs nothing but HTTP and your inbox, this server has no
90
92
  browser dependency and can run anywhere.
91
93
 
94
+ ## Confirmations
95
+
96
+ `simplepractice_request_sign_in_link` sends a real email, so it asks you to
97
+ confirm first. On a client that can show a confirmation prompt (Claude Code) you
98
+ get the prompt. On one that cannot (claude.ai, Claude Desktop), the first call
99
+ sends nothing and returns a preview — the address, the practice — plus a
100
+ `confirmToken`; only a repeat call with that token, and the same arguments,
101
+ sends. A token works once, and a changed address or practice is refused.
102
+
103
+ | variable | default | |
104
+ |---|---|---|
105
+ | `MCP_CONFIRM_MODE` | `ask-user` | What a write does on a client that cannot show a confirmation prompt (claude.ai, Claude Desktop). `ask-user`: two steps — the first call does nothing and returns a preview plus a token, and the model must get your approval in chat before calling again with it. `auto`: the same two steps, but the model may use the token after reviewing the preview itself. `refuse`: writes are refused on such clients. A client that can show prompts (Claude Code) always gets the real prompt. An unrecognised value is treated as `refuse`. |
106
+ | `MCP_CONFIRM_TTL_SECONDS` | `600` | How long a token stays valid. |
107
+ | `MCP_CONFIRM_SECRET` | random per process | Signing key; set it only if tokens must survive a server restart. |
108
+
92
109
  ## Without the server
93
110
 
94
111
  `skills/simplepractice-fpx` does the same reads with `curl`, either signing in
package/dist/bundle.js CHANGED
@@ -19,6 +19,33 @@ var storage2 = new AsyncLocalStorage2();
19
19
  function withCallerCapabilities(capabilities, fn) {
20
20
  return capabilities ? storage2.run(capabilities, fn) : fn();
21
21
  }
22
+ function currentCallerCapabilities() {
23
+ return storage2.getStore();
24
+ }
25
+ var ENVELOPE_CAPABILITIES_KEY = "io.modelcontextprotocol/clientCapabilities";
26
+ var ELICITATION_MODES = ["form", "url"];
27
+ function isRecord(value) {
28
+ return typeof value === "object" && value !== null && !Array.isArray(value);
29
+ }
30
+ function callerCapabilities(ctx) {
31
+ const envelope = isRecord(ctx) && isRecord(ctx.mcpReq) ? ctx.mcpReq.envelope : void 0;
32
+ if (isRecord(envelope)) {
33
+ const declared = envelope[ENVELOPE_CAPABILITIES_KEY];
34
+ if (isRecord(declared))
35
+ return declared;
36
+ }
37
+ return currentCallerCapabilities();
38
+ }
39
+ function callerAcceptsFormElicitation(ctx) {
40
+ const capabilities = callerCapabilities(ctx);
41
+ if (!capabilities)
42
+ return void 0;
43
+ const elicitation = capabilities.elicitation;
44
+ if (!isRecord(elicitation))
45
+ return false;
46
+ const namedModes = ELICITATION_MODES.filter((mode) => mode in elicitation);
47
+ return namedModes.length === 0 || namedModes.includes("form");
48
+ }
22
49
 
23
50
  // node_modules/@modelcontextprotocol/server/dist/chunk-Br0eD_fh.mjs
24
51
  var __create = Object.create;
@@ -24083,6 +24110,37 @@ var inputRequired = Object.assign(buildInputRequired, {
24083
24110
  return { method: "roots/list" };
24084
24111
  }
24085
24112
  });
24113
+ function acceptedContent(responses, key, schema) {
24114
+ const view = inputResponse(responses, key);
24115
+ if (view.kind !== "elicit" || view.action !== "accept" || view.content === void 0) return void 0;
24116
+ if (schema === void 0) return view.content;
24117
+ const outcome = schema["~standard"].validate(view.content);
24118
+ if (outcome instanceof Promise) throw new TypeError("acceptedContent(responses, key, schema) requires a synchronously-validating schema");
24119
+ return outcome.issues === void 0 ? outcome.value : void 0;
24120
+ }
24121
+ function inputResponse(responses, key) {
24122
+ if (responses === void 0 || typeof responses !== "object" || responses === null) return { kind: "missing" };
24123
+ const entry = responses[key];
24124
+ if (entry === null || typeof entry !== "object" || Array.isArray(entry)) return { kind: "missing" };
24125
+ const candidate = entry;
24126
+ if (candidate["action"] === "accept" || candidate["action"] === "decline" || candidate["action"] === "cancel") {
24127
+ const content = candidate["content"];
24128
+ return {
24129
+ kind: "elicit",
24130
+ action: candidate["action"],
24131
+ ...content !== null && typeof content === "object" && !Array.isArray(content) && { content }
24132
+ };
24133
+ }
24134
+ if (Array.isArray(candidate["roots"])) return {
24135
+ kind: "roots",
24136
+ roots: candidate["roots"]
24137
+ };
24138
+ if (typeof candidate["role"] === "string" && candidate["content"] !== void 0) return {
24139
+ kind: "sampling",
24140
+ result: candidate
24141
+ };
24142
+ return { kind: "missing" };
24143
+ }
24086
24144
  var REQUEST_STATE_ONLY_LEG_PACING_MS = 250;
24087
24145
  function inputRequiredRoundsExceededMessage(method, maxRounds) {
24088
24146
  return `Multi-round-trip request '${method}' still required input after ${maxRounds} rounds (inputRequired.maxRounds)`;
@@ -34130,14 +34188,14 @@ function serveStdio(factory, options = {}) {
34130
34188
  return false;
34131
34189
  };
34132
34190
  const answerLegacyRejection = (request, reason, requestedVersion) => {
34133
- const rejection2 = modernOnlyStrictRejection({
34191
+ const rejection3 = modernOnlyStrictRejection({
34134
34192
  kind: "legacy",
34135
34193
  reason,
34136
34194
  ...requestedVersion !== void 0 && { requestedVersion }
34137
34195
  }, SUPPORTED_MODERN_PROTOCOL_VERSIONS);
34138
- if (rejection2 === void 0) return Promise.resolve();
34139
- reportError(/* @__PURE__ */ new Error(`Rejected 2025-era request on a modern-only stdio connection (${rejection2.cell}): ${rejection2.message}`));
34140
- return writeErrorResponse(request.id, rejection2.code, rejection2.message, rejection2.data);
34196
+ if (rejection3 === void 0) return Promise.resolve();
34197
+ reportError(/* @__PURE__ */ new Error(`Rejected 2025-era request on a modern-only stdio connection (${rejection3.cell}): ${rejection3.message}`));
34198
+ return writeErrorResponse(request.id, rejection3.code, rejection3.message, rejection3.data);
34141
34199
  };
34142
34200
  const onInstanceClosed = (channel) => {
34143
34201
  if (closing || channel === discarding) return;
@@ -34474,6 +34532,11 @@ function walk(value, keep, drop) {
34474
34532
  }
34475
34533
 
34476
34534
  // node_modules/@chrischall/mcp-utils/dist/response/index.js
34535
+ function textResult(data) {
34536
+ return {
34537
+ content: [{ type: "text", text: JSON.stringify(data, null, 2) }]
34538
+ };
34539
+ }
34477
34540
  function errorResult(message) {
34478
34541
  return {
34479
34542
  content: [{ type: "text", text: redactSecrets(message) }],
@@ -34481,6 +34544,402 @@ function errorResult(message) {
34481
34544
  };
34482
34545
  }
34483
34546
 
34547
+ // node_modules/@chrischall/mcp-utils/dist/server/confirmation.js
34548
+ import { createHash, createHmac, timingSafeEqual } from "node:crypto";
34549
+
34550
+ // node_modules/@chrischall/mcp-utils/dist/server/canonical.js
34551
+ function canonicalJson(value) {
34552
+ if (value === null || typeof value === "string" || typeof value === "boolean")
34553
+ return JSON.stringify(value);
34554
+ if (value === void 0)
34555
+ return "null";
34556
+ if (typeof value === "number")
34557
+ return Number.isFinite(value) ? JSON.stringify(value) : `{"$num":"${String(value)}"}`;
34558
+ if (typeof value === "bigint")
34559
+ return `{"$bigint":"${value.toString()}"}`;
34560
+ if (typeof value === "function" || typeof value === "symbol") {
34561
+ throw new TypeError(`confirmation: cannot bind a ${typeof value} argument value.`);
34562
+ }
34563
+ if (Array.isArray(value))
34564
+ return `[${value.map(canonicalJson).join(",")}]`;
34565
+ if (value instanceof Date) {
34566
+ return `{"$date":${JSON.stringify(Number.isNaN(value.getTime()) ? "Invalid Date" : value.toISOString())}}`;
34567
+ }
34568
+ if (ArrayBuffer.isView(value)) {
34569
+ const bytes = Buffer.from(value.buffer, value.byteOffset, value.byteLength);
34570
+ return `{"$bytes":${JSON.stringify(bytes.toString("base64"))}}`;
34571
+ }
34572
+ if (value instanceof ArrayBuffer)
34573
+ return `{"$bytes":${JSON.stringify(Buffer.from(value).toString("base64"))}}`;
34574
+ if (value instanceof Map) {
34575
+ const entries2 = [...value.entries()].map(([k, v]) => `[${canonicalJson(k)},${canonicalJson(v)}]`).sort();
34576
+ return `{"$map":[${entries2.join(",")}]}`;
34577
+ }
34578
+ if (value instanceof Set) {
34579
+ return `{"$set":[${[...value].map(canonicalJson).sort().join(",")}]}`;
34580
+ }
34581
+ const proto = Object.getPrototypeOf(value);
34582
+ if (proto !== Object.prototype && proto !== null) {
34583
+ throw new TypeError("confirmation: cannot bind a non-plain object argument value (class instance).");
34584
+ }
34585
+ const entries = Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
34586
+ return `{${entries.map(([k, v]) => `${JSON.stringify(escapeKey(k))}:${canonicalJson(v)}`).join(",")}}`;
34587
+ }
34588
+ function escapeKey(key) {
34589
+ return key.startsWith("$") ? `$${key}` : key;
34590
+ }
34591
+
34592
+ // node_modules/@chrischall/mcp-utils/dist/server/confirmation.js
34593
+ var DEFAULT_REQUEST_KEY = "confirmation";
34594
+ var DEFAULT_CONFIRMATION_LABEL = "Confirm this action should proceed.";
34595
+ var UNSUPPORTED_NOTE = "Nothing was done because this client cannot show a confirmation prompt (it declares no MCP elicitation capability), and this action is never taken without one";
34596
+ var STATE_PREFIX = "mcpu.confirm.v1.";
34597
+ function bindingKey(binding) {
34598
+ if (binding.ttlSeconds !== void 0 && !(Number.isFinite(binding.ttlSeconds) && binding.ttlSeconds > 0)) {
34599
+ throw new RangeError("requireConfirmation: binding.ttlSeconds must be a finite number greater than 0.");
34600
+ }
34601
+ const key = typeof binding.key === "string" ? Buffer.from(binding.key, "utf8") : Buffer.from(binding.key);
34602
+ if (key.length < 32) {
34603
+ throw new RangeError("requireConfirmation: binding.key must be at least 32 bytes.");
34604
+ }
34605
+ return key;
34606
+ }
34607
+ function commitment(action, args) {
34608
+ return createHash("sha256").update(`${action}\0${canonicalJson(args)}`).digest("base64url");
34609
+ }
34610
+ function mintState(key, action, binding) {
34611
+ const exp = Math.floor(Date.now() / 1e3) + (binding.ttlSeconds ?? 600);
34612
+ const body = Buffer.from(JSON.stringify({ c: commitment(action, binding.args), exp })).toString("base64url");
34613
+ const mac3 = createHmac("sha256", key).update(`${STATE_PREFIX}${body}`).digest("base64url");
34614
+ return `${STATE_PREFIX}${body}.${mac3}`;
34615
+ }
34616
+ function verifyState(key, action, binding, state) {
34617
+ if (typeof state !== "string" || !state.startsWith(STATE_PREFIX))
34618
+ return false;
34619
+ const rest = state.slice(STATE_PREFIX.length);
34620
+ const dot = rest.indexOf(".");
34621
+ if (dot < 0)
34622
+ return false;
34623
+ const body = rest.slice(0, dot);
34624
+ const mac3 = Buffer.from(rest.slice(dot + 1), "base64url");
34625
+ const expected = createHmac("sha256", key).update(`${STATE_PREFIX}${body}`).digest();
34626
+ if (mac3.length !== expected.length || !timingSafeEqual(mac3, expected))
34627
+ return false;
34628
+ let payload;
34629
+ try {
34630
+ payload = JSON.parse(Buffer.from(body, "base64url").toString("utf8"));
34631
+ } catch {
34632
+ return false;
34633
+ }
34634
+ if (typeof payload.exp !== "number" || payload.exp * 1e3 <= Date.now())
34635
+ return false;
34636
+ const want = Buffer.from(commitment(action, binding.args));
34637
+ const got = Buffer.from(typeof payload.c === "string" ? payload.c : "");
34638
+ return got.length === want.length && timingSafeEqual(got, want);
34639
+ }
34640
+ function echoedState(ctx) {
34641
+ const accessor = ctx.mcpReq.requestState;
34642
+ return typeof accessor === "function" ? accessor() : void 0;
34643
+ }
34644
+ function requireConfirmation(ctx, options) {
34645
+ const requestKey = options.requestKey ?? DEFAULT_REQUEST_KEY;
34646
+ const key = options.binding ? bindingKey(options.binding) : void 0;
34647
+ const confirmationSchema = external_exports.object({
34648
+ confirmed: external_exports.boolean().describe(options.confirmationLabel ?? DEFAULT_CONFIRMATION_LABEL)
34649
+ });
34650
+ const ask = () => {
34651
+ const preview = {
34652
+ action: options.action,
34653
+ ...options.details === void 0 ? {} : { details: options.details }
34654
+ };
34655
+ return inputRequired({
34656
+ inputRequests: {
34657
+ [requestKey]: inputRequired.elicit({
34658
+ message: `${options.message}
34659
+ ${JSON.stringify(preview, null, 2)}`,
34660
+ requestedSchema: confirmationSchema
34661
+ })
34662
+ },
34663
+ ...key && options.binding ? { requestState: mintState(key, options.action, options.binding) } : {}
34664
+ });
34665
+ };
34666
+ const response = inputResponse(ctx.mcpReq.inputResponses, requestKey);
34667
+ const accepted = acceptedContent(ctx.mcpReq.inputResponses, requestKey, confirmationSchema);
34668
+ if (response.kind === "missing") {
34669
+ if (callerAcceptsFormElicitation(ctx) === false) {
34670
+ return textResult({
34671
+ confirmed: false,
34672
+ dispatched: false,
34673
+ action: options.action,
34674
+ reason: "confirmation-unsupported",
34675
+ note: options.unsupportedNote ? `${UNSUPPORTED_NOTE}. ${options.unsupportedNote}` : `${UNSUPPORTED_NOTE}.`
34676
+ });
34677
+ }
34678
+ return ask();
34679
+ }
34680
+ if (response.kind === "elicit" && response.action === "accept" && accepted?.confirmed === true) {
34681
+ if (key && options.binding) {
34682
+ const state = echoedState(ctx);
34683
+ if (state === void 0 || state === null) {
34684
+ return errorResult(`Confirmation for ${options.action} was accepted, but the retry carried no requestState, so it cannot be checked against the prompt that was shown. Nothing was done. The likely cause is that the MCP client or host does not round-trip requestState (it must echo the requestState from the input_required result back on the retry); asking again would loop.`);
34685
+ }
34686
+ if (!verifyState(key, options.action, options.binding, state))
34687
+ return ask();
34688
+ }
34689
+ return void 0;
34690
+ }
34691
+ return textResult({
34692
+ confirmed: false,
34693
+ cancelled: true,
34694
+ action: options.action,
34695
+ note: "Nothing was changed because the confirmation was declined, cancelled, or left unchecked."
34696
+ });
34697
+ }
34698
+
34699
+ // node_modules/@chrischall/mcp-utils/dist/server/confirm-token.js
34700
+ import { createHash as createHash2, createHmac as createHmac2, randomBytes, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
34701
+ function createSpentTokenStore() {
34702
+ const spent = /* @__PURE__ */ new Map();
34703
+ return {
34704
+ has: (nonce) => spent.has(nonce),
34705
+ add: (nonce, exp) => {
34706
+ spent.set(nonce, exp);
34707
+ },
34708
+ prune: (now) => {
34709
+ for (const [nonce, exp] of spent)
34710
+ if (exp < now)
34711
+ spent.delete(nonce);
34712
+ },
34713
+ clear: () => spent.clear(),
34714
+ get size() {
34715
+ return spent.size;
34716
+ }
34717
+ };
34718
+ }
34719
+ var PROCESS_SPENT = createSpentTokenStore();
34720
+ var PREFIX = "mcpu.token.v1.";
34721
+ var DEFAULT_TTL_SECONDS = 600;
34722
+ function tokenKey(key) {
34723
+ const bytes = typeof key === "string" ? Buffer.from(key, "utf8") : Buffer.from(key);
34724
+ if (bytes.length < 32)
34725
+ throw new RangeError("confirm token: key must be at least 32 bytes.");
34726
+ return bytes;
34727
+ }
34728
+ function ttlOf(ttlSeconds) {
34729
+ if (ttlSeconds === void 0)
34730
+ return DEFAULT_TTL_SECONDS;
34731
+ if (!(Number.isFinite(ttlSeconds) && ttlSeconds > 0)) {
34732
+ throw new RangeError("confirm token: ttlSeconds must be a finite number greater than 0.");
34733
+ }
34734
+ return ttlSeconds;
34735
+ }
34736
+ function sign(key, body) {
34737
+ return createHmac2("sha256", key).update(`${PREFIX}${body}`).digest();
34738
+ }
34739
+ function hashConfirmPayload(payload) {
34740
+ return createHash2("sha256").update(canonicalJson(payload)).digest("base64url");
34741
+ }
34742
+ function issueConfirmToken(key, binding, options = {}) {
34743
+ const k = tokenKey(key);
34744
+ const now = options.now ?? Date.now();
34745
+ const exp = now + ttlOf(options.ttlSeconds) * 1e3;
34746
+ const claims = {
34747
+ t: binding.tool,
34748
+ ...binding.account === void 0 ? {} : { a: binding.account },
34749
+ g: binding.target,
34750
+ ...binding.revision === void 0 ? {} : { r: binding.revision },
34751
+ h: binding.payloadHash,
34752
+ exp,
34753
+ n: randomBytes(16).toString("base64url")
34754
+ };
34755
+ const body = Buffer.from(JSON.stringify(claims), "utf8").toString("base64url");
34756
+ return { token: `${PREFIX}${body}.${sign(k, body).toString("base64url")}`, expiresAt: new Date(exp).toISOString() };
34757
+ }
34758
+ function parseClaims(body) {
34759
+ try {
34760
+ const claims = JSON.parse(Buffer.from(body, "base64url").toString("utf8"));
34761
+ return claims && typeof claims === "object" ? claims : void 0;
34762
+ } catch {
34763
+ return void 0;
34764
+ }
34765
+ }
34766
+ function verifyConfirmToken(key, token, binding, options = {}) {
34767
+ const k = tokenKey(key);
34768
+ const now = options.now ?? Date.now();
34769
+ const spent = options.spent ?? PROCESS_SPENT;
34770
+ spent.prune(now);
34771
+ if (!token.startsWith(PREFIX))
34772
+ return { ok: false, error: "TOKEN_INVALID" };
34773
+ const rest = token.slice(PREFIX.length);
34774
+ const dot = rest.indexOf(".");
34775
+ const body = dot < 0 ? "" : rest.slice(0, dot);
34776
+ const mac3 = Buffer.from(dot < 0 ? "" : rest.slice(dot + 1), "base64url");
34777
+ const expected = sign(k, body);
34778
+ if (!body || mac3.length !== expected.length || !timingSafeEqual2(mac3, expected))
34779
+ return { ok: false, error: "TOKEN_INVALID" };
34780
+ const claims = parseClaims(body);
34781
+ if (!claims)
34782
+ return { ok: false, error: "TOKEN_INVALID" };
34783
+ if (claims.t !== binding.tool || claims.a !== binding.account || claims.g !== binding.target) {
34784
+ return { ok: false, error: "TOKEN_INVALID" };
34785
+ }
34786
+ if (spent.has(claims.n))
34787
+ return { ok: false, error: "TOKEN_REUSED" };
34788
+ if (now > claims.exp)
34789
+ return { ok: false, error: "TOKEN_EXPIRED" };
34790
+ if (claims.r !== binding.revision)
34791
+ return { ok: false, error: "DRAFT_CHANGED", reason: "revision-changed" };
34792
+ if (claims.h !== binding.payloadHash)
34793
+ return { ok: false, error: "DRAFT_CHANGED", reason: "payload-changed" };
34794
+ spent.add(claims.n, claims.exp);
34795
+ return { ok: true };
34796
+ }
34797
+ var CONFIRM_TOKEN_INSTRUCTION = "Show this preview to the user verbatim and proceed only after they explicitly approve in chat. Then call again with confirmToken.";
34798
+ var confirmTokenParam = external_exports.string().optional().describe(`ONLY for the two-step confirmation fallback (a client without MCP elicitation). The confirmToken from this same tool's phase-1 "confirmation-required" response, passed back ONLY after the user has seen that preview and explicitly approved it in chat \u2014 never on the first call, never invented, never reused. Call again with the same arguments. Ignored when the client supports elicitation.`);
34799
+ var TOKEN_ERROR_NOTE = {
34800
+ TOKEN_EXPIRED: "Nothing was sent or changed: the confirmToken expired. Call again WITHOUT confirmToken for a fresh preview, and ask the user to approve it again.",
34801
+ TOKEN_REUSED: "Nothing was sent or changed by this call: this confirmToken was already used, and one approval acts once. If doing it again is really intended, call again WITHOUT confirmToken and get a new approval.",
34802
+ TOKEN_INVALID: "Nothing was sent or changed: this confirmToken was not issued by this server for this tool, account and target (or the server has restarted since). Call again WITHOUT confirmToken for a fresh preview and approval."
34803
+ };
34804
+ var CHANGED_NOTE = {
34805
+ "revision-changed": "Nothing was sent or changed: the target was edited since the user approved it (its version rotated), so what would happen is not what they saw.",
34806
+ "payload-changed": "Nothing was sent or changed: what would happen no longer matches what the user approved."
34807
+ };
34808
+ function isToolResult(value) {
34809
+ return Array.isArray(value.content);
34810
+ }
34811
+ function rejection2(data) {
34812
+ return { ...textResult({ status: "confirmation-rejected", confirmed: false, dispatched: false, ...data }), isError: true };
34813
+ }
34814
+ async function tokenConfirmation(action, fb) {
34815
+ const subject = await fb.subject();
34816
+ if (isToolResult(subject))
34817
+ return subject;
34818
+ const binding = {
34819
+ tool: fb.tool,
34820
+ ...fb.account === void 0 ? {} : { account: fb.account },
34821
+ target: subject.target,
34822
+ ...subject.revision === void 0 ? {} : { revision: subject.revision },
34823
+ payloadHash: hashConfirmPayload(subject.payload)
34824
+ };
34825
+ const phaseOne = () => {
34826
+ const { token, expiresAt } = issueConfirmToken(fb.key, binding, { ttlSeconds: fb.ttlSeconds });
34827
+ return {
34828
+ action,
34829
+ preview: subject.preview,
34830
+ confirmToken: token,
34831
+ expiresAt,
34832
+ ttlSeconds: ttlOf(fb.ttlSeconds),
34833
+ instruction: fb.instruction ?? CONFIRM_TOKEN_INSTRUCTION
34834
+ };
34835
+ };
34836
+ if (!fb.confirmToken) {
34837
+ return textResult({ status: "confirmation-required", confirmed: false, dispatched: false, ...phaseOne() });
34838
+ }
34839
+ const verdict = verifyConfirmToken(fb.key, fb.confirmToken, binding, { spent: fb.spent });
34840
+ if (verdict.ok)
34841
+ return void 0;
34842
+ if (verdict.error === "DRAFT_CHANGED") {
34843
+ return rejection2({
34844
+ error: "DRAFT_CHANGED",
34845
+ reason: verdict.reason,
34846
+ note: `${CHANGED_NOTE[verdict.reason]} The current preview and a fresh confirmToken are below.`,
34847
+ ...phaseOne()
34848
+ });
34849
+ }
34850
+ return rejection2({ error: verdict.error, action, note: TOKEN_ERROR_NOTE[verdict.error] });
34851
+ }
34852
+ async function requireConfirmationWithFallback(ctx, options) {
34853
+ const { tokenFallback, ...confirmation } = options;
34854
+ if (tokenFallback && callerAcceptsFormElicitation(ctx) === false) {
34855
+ return tokenConfirmation(options.action, tokenFallback);
34856
+ }
34857
+ return requireConfirmation(ctx, confirmation);
34858
+ }
34859
+
34860
+ // node_modules/@chrischall/mcp-utils/dist/server/confirm-env.js
34861
+ import { createHash as createHash3, randomBytes as randomBytes2 } from "node:crypto";
34862
+
34863
+ // node_modules/@chrischall/mcp-utils/dist/config/index.js
34864
+ import { homedir } from "node:os";
34865
+ import { isAbsolute, join, resolve } from "node:path";
34866
+ var PLACEHOLDER_RE = /^\$\{[^}]*\}$/;
34867
+ function readEnvVar(key, opts = {}) {
34868
+ const env = opts.env ?? process.env;
34869
+ const raw = env[key];
34870
+ if (typeof raw === "string") {
34871
+ const trimmed = raw.trim();
34872
+ if (trimmed.length > 0 && trimmed !== "undefined" && trimmed !== "null" && !PLACEHOLDER_RE.test(trimmed)) {
34873
+ return trimmed;
34874
+ }
34875
+ }
34876
+ return opts.default;
34877
+ }
34878
+ function expandPath(p) {
34879
+ let expanded = p;
34880
+ if (p === "~") {
34881
+ expanded = homedir();
34882
+ } else if (p.startsWith("~/")) {
34883
+ expanded = join(homedir(), p.slice(2));
34884
+ }
34885
+ return isAbsolute(expanded) ? expanded : resolve(expanded);
34886
+ }
34887
+
34888
+ // node_modules/@chrischall/mcp-utils/dist/server/confirm-env.js
34889
+ var MODES = /* @__PURE__ */ new Set(["ask-user", "auto", "refuse"]);
34890
+ var DEFAULT_TTL_SECONDS2 = 600;
34891
+ var warned = /* @__PURE__ */ new Set();
34892
+ function readConfirmMode(env = process.env) {
34893
+ const raw = readEnvVar("MCP_CONFIRM_MODE", { env })?.trim().toLowerCase();
34894
+ if (!raw)
34895
+ return "ask-user";
34896
+ if (MODES.has(raw))
34897
+ return raw;
34898
+ if (!warned.has(raw)) {
34899
+ warned.add(raw);
34900
+ process.stderr.write(`MCP_CONFIRM_MODE="${raw}" is not one of ask-user, auto, refuse; treating it as refuse.
34901
+ `);
34902
+ }
34903
+ return "refuse";
34904
+ }
34905
+ function confirmTtlFromEnv(env = process.env) {
34906
+ const raw = readEnvVar("MCP_CONFIRM_TTL_SECONDS", { env })?.trim();
34907
+ return raw && /^[1-9]\d*$/.test(raw) ? Number(raw) : DEFAULT_TTL_SECONDS2;
34908
+ }
34909
+ var processKey;
34910
+ function confirmKeyFromEnv(env = process.env) {
34911
+ const secret = readEnvVar("MCP_CONFIRM_SECRET", { env });
34912
+ if (secret)
34913
+ return createHash3("sha256").update(secret, "utf8").digest();
34914
+ processKey ??= randomBytes2(32);
34915
+ return processKey;
34916
+ }
34917
+ var CONFIRM_TOKEN_AUTO_INSTRUCTION = "Nothing has been done yet. Review this preview; if it is what was intended, call again with the same arguments plus confirmToken. (This server runs with MCP_CONFIRM_MODE=auto, so the user's approval in chat is not required.)";
34918
+ var REFUSE_HINT = "Set MCP_CONFIRM_MODE=ask-user on the server to allow two-step confirmation instead.";
34919
+ function confirmationFromEnv(options) {
34920
+ const { tool, account, confirmToken, subject, instruction, spent, env = process.env, ...confirmation } = options;
34921
+ const mode = readConfirmMode(env);
34922
+ if (mode === "refuse") {
34923
+ return {
34924
+ ...confirmation,
34925
+ unsupportedNote: confirmation.unsupportedNote ? `${confirmation.unsupportedNote} ${REFUSE_HINT}` : REFUSE_HINT
34926
+ };
34927
+ }
34928
+ return {
34929
+ ...confirmation,
34930
+ tokenFallback: {
34931
+ key: confirmKeyFromEnv(env),
34932
+ tool,
34933
+ ...account === void 0 ? {} : { account },
34934
+ ...confirmToken === void 0 ? {} : { confirmToken },
34935
+ subject,
34936
+ ttlSeconds: confirmTtlFromEnv(env),
34937
+ instruction: mode === "auto" ? CONFIRM_TOKEN_AUTO_INSTRUCTION : instruction ?? CONFIRM_TOKEN_INSTRUCTION,
34938
+ ...spent === void 0 ? {} : { spent }
34939
+ }
34940
+ };
34941
+ }
34942
+
34484
34943
  // node_modules/@chrischall/mcp-utils/dist/server/index.js
34485
34944
  var SERVER_PROTOCOL_VERSIONS = Object.freeze([
34486
34945
  "2026-07-28",
@@ -34656,31 +35115,6 @@ function runMcp(opts) {
34656
35115
  return handle;
34657
35116
  }
34658
35117
 
34659
- // node_modules/@chrischall/mcp-utils/dist/config/index.js
34660
- import { homedir } from "node:os";
34661
- import { isAbsolute, join, resolve } from "node:path";
34662
- var PLACEHOLDER_RE = /^\$\{[^}]*\}$/;
34663
- function readEnvVar(key, opts = {}) {
34664
- const env = opts.env ?? process.env;
34665
- const raw = env[key];
34666
- if (typeof raw === "string") {
34667
- const trimmed = raw.trim();
34668
- if (trimmed.length > 0 && trimmed !== "undefined" && trimmed !== "null" && !PLACEHOLDER_RE.test(trimmed)) {
34669
- return trimmed;
34670
- }
34671
- }
34672
- return opts.default;
34673
- }
34674
- function expandPath(p) {
34675
- let expanded = p;
34676
- if (p === "~") {
34677
- expanded = homedir();
34678
- } else if (p.startsWith("~/")) {
34679
- expanded = join(homedir(), p.slice(2));
34680
- }
34681
- return isAbsolute(expanded) ? expanded : resolve(expanded);
34682
- }
34683
-
34684
35118
  // node_modules/@chrischall/mcp-utils/dist/http/index.js
34685
35119
  var MAX_AGE_RE = /(?:^|;)\s*Max-Age\s*=\s*(-?\d+)\s*(?:;|$)/i;
34686
35120
  var EXPIRES_RE = /(?:^|;)\s*Expires\s*=\s*([^;]+)/i;
@@ -34782,7 +35216,7 @@ function toolAnnotations(opts = {}) {
34782
35216
  }
34783
35217
 
34784
35218
  // src/version.ts
34785
- var VERSION = "1.1.3";
35219
+ var VERSION = "1.2.0";
34786
35220
 
34787
35221
  // node_modules/@chrischall/mcp-utils/dist/session/index.js
34788
35222
  import { existsSync, readFileSync, writeFileSync, mkdirSync, chmodSync, renameSync, unlinkSync } from "node:fs";
@@ -35027,14 +35461,27 @@ function buildQuery(params) {
35027
35461
  return pairs.join("&");
35028
35462
  }
35029
35463
  var SimplePracticeClient = class {
35030
- store;
35464
+ /**
35465
+ * The session store, as it is on disk NOW.
35466
+ *
35467
+ * Another server process (Claude Desktop beside Claude Code) shares the
35468
+ * session file, and `SessionStore` reads it only in its constructor, then
35469
+ * rewrites the whole file from its in-memory Map on every add/remove. Held
35470
+ * for the life of the process, that snapshot would write a session another
35471
+ * process signed out of straight back to disk, or drop one it just created.
35472
+ * So by default every access opens the store afresh; an injected store
35473
+ * (tests) is used as given.
35474
+ */
35475
+ openStore;
35031
35476
  fetchImpl;
35032
35477
  /** A practice learned at runtime — from a sign-in link, or named on a tool call. */
35033
35478
  adoptedHost = null;
35034
35479
  constructor(opts = {}) {
35035
35480
  this.fetchImpl = opts.fetchImpl ?? globalThis.fetch;
35036
- this.store = opts.store ?? new SessionStore({
35037
- filePath: sessionFilePath(),
35481
+ const injected = opts.store;
35482
+ const filePath = sessionFilePath();
35483
+ this.openStore = injected ? () => injected : () => new SessionStore({
35484
+ filePath,
35038
35485
  keyOf: (session) => session.host,
35039
35486
  normalizeKey: (key) => key.toLowerCase()
35040
35487
  });
@@ -35079,7 +35526,7 @@ var SimplePracticeClient = class {
35079
35526
  */
35080
35527
  mostRecentSessionHost() {
35081
35528
  let newest = null;
35082
- for (const session of this.store.list()) {
35529
+ for (const session of this.openStore().list()) {
35083
35530
  if (!newest || session.createdAt > newest.createdAt) newest = session;
35084
35531
  }
35085
35532
  return newest?.host ?? null;
@@ -35099,7 +35546,7 @@ var SimplePracticeClient = class {
35099
35546
  * through, so a link outside `*.clientsecure.me` cannot redirect a token.
35100
35547
  *
35101
35548
  * Separate from {@link adoptPracticeHost} so a caller that only wants to
35102
- * *name* the practice — a dry run reporting what it would do — can do that
35549
+ * *name* the practice — a preview reporting what it would do — can do that
35103
35550
  * without the side effect. Answering a question should not move the server.
35104
35551
  */
35105
35552
  validatePracticeHost(raw) {
@@ -35160,17 +35607,17 @@ var SimplePracticeClient = class {
35160
35607
  }
35161
35608
  getSession() {
35162
35609
  const host = this.knownPortalHost();
35163
- return host ? this.store.get(host) : null;
35610
+ return host ? this.openStore().get(host) : null;
35164
35611
  }
35165
35612
  saveSession(cookie) {
35166
35613
  const host = this.requireConfig();
35167
35614
  const session = { host, cookie, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
35168
- this.store.add(session);
35615
+ this.openStore().add(session);
35169
35616
  return session;
35170
35617
  }
35171
35618
  clearSession() {
35172
35619
  const host = this.knownPortalHost();
35173
- return host ? this.store.remove(host) : false;
35620
+ return host ? this.openStore().remove(host) : false;
35174
35621
  }
35175
35622
  requireSession() {
35176
35623
  const session = this.getSession();
@@ -35368,29 +35815,42 @@ function registerAuthTools(server, client2) {
35368
35815
  server.registerTool(
35369
35816
  "simplepractice_request_sign_in_link",
35370
35817
  {
35371
- description: "Ask SimplePractice to email a sign-in link to a Client Portal address. The portal has no password \u2014 this is how you sign in. Sends a real email and is rate-limited per email address AND per IP, so it requires confirm:true. A success does not prove the address has an account: the API answers identically for unknown addresses by design.",
35818
+ description: "Ask SimplePractice to email a sign-in link to a Client Portal address. The portal has no password \u2014 this is how you sign in. Sends a real email and is rate-limited per email address AND per IP, so it asks the user to confirm first: a confirmation prompt where the client supports one; otherwise the first call returns a preview and a confirmToken, and only a repeat call with that token proceeds (see MCP_CONFIRM_MODE). A success does not prove the address has an account: the API answers identically for unknown addresses by design.",
35372
35819
  annotations: toolAnnotations({ readOnly: false, idempotent: false, destructive: true }),
35373
35820
  inputSchema: external_exports.object({
35374
35821
  email: external_exports.string().email().describe("The email address the Client Portal is registered to."),
35375
35822
  practice: external_exports.string().min(1).optional().describe(
35376
35823
  'The practice whose portal to sign in to \u2014 the slug ("achievebalancetherapy"), the host, or the portal URL. Only needed when this server does not know the practice yet; signing in with an emailed link teaches it, and it then remembers.'
35377
35824
  ),
35378
- confirm: schemaConfirm
35825
+ confirmToken: confirmTokenParam
35379
35826
  })
35380
35827
  },
35381
- async ({ email: email3, practice, confirm }) => {
35382
- if (!confirm) {
35383
- return minifiedResult({
35384
- dryRun: true,
35385
- wouldSend: "a Client Portal sign-in email",
35386
- to: email3,
35387
- // Named, not adopted. A dry run sends nothing, so it must not move
35388
- // the server either — silently overriding a SIMPLEPRACTICE_PRACTICE
35389
- // pin is not something an inert preview gets to do.
35390
- practiceHost: practice ? client2.validatePracticeHost(practice) : client2.portalHost(),
35391
- note: "Re-run with confirm:true to actually send it. Do not retry a failed send \u2014 SimplePractice locks out repeated sign-in requests."
35392
- });
35393
- }
35828
+ async ({ email: email3, practice, confirmToken }, ctx) => {
35829
+ const practiceHost = practice ? client2.validatePracticeHost(practice) : client2.portalHost();
35830
+ const gate = await requireConfirmationWithFallback(
35831
+ ctx,
35832
+ confirmationFromEnv({
35833
+ action: "sign_in.request_link",
35834
+ message: "Review and confirm sending this Client Portal sign-in email:",
35835
+ details: { to: email3, practiceHost },
35836
+ tool: "simplepractice_request_sign_in_link",
35837
+ account: practiceHost,
35838
+ confirmToken,
35839
+ subject: () => ({
35840
+ // Nothing existing is acted on: the address is bound through the payload,
35841
+ // so editing it between the calls is a DRAFT_CHANGED with a fresh preview.
35842
+ target: "",
35843
+ payload: { email: email3, practiceHost },
35844
+ preview: {
35845
+ wouldSend: "a Client Portal sign-in email",
35846
+ to: email3,
35847
+ practiceHost,
35848
+ note: "Do not retry a failed send \u2014 SimplePractice locks out repeated sign-in requests."
35849
+ }
35850
+ })
35851
+ })
35852
+ );
35853
+ if (gate) return gate;
35394
35854
  const send = async () => {
35395
35855
  const { expiresIn } = await requestSignInLink(client2, email3);
35396
35856
  return minifiedResult({
package/dist/client.js CHANGED
@@ -20,19 +20,32 @@ export function buildQuery(params) {
20
20
  return pairs.join('&');
21
21
  }
22
22
  export class SimplePracticeClient {
23
- store;
23
+ /**
24
+ * The session store, as it is on disk NOW.
25
+ *
26
+ * Another server process (Claude Desktop beside Claude Code) shares the
27
+ * session file, and `SessionStore` reads it only in its constructor, then
28
+ * rewrites the whole file from its in-memory Map on every add/remove. Held
29
+ * for the life of the process, that snapshot would write a session another
30
+ * process signed out of straight back to disk, or drop one it just created.
31
+ * So by default every access opens the store afresh; an injected store
32
+ * (tests) is used as given.
33
+ */
34
+ openStore;
24
35
  fetchImpl;
25
36
  /** A practice learned at runtime — from a sign-in link, or named on a tool call. */
26
37
  adoptedHost = null;
27
38
  constructor(opts = {}) {
28
39
  this.fetchImpl = opts.fetchImpl ?? globalThis.fetch;
29
- this.store =
30
- opts.store ??
31
- new SessionStore({
32
- filePath: sessionFilePath(),
33
- keyOf: (session) => session.host,
34
- normalizeKey: (key) => key.toLowerCase(),
35
- });
40
+ const injected = opts.store;
41
+ const filePath = sessionFilePath();
42
+ this.openStore = injected
43
+ ? () => injected
44
+ : () => new SessionStore({
45
+ filePath,
46
+ keyOf: (session) => session.host,
47
+ normalizeKey: (key) => key.toLowerCase(),
48
+ });
36
49
  }
37
50
  /**
38
51
  * Which practice this server is talking to, and how it found out.
@@ -76,7 +89,7 @@ export class SimplePracticeClient {
76
89
  */
77
90
  mostRecentSessionHost() {
78
91
  let newest = null;
79
- for (const session of this.store.list()) {
92
+ for (const session of this.openStore().list()) {
80
93
  if (!newest || session.createdAt > newest.createdAt)
81
94
  newest = session;
82
95
  }
@@ -97,7 +110,7 @@ export class SimplePracticeClient {
97
110
  * through, so a link outside `*.clientsecure.me` cannot redirect a token.
98
111
  *
99
112
  * Separate from {@link adoptPracticeHost} so a caller that only wants to
100
- * *name* the practice — a dry run reporting what it would do — can do that
113
+ * *name* the practice — a preview reporting what it would do — can do that
101
114
  * without the side effect. Answering a question should not move the server.
102
115
  */
103
116
  validatePracticeHost(raw) {
@@ -159,12 +172,12 @@ export class SimplePracticeClient {
159
172
  }
160
173
  getSession() {
161
174
  const host = this.knownPortalHost();
162
- return host ? this.store.get(host) : null;
175
+ return host ? this.openStore().get(host) : null;
163
176
  }
164
177
  saveSession(cookie) {
165
178
  const host = this.requireConfig();
166
179
  const session = { host, cookie, createdAt: new Date().toISOString() };
167
- this.store.add(session);
180
+ this.openStore().add(session);
168
181
  return session;
169
182
  }
170
183
  clearSession() {
@@ -172,7 +185,7 @@ export class SimplePracticeClient {
172
185
  // Not knowing the practice is the same outcome as having no session for
173
186
  // it: nothing to sign out of. Throwing would make sign-out the one tool
174
187
  // that fails when it has nothing to do.
175
- return host ? this.store.remove(host) : false;
188
+ return host ? this.openStore().remove(host) : false;
176
189
  }
177
190
  requireSession() {
178
191
  const session = this.getSession();
@@ -1,11 +1,11 @@
1
1
  import { z } from 'zod';
2
- import { minifiedResult, schemaConfirm, toolAnnotations } from '@chrischall/mcp-utils';
2
+ import { confirmationFromEnv, confirmTokenParam, minifiedResult, requireConfirmationWithFallback, toolAnnotations, } from '@chrischall/mcp-utils';
3
3
  import { requestSignInLink, verifySignInPin, verifySignInToken } from '../auth.js';
4
4
  /**
5
5
  * No `view` here, deliberately.
6
6
  *
7
7
  * Nothing in this file answers with a SimplePractice record: every response is
8
- * a small object this server builds — local session state, a dry-run preview,
8
+ * a small object this server builds — local session state, a send preview,
9
9
  * the result of a sign-in exchange. There is no upstream payload to project or
10
10
  * strip, and none of these are reads a caller pages through, so the rung would
11
11
  * have nothing to switch between.
@@ -33,7 +33,7 @@ export function registerAuthTools(server, client) {
33
33
  });
34
34
  });
35
35
  server.registerTool('simplepractice_request_sign_in_link', {
36
- description: 'Ask SimplePractice to email a sign-in link to a Client Portal address. The portal has no password — this is how you sign in. Sends a real email and is rate-limited per email address AND per IP, so it requires confirm:true. A success does not prove the address has an account: the API answers identically for unknown addresses by design.',
36
+ description: 'Ask SimplePractice to email a sign-in link to a Client Portal address. The portal has no password — this is how you sign in. Sends a real email and is rate-limited per email address AND per IP, so it asks the user to confirm first: a confirmation prompt where the client supports one; otherwise the first call returns a preview and a confirmToken, and only a repeat call with that token proceeds (see MCP_CONFIRM_MODE). A success does not prove the address has an account: the API answers identically for unknown addresses by design.',
37
37
  annotations: toolAnnotations({ readOnly: false, idempotent: false, destructive: true }),
38
38
  inputSchema: z.object({
39
39
  email: z.string().email().describe('The email address the Client Portal is registered to.'),
@@ -42,21 +42,36 @@ export function registerAuthTools(server, client) {
42
42
  .min(1)
43
43
  .optional()
44
44
  .describe('The practice whose portal to sign in to — the slug ("achievebalancetherapy"), the host, or the portal URL. Only needed when this server does not know the practice yet; signing in with an emailed link teaches it, and it then remembers.'),
45
- confirm: schemaConfirm,
45
+ confirmToken: confirmTokenParam,
46
46
  }),
47
- }, async ({ email, practice, confirm }) => {
48
- if (!confirm) {
49
- return minifiedResult({
50
- dryRun: true,
51
- wouldSend: 'a Client Portal sign-in email',
52
- to: email,
53
- // Named, not adopted. A dry run sends nothing, so it must not move
54
- // the server either — silently overriding a SIMPLEPRACTICE_PRACTICE
55
- // pin is not something an inert preview gets to do.
56
- practiceHost: practice ? client.validatePracticeHost(practice) : client.portalHost(),
57
- note: 'Re-run with confirm:true to actually send it. Do not retry a failed send — SimplePractice locks out repeated sign-in requests.',
58
- });
59
- }
47
+ }, async ({ email, practice, confirmToken }, ctx) => {
48
+ // Resolved, not adopted. The preview sends nothing, so it must not move
49
+ // the server either — silently overriding a SIMPLEPRACTICE_PRACTICE pin
50
+ // is not something an inert preview gets to do. It still refuses a
51
+ // non-portal address or an unknown practice before anything is asked.
52
+ const practiceHost = practice ? client.validatePracticeHost(practice) : client.portalHost();
53
+ const gate = await requireConfirmationWithFallback(ctx, confirmationFromEnv({
54
+ action: 'sign_in.request_link',
55
+ message: 'Review and confirm sending this Client Portal sign-in email:',
56
+ details: { to: email, practiceHost },
57
+ tool: 'simplepractice_request_sign_in_link',
58
+ account: practiceHost,
59
+ confirmToken,
60
+ subject: () => ({
61
+ // Nothing existing is acted on: the address is bound through the payload,
62
+ // so editing it between the calls is a DRAFT_CHANGED with a fresh preview.
63
+ target: '',
64
+ payload: { email, practiceHost },
65
+ preview: {
66
+ wouldSend: 'a Client Portal sign-in email',
67
+ to: email,
68
+ practiceHost,
69
+ note: 'Do not retry a failed send — SimplePractice locks out repeated sign-in requests.',
70
+ },
71
+ }),
72
+ }));
73
+ if (gate)
74
+ return gate;
60
75
  const send = async () => {
61
76
  const { expiresIn } = await requestSignInLink(client, email);
62
77
  return minifiedResult({
package/dist/version.js CHANGED
@@ -2,4 +2,4 @@
2
2
  * Single source of truth for the server version. release-please rewrites the
3
3
  * literal below; every other file imports VERSION rather than repeating it.
4
4
  */
5
- export const VERSION = '1.1.3'; // x-release-please-version
5
+ export const VERSION = '1.2.0'; // x-release-please-version
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simplepractice-mcp",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
4
4
  "license": "MIT",
5
5
  "mcpName": "io.github.chrischall/simplepractice-mcp",
6
6
  "description": "SimplePractice Client Portal MCP server for Claude — developed and maintained by AI (Claude Code)",
@@ -34,7 +34,7 @@
34
34
  "test:watch": "vitest"
35
35
  },
36
36
  "dependencies": {
37
- "@chrischall/mcp-utils": "^2.4.0",
37
+ "@chrischall/mcp-utils": "^2.6.0",
38
38
  "@modelcontextprotocol/server": "^2.0.0",
39
39
  "dotenv": "^18.0.0",
40
40
  "zod": "^4.6.5"
package/server.json CHANGED
@@ -6,12 +6,12 @@
6
6
  "url": "https://github.com/chrischall/simplepractice-mcp",
7
7
  "source": "github"
8
8
  },
9
- "version": "1.1.3",
9
+ "version": "1.2.0",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "simplepractice-mcp",
14
- "version": "1.1.3",
14
+ "version": "1.2.0",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  },
@@ -26,10 +26,13 @@ The portal has **no password**. SimplePractice emails a one-time link (or a
26
26
  the saved session.
27
27
  2. If the user already has the email, skip straight to step 4 — asking for a
28
28
  second link when one is in their inbox spends a rate limit for nothing.
29
- 3. `simplepractice_request_sign_in_link` with the user's portal email. It is
30
- confirm-gated because it sends a real email and the endpoint is rate-limited
31
- **per address and per IP** — a retry loop locks the user out of the only
32
- auth path there is. Ask before sending, and never send twice. If the server
29
+ 3. `simplepractice_request_sign_in_link` with the user's portal email. It asks
30
+ for confirmation because it sends a real email and the endpoint is
31
+ rate-limited **per address and per IP** — a retry loop locks the user out of
32
+ the only auth path there is. Where the client cannot show a prompt, the
33
+ first call sends nothing and returns a preview plus a `confirmToken`: show
34
+ the user the preview, and only after they approve call again with the same
35
+ arguments and that `confirmToken`. Never send twice. If the server
33
36
  does not know the practice yet, pass `practice` (the slug, host, or portal
34
37
  URL) — otherwise it has no portal to ask.
35
38
  4. The user opens the email and gives you the link. Pass it **whole** to