@nannykeeper/mcp-server 1.17.0 → 1.18.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/AGENTS.md CHANGED
@@ -7,9 +7,10 @@ Calculate US household employer (nanny) taxes for all 50 states + DC.
7
7
  - `calculate_nanny_taxes(state, annual_wages, pay_frequency?)` — returns full tax breakdown
8
8
  - `check_threshold(state, annual_wages, tax_year?)` — checks if employer obligations apply
9
9
  - `list_employees(employer_id?)` — returns the household's employer_id and every employee_id. Call it first; never invent IDs
10
- - `preview_payroll(employee_id, ..., employer_id?)` — previews payroll without creating a record
11
- - `run_payroll(employee_id, ..., employer_id?)` — run payroll with full tax calc, YTD tracking, and DB persistence (Starter+ required)
10
+ - `preview_payroll(employee_id, ..., reimbursements?, employer_id?)` — previews payroll without creating a record. Mileage goes in `reimbursements` as `{type: "mileage", miles, amount: 0}`
11
+ - `run_payroll(employee_id, ..., reimbursements?, employer_id?)` — run payroll with full tax calc, YTD tracking, and DB persistence (Starter+ required)
12
12
  - `get_payroll(payroll_id?, employer_id?)` — reads one payroll (every deduction, net pay, status) or lists them
13
+ - `list_payrolls(employee_id?, pay_date_from?, pay_date_to?, limit?, cursor?, employer_id?)` — the household's payrolls, newest first, with the employee_ids each paid; filter by employee and pay date. Use `limit: 3` for the last three
13
14
  - `get_pay_stub(payroll_id, employer_id?)` — returns each employee's pay stub PDF
14
15
  - `get_w2(employee_id, tax_year, copy?, employer_id?)`: returns `download_url`, a link that works for 15 minutes, for one copy of a W-2 the household has already generated in NannyKeeper. Give the user the link and tell them to open it in their browser. Never the PDF, and never open the link yourself. Never generates a W-2
15
16
  - `get_schedule_h(tax_year, employer_id?)`: returns `download_url`, a link that works for 15 minutes, for the household's Schedule H, or `schedule_h_unavailable` with a reason. Give the user the link
package/CLAUDE.md CHANGED
@@ -10,6 +10,7 @@ Calculate nanny taxes for all 50 US states.
10
10
  - `get_w2`: a 15-minute DOWNLOAD LINK (`download_url`) for one copy of an employee's W-2 for an ended tax year. ⛔ Never the PDF: a W-2 prints the full SSN and a tool result is read by the assistant's model, so the tool always asks the API for `delivery: "link"` and the person opens the link. Do not "align" it with `get_pay_stub`'s attached file. Only a W-2 the household already generated in the dashboard; never generates one (`w2_not_generated`). Hosted and npm identical (added 1.16.0)
11
11
  - `get_schedule_h`: a 15-minute download link for the household's Schedule H for an ended tax year, through the dashboard's own Download procedure; its refusals come back as `schedule_h_unavailable` with a `reason`. A link for the same reason as `get_w2` (added 1.16.0)
12
12
  - `get_quarter_taxes`: a quarter's tax figures as the Taxes page shows them, from `GET /api/v1/taxes/quarterly`, passed through unchanged. ⛔ Never summarise it in the tool: a null amount is NannyKeeper refusing to state a figure (`waiting_on`), and a summary is where a null becomes a 0 (added 1.17.0)
13
+ - `list_payrolls`: the household's payrolls from `GET /api/v1/payrolls`, newest first, filtered by `employee_id` and an inclusive `pay_date_from`/`pay_date_to`, each naming the `employee_ids` it paid. Passed through unchanged. Registered from its own module, `tools/list-payrolls.ts` (added 1.18.0)
13
14
  - `calculate_nanny_taxes` — Full federal + state tax breakdown
14
15
  - `check_threshold` — Whether wages trigger employer tax obligations
15
16
  - `preview_payroll` — Dry-run payroll calc, returns taxes/net pay without creating a record (Starter+ required)
@@ -18,7 +19,7 @@ Calculate nanny taxes for all 50 US states.
18
19
  - `manage_autopilot` — Pause / resume / skip / disable an existing enrollment. **Enrolling is NOT exposed** — it captures a standing recurring ACH authorization that must be employer-driven in-app. (Plus/Professional, `ach` scope) — added 1.9.0
19
20
  - `get_state_filing_status` — The employer's state agency accounts (UC, withholding, SDI) per state, last-four only. Each account has a status: `registered`, `pending`, `required`, or `not_required`. ⛔ `not_required` means this household genuinely does not owe that registration — most often because they and their employee agreed not to withhold state income tax — so never tell them to go register for it. A registration URL is returned only where there is still something to open or finish. Takes an optional `employer_id` — omit it for a single-household account; a **test-mode key must pass one**, because a key's default household is always the real one and the endpoint enforces the test/live boundary.
20
21
 
21
- **Declare tool parameters in `server.ts`, never in the tool descriptor.** `server.tool()` takes its own zod shape, so an `inputSchema` on the exported descriptor is read by nothing. The same applies to the tool description: `server.ts` must import the descriptor's `name` and `description` rather than restating them, or the copy an agent actually reads can drift from the one being edited. `index.ts` only starts the stdio transport. Hosted callers pass request-scoped credentials to the same server factory.
22
+ **Declare tool parameters in the `server.tool()` call, never in the tool descriptor.** A tool is either registered in `server.ts` or, from 1.18.0, from its own module through a `register<Tool>(server, context)` function that `server.ts` calls (`tools/list-payrolls.ts`), so a new tool does not edit another's registration. `server.tool()` takes its own zod shape, so an `inputSchema` on the exported descriptor is read by nothing. The same applies to the tool description: the registering call must import the descriptor's `name` and `description` rather than restating them, or the copy an agent actually reads can drift from the one being edited. `index.ts` only starts the stdio transport. Hosted callers pass request-scoped credentials to the same server factory.
22
23
 
23
24
  ## Autopilot (get_autopilot, manage_autopilot)
24
25
  Autopilot auto-runs each period's payroll onto the existing scheduled-fire path so a household never misses a paycheck. The MCP surface is **manage-only**: read status/enrollments and pause/resume/skip/disable. Turning it ON must happen in the app (standing ACH authorization = employer-driven consent), so there is no enroll tool — `POST /api/v1/autopilot/enroll` returns 403 pointing back to the app. `skip` with `through_date` skips every period up to that date (vacation). Confirm any management action with the user before calling.
@@ -35,6 +36,9 @@ API callers with direct-deposit payments must tick the same safety gates the UI
35
36
 
36
37
  These flags exist even for server-to-server callers as a safety measure. Agents should only set them after verifying the amounts with the user.
37
38
 
39
+ ## Reimbursements (run_payroll, preview_payroll)
40
+ `reimbursements` is the API's `employees[].reimbursements`, sent through unchanged: up to 10 lines of `{ type, amount, description?, miles?, rate_per_mile? }`. ⛔ Its schema lives in `tools/reimbursements.ts` and must keep the API's exact limits; a test in the application repository holds the two to the same boundaries. A mileage line with miles is priced by the API (amount 0), at `rate_per_mile` when sent, else at the IRS rate the API holds for the pay period and pay date; a year it holds none for answers `mileage_rate_unavailable`. The one array input in the server, which is why `MAX_TOOL_INPUT_ELEMENTS` names it.
41
+
38
42
  ## Voluntary set-aside (run_payroll, preview_payroll)
39
43
  The optional `voluntary_set_aside: { skip?, amount? }` field overrides the employee's recurring set-aside rule for a single paycheck. The recurring rule (e.g., 2% of gross for OH municipal courtesy withholding) is configured via the dashboard — this field can only override or skip per-payroll. Omit the field to apply the rule normally.
40
44
 
@@ -65,3 +69,6 @@ Get employee_id (and the household's employer_id) from `list_employees`.
65
69
  household the key belongs to. Pass it only when one account manages several.
66
70
 
67
71
  Full API docs: https://www.nannykeeper.com/developers/reference
72
+
73
+ ## Client label
74
+ Every API request carries `X-NannyKeeper-Client: mcp` (`CLIENT_HEADER` in `context.ts`), so the API can count MCP use of an endpoint apart from direct API use. It is a label only and grants nothing. A new tool's fetch spreads it like the others.
package/README.md CHANGED
@@ -15,7 +15,7 @@ MCP server for calculating US household employer (nanny) taxes. Works with Claud
15
15
  "mcpServers": {
16
16
  "nannykeeper": {
17
17
  "command": "npx",
18
- "args": ["@nannykeeper/mcp-server"],
18
+ "args": ["-y", "@nannykeeper/mcp-server@latest"],
19
19
  "env": {
20
20
  "NANNYKEEPER_API_KEY": "nk_live_YOUR_KEY"
21
21
  }
@@ -31,7 +31,7 @@ MCP server for calculating US household employer (nanny) taxes. Works with Claud
31
31
  Run this once in your terminal, with your own key in place of `nk_live_YOUR_KEY`:
32
32
 
33
33
  ```bash
34
- claude mcp add nannykeeper --env NANNYKEEPER_API_KEY=nk_live_YOUR_KEY -- npx -y @nannykeeper/mcp-server
34
+ claude mcp add nannykeeper --env NANNYKEEPER_API_KEY=nk_live_YOUR_KEY -- npx -y @nannykeeper/mcp-server@latest
35
35
  ```
36
36
 
37
37
  Start `claude` and run `/mcp` to see the NannyKeeper tools. Add `--scope user` to use it in every project.
@@ -39,9 +39,10 @@ Start `claude` and run `/mcp` to see the NannyKeeper tools. Add `--scope user` t
39
39
  ## Running payroll from an agent
40
40
 
41
41
  1. `list_employees` returns your household's `employer_id` and each employee's `employee_id`.
42
- 2. `preview_payroll` with the period and hours. Check the figures with the person you are working for.
42
+ 2. `preview_payroll` with the period, hours and any mileage (`reimbursements`). Check the figures with the person you are working for.
43
43
  3. `run_payroll` with the same inputs and an `idempotency_key`.
44
44
  4. `get_payroll` confirms the status and every deduction; `get_pay_stub` returns the stub PDF.
45
+ 5. `list_payrolls` answers "what did I pay her last time?" and "show my last three payrolls", filtered by employee and pay date.
45
46
 
46
47
  `employer_id` is optional on every tool: leave it out and the API uses the household your key belongs to.
47
48
 
@@ -62,6 +63,17 @@ With `payroll_id`, read one payroll: status, dates, and each employee's gross pa
62
63
  - `payroll_id` (optional) — A payroll ID from `run_payroll`
63
64
  - `employer_id` (optional) — Only when listing for one of several households
64
65
 
66
+ ### `list_payrolls`
67
+
68
+ The household's payrolls, newest first, each with status, pay period, pay date, totals and the `employee_ids` it paid. Totals are for the whole payroll; `get_payroll` has each employee's figures. Read-only (added 1.18.0).
69
+
70
+ **Parameters:**
71
+ - `employee_id` (optional) — Only payrolls that paid this employee. One not in the household answers `not_found`
72
+ - `pay_date_from`, `pay_date_to` (optional) — Inclusive pay-date range (YYYY-MM-DD)
73
+ - `limit` (optional) — 1–100, default 25. Use 3 for "the last three payrolls"
74
+ - `cursor` (optional) — The `next_cursor` from the previous call
75
+ - `employer_id` (optional) — Only when one account manages several households
76
+
65
77
  ### `get_pay_stub`
66
78
 
67
79
  The pay stub PDF for each employee on a payroll, the same stub the household downloads in the dashboard, attached as a PDF file.
@@ -142,6 +154,7 @@ Dry-run payroll calculation. Returns the full tax breakdown, net pay, and employ
142
154
  - `bonus` (optional) — Bonus amount
143
155
  - `other_earnings` (optional) — Other earnings
144
156
  - `voluntary_set_aside` (optional, v1.6.0+) — Override or skip the employee's recurring voluntary set-aside rule for this paycheck only. Object with `skip` (boolean) or `amount` (number, $0–$9,999). The recurring rule is configured via the dashboard; omit this field to apply it normally.
157
+ - `reimbursements` (optional, v1.18.0+) — Up to 10 reimbursement lines paid with this paycheck, which NannyKeeper adds to net pay without calculating tax on them, the same lines the API takes: `{ type, amount, description?, miles?, rate_per_mile? }`. `type` is `transit`, `parking`, `mileage` or `other`; `amount` $0–$9,999; `miles` 0–9,999; `rate_per_mile` $0–$5. For mileage send the miles and `amount: 0`: NannyKeeper prices the miles at the IRS rate it holds for the pay period and pay date unless you pass `rate_per_mile`, and refuses a year it holds no rate for with `mileage_rate_unavailable`.
145
158
 
146
159
  ### `run_payroll`
147
160
 
@@ -165,6 +178,7 @@ Run payroll for a household employee **end-to-end in a single call** — creates
165
178
  - `confirm_large_payroll` (optional) — Required for direct-deposit payrolls with total net pay >$5,000 or any single net pay >$3,000
166
179
  - `confirm_ach_debit` (optional) — Required for first-ever DD payroll or when >30 days have elapsed since the last DD authorization
167
180
  - `voluntary_set_aside` (optional, v1.6.0+) — Override or skip the employee's recurring voluntary set-aside rule for this paycheck only. Object with `skip` (boolean) or `amount` (number, $0–$9,999). The recurring rule is configured via the dashboard; omit this field to apply it normally.
181
+ - `reimbursements` (optional, v1.18.0+) — Up to 10 reimbursement lines paid with this paycheck, which NannyKeeper adds to net pay without calculating tax on them, the same lines the API takes: `{ type, amount, description?, miles?, rate_per_mile? }`. `type` is `transit`, `parking`, `mileage` or `other`; `amount` $0–$9,999; `miles` 0–9,999; `rate_per_mile` $0–$5. For mileage send the miles and `amount: 0`: NannyKeeper prices the miles at the IRS rate it holds for the pay period and pay date unless you pass `rate_per_mile`, and refuses a year it holds no rate for with `mileage_rate_unavailable`.
168
182
  - `idempotency_key` (optional) — Prevent duplicate payroll creation
169
183
 
170
184
  ### `get_state_filing_status`
package/dist/context.d.ts CHANGED
@@ -5,3 +5,11 @@ export interface ToolContext {
5
5
  publicConnection?: boolean;
6
6
  }
7
7
  export declare function getToolContext(context?: ToolContext): ToolContext;
8
+ /**
9
+ * Sent with every API request. A label that lets NannyKeeper count MCP use of
10
+ * an endpoint separately from direct API use of the same endpoint; the API
11
+ * never grants or refuses anything because of it.
12
+ */
13
+ export declare const CLIENT_HEADER: {
14
+ readonly "X-NannyKeeper-Client": "mcp";
15
+ };
package/dist/context.js CHANGED
@@ -4,3 +4,9 @@ export function getToolContext(context) {
4
4
  apiBase: process.env.NANNYKEEPER_API_URL || "https://www.nannykeeper.com",
5
5
  };
6
6
  }
7
+ /**
8
+ * Sent with every API request. A label that lets NannyKeeper count MCP use of
9
+ * an endpoint separately from direct API use of the same endpoint; the API
10
+ * never grants or refuses anything because of it.
11
+ */
12
+ export const CLIENT_HEADER = { "X-NannyKeeper-Client": "mcp" };
@@ -2,11 +2,11 @@
2
2
  export const publicDescriptions = {
3
3
  calculate_nanny_taxes: "Estimate household payroll taxes using the NannyKeeper calculator. Provide work state, annual wages, and pay frequency; include residence state when different. These estimates do not incorporate an existing employee's year-to-date payroll. Use preview_payroll for an existing employee. The calculator has no family-relationship input, so its taxes assume no family exemption applies. threshold.action_required is true or null, never false; present null as not determined. Preserve any limitations or unassessed items returned by the API.",
4
4
  check_threshold: "Check the supported annual wage threshold assessment for one household employee. This tool has no household-wide quarterly wages or family-relationship input. federal.action_required is true or null, never false; present null as not determined. Preserve the API's limitations and unassessed items; do not present its result as a complete determination of obligations.",
5
- preview_payroll: "Preview payroll for an existing household employee without creating a payroll record. Review the returned pay date, gross and net pay, employer costs, warnings, and any estimated status with the user before running payroll. The account must already have access to payroll. Get employee IDs from list_employees; never invent them.",
6
- run_payroll: "Create, approve, and process payroll for an existing household employee. Check and cash record payments the employer handles themselves. Direct deposit initiates or schedules NannyKeeper processing through Stripe. First preview the same inputs and obtain explicit confirmation of the employee, period, pay date, amounts, and payment method. Set debit or large-payroll confirmation flags only after the user explicitly authorizes the corresponding action. Use one idempotency_key per approved payroll and reuse it on a retry with identical inputs. Do not retry a rejected payroll with changed dates, payment method, confirmation flags, or off_cycle to bypass a safeguard. Report the exact returned status; scheduled or processing does not mean paid.",
5
+ preview_payroll: "Preview payroll for an existing household employee without creating a payroll record. Pass mileage and other reimbursements in reimbursements, as run_payroll takes them. Review the returned pay date, gross and net pay, employer costs, warnings, and any estimated status with the user before running payroll. The account must already have access to payroll. Get employee IDs from list_employees; never invent them.",
6
+ run_payroll: "Create, approve, and process payroll for an existing household employee. Check and cash record payments the employer handles themselves. Direct deposit initiates or schedules NannyKeeper processing through Stripe. Mileage and other reimbursements go in reimbursements (up to 10 lines; for mileage send the miles and amount 0). First preview the same inputs and obtain explicit confirmation of the employee, period, pay date, amounts, and payment method. Set debit or large-payroll confirmation flags only after the user explicitly authorizes the corresponding action. Use one idempotency_key per approved payroll and reuse it on a retry with identical inputs. Do not retry a rejected payroll with changed dates, payment method, confirmation flags, or off_cycle to bypass a safeguard. Report the exact returned status; scheduled or processing does not mean paid.",
7
7
  get_state_filing_status: "Read masked state agency account status for the connected household. Use employer_id to select an authorized household when needed. Present returned registered, pending, required, and not_required states faithfully. This tool does not register an account or submit a filing. Do not infer that missing or unassessed information means no obligation.",
8
8
  list_employees: "List the connected household's employees with their pay setup and what is still missing for payroll. Returns the employee IDs the payroll tools need. Read-only.",
9
- get_payroll: "Read one payroll by ID, or list the household's payrolls. Returns status, dates, gross pay, each deduction, net pay, and employer taxes. Report the exact status; scheduled or processing does not mean paid.",
9
+ get_payroll: "Read one payroll by ID, or list the household's payrolls (list_payrolls filters that list by employee and pay date). Returns status, dates, gross pay, each deduction, net pay, and employer taxes. Report the exact status; scheduled or processing does not mean paid.",
10
10
  get_pay_stub: "Get the pay stub PDF for each employee on a paid payroll, the same stub the household downloads in NannyKeeper. A payroll that is not paid yet answers payroll_not_completed. Safe to repeat.",
11
11
  get_w2: "Get a download link for one copy of an employee's W-2 for a tax year that has ended. Returns download_url, a link on nannykeeper.com that works for 15 minutes; give it to the user and tell them to open it in their browser. This tool never returns the PDF, and you must not open the link yourself. The household generates the W-2 in NannyKeeper first; until then this answers w2_not_generated, and this tool never generates one. Safe to repeat.",
12
12
  get_schedule_h: "Get a download link for the household's Schedule H for a tax year that has ended. Returns download_url, a link on nannykeeper.com that works for 15 minutes; give it to the user and tell them to open it in their browser. This tool never returns the PDF, and you must not open the link yourself. When NannyKeeper would not produce the form this answers schedule_h_unavailable with a reason; report that reason faithfully. NannyKeeper does not file the form. Safe to repeat.",
package/dist/server.d.ts CHANGED
@@ -4,9 +4,12 @@ import type { ToolContext } from "./context.ts";
4
4
  * Cap on array elements plus object members in one tools/call `arguments`
5
5
  * (GHSA-46jr-4wx8-v453). The SDK counts them before validation and
6
6
  * has no limit unless one is set, so an object with tens of thousands of keys
7
- * inside the 64KB body cap could exhaust memory. No tool takes an array or a
8
- * record, and the widest (run_payroll) has about 22 members, so 256 refuses
9
- * nothing real. Raise it if a tool ever gains an array input.
7
+ * inside the 64KB body cap could exhaust memory. The one array input is
8
+ * `reimbursements` on preview_payroll and run_payroll: at most 10 lines of 5
9
+ * members, so the widest call (run_payroll, about 22 members plus 10 + 50 for
10
+ * a full set of lines) stays near 85, and 256 refuses nothing real. A test
11
+ * sends the largest valid run_payroll call through the real server to hold
12
+ * that. Raise this if an input grows past it.
10
13
  */
11
14
  export declare const MAX_TOOL_INPUT_ELEMENTS = 256;
12
15
  /** A fresh server and credential closure for each hosted request. */
package/dist/server.js CHANGED
@@ -6,6 +6,8 @@ import { executePreviewPayroll } from "./tools/preview-payroll.js";
6
6
  import { executeRunPayroll } from "./tools/run-payroll.js";
7
7
  import { executeStateFilingStatus, stateFilingStatusTool, } from "./tools/state-filing-status.js";
8
8
  import { executeGetAutopilot, executeManageAutopilot } from "./tools/autopilot.js";
9
+ import { reimbursementsParam } from "./tools/reimbursements.js";
10
+ import { registerListPayrolls } from "./tools/list-payrolls.js";
9
11
  import { executeGetPayStub, executeGetW2, executeGetScheduleH, executeGetQuarterTaxes, executeGetPayroll, executeListEmployees, } from "./tools/household.js";
10
12
  import { publicDescriptions, toolResult } from "./public-profile.js";
11
13
  /**
@@ -23,9 +25,12 @@ const EMPLOYER_ID_OPTIONAL = z
23
25
  * Cap on array elements plus object members in one tools/call `arguments`
24
26
  * (GHSA-46jr-4wx8-v453). The SDK counts them before validation and
25
27
  * has no limit unless one is set, so an object with tens of thousands of keys
26
- * inside the 64KB body cap could exhaust memory. No tool takes an array or a
27
- * record, and the widest (run_payroll) has about 22 members, so 256 refuses
28
- * nothing real. Raise it if a tool ever gains an array input.
28
+ * inside the 64KB body cap could exhaust memory. The one array input is
29
+ * `reimbursements` on preview_payroll and run_payroll: at most 10 lines of 5
30
+ * members, so the widest call (run_payroll, about 22 members plus 10 + 50 for
31
+ * a full set of lines) stays near 85, and 256 refuses nothing real. A test
32
+ * sends the largest valid run_payroll call through the real server to hold
33
+ * that. Raise this if an input grows past it.
29
34
  */
30
35
  export const MAX_TOOL_INPUT_ELEMENTS = 256;
31
36
  /** A fresh server and credential closure for each hosted request. */
@@ -109,6 +114,7 @@ export function createNannyKeeperServer(version, context) {
109
114
  "work/residence states have a reciprocal agreement — applied=true means the work state's income " +
110
115
  "tax was suppressed under the employer's certificate attestation (set up in the NannyKeeper app " +
111
116
  "on the employee's profile); applied=false names the certificate still to collect. " +
117
+ "Mileage and other reimbursements go in reimbursements, the same lines run_payroll takes. " +
112
118
  "Use this to validate your request before calling run_payroll. " +
113
119
  "Same parameters as run_payroll. Requires a Starter+ subscription. " +
114
120
  "pay_date is optional. When omitted, the server picks the earliest valid business day on or " +
@@ -136,6 +142,7 @@ export function createNannyKeeperServer(version, context) {
136
142
  })
137
143
  .optional()
138
144
  .describe("Override or skip the employee's voluntary post-tax set-aside rule for this paycheck only. The recurring rule itself is configured via the dashboard. Omit this field to apply the rule normally."),
145
+ reimbursements: reimbursementsParam,
139
146
  }, {
140
147
  title: "Preview Payroll",
141
148
  readOnlyHint: true,
@@ -165,6 +172,9 @@ export function createNannyKeeperServer(version, context) {
165
172
  "if YTD or rate configs change between approve and fire. " +
166
173
  "Direct deposit callers: set confirm_large_payroll=true for totals >$5,000 or any single " +
167
174
  "net pay >$3,000; set confirm_ach_debit=true for first-time DD or if no DD in 30 days. " +
175
+ "Mileage, transit, parking and other reimbursements: pass up to 10 lines in reimbursements. For mileage send " +
176
+ "type mileage, the miles and amount 0, and NannyKeeper prices the miles at the IRS rate it holds for the pay " +
177
+ "period and pay date unless you pass rate_per_mile; a year it holds no rate for is refused with mileage_rate_unavailable. " +
168
178
  "Tip: use preview_payroll first to validate your request and see results before committing. " +
169
179
  "Get employee_id from list_employees. employer_id is optional: leave it out and the API uses " +
170
180
  "the household your API key belongs to (pass it only when one account manages several households)."), {
@@ -204,6 +214,7 @@ export function createNannyKeeperServer(version, context) {
204
214
  })
205
215
  .optional()
206
216
  .describe("Override or skip the employee's voluntary post-tax set-aside rule for this paycheck only. The recurring rule itself is configured via the dashboard. Omit this field to apply the rule normally."),
217
+ reimbursements: reimbursementsParam,
207
218
  idempotency_key: context?.publicConnection ? z.string().trim().min(1).max(255).describe("Unique key for this approved payroll. Reuse the same key with identical inputs when retrying.") : z
208
219
  .string()
209
220
  .optional()
@@ -313,7 +324,8 @@ export function createNannyKeeperServer(version, context) {
313
324
  // Register get_payroll tool (read, 1.15.0)
314
325
  server.tool("get_payroll", context?.publicConnection ? publicDescriptions.get_payroll : ("Read payrolls. With payroll_id: that payroll's status, dates, and each employee's gross pay, every deduction " +
315
326
  "(federal, Social Security, Medicare, state, local), net pay, and employer taxes. Without payroll_id: the " +
316
- "household's payrolls, newest first, with totals. Use it to confirm what run_payroll created. Read-only."), {
327
+ "household's payrolls, newest first, with totals (list_payrolls filters that list by employee and pay date). " +
328
+ "Use it to confirm what run_payroll created. Read-only."), {
317
329
  payroll_id: z.string().uuid().optional().describe("A payroll id from run_payroll. Leave it out to list payrolls."),
318
330
  employer_id: EMPLOYER_ID_OPTIONAL,
319
331
  }, {
@@ -394,6 +406,7 @@ export function createNannyKeeperServer(version, context) {
394
406
  idempotentHint: true,
395
407
  openWorldHint: true,
396
408
  }, async (args) => toolResult(await executeGetScheduleH(args, context), context?.publicConnection));
409
+ registerListPayrolls(server, context);
397
410
  // Register get_quarter_taxes tool (read, 1.17.0)
398
411
  server.tool("get_quarter_taxes", context?.publicConnection ? publicDescriptions.get_quarter_taxes : ("Get a quarter's tax figures as the household's Taxes page shows them: `items` is the checklist of what to " +
399
412
  "pay or file, to whom and by when (an item of kind `rec` has no hard deadline this quarter but may still be " +
@@ -7,7 +7,7 @@
7
7
  * on captures a standing recurring ACH authorization that must be employer-
8
8
  * driven in the app. Requires a Plus/Professional key (the `ach` scope).
9
9
  */
10
- import { getToolContext } from "../context.js";
10
+ import { CLIENT_HEADER, getToolContext } from "../context.js";
11
11
  function missingKey() {
12
12
  return JSON.stringify({
13
13
  error: "NANNYKEEPER_API_KEY environment variable is not set. Autopilot management requires a Plus/Professional key: nannykeeper.com/developers/keys",
@@ -25,7 +25,7 @@ export async function executeGetAutopilot(args, context) {
25
25
  if (args.employee_id)
26
26
  params.set("employee_id", args.employee_id);
27
27
  const response = await fetch(`${API_BASE}/api/v1/autopilot?${params.toString()}`, {
28
- headers: { Authorization: `Bearer ${apiKey}` },
28
+ headers: { Authorization: `Bearer ${apiKey}`, ...CLIENT_HEADER },
29
29
  });
30
30
  const data = await response.json();
31
31
  if (!response.ok) {
@@ -56,6 +56,7 @@ export async function executeManageAutopilot(args, context) {
56
56
  method: "POST",
57
57
  headers: {
58
58
  Authorization: `Bearer ${apiKey}`,
59
+ ...CLIENT_HEADER,
59
60
  "Content-Type": "application/json",
60
61
  },
61
62
  body: JSON.stringify(body),
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Calls the NannyKeeper API to calculate household employer taxes.
5
5
  */
6
- import { getToolContext } from "../context.js";
6
+ import { CLIENT_HEADER, getToolContext } from "../context.js";
7
7
  /**
8
8
  * ⛔ THE DESCRIPTOR CONST THAT USED TO LIVE HERE WAS DEAD AND HAS BEEN REMOVED.
9
9
  *
@@ -29,6 +29,7 @@ export async function executeCalculate(args, context) {
29
29
  method: "POST",
30
30
  headers: {
31
31
  Authorization: `Bearer ${apiKey}`,
32
+ ...CLIENT_HEADER,
32
33
  "Content-Type": "application/json",
33
34
  },
34
35
  body: JSON.stringify({
@@ -6,7 +6,7 @@
6
6
  * needs (and the household's employer_id). Without it, an agent with a
7
7
  * single-household key has no tool that returns either ID.
8
8
  */
9
- import { getToolContext } from "../context.js";
9
+ import { CLIENT_HEADER, getToolContext } from "../context.js";
10
10
  const MISSING_KEY = "NANNYKEEPER_API_KEY environment variable is not set. Get a key at nannykeeper.com/developers/keys";
11
11
  async function getJson(path, init, context) {
12
12
  const { apiKey, apiBase } = getToolContext(context);
@@ -19,6 +19,8 @@ async function getJson(path, init, context) {
19
19
  Authorization: `Bearer ${apiKey}`,
20
20
  "Content-Type": "application/json",
21
21
  ...(init.headers ?? {}),
22
+ // Last, so no caller's headers can drop the label.
23
+ ...CLIENT_HEADER,
22
24
  },
23
25
  });
24
26
  const data = await response.json();
@@ -0,0 +1,26 @@
1
+ /**
2
+ * list_payrolls: the household's payrolls, newest first, from
3
+ * `GET /api/v1/payrolls`, filtered by employee and by pay date.
4
+ *
5
+ * It answers "what did I pay her last time?" and "list my last three
6
+ * payrolls" without an id the agent would otherwise need from somewhere.
7
+ * get_payroll still reads one payroll in full; this tool is the index.
8
+ *
9
+ * Registered from its own module (one tool per file) so a new tool never has
10
+ * to edit another's registration.
11
+ */
12
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
13
+ import { type ToolContext } from "../context.ts";
14
+ export declare const LIST_PAYROLLS_DESCRIPTION: string;
15
+ /** The hosted listing's copy: no account or plan prompts, same facts. */
16
+ export declare const LIST_PAYROLLS_PUBLIC_DESCRIPTION: string;
17
+ export interface ListPayrollsArgs {
18
+ employer_id?: string;
19
+ employee_id?: string;
20
+ pay_date_from?: string;
21
+ pay_date_to?: string;
22
+ limit?: number;
23
+ cursor?: string;
24
+ }
25
+ export declare function executeListPayrolls(args: ListPayrollsArgs, context?: ToolContext): Promise<string>;
26
+ export declare function registerListPayrolls(server: McpServer, context?: ToolContext): void;
@@ -0,0 +1,85 @@
1
+ import { z } from "zod";
2
+ import { CLIENT_HEADER, getToolContext } from "../context.js";
3
+ import { toolResult } from "../public-profile.js";
4
+ export const LIST_PAYROLLS_DESCRIPTION = "List the household's payrolls, newest first, each with its status, pay period, pay date, total gross pay, " +
5
+ "total net pay, employer taxes and the employee_ids it paid. Filter with employee_id (only payrolls that paid " +
6
+ "that employee) and pay_date_from / pay_date_to (inclusive pay-date range, YYYY-MM-DD). Use limit for " +
7
+ '"the last three payrolls" (limit: 3). When has_more is true, pass next_cursor back as cursor for the next ' +
8
+ "page; a cursor it did not issue answers invalid_cursor, so start again without one. Totals are for the whole payroll; call get_payroll with a payroll id for each employee's gross pay, " +
9
+ "deductions and net pay. Report the exact status: scheduled or processing does not mean paid, and a voided " +
10
+ "payroll paid nothing. An employee_id that is not in this household answers not_found. Read-only.";
11
+ /** The hosted listing's copy: no account or plan prompts, same facts. */
12
+ export const LIST_PAYROLLS_PUBLIC_DESCRIPTION = "List the household's payrolls, newest first, with status, pay period, pay date, totals and the employee IDs " +
13
+ "each one paid. Filter by employee_id and by an inclusive pay-date range (pay_date_from, pay_date_to). Use " +
14
+ "limit for the most recent few, and pass next_cursor back as cursor for more. Use get_payroll for one " +
15
+ "payroll's per-employee figures. Report the exact status; scheduled or processing does not mean paid. Read-only.";
16
+ /** A real calendar date, as the API's own pay-date rule requires. */
17
+ const DATE = z
18
+ .string()
19
+ .regex(/^\d{4}-\d{2}-\d{2}$/, "Use YYYY-MM-DD")
20
+ .refine((value) => {
21
+ const [y, m, d] = value.split("-").map(Number);
22
+ const date = new Date(Date.UTC(y, m - 1, d));
23
+ return date.getUTCFullYear() === y && date.getUTCMonth() === m - 1 && date.getUTCDate() === d;
24
+ }, "Must be a real calendar date");
25
+ export async function executeListPayrolls(args, context) {
26
+ // The API refuses a range that runs backwards; say so without a round trip.
27
+ if (args.pay_date_from && args.pay_date_to && args.pay_date_from > args.pay_date_to) {
28
+ return JSON.stringify({ error: "pay_date_from must be on or before pay_date_to", code: "validation_error" });
29
+ }
30
+ const { apiKey, apiBase } = getToolContext(context);
31
+ if (!apiKey) {
32
+ return JSON.stringify({
33
+ error: "NANNYKEEPER_API_KEY environment variable is not set. Get a key at nannykeeper.com/developers/keys",
34
+ });
35
+ }
36
+ const params = new URLSearchParams();
37
+ for (const key of ["employer_id", "employee_id", "pay_date_from", "pay_date_to", "cursor"]) {
38
+ const value = args[key];
39
+ if (value)
40
+ params.set(key, value);
41
+ }
42
+ if (args.limit !== undefined)
43
+ params.set("limit", String(args.limit));
44
+ const query = params.toString();
45
+ try {
46
+ const response = await fetch(`${apiBase}/api/v1/payrolls${query ? `?${query}` : ""}`, {
47
+ method: "GET",
48
+ headers: { Authorization: `Bearer ${apiKey}`, ...CLIENT_HEADER },
49
+ });
50
+ const data = await response.json();
51
+ if (!response.ok) {
52
+ return JSON.stringify({
53
+ error: data.error?.message || `API error: ${response.status}`,
54
+ code: data.error?.code,
55
+ details: data.error?.details,
56
+ });
57
+ }
58
+ return JSON.stringify(data);
59
+ }
60
+ catch (error) {
61
+ return JSON.stringify({
62
+ error: `Network error: ${error instanceof Error ? error.message : "Unknown error"}`,
63
+ });
64
+ }
65
+ }
66
+ export function registerListPayrolls(server, context) {
67
+ server.tool("list_payrolls", context?.publicConnection ? LIST_PAYROLLS_PUBLIC_DESCRIPTION : LIST_PAYROLLS_DESCRIPTION, {
68
+ employee_id: z.string().uuid().optional().describe("Optional. Only payrolls that paid this employee. Get it from list_employees."),
69
+ pay_date_from: DATE.optional().describe("Optional. Earliest pay date to include, YYYY-MM-DD."),
70
+ pay_date_to: DATE.optional().describe("Optional. Latest pay date to include, YYYY-MM-DD."),
71
+ limit: z.number().int().min(1).max(100).optional().describe("Optional. How many payrolls to return, 1 to 100 (default 25)."),
72
+ cursor: z.string().max(200).optional().describe("Optional. The next_cursor from a previous call, for the next page."),
73
+ employer_id: z
74
+ .string()
75
+ .uuid()
76
+ .optional()
77
+ .describe("Optional. Leave it out to use the household your API key belongs to. Pass it only when one account manages several households; list_employees returns it."),
78
+ }, {
79
+ title: "List Payrolls",
80
+ readOnlyHint: true,
81
+ destructiveHint: false,
82
+ idempotentHint: true,
83
+ openWorldHint: true,
84
+ }, async (args) => toolResult(await executeListPayrolls(args, context), context?.publicConnection));
85
+ }
@@ -5,6 +5,7 @@
5
5
  * Returns full tax breakdown and net pay — use to validate before run_payroll.
6
6
  */
7
7
  import { type ToolContext } from "../context.ts";
8
+ import type { ReimbursementLine } from "./reimbursements.ts";
8
9
  export declare function executePreviewPayroll(args: {
9
10
  employer_id?: string;
10
11
  employee_id: string;
@@ -20,4 +21,5 @@ export declare function executePreviewPayroll(args: {
20
21
  skip?: boolean;
21
22
  amount?: number;
22
23
  };
24
+ reimbursements?: ReimbursementLine[];
23
25
  }, context?: ToolContext): Promise<string>;
@@ -4,7 +4,7 @@
4
4
  * Calls the NannyKeeper API to preview payroll without creating a record.
5
5
  * Returns full tax breakdown and net pay — use to validate before run_payroll.
6
6
  */
7
- import { getToolContext } from "../context.js";
7
+ import { CLIENT_HEADER, getToolContext } from "../context.js";
8
8
  export async function executePreviewPayroll(args, context) {
9
9
  const { apiKey, apiBase: API_BASE } = getToolContext(context);
10
10
  if (!apiKey) {
@@ -17,6 +17,7 @@ export async function executePreviewPayroll(args, context) {
17
17
  method: "POST",
18
18
  headers: {
19
19
  Authorization: `Bearer ${apiKey}`,
20
+ ...CLIENT_HEADER,
20
21
  "Content-Type": "application/json",
21
22
  },
22
23
  body: JSON.stringify({
@@ -36,6 +37,10 @@ export async function executePreviewPayroll(args, context) {
36
37
  ...(args.voluntary_set_aside
37
38
  ? { voluntary_set_aside: args.voluntary_set_aside }
38
39
  : {}),
40
+ // Sent unchanged: same field names and limits as the API.
41
+ ...(args.reimbursements?.length
42
+ ? { reimbursements: args.reimbursements }
43
+ : {}),
39
44
  },
40
45
  ],
41
46
  }),
@@ -0,0 +1,38 @@
1
+ /**
2
+ * The `reimbursements` parameter of preview_payroll and run_payroll.
3
+ *
4
+ * ⛔ The SAME shape and limits as the REST API's `employees[].reimbursements`
5
+ * (`POST /api/v1/payroll/preview` and `/run`): at most 10 lines, each a type,
6
+ * an amount from 0 to 9,999, optional miles from 0 to 9,999 and an optional
7
+ * per-mile rate from 0 to 5. The tool sends the lines through unchanged, so
8
+ * any limit declared here that the API does not share either refuses a
9
+ * payroll the API would run or lets through one it will refuse. A test in the
10
+ * application repository holds the two schemas to the same boundaries.
11
+ */
12
+ import { z } from "zod";
13
+ export declare const MAX_REIMBURSEMENT_LINES = 10;
14
+ export declare const reimbursementLineSchema: z.ZodObject<{
15
+ type: z.ZodEnum<{
16
+ transit: "transit";
17
+ parking: "parking";
18
+ mileage: "mileage";
19
+ other: "other";
20
+ }>;
21
+ description: z.ZodOptional<z.ZodString>;
22
+ amount: z.ZodNumber;
23
+ miles: z.ZodOptional<z.ZodNumber>;
24
+ rate_per_mile: z.ZodOptional<z.ZodNumber>;
25
+ }, z.core.$strip>;
26
+ export declare const reimbursementsParam: z.ZodOptional<z.ZodArray<z.ZodObject<{
27
+ type: z.ZodEnum<{
28
+ transit: "transit";
29
+ parking: "parking";
30
+ mileage: "mileage";
31
+ other: "other";
32
+ }>;
33
+ description: z.ZodOptional<z.ZodString>;
34
+ amount: z.ZodNumber;
35
+ miles: z.ZodOptional<z.ZodNumber>;
36
+ rate_per_mile: z.ZodOptional<z.ZodNumber>;
37
+ }, z.core.$strip>>>;
38
+ export type ReimbursementLine = z.infer<typeof reimbursementLineSchema>;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * The `reimbursements` parameter of preview_payroll and run_payroll.
3
+ *
4
+ * ⛔ The SAME shape and limits as the REST API's `employees[].reimbursements`
5
+ * (`POST /api/v1/payroll/preview` and `/run`): at most 10 lines, each a type,
6
+ * an amount from 0 to 9,999, optional miles from 0 to 9,999 and an optional
7
+ * per-mile rate from 0 to 5. The tool sends the lines through unchanged, so
8
+ * any limit declared here that the API does not share either refuses a
9
+ * payroll the API would run or lets through one it will refuse. A test in the
10
+ * application repository holds the two schemas to the same boundaries.
11
+ */
12
+ import { z } from "zod";
13
+ export const MAX_REIMBURSEMENT_LINES = 10;
14
+ export const reimbursementLineSchema = z.object({
15
+ type: z
16
+ .enum(["transit", "parking", "mileage", "other"])
17
+ .describe("transit, parking, mileage or other"),
18
+ description: z.string().max(200).optional().describe("Optional. What it was for, as the pay stub should show it."),
19
+ amount: z
20
+ .number()
21
+ .min(0)
22
+ .max(9999)
23
+ .describe("Dollars. For a mileage line with miles, send 0: NannyKeeper prices the miles and ignores this amount."),
24
+ miles: z
25
+ .number()
26
+ .min(0)
27
+ .max(9999)
28
+ .optional()
29
+ .describe("Mileage lines: the miles driven this pay period."),
30
+ rate_per_mile: z
31
+ .number()
32
+ .min(0)
33
+ .max(5)
34
+ .optional()
35
+ .describe("Optional, mileage lines only. Leave it out and NannyKeeper uses the IRS business mileage rate it holds for the " +
36
+ "pay period and pay date. If it holds none for that year, the payroll is refused with mileage_rate_unavailable; pass the rate " +
37
+ "your agreement sets to continue."),
38
+ });
39
+ export const reimbursementsParam = z
40
+ .array(reimbursementLineSchema)
41
+ .max(MAX_REIMBURSEMENT_LINES)
42
+ .optional()
43
+ .describe("Optional. Up to 10 reimbursements paid with this paycheck: mileage, transit, parking or other. " +
44
+ "NannyKeeper adds them to net pay, outside gross pay, without calculating tax on them; a transit or parking " +
45
+ "line over the monthly limit, or in a year whose limit NannyKeeper does not hold, comes back with a warning. " +
46
+ 'Mileage example: [{"type":"mileage","miles":42,"amount":0}].');
@@ -5,6 +5,7 @@
5
5
  * Creates a payroll record with full tax calculations and YTD tracking.
6
6
  */
7
7
  import { type ToolContext } from "../context.ts";
8
+ import type { ReimbursementLine } from "./reimbursements.ts";
8
9
  export declare function executeRunPayroll(args: {
9
10
  employer_id?: string;
10
11
  employee_id: string;
@@ -24,6 +25,7 @@ export declare function executeRunPayroll(args: {
24
25
  skip?: boolean;
25
26
  amount?: number;
26
27
  };
28
+ reimbursements?: ReimbursementLine[];
27
29
  off_cycle?: boolean;
28
30
  idempotency_key?: string;
29
31
  }, context?: ToolContext): Promise<string>;
@@ -4,7 +4,7 @@
4
4
  * Calls the NannyKeeper API to run payroll for a household employee.
5
5
  * Creates a payroll record with full tax calculations and YTD tracking.
6
6
  */
7
- import { getToolContext } from "../context.js";
7
+ import { CLIENT_HEADER, getToolContext } from "../context.js";
8
8
  export async function executeRunPayroll(args, context) {
9
9
  const { apiKey, apiBase: API_BASE } = getToolContext(context);
10
10
  if (!apiKey) {
@@ -15,6 +15,7 @@ export async function executeRunPayroll(args, context) {
15
15
  try {
16
16
  const headers = {
17
17
  Authorization: `Bearer ${apiKey}`,
18
+ ...CLIENT_HEADER,
18
19
  "Content-Type": "application/json",
19
20
  };
20
21
  if (args.idempotency_key) {
@@ -41,6 +42,10 @@ export async function executeRunPayroll(args, context) {
41
42
  ...(args.voluntary_set_aside
42
43
  ? { voluntary_set_aside: args.voluntary_set_aside }
43
44
  : {}),
45
+ // Sent unchanged: same field names and limits as the API.
46
+ ...(args.reimbursements?.length
47
+ ? { reimbursements: args.reimbursements }
48
+ : {}),
44
49
  },
45
50
  ],
46
51
  notes: args.notes,
@@ -18,7 +18,7 @@
18
18
  * via /settings/states or call the REST API explicitly with
19
19
  * confirmation context.
20
20
  */
21
- import { getToolContext } from "../context.js";
21
+ import { CLIENT_HEADER, getToolContext } from "../context.js";
22
22
  /**
23
23
  * The single definition of this tool's name and description. `server.ts` imports
24
24
  * it rather than restating it: an inline copy there is the one agents actually
@@ -71,6 +71,7 @@ export async function executeStateFilingStatus(args, context) {
71
71
  const response = await fetch(url, {
72
72
  headers: {
73
73
  Authorization: `Bearer ${apiKey}`,
74
+ ...CLIENT_HEADER,
74
75
  },
75
76
  });
76
77
  const data = await response.json();
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Calls the NannyKeeper API to check one worker's annual FICA threshold.
5
5
  */
6
- import { getToolContext } from "../context.js";
6
+ import { CLIENT_HEADER, getToolContext } from "../context.js";
7
7
  /**
8
8
  * ⛔ THE DESCRIPTOR CONST THAT USED TO LIVE HERE WAS DEAD AND HAS BEEN REMOVED.
9
9
  *
@@ -35,6 +35,7 @@ export async function executeThreshold(args, context) {
35
35
  const response = await fetch(`${API_BASE}/api/v1/threshold?${params.toString()}`, {
36
36
  headers: {
37
37
  Authorization: `Bearer ${apiKey}`,
38
+ ...CLIENT_HEADER,
38
39
  },
39
40
  });
40
41
  const data = await response.json();
package/manifest.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "manifest_version": "0.3",
3
3
  "name": "nannykeeper",
4
- "version": "1.17.0",
5
- "description": "Calculate US household employer (nanny) taxes for all 50 states. List employees, preview and run payroll, read payrolls and pay stubs, get download links for W-2s and Schedule H, list state agency account numbers, and manage existing Autopilot enrollments. 12 tools: calculate_nanny_taxes, check_threshold, list_employees, preview_payroll, run_payroll, get_payroll, get_pay_stub, get_w2, get_schedule_h, get_state_filing_status, get_autopilot, manage_autopilot.",
4
+ "version": "1.18.0",
5
+ "description": "Calculate US household employer (nanny) taxes for all 50 states. List employees, preview and run payroll with mileage, read and list payrolls and pay stubs, read a quarter's taxes, get download links for W-2s and Schedule H, list state agency account numbers, and manage existing Autopilot enrollments. 14 tools: calculate_nanny_taxes, check_threshold, list_employees, preview_payroll, run_payroll, get_payroll, list_payrolls, get_pay_stub, get_w2, get_schedule_h, get_quarter_taxes, get_state_filing_status, get_autopilot, manage_autopilot.",
6
6
  "author": {
7
7
  "name": "nannykeeper",
8
8
  "url": "https://github.com/nannykeeper"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nannykeeper/mcp-server",
3
- "version": "1.17.0",
3
+ "version": "1.18.0",
4
4
  "mcpName": "com.nannykeeper.www/mcp-server",
5
5
  "description": "MCP server for calculating US household employer (nanny) taxes. All 50 states. Works with Claude, ChatGPT, and any MCP-compatible AI agent.",
6
6
  "keywords": [