simplepractice-mcp 0.1.0 → 0.3.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.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +38 -13
- package/dist/auth.js +31 -4
- package/dist/bundle.js +401 -59
- package/dist/client.js +142 -27
- package/dist/config.js +41 -6
- package/dist/index.js +5 -2
- package/dist/tools/auth.js +35 -13
- package/dist/tools/health.js +103 -0
- package/dist/version.js +1 -1
- package/mint.yaml +74 -0
- package/package.json +8 -6
- package/server.json +4 -4
- package/skills/simplepractice/SKILL.md +17 -8
- package/skills/simplepractice-fpx/SKILL.md +13 -5
- package/skills/simplepractice-fpx/references/requests.md +18 -11
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
},
|
|
7
7
|
"metadata": {
|
|
8
8
|
"description": "SimplePractice Client Portal tools for Claude",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.3.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": "0.
|
|
16
|
+
"version": "0.3.0",
|
|
17
17
|
"author": {
|
|
18
18
|
"name": "Chris Chall",
|
|
19
19
|
"url": "https://github.com/chrischall"
|
package/README.md
CHANGED
|
@@ -20,6 +20,7 @@ and announcements, read over the portal's own JSON:API.
|
|
|
20
20
|
| `simplepractice_list_documents` | files the practice has shared |
|
|
21
21
|
| `simplepractice_list_announcements` | practice announcements, with unread counts |
|
|
22
22
|
| `simplepractice_session_status` · `_request_sign_in_link` · `_verify_sign_in_token` · `_verify_sign_in_pin` · `_sign_out` | sign-in |
|
|
23
|
+
| `simplepractice_healthcheck` | Verify credentials and upstream reachability; reports failures as data, not exceptions |
|
|
23
24
|
|
|
24
25
|
Everything is read-only. Cancelling, signing, and paying happen in the portal.
|
|
25
26
|
|
|
@@ -27,15 +28,13 @@ Everything is read-only. Cancelling, signing, and paying happen in the portal.
|
|
|
27
28
|
|
|
28
29
|
```sh
|
|
29
30
|
npm install -g simplepractice-mcp
|
|
30
|
-
export SIMPLEPRACTICE_PRACTICE=achievebalancetherapy # or the full host
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
whole `<practice>.clientsecure.me` host from the link your provider emailed.
|
|
33
|
+
There is nothing to configure. The practice comes from your sign-in link.
|
|
35
34
|
|
|
36
35
|
| Variable | |
|
|
37
36
|
|---|---|
|
|
38
|
-
| `SIMPLEPRACTICE_PRACTICE` |
|
|
37
|
+
| `SIMPLEPRACTICE_PRACTICE` | optional — pins the server to one practice (slug or host) |
|
|
39
38
|
| `SIMPLEPRACTICE_SESSION_FILE` | optional — session path (default `~/.simplepractice-mcp/session.json`, written `0600`) |
|
|
40
39
|
|
|
41
40
|
## Signing in
|
|
@@ -43,15 +42,41 @@ whole `<practice>.clientsecure.me` host from the link your provider emailed.
|
|
|
43
42
|
The Client Portal has **no password**. SimplePractice emails a one-time link
|
|
44
43
|
(or a 6-digit PIN); you trade it for a session cookie:
|
|
45
44
|
|
|
46
|
-
1.
|
|
47
|
-
2.
|
|
48
|
-
3. `simplepractice_verify_sign_in_token { link }` — pass the whole link; the
|
|
49
|
-
token is its `#` fragment and the tool extracts it.
|
|
45
|
+
1. Open the email your provider sent, copy the link.
|
|
46
|
+
2. `simplepractice_verify_sign_in_token { link }` — pass the **whole** link.
|
|
50
47
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
session
|
|
48
|
+
The link is `https://<practice>.clientsecure.me/sign-in/token#<TOKEN>`, so one
|
|
49
|
+
paste carries both halves of what the server needs: the token is the `#`
|
|
50
|
+
fragment, and the host names the practice. Nothing is hardcoded, and the
|
|
51
|
+
stored session remembers the practice for every later run —
|
|
52
|
+
`simplepractice_session_status` reports which practice is in play and whether
|
|
53
|
+
it came from a link, the environment variable, or the saved session.
|
|
54
|
+
|
|
55
|
+
To have a fresh link sent rather than using one you already have, name the
|
|
56
|
+
practice once:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
simplepractice_request_sign_in_link { email, practice: "achievebalancetherapy", confirm: true }
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`practice` can be omitted whenever the server already knows the practice —
|
|
63
|
+
from an earlier sign-in, or from `SIMPLEPRACTICE_PRACTICE`.
|
|
64
|
+
|
|
65
|
+
Two sign-in links name no practice, and fall back to whichever one is already
|
|
66
|
+
known: the mobile-app variant SimplePractice sends
|
|
67
|
+
(`https://clientsecure.me/client-portal-api/sign-in/token#<TOKEN>`, pointed at
|
|
68
|
+
the bare apex), and a bare token pasted without its link. A link on any host
|
|
69
|
+
outside `*.clientsecure.me` is never adopted — the token is not sent there.
|
|
70
|
+
|
|
71
|
+
Links are single-use — replaying one answers
|
|
72
|
+
`401 "Authorization has already been used or expired"` — and last 24 hours. The
|
|
73
|
+
request endpoint is rate-limited per address **and** per IP, which is why
|
|
74
|
+
sending is confirm-gated: a retry loop locks you out of the only way in. There
|
|
75
|
+
is no refresh token; when the session lapses, you sign in again.
|
|
76
|
+
|
|
77
|
+
The whole chain is verified end to end against a live portal — request, the
|
|
78
|
+
emailed link, the exchange returning `verified` plus a session cookie, and an
|
|
79
|
+
authenticated read with that new session.
|
|
55
80
|
|
|
56
81
|
Because that flow needs nothing but HTTP and your inbox, this server has no
|
|
57
82
|
browser dependency and can run anywhere.
|
|
@@ -82,7 +107,7 @@ records the endpoints and the traps, all confirmed against a live portal:
|
|
|
82
107
|
```sh
|
|
83
108
|
npm install
|
|
84
109
|
npm run build
|
|
85
|
-
npm test #
|
|
110
|
+
npm test # 214 tests
|
|
86
111
|
npm run test:coverage # 100% enforced
|
|
87
112
|
npm run typecheck # vitest does not run tsc — this does
|
|
88
113
|
```
|
package/dist/auth.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CookieJar, McpToolError } from '@chrischall/mcp-utils';
|
|
2
|
+
import { practiceHostFromLink } from './config.js';
|
|
2
3
|
/** The Rails/Devise session cookie the portal authenticates with. */
|
|
3
4
|
export const SESSION_COOKIE = 'simplepractice-session';
|
|
4
5
|
/**
|
|
@@ -67,11 +68,37 @@ async function establishSession(client, attributes) {
|
|
|
67
68
|
hint: `Expected a ${SESSION_COOKIE} cookie on the response. If SimplePractice has renamed it, simplepractice-mcp needs updating.`,
|
|
68
69
|
});
|
|
69
70
|
}
|
|
70
|
-
client.saveSession(`${SESSION_COOKIE}=${cookie}`);
|
|
71
|
-
return { status, signedIn: true };
|
|
71
|
+
const session = client.saveSession(`${SESSION_COOKIE}=${cookie}`);
|
|
72
|
+
return { status, signedIn: true, practiceHost: session.host };
|
|
72
73
|
}
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Trade an emailed sign-in link for a session — and take the practice from the
|
|
76
|
+
* link while we are at it.
|
|
77
|
+
*
|
|
78
|
+
* The link is `https://<practice>.clientsecure.me/sign-in/token#<TOKEN>`, so
|
|
79
|
+
* the same paste that carries the token also says which portal to send it to.
|
|
80
|
+
* That is the only ordering that can work when the link and the configuration
|
|
81
|
+
* disagree: the token was minted for the practice in the link, and posting it
|
|
82
|
+
* anywhere else is a 401.
|
|
83
|
+
*
|
|
84
|
+
* A link that names no practice — the mobile variant at the bare apex, or a
|
|
85
|
+
* bare token — falls back to whatever practice is already known.
|
|
86
|
+
*/
|
|
87
|
+
// `async` so that the pre-flight rejections below reach a caller the same way
|
|
88
|
+
// the network ones do, rather than throwing synchronously out of a function
|
|
89
|
+
// that otherwise returns a promise.
|
|
90
|
+
export async function verifySignInToken(client, linkOrToken) {
|
|
91
|
+
const attributes = { type: 'token', token: extractToken(linkOrToken) };
|
|
92
|
+
const fromLink = practiceHostFromLink(linkOrToken);
|
|
93
|
+
// Scoped, so a link that fails to verify does not leave the process pointed
|
|
94
|
+
// at its practice — links are single-use, so failing is the ordinary case.
|
|
95
|
+
if (fromLink) {
|
|
96
|
+
return client.withPracticeHost(fromLink, () => establishSession(client, attributes));
|
|
97
|
+
}
|
|
98
|
+
// No practice in the link, so it has to be known already: resolve before
|
|
99
|
+
// posting, or a single-use token is spent against a guess.
|
|
100
|
+
client.portalHost();
|
|
101
|
+
return establishSession(client, attributes);
|
|
75
102
|
}
|
|
76
103
|
export function verifySignInPin(client, email, pin) {
|
|
77
104
|
return establishSession(client, { type: 'pin', email, pin });
|