creditkarma-mcp 2.0.4 → 2.0.6

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/README.md CHANGED
@@ -65,7 +65,7 @@ cp .env.example .env
65
65
  "command": "node",
66
66
  "args": ["/absolute/path/to/creditkarma-mcp/dist/index.js"],
67
67
  "env": {
68
- "CK_COOKIES": "your-ckat-value-here"
68
+ "CK_COOKIES": "CKTRKID=...; CKAT=eyJ...%3BeyJ...; ..."
69
69
  }
70
70
  }
71
71
  }
@@ -85,44 +85,47 @@ Credit Karma uses short-lived JWTs. This server handles automatic token refresh
85
85
  #### Option A — scripted (recommended)
86
86
 
87
87
  ```bash
88
- npm run auth # prints the CKAT value to the console
89
- npm run auth -- .env # writes CK_COOKIES=<ckat> to .env
88
+ npm run auth # prints the Cookie header to the console
89
+ npm run auth -- .env # writes CK_COOKIES=<header> to .env
90
90
  ```
91
91
 
92
- Launches Chrome with a dedicated profile at `~/.creditkarma-mcp/chrome-profile`, waits for you to sign in at creditkarma.com, then captures the `CKAT` cookie (the URL-encoded bundle of access + refresh JWTs). Either prints it (for pasting into Claude Desktop / MCPB) or writes it to the env file you pass. Requires Google Chrome installed locally; the script installs `puppeteer-core` on first run (~1 MB).
92
+ Launches Chrome with a dedicated profile at `~/.creditkarma-mcp/chrome-profile`, waits for you to sign in at creditkarma.com, then captures the full session Cookie header (CKAT carries the access + refresh JWTs; CKTRKID and friends are needed by the refresh endpoint). Either prints it (for pasting into Claude Desktop / MCPB) or writes it to the env file you pass at mode 0600 (owner-only). Requires Google Chrome installed locally; on first run the script installs `puppeteer-core`, `puppeteer-extra`, and `puppeteer-extra-plugin-stealth` (a few MB, not added to `package.json`).
93
93
 
94
- #### Option B — manual (DevTools)
94
+ #### Option B — manual paste (secure prompt)
95
+
96
+ ```bash
97
+ npm run auth -- --manual # prompts for the cookie, prints CK_COOKIES
98
+ npm run auth -- --manual .env # prompts for the cookie, writes to .env
99
+ ```
100
+
101
+ Use this if the scripted flow hits Intuit/Akamai bot detection (sign-in returns "A technical issue has unexpectedly occurred"). Grab the Cookie header from your normal Chrome (Option C below), then paste it at the prompt. Input is **not echoed** — paste, press Enter.
102
+
103
+ #### Option C — manual (DevTools)
95
104
 
96
105
  1. Log in to [creditkarma.com](https://www.creditkarma.com) in Chrome
97
- 2. Open DevTools → **Application** → **Cookies** `https://www.creditkarma.com`
98
- 3. Find the `CKAT` cookie and copy its value
106
+ 2. Open DevTools → **Network** → click any request to creditkarma.com → **Request Headers**
107
+ 3. Right-click the `cookie` header **Copy value**
99
108
 
100
109
  ### Setting credentials
101
110
 
102
111
  Either of these works:
103
112
 
104
- - Paste the value from `npm run auth` (or your CKAT cookie) into `CK_COOKIES` in your `.env` or Claude config
105
- - Or call `ck_set_session` from within Claude with the cookie value — it accepts any of:
106
-
107
- | Format | Example |
108
- |--------|---------|
109
- | Raw CKAT value | `eyJraWQ...%3BeyJraWQ...` |
110
- | `CKAT=<value>` | `CKAT=eyJraWQ...%3BeyJraWQ...` |
111
- | Full Cookie header | *(what `npm run auth` prints)* |
113
+ - Paste the value from `npm run auth` into `CK_COOKIES` in your `.env` or Claude config
114
+ - Or call `ck_set_session` from within Claude with the Cookie header value
112
115
 
113
- The server automatically extracts both the access token and refresh token from the CKAT cookie, and refreshes the access token as needed.
116
+ The server extracts the access and refresh JWTs from the `CKAT` cookie inside the header and refreshes the access token automatically as needed.
114
117
 
115
118
  ### Session expiry
116
119
 
117
120
  - **Access token**: ~15 minutes (auto-refreshed transparently)
118
121
  - **Refresh token**: ~8 hours
119
- - When the refresh token expires, re-run `npm run auth` (or grab the new CKAT cookie from DevTools) and either update `CK_COOKIES` or call `ck_set_session`
122
+ - When the refresh token expires, re-run `npm run auth` (or grab a fresh Cookie header from DevTools) and either update `CK_COOKIES` or call `ck_set_session`
120
123
 
121
124
  ## Available tools
122
125
 
123
126
  | Tool | What it does |
124
127
  |------|-------------|
125
- | `ck_set_session` | Store credentials from your browser cookies (auto-extracts tokens from CKAT) |
128
+ | `ck_set_session` | Store credentials from your browser Cookie header (auto-extracts JWTs from the CKAT cookie) |
126
129
  | `ck_sync_transactions` | Sync transactions into the local SQLite database |
127
130
  | `ck_list_transactions` | List transactions with filters (date, account, category, merchant, amount) |
128
131
  | `ck_get_recent_transactions` | Fetch the N most recent transactions |
@@ -153,14 +156,14 @@ sync_state (key, value)
153
156
 
154
157
  | Env var | Description | Default |
155
158
  |---------|-------------|---------|
156
- | `CK_COOKIES` | CKAT value, `CKAT=<value>`, or full Cookie header | *(required)* |
159
+ | `CK_COOKIES` | Full Cookie header from a signed-in creditkarma.com request | *(required)* |
157
160
  | `CK_DB_PATH` | Path to SQLite database file | `~/.creditkarma-mcp/transactions.db` |
158
161
 
159
162
  ## Troubleshooting
160
163
 
161
- **"TOKEN_EXPIRED"** — your refresh token has expired. Re-run `npm run auth` (or grab a new CKAT cookie) and update `CK_COOKIES` or call `ck_set_session`.
164
+ **"TOKEN_EXPIRED"** — your refresh token has expired. Re-run `npm run auth` (or grab a fresh Cookie header) and update `CK_COOKIES` or call `ck_set_session`.
162
165
 
163
- **Sync returns 0 transactions** — check that your `CK_COOKIES` value is fresh. CKAT cookies expire after ~8 hours.
166
+ **Sync returns 0 transactions** — check that your `CK_COOKIES` value is fresh. The refresh token inside the CKAT cookie expires after ~8 hours.
164
167
 
165
168
  **Tools not appearing** — fully quit and relaunch Claude Desktop. In Claude Code, run `/mcp` to check server status.
166
169
 
@@ -169,33 +172,44 @@ sync_state (key, value)
169
172
  ## Security
170
173
 
171
174
  - Credentials are stored only in your local `.env` file (gitignored) or Claude config
172
- - The server never logs credentials
173
- - Only SELECT queries are permitted via `ck_query_sql` — no writes to Credit Karma
175
+ - `.env` is written at mode 0600 (owner read/write only) by both `npm run auth` and `ck_set_session`
176
+ - `ck_set_session` refuses to save a refresh token whose JWT `exp` is already in the past prevents stale credentials from polluting `.env`
177
+ - The server never logs credentials; warnings go to stderr only (stdout is reserved for the MCP JSON-RPC stream)
178
+ - Only `SELECT` queries are permitted via `ck_query_sql` — no writes to Credit Karma; the underlying `node:sqlite` `prepare()` also rejects multi-statement input
174
179
 
175
180
  ## Development
176
181
 
177
182
  ```bash
178
- npm test # run the test suite
179
- npm run build # compile TypeScript → dist/
180
- npm run test:watch # watch mode
183
+ npm test # run the test suite (vitest)
184
+ npm run build # compile TypeScript → dist/, copy transaction.graphql, bundle for MCPB
185
+ npm run test:watch # watch mode
186
+ npm run test:coverage # coverage report (CI enforces 100% on src/**)
181
187
  ```
182
188
 
189
+ Versions are bumped automatically by the **Tag & Bump** GitHub Action (`.github/workflows/tag-and-bump.yml`). Do not bump manually.
190
+
183
191
  ### Project structure
184
192
 
185
193
  ```
186
194
  src/
187
- client.ts Credit Karma GraphQL client with auto-refresh
188
- index.ts MCP server entry point
189
- db.ts SQLite schema and upsert helpers
190
- transaction.graphql GraphQL query for transactions
195
+ client.ts Credit Karma GraphQL client (auto-refresh, JWT helpers, cookie parser)
196
+ index.ts MCP server entry point; bootstraps tokens from CK_COOKIES
197
+ db.ts SQLite schema, migrations, and upsert helpers
198
+ transaction.graphql GraphQL query for transactions (copied to dist/ at build time)
191
199
  tools/
192
- auth.ts ck_set_session
193
- sync.ts ck_sync_transactions
194
- query.ts ck_list_transactions, ck_get_recent_transactions, etc.
195
- sql.ts ck_query_sql
200
+ auth.ts ck_set_session — refuses stale refresh tokens, writes .env at 0600
201
+ sync.ts ck_sync_transactions — incremental sync with resume-on-failure
202
+ query.ts ck_list_transactions, ck_get_recent_transactions,
203
+ ck_get_spending_by_category, ck_get_spending_by_merchant,
204
+ ck_get_account_summary
205
+ sql.ts ck_query_sql — SELECT-only escape hatch
206
+ scripts/
207
+ setup-auth.mjs npm run auth — Puppeteer flow + manual paste fallback
196
208
  tests/
209
+ helpers.ts Shared test helpers (fakeServer, makeJwt)
197
210
  client.test.ts
198
211
  db.test.ts
212
+ setup-auth.test.ts
199
213
  tools/
200
214
  auth.test.ts
201
215
  sync.test.ts
package/SKILL.md CHANGED
@@ -23,7 +23,7 @@ Add to `.mcp.json` in your project or `~/.claude/mcp.json`:
23
23
  "command": "npx",
24
24
  "args": ["-y", "creditkarma-mcp"],
25
25
  "env": {
26
- "CK_COOKIES": "your-ckat-value-here"
26
+ "CK_COOKIES": "CKTRKID=...; CKAT=eyJ...%3BeyJ...; ..."
27
27
  }
28
28
  }
29
29
  }
@@ -47,7 +47,7 @@ Then add to `.mcp.json`:
47
47
  "command": "node",
48
48
  "args": ["/path/to/creditkarma-mcp/dist/index.js"],
49
49
  "env": {
50
- "CK_COOKIES": "your-ckat-value-here"
50
+ "CK_COOKIES": "CKTRKID=...; CKAT=eyJ...%3BeyJ...; ..."
51
51
  }
52
52
  }
53
53
  }
@@ -60,33 +60,31 @@ Or use a `.env` file in the project directory with `CK_COOKIES=<value>`.
60
60
 
61
61
  **Scripted (recommended — source install):**
62
62
  ```bash
63
- npm run auth # prints the CKAT value to the console
64
- npm run auth -- .env # writes CK_COOKIES=<ckat> to .env
63
+ npm run auth # prints the Cookie header to the console
64
+ npm run auth -- .env # writes CK_COOKIES=<header> to .env
65
65
  ```
66
66
 
67
- Launches Chrome with a dedicated profile, waits for sign-in at creditkarma.com, then captures the `CKAT` cookie (the URL-encoded bundle of access + refresh JWTs). Use the printed value with Claude Desktop / MCPB, or the `.env` form when running from source.
67
+ Launches Chrome with a dedicated profile, waits for sign-in at creditkarma.com, then captures the full session Cookie header (CKAT carries the access + refresh JWTs; CKTRKID and friends are needed by the refresh endpoint). Use the printed value with Claude Desktop / MCPB, or the `.env` form when running from source.
68
68
 
69
69
  **Manual (DevTools):**
70
70
  1. Log in to [creditkarma.com](https://www.creditkarma.com) in Chrome
71
- 2. DevTools → **Application** → **Cookies** → `creditkarma.com`
72
- 3. Copy the `CKAT` cookie value
73
-
74
- Accepts: raw CKAT value, `CKAT=<value>`, or the full Cookie header string from any CK network request.
71
+ 2. DevTools → **Network** → any creditkarma.com request → **Request Headers**
72
+ 3. Right-click the `cookie` header → **Copy value**
75
73
 
76
74
  ## Authentication
77
75
 
78
- Call `ck_set_session` with your cookie value to store credentials and enable auto-refresh.
76
+ Call `ck_set_session` with your Cookie header to store credentials and enable auto-refresh.
79
77
 
80
78
  - Access token: ~15 min TTL, auto-refreshed transparently
81
79
  - Refresh token: ~8 hours TTL
82
- - When expired: re-run `npm run auth` (or grab a new CKAT cookie) and call `ck_set_session`
80
+ - When expired: re-run `npm run auth` (or grab a fresh Cookie header) and call `ck_set_session`
83
81
 
84
82
  ## Tools
85
83
 
86
84
  ### Auth
87
85
  | Tool | Description |
88
86
  |------|-------------|
89
- | `ck_set_session(cookies)` | Store credentials — accepts CKAT value, `CKAT=<value>`, or full Cookie header |
87
+ | `ck_set_session(cookies)` | Store credentials — paste the full Cookie header from a signed-in creditkarma.com request |
90
88
 
91
89
  ### Sync
92
90
  | Tool | Description |
@@ -106,7 +104,7 @@ Call `ck_set_session` with your cookie value to store credentials and enable aut
106
104
  ## Workflows
107
105
 
108
106
  **First-time setup:**
109
- 1. Run `npm run auth` (or grab the `CKAT` cookie manually from creditkarma.com DevTools)
107
+ 1. Run `npm run auth` (or grab the Cookie header manually from a creditkarma.com request in DevTools)
110
108
  2. Paste into `CK_COOKIES` env var, or call `ck_set_session(cookies)` from within Claude
111
109
  3. `ck_sync_transactions` → initial full sync
112
110