simplepractice-mcp 0.2.0 → 0.4.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 +37 -9
- package/dist/auth.js +31 -4
- package/dist/bundle.js +531 -87
- package/dist/client.js +132 -24
- package/dist/config.js +41 -6
- package/dist/index.js +5 -2
- package/dist/tools/account.js +12 -2
- package/dist/tools/appointments.js +6 -8
- package/dist/tools/auth.js +50 -19
- package/dist/tools/billing.js +29 -8
- package/dist/tools/documents.js +39 -11
- package/dist/tools/health.js +103 -0
- package/dist/version.js +1 -1
- package/dist/view.js +37 -0
- package/mint.yaml +9 -5
- package/package.json +4 -4
- package/server.json +4 -4
- package/skills/simplepractice/SKILL.md +17 -8
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
},
|
|
7
7
|
"metadata": {
|
|
8
8
|
"description": "SimplePractice Client Portal tools for Claude",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.4.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.4.0",
|
|
17
17
|
"author": {
|
|
18
18
|
"name": "Chris Chall",
|
|
19
19
|
"url": "https://github.com/chrischall"
|
package/README.md
CHANGED
|
@@ -20,22 +20,29 @@ 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
|
+
The reads that answer with a SimplePractice record rather than a projection —
|
|
28
|
+
appointments, billing items, the billing overview, one document request,
|
|
29
|
+
announcements — take a `view`. It defaults to `compact`, which returns the slim
|
|
30
|
+
projection where this server has one and otherwise drops logo and avatar URLs a
|
|
31
|
+
model cannot see; `view: "full"` returns the record untouched.
|
|
32
|
+
`simplepractice_list_documents` deliberately takes none: what it returns is the
|
|
33
|
+
file reference, and a shared scan is a `.jpg`.
|
|
34
|
+
|
|
26
35
|
## Setup
|
|
27
36
|
|
|
28
37
|
```sh
|
|
29
38
|
npm install -g simplepractice-mcp
|
|
30
|
-
export SIMPLEPRACTICE_PRACTICE=achievebalancetherapy # or the full host
|
|
31
39
|
```
|
|
32
40
|
|
|
33
|
-
|
|
34
|
-
whole `<practice>.clientsecure.me` host from the link your provider emailed.
|
|
41
|
+
There is nothing to configure. The practice comes from your sign-in link.
|
|
35
42
|
|
|
36
43
|
| Variable | |
|
|
37
44
|
|---|---|
|
|
38
|
-
| `SIMPLEPRACTICE_PRACTICE` |
|
|
45
|
+
| `SIMPLEPRACTICE_PRACTICE` | optional — pins the server to one practice (slug or host) |
|
|
39
46
|
| `SIMPLEPRACTICE_SESSION_FILE` | optional — session path (default `~/.simplepractice-mcp/session.json`, written `0600`) |
|
|
40
47
|
|
|
41
48
|
## Signing in
|
|
@@ -43,10 +50,31 @@ whole `<practice>.clientsecure.me` host from the link your provider emailed.
|
|
|
43
50
|
The Client Portal has **no password**. SimplePractice emails a one-time link
|
|
44
51
|
(or a 6-digit PIN); you trade it for a session cookie:
|
|
45
52
|
|
|
46
|
-
1.
|
|
47
|
-
2.
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
1. Open the email your provider sent, copy the link.
|
|
54
|
+
2. `simplepractice_verify_sign_in_token { link }` — pass the **whole** link.
|
|
55
|
+
|
|
56
|
+
The link is `https://<practice>.clientsecure.me/sign-in/token#<TOKEN>`, so one
|
|
57
|
+
paste carries both halves of what the server needs: the token is the `#`
|
|
58
|
+
fragment, and the host names the practice. Nothing is hardcoded, and the
|
|
59
|
+
stored session remembers the practice for every later run —
|
|
60
|
+
`simplepractice_session_status` reports which practice is in play and whether
|
|
61
|
+
it came from a link, the environment variable, or the saved session.
|
|
62
|
+
|
|
63
|
+
To have a fresh link sent rather than using one you already have, name the
|
|
64
|
+
practice once:
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
simplepractice_request_sign_in_link { email, practice: "achievebalancetherapy", confirm: true }
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
`practice` can be omitted whenever the server already knows the practice —
|
|
71
|
+
from an earlier sign-in, or from `SIMPLEPRACTICE_PRACTICE`.
|
|
72
|
+
|
|
73
|
+
Two sign-in links name no practice, and fall back to whichever one is already
|
|
74
|
+
known: the mobile-app variant SimplePractice sends
|
|
75
|
+
(`https://clientsecure.me/client-portal-api/sign-in/token#<TOKEN>`, pointed at
|
|
76
|
+
the bare apex), and a bare token pasted without its link. A link on any host
|
|
77
|
+
outside `*.clientsecure.me` is never adopted — the token is not sent there.
|
|
50
78
|
|
|
51
79
|
Links are single-use — replaying one answers
|
|
52
80
|
`401 "Authorization has already been used or expired"` — and last 24 hours. The
|
|
@@ -87,7 +115,7 @@ records the endpoints and the traps, all confirmed against a live portal:
|
|
|
87
115
|
```sh
|
|
88
116
|
npm install
|
|
89
117
|
npm run build
|
|
90
|
-
npm test #
|
|
118
|
+
npm test # 214 tests
|
|
91
119
|
npm run test:coverage # 100% enforced
|
|
92
120
|
npm run typecheck # vitest does not run tsc — this does
|
|
93
121
|
```
|
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 });
|