@nannykeeper/mcp-server 1.14.1 → 1.16.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 +14 -6
- package/CLAUDE.md +9 -3
- package/README.md +76 -7
- package/dist/public-profile.js +8 -3
- package/dist/server.js +136 -18
- package/dist/tools/autopilot.d.ts +2 -2
- package/dist/tools/autopilot.js +3 -1
- package/dist/tools/household.d.ts +51 -0
- package/dist/tools/household.js +156 -0
- package/dist/tools/preview-payroll.d.ts +1 -1
- package/dist/tools/run-payroll.d.ts +1 -1
- package/manifest.json +2 -2
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -6,11 +6,16 @@ Calculate US household employer (nanny) taxes for all 50 states + DC.
|
|
|
6
6
|
## Tools Available
|
|
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
|
-
- `
|
|
10
|
-
- `
|
|
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)
|
|
12
|
+
- `get_payroll(payroll_id?, employer_id?)` — reads one payroll (every deduction, net pay, status) or lists them
|
|
13
|
+
- `get_pay_stub(payroll_id, employer_id?)` — returns each employee's pay stub PDF
|
|
14
|
+
- `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
|
+
- `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
|
|
11
16
|
- `get_state_filing_status(employer_id?)` — reads masked state-account status. Pass an owned household ID when selecting a household; test-mode keys must explicitly select a sandbox household. Omitting it uses the key's default household. Each account carries `registered` / `pending` / `required` / `not_required`; `not_required` means this household does not owe that registration at all, so never tell them to go register for it.
|
|
12
|
-
- `get_autopilot(employer_id
|
|
13
|
-
- `manage_autopilot(
|
|
17
|
+
- `get_autopilot(employer_id?, employee_id?)` — reads existing Autopilot enrollments
|
|
18
|
+
- `manage_autopilot(employee_id, action, ..., employer_id?)` — pauses, resumes, skips, or disables an existing enrollment; never enrolls
|
|
14
19
|
|
|
15
20
|
## When to Use
|
|
16
21
|
- User asks about nanny taxes, household employer taxes, or paying a caregiver
|
|
@@ -28,8 +33,11 @@ obligation. Ask for missing household details when needed.
|
|
|
28
33
|
## After Calculation
|
|
29
34
|
The `calculate_nanny_taxes` response includes `next_actions` and a `signup_url`.
|
|
30
35
|
If the user wants to run payroll with persistence, use the `run_payroll` tool
|
|
31
|
-
(requires Starter+ subscription).
|
|
32
|
-
|
|
36
|
+
(requires Starter+ subscription). `get_pay_stub` returns pay stubs as PDFs. `get_w2` and `get_schedule_h` return a
|
|
37
|
+
download link for the user to open. Generating a W-2 and direct deposit setup
|
|
38
|
+
are in the NannyKeeper web app.
|
|
39
|
+
|
|
40
|
+
`employer_id` is optional on every tool. Leave it out for a single-household key.
|
|
33
41
|
|
|
34
42
|
## API Key
|
|
35
43
|
Requires `NANNYKEEPER_API_KEY` environment variable.
|
package/CLAUDE.md
CHANGED
|
@@ -4,6 +4,11 @@ Official MCP server for NannyKeeper's household employer tax API.
|
|
|
4
4
|
Calculate nanny taxes for all 50 US states.
|
|
5
5
|
|
|
6
6
|
## Tools
|
|
7
|
+
- `list_employees` — The household's employer_id and every employee's id, pay setup and missing payroll items. The first call in any payroll flow (added 1.15.0)
|
|
8
|
+
- `get_payroll` — One payroll by id (every deduction incl. local tax, net pay, employer taxes, status) or the household's payroll list (added 1.15.0)
|
|
9
|
+
- `get_pay_stub` — Each employee's pay stub PDF for a payroll, returned as an embedded PDF resource, the dashboard's own stub (added 1.15.0)
|
|
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
|
+
- `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)
|
|
7
12
|
- `calculate_nanny_taxes` — Full federal + state tax breakdown
|
|
8
13
|
- `check_threshold` — Whether wages trigger employer tax obligations
|
|
9
14
|
- `preview_payroll` — Dry-run payroll calc, returns taxes/net pay without creating a record (Starter+ required)
|
|
@@ -18,7 +23,7 @@ Calculate nanny taxes for all 50 US states.
|
|
|
18
23
|
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.
|
|
19
24
|
|
|
20
25
|
## Pay-date handling (run_payroll, preview_payroll)
|
|
21
|
-
- `pay_date` is optional. When omitted, the server picks the earliest valid pay date
|
|
26
|
+
- `pay_date` is optional. When omitted, the server picks the earliest valid pay date (5 business days ahead, holiday-aware), and never one before the period end: a period still running gets the first business day on or after its end. It is echoed back in the response.
|
|
22
27
|
- If `pay_date` is supplied and past the submission deadline, the API rejects with HTTP 400 and includes `next_valid_pay_date` in the error details for self-correction.
|
|
23
28
|
- **v1.5.0**: If `pay_date` is more than 5 business days in the future on a DD payroll, the response status is `scheduled`. The payroll will auto-fire at `scheduled_send_at` (5 biz days before `pay_date`). The `net_pay` and tax amounts in the response are estimates — they're recomputed at fire time if YTD or rate configs changed. `is_estimated: true` is set when this happens so callers can surface that to users.
|
|
24
29
|
|
|
@@ -54,7 +59,8 @@ For payroll: use `preview_payroll` first to validate your request, then
|
|
|
54
59
|
`run_payroll` to create the record. Error responses include an `example`
|
|
55
60
|
field with the correct request format for self-correction.
|
|
56
61
|
|
|
57
|
-
Get
|
|
58
|
-
`
|
|
62
|
+
Get employee_id (and the household's employer_id) from `list_employees`.
|
|
63
|
+
`employer_id` is optional on every tool since 1.15.0: the API defaults it to the
|
|
64
|
+
household the key belongs to. Pass it only when one account manages several.
|
|
59
65
|
|
|
60
66
|
Full API docs: https://www.nannykeeper.com/developers/reference
|
package/README.md
CHANGED
|
@@ -26,8 +26,77 @@ MCP server for calculating US household employer (nanny) taxes. Works with Claud
|
|
|
26
26
|
|
|
27
27
|
3. **Restart Claude Desktop** and ask about nanny taxes!
|
|
28
28
|
|
|
29
|
+
## Quick Setup (Claude Code)
|
|
30
|
+
|
|
31
|
+
Run this once in your terminal, with your own key in place of `nk_live_YOUR_KEY`:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
claude mcp add nannykeeper --env NANNYKEEPER_API_KEY=nk_live_YOUR_KEY -- npx -y @nannykeeper/mcp-server
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Start `claude` and run `/mcp` to see the NannyKeeper tools. Add `--scope user` to use it in every project.
|
|
38
|
+
|
|
39
|
+
## Running payroll from an agent
|
|
40
|
+
|
|
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.
|
|
43
|
+
3. `run_payroll` with the same inputs and an `idempotency_key`.
|
|
44
|
+
4. `get_payroll` confirms the status and every deduction; `get_pay_stub` returns the stub PDF.
|
|
45
|
+
|
|
46
|
+
`employer_id` is optional on every tool: leave it out and the API uses the household your key belongs to.
|
|
47
|
+
|
|
29
48
|
## Tools
|
|
30
49
|
|
|
50
|
+
### `list_employees`
|
|
51
|
+
|
|
52
|
+
List the household's employees and return the household's `employer_id`. Call this first to get the `employee_id` the payroll tools need. Each employee shows pay type, pay rate, pay frequency, work state, and what is still missing for payroll.
|
|
53
|
+
|
|
54
|
+
**Parameters:**
|
|
55
|
+
- `employer_id` (optional) — Only when one account manages several households
|
|
56
|
+
|
|
57
|
+
### `get_payroll`
|
|
58
|
+
|
|
59
|
+
With `payroll_id`, read one payroll: status, dates, and each employee's gross pay, every deduction (federal, Social Security, Medicare, state, local), net pay, and employer taxes. Without it, list the household's payrolls, newest first.
|
|
60
|
+
|
|
61
|
+
**Parameters:**
|
|
62
|
+
- `payroll_id` (optional) — A payroll ID from `run_payroll`
|
|
63
|
+
- `employer_id` (optional) — Only when listing for one of several households
|
|
64
|
+
|
|
65
|
+
### `get_pay_stub`
|
|
66
|
+
|
|
67
|
+
The pay stub PDF for each employee on a payroll, the same stub the household downloads in the dashboard, attached as a PDF file.
|
|
68
|
+
|
|
69
|
+
Only a paid payroll has stubs; anything else answers `payroll_not_completed`.
|
|
70
|
+
|
|
71
|
+
**Parameters:**
|
|
72
|
+
- `payroll_id` (required) — The payroll ID from `run_payroll` or `get_payroll`
|
|
73
|
+
- `employee_id` (optional) — One employee's stub instead of everyone's
|
|
74
|
+
- `employer_id` (optional)
|
|
75
|
+
|
|
76
|
+
### `get_w2`
|
|
77
|
+
|
|
78
|
+
A download link for one copy of an employee's W-2, for a tax year that has ended. It is the same W-2 the household downloads in the dashboard.
|
|
79
|
+
|
|
80
|
+
The tool returns `download_url`, a link on nannykeeper.com that works for 15 minutes. The assistant gives the link to the person, who opens it in their browser. The PDF itself is never a tool result: a W-2 shows the employee's full Social Security number, so it goes from NannyKeeper to the person and not through the assistant.
|
|
81
|
+
|
|
82
|
+
The household generates the W-2 in the dashboard first (Taxes, then W-2s). Until then the answer is `w2_not_generated`; this tool never generates one.
|
|
83
|
+
|
|
84
|
+
**Parameters:**
|
|
85
|
+
- `employee_id` (required): from `list_employees`
|
|
86
|
+
- `tax_year` (required): a tax year that has ended
|
|
87
|
+
- `copy` (optional): `A`, `B`, `C`, `D`, `1` or `2`. Defaults to `B`
|
|
88
|
+
- `employer_id` (optional)
|
|
89
|
+
|
|
90
|
+
### `get_schedule_h`
|
|
91
|
+
|
|
92
|
+
A download link for the household's Schedule H, for a tax year that has ended. It is the same form the household downloads in the dashboard. Like `get_w2`, it returns `download_url`, a link that works for 15 minutes, and never the PDF.
|
|
93
|
+
|
|
94
|
+
When the dashboard would not produce the form, the answer is `schedule_h_unavailable` with a `reason`: `year_not_ended`, `no_household_data`, `prior_wage_overlap`, `prior_wage_withholding_unknown` or `futa_prior_year_unanswered`. NannyKeeper does not file the form.
|
|
95
|
+
|
|
96
|
+
**Parameters:**
|
|
97
|
+
- `tax_year` (required): a tax year that has ended
|
|
98
|
+
- `employer_id` (optional)
|
|
99
|
+
|
|
31
100
|
### `calculate_nanny_taxes`
|
|
32
101
|
|
|
33
102
|
Calculate employer and employee tax obligations for a household employee.
|
|
@@ -51,11 +120,11 @@ Check if annual wages cross the household employer tax threshold.
|
|
|
51
120
|
Dry-run payroll calculation. Returns the full tax breakdown, net pay, and employer costs WITHOUT creating a payroll record. Use to validate your request before calling `run_payroll`. Requires a Starter+ subscription.
|
|
52
121
|
|
|
53
122
|
**Parameters:**
|
|
54
|
-
- `employer_id` (
|
|
55
|
-
- `employee_id` (required) — Employee UUID
|
|
123
|
+
- `employer_id` (optional) — Leave it out to use the household your API key belongs to
|
|
124
|
+
- `employee_id` (required) — Employee UUID from `list_employees`
|
|
56
125
|
- `pay_period_start` (required) — Start of pay period (YYYY-MM-DD)
|
|
57
126
|
- `pay_period_end` (required) — End of pay period (YYYY-MM-DD)
|
|
58
|
-
- `pay_date` (optional) — Date employee is paid (YYYY-MM-DD). When omitted, the server picks the earliest valid
|
|
127
|
+
- `pay_date` (optional) — Date employee is paid (YYYY-MM-DD). When omitted, the server picks the earliest valid business day on or after the period end (allowing for ACH submission lead time) and echoes it back in the response.
|
|
59
128
|
- `pay_frequency` (required) — weekly, biweekly, semimonthly, or monthly
|
|
60
129
|
- `regular_hours` (optional) — Regular hours worked
|
|
61
130
|
- `overtime_hours` (optional) — Overtime hours worked
|
|
@@ -70,11 +139,11 @@ Run payroll for a household employee **end-to-end in a single call** — creates
|
|
|
70
139
|
**Scheduled payrolls (v1.5.0):** When `pay_date` is more than 5 business days in the future on a direct-deposit payroll, the response status is `scheduled`. Two additional fields come back: `scheduled_send_at` (ISO UTC timestamp — when the payroll will auto-fire) and `is_estimated: true` (the returned net pay and tax amounts will be recomputed against current YTD and rate configs at fire time, so they may shift slightly). In-window pay dates fire immediately as before.
|
|
71
140
|
|
|
72
141
|
**Parameters:**
|
|
73
|
-
- `employer_id` (
|
|
74
|
-
- `employee_id` (required) — Employee UUID
|
|
142
|
+
- `employer_id` (optional) — Leave it out to use the household your API key belongs to
|
|
143
|
+
- `employee_id` (required) — Employee UUID from `list_employees`
|
|
75
144
|
- `pay_period_start` (required) — Start of pay period (YYYY-MM-DD)
|
|
76
145
|
- `pay_period_end` (required) — End of pay period (YYYY-MM-DD)
|
|
77
|
-
- `pay_date` (optional) — Date employee is paid (YYYY-MM-DD). When omitted, the server picks the earliest valid
|
|
146
|
+
- `pay_date` (optional) — Date employee is paid (YYYY-MM-DD). When omitted, the server picks the earliest valid business day on or after the period end, allowing for ACH submission lead time. If supplied and past the submission deadline, the request is rejected with HTTP 400 + `next_valid_pay_date` in the error details so you can retry with a valid date.
|
|
78
147
|
- `pay_frequency` (required) — weekly, biweekly, semimonthly, or monthly
|
|
79
148
|
- `regular_hours` (optional) — Regular hours worked
|
|
80
149
|
- `overtime_hours` (optional) — Overtime hours worked
|
|
@@ -93,7 +162,7 @@ Read an employer's state agency account status with masked identifiers. Pass the
|
|
|
93
162
|
|
|
94
163
|
### `get_autopilot`
|
|
95
164
|
|
|
96
|
-
Read Autopilot status for one employee or list an employer's active enrollments.
|
|
165
|
+
Read Autopilot status for one employee or list an employer's active enrollments. `employer_id` is optional.
|
|
97
166
|
|
|
98
167
|
### `manage_autopilot`
|
|
99
168
|
|
package/dist/public-profile.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
/** Public listing copy avoids pricing prompts and delegates tax facts to the API. */
|
|
2
2
|
export const publicDescriptions = {
|
|
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. Preserve any limitations or unassessed items returned by the API.",
|
|
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. 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.
|
|
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
|
+
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
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.",
|
|
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
|
+
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.",
|
|
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
|
+
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
|
+
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.",
|
|
8
13
|
get_autopilot: "Read existing recurring payroll enrollment status for a household, optionally for one employee. Returns status and available schedule information; it does not enroll anyone or change payroll.",
|
|
9
14
|
manage_autopilot: "Pause, resume, skip, or disable an existing recurring payroll enrollment. Confirm the employee and exact action before calling. Resume can restart future payroll generation and Stripe processing. Pausing does not cancel a payroll that is already scheduled. To cancel an existing payroll, use NannyKeeper. Initial enrollment and its standing authorization happen in NannyKeeper.",
|
|
10
15
|
};
|
package/dist/server.js
CHANGED
|
@@ -6,7 +6,19 @@ 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 { executeGetPayStub, executeGetW2, executeGetScheduleH, executeGetPayroll, executeListEmployees, } from "./tools/household.js";
|
|
9
10
|
import { publicDescriptions, toolResult } from "./public-profile.js";
|
|
11
|
+
/**
|
|
12
|
+
* `employer_id` on every household tool (1.15.0). The API defaults it to the
|
|
13
|
+
* household the key belongs to, so a single-household caller never needs it.
|
|
14
|
+
* Do not make it required again: list_employees is the only place an agent
|
|
15
|
+
* can learn it, and a required parameter it cannot fill stops the flow.
|
|
16
|
+
*/
|
|
17
|
+
const EMPLOYER_ID_OPTIONAL = z
|
|
18
|
+
.string()
|
|
19
|
+
.uuid()
|
|
20
|
+
.optional()
|
|
21
|
+
.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.");
|
|
10
22
|
/** A fresh server and credential closure for each hosted request. */
|
|
11
23
|
export function createNannyKeeperServer(version, context) {
|
|
12
24
|
const server = new McpServer({ name: "nannykeeper", version });
|
|
@@ -30,6 +42,11 @@ export function createNannyKeeperServer(version, context) {
|
|
|
30
42
|
"pass reciprocity_certificate_on_file=true to suppress the work state's income tax (local taxes and SUI are unaffected). " +
|
|
31
43
|
"Important: These are annual estimates from annual_wages, with derived per-paycheck amounts. " +
|
|
32
44
|
"They do not read an existing employee's year-to-date payroll records; use preview_payroll for an existing employee. " +
|
|
45
|
+
"This tool has no family-relationship or age input, so Social Security, Medicare and FUTA are quoted as if no " +
|
|
46
|
+
"family-employee exemption (Social Security, Medicare and FUTA) or under-18 exemption (Social Security and " +
|
|
47
|
+
"Medicare only) applies, and FUTA's household quarterly test is reported as unassessed. " +
|
|
48
|
+
"threshold.action_required is true when the FICA wage test is met and null otherwise, never false: present null as " +
|
|
49
|
+
"not determined, not as nothing owed, and pass on the response's limitations. " +
|
|
33
50
|
"For accurate ongoing calculations with automatic YTD tracking, pay stubs, W-2s, and direct deposit, " +
|
|
34
51
|
"the user needs a NannyKeeper account (free to start, $10/mo for full payroll). Use the signup_url in the response."), {
|
|
35
52
|
state: z.string().describe("2-letter US state code where the employee WORKS (e.g., CA, NY, TX, FL)"),
|
|
@@ -60,7 +77,9 @@ export function createNannyKeeperServer(version, context) {
|
|
|
60
77
|
server.tool("check_threshold", context?.publicConnection ? publicDescriptions.check_threshold : ("Check whether one household employee's annual wages cross the IRS Social Security and Medicare threshold " +
|
|
61
78
|
"($3,000 for 2026). The response discloses, but cannot assess, household-wide quarterly FUTA and state thresholds " +
|
|
62
79
|
"because this tool does not receive quarterly wages for every employee. It also cannot assess family-employee exemptions " +
|
|
63
|
-
"because it has no relationship input.
|
|
80
|
+
"because it has no relationship input. federal.action_required is true when the FICA wage test is met and null " +
|
|
81
|
+
"otherwise, never false; null means not determined, not nothing owed. " +
|
|
82
|
+
"Never interpret the result as a complete tax-obligation decision."), {
|
|
64
83
|
state: z.string().describe("2-letter US state code (e.g., CA, NY, TX)"),
|
|
65
84
|
annual_wages: z.number().describe("Annual wages paid (or planned) to the household employee"),
|
|
66
85
|
tax_year: z.number().min(2024).max(2026).optional().describe("Supported tax year to check (2024-2026; default: current year)"),
|
|
@@ -83,17 +102,17 @@ export function createNannyKeeperServer(version, context) {
|
|
|
83
102
|
"on the employee's profile); applied=false names the certificate still to collect. " +
|
|
84
103
|
"Use this to validate your request before calling run_payroll. " +
|
|
85
104
|
"Same parameters as run_payroll. Requires a Starter+ subscription. " +
|
|
86
|
-
"pay_date is optional
|
|
87
|
-
"
|
|
105
|
+
"pay_date is optional. When omitted, the server picks the earliest valid business day on or " +
|
|
106
|
+
"after pay_period_end, allowing for ACH submission lead time, and echoes it back in the response. " +
|
|
88
107
|
"v1.5.0: if pay_date is more than 5 business days in the future, the response includes " +
|
|
89
108
|
"is_estimated=true — those numbers will be recomputed at fire time if the user schedules. " +
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
employer_id:
|
|
93
|
-
employee_id: z.string().uuid().describe("Employee UUID
|
|
109
|
+
"Get employee_id from list_employees. employer_id is optional: leave it out and the API uses " +
|
|
110
|
+
"the household your API key belongs to (pass it only when one account manages several households)."), {
|
|
111
|
+
employer_id: EMPLOYER_ID_OPTIONAL,
|
|
112
|
+
employee_id: z.string().uuid().describe("Employee UUID. Get it from list_employees."),
|
|
94
113
|
pay_period_start: z.string().describe("Start of pay period in YYYY-MM-DD format (e.g., 2026-04-07)"),
|
|
95
114
|
pay_period_end: z.string().describe("End of pay period in YYYY-MM-DD format (e.g., 2026-04-13)"),
|
|
96
|
-
pay_date: z.string().optional().describe("Date employee is paid (YYYY-MM-DD). Optional
|
|
115
|
+
pay_date: z.string().optional().describe("Date employee is paid (YYYY-MM-DD), on or after pay_period_end. Optional: if omitted, the server picks the earliest valid business day on or after pay_period_end."),
|
|
97
116
|
pay_frequency: z
|
|
98
117
|
.enum(["weekly", "biweekly", "semimonthly", "monthly"])
|
|
99
118
|
.describe("How often the employee is paid"),
|
|
@@ -128,8 +147,8 @@ export function createNannyKeeperServer(version, context) {
|
|
|
128
147
|
"Plans cap active employees per employer (Starter 1, Plus 5, Professional 5 included, expandable " +
|
|
129
148
|
"to 25 at $6/mo each); if the roster exceeds the plan's count, the API returns 403 with guidance — " +
|
|
130
149
|
"the user adds employees at Settings → Billing in the dashboard (never billed implicitly via API), then retry. " +
|
|
131
|
-
"pay_date is optional
|
|
132
|
-
"
|
|
150
|
+
"pay_date is optional. When omitted, the server picks the earliest valid business day on or " +
|
|
151
|
+
"after pay_period_end, allowing for ACH submission lead time, and echoes it back. If supplied and past the " +
|
|
133
152
|
"submission deadline, the request is rejected with next_valid_pay_date in the error. " +
|
|
134
153
|
"If pay_date is more than 5 business days in the future on a DD payroll, status=scheduled " +
|
|
135
154
|
"and the payroll will auto-fire at scheduled_send_at (5 biz days before pay_date). " +
|
|
@@ -138,13 +157,13 @@ export function createNannyKeeperServer(version, context) {
|
|
|
138
157
|
"Direct deposit callers: set confirm_large_payroll=true for totals >$5,000 or any single " +
|
|
139
158
|
"net pay >$3,000; set confirm_ach_debit=true for first-time DD or if no DD in 30 days. " +
|
|
140
159
|
"Tip: use preview_payroll first to validate your request and see results before committing. " +
|
|
141
|
-
"
|
|
142
|
-
"
|
|
143
|
-
employer_id:
|
|
144
|
-
employee_id: z.string().uuid().describe("Employee UUID
|
|
160
|
+
"Get employee_id from list_employees. employer_id is optional: leave it out and the API uses " +
|
|
161
|
+
"the household your API key belongs to (pass it only when one account manages several households)."), {
|
|
162
|
+
employer_id: EMPLOYER_ID_OPTIONAL,
|
|
163
|
+
employee_id: z.string().uuid().describe("Employee UUID. Get it from list_employees."),
|
|
145
164
|
pay_period_start: z.string().describe("Start of pay period in YYYY-MM-DD format (e.g., 2026-04-07)"),
|
|
146
165
|
pay_period_end: z.string().describe("End of pay period in YYYY-MM-DD format (e.g., 2026-04-13)"),
|
|
147
|
-
pay_date: z.string().optional().describe("Date employee is paid (YYYY-MM-DD). Optional
|
|
166
|
+
pay_date: z.string().optional().describe("Date employee is paid (YYYY-MM-DD), on or after pay_period_end. Optional: if omitted, the server picks the earliest valid business day on or after pay_period_end."),
|
|
148
167
|
pay_frequency: z
|
|
149
168
|
.enum(["weekly", "biweekly", "semimonthly", "monthly"])
|
|
150
169
|
.describe("How often the employee is paid"),
|
|
@@ -222,8 +241,8 @@ export function createNannyKeeperServer(version, context) {
|
|
|
222
241
|
"(status, standard hours, expected net, next pay date) plus eligibility and a 3-payday schedule " +
|
|
223
242
|
"preview — or, if not enrolled, WHY (the eligibility reason, e.g. not_plus / insufficient_history). " +
|
|
224
243
|
"Without employee_id: the list of the employer's active enrollments. Read-only. " +
|
|
225
|
-
"Requires a Plus/Professional key.
|
|
226
|
-
employer_id:
|
|
244
|
+
"Requires a Plus/Professional key. Get employee_id from list_employees; employer_id is optional."), {
|
|
245
|
+
employer_id: EMPLOYER_ID_OPTIONAL,
|
|
227
246
|
employee_id: z
|
|
228
247
|
.string()
|
|
229
248
|
.uuid()
|
|
@@ -247,7 +266,7 @@ export function createNannyKeeperServer(version, context) {
|
|
|
247
266
|
"`disable` (turn Autopilot off — soft-deleted so the ledger + ACH authorization are retained; the employee can re-enroll in-app). " +
|
|
248
267
|
"Turning Autopilot ON is NOT available here — it captures a standing recurring ACH authorization that must be " +
|
|
249
268
|
"done by the employer in the app. Requires a Plus/Professional key. Confirm the action with the user before calling."), {
|
|
250
|
-
employer_id:
|
|
269
|
+
employer_id: EMPLOYER_ID_OPTIONAL,
|
|
251
270
|
employee_id: z.string().uuid().describe("Employee UUID whose enrollment to manage"),
|
|
252
271
|
action: z
|
|
253
272
|
.enum(["pause", "resume", "skip", "disable"])
|
|
@@ -267,5 +286,104 @@ export function createNannyKeeperServer(version, context) {
|
|
|
267
286
|
const result = await executeManageAutopilot(args, context);
|
|
268
287
|
return toolResult(result, context?.publicConnection);
|
|
269
288
|
});
|
|
289
|
+
// Register list_employees tool (read, 1.15.0)
|
|
290
|
+
server.tool("list_employees", context?.publicConnection ? publicDescriptions.list_employees : ("List the household's employees and return the household's employer_id. Call this first: it is how you get " +
|
|
291
|
+
"the employee_id every payroll tool needs. Each employee shows pay type, pay rate, pay frequency, work state, " +
|
|
292
|
+
"and what is still missing for payroll (W-4, address, SSN, direct deposit). Read-only."), {
|
|
293
|
+
employer_id: EMPLOYER_ID_OPTIONAL,
|
|
294
|
+
}, {
|
|
295
|
+
title: "List Employees",
|
|
296
|
+
readOnlyHint: true,
|
|
297
|
+
destructiveHint: false,
|
|
298
|
+
idempotentHint: true,
|
|
299
|
+
openWorldHint: true,
|
|
300
|
+
}, async (args) => {
|
|
301
|
+
const result = await executeListEmployees(args, context);
|
|
302
|
+
return toolResult(result, context?.publicConnection);
|
|
303
|
+
});
|
|
304
|
+
// Register get_payroll tool (read, 1.15.0)
|
|
305
|
+
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 " +
|
|
306
|
+
"(federal, Social Security, Medicare, state, local), net pay, and employer taxes. Without payroll_id: the " +
|
|
307
|
+
"household's payrolls, newest first, with totals. Use it to confirm what run_payroll created. Read-only."), {
|
|
308
|
+
payroll_id: z.string().uuid().optional().describe("A payroll id from run_payroll. Leave it out to list payrolls."),
|
|
309
|
+
employer_id: EMPLOYER_ID_OPTIONAL,
|
|
310
|
+
}, {
|
|
311
|
+
title: "Get Payroll",
|
|
312
|
+
readOnlyHint: true,
|
|
313
|
+
destructiveHint: false,
|
|
314
|
+
idempotentHint: true,
|
|
315
|
+
openWorldHint: true,
|
|
316
|
+
}, async (args) => {
|
|
317
|
+
const result = await executeGetPayroll(args, context);
|
|
318
|
+
return toolResult(result, context?.publicConnection);
|
|
319
|
+
});
|
|
320
|
+
// Register get_pay_stub tool (read, 1.15.0)
|
|
321
|
+
server.tool("get_pay_stub", context?.publicConnection ? publicDescriptions.get_pay_stub : ("Get the pay stub PDF for each employee on a paid payroll. Returns the same stub the family downloads in the " +
|
|
322
|
+
"dashboard, attached as a PDF file, plus a short summary. A payroll that is not paid yet answers " +
|
|
323
|
+
"payroll_not_completed; check get_payroll and ask again once it is completed. For a household other " +
|
|
324
|
+
"than the key's own, pass its employer_id."), {
|
|
325
|
+
payroll_id: z.string().uuid().describe("The payroll id from run_payroll or get_payroll."),
|
|
326
|
+
employee_id: z.string().uuid().optional().describe("Optional. One employee's stub instead of everyone's on the payroll."),
|
|
327
|
+
employer_id: EMPLOYER_ID_OPTIONAL,
|
|
328
|
+
}, {
|
|
329
|
+
title: "Get Pay Stub",
|
|
330
|
+
// Not read-only: the first request for a stub saves it, as the dashboard's
|
|
331
|
+
// download does. Safe to repeat.
|
|
332
|
+
readOnlyHint: false,
|
|
333
|
+
destructiveHint: false,
|
|
334
|
+
idempotentHint: true,
|
|
335
|
+
openWorldHint: true,
|
|
336
|
+
}, async (args) => {
|
|
337
|
+
const result = await executeGetPayStub(args, context);
|
|
338
|
+
// Errors go through toolResult like every other tool, so a hosted
|
|
339
|
+
// connection gets the same scrubbing.
|
|
340
|
+
if (result.isError) {
|
|
341
|
+
const text = result.content.find((c) => c.type === "text");
|
|
342
|
+
return toolResult(text && "text" in text ? text.text : JSON.stringify({ error: "Unknown error" }), context?.publicConnection);
|
|
343
|
+
}
|
|
344
|
+
return result;
|
|
345
|
+
});
|
|
346
|
+
// ⛔ get_w2 and get_schedule_h return a download LINK, never the PDF, on the
|
|
347
|
+
// hosted connector and the npm package alike. A
|
|
348
|
+
// W-2 prints the employee's full Social Security number and a tool result is
|
|
349
|
+
// read by the assistant's model, so the form goes from NannyKeeper to the
|
|
350
|
+
// person's browser and the assistant only passes the link along.
|
|
351
|
+
// Register get_w2 tool (1.16.0)
|
|
352
|
+
server.tool("get_w2", context?.publicConnection ? publicDescriptions.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, " +
|
|
353
|
+
"a link on nannykeeper.com that works for 15 minutes: give it to the user and tell them to open it in their " +
|
|
354
|
+
"browser to download the PDF. This tool never returns the PDF itself, and you must not open the link " +
|
|
355
|
+
"yourself. The family generates the W-2 in the dashboard first (Taxes, then W-2s); until then this answers " +
|
|
356
|
+
"w2_not_generated with a link to that page, and this tool never generates one. " +
|
|
357
|
+
"For a household other than the key's own, pass its employer_id."), {
|
|
358
|
+
employee_id: z.string().uuid().describe("The employee id from list_employees."),
|
|
359
|
+
tax_year: z.number().int().describe("A tax year that has ended, for example 2025."),
|
|
360
|
+
copy: z.enum(["A", "B", "C", "D", "1", "2"]).optional().describe("Optional. Which copy of the W-2. Defaults to B. Each PDF says on its face who that copy is for."),
|
|
361
|
+
employer_id: EMPLOYER_ID_OPTIONAL,
|
|
362
|
+
}, {
|
|
363
|
+
title: "Get W-2 Download Link",
|
|
364
|
+
// Not read-only: making a link writes an audit row. Safe to repeat.
|
|
365
|
+
readOnlyHint: false,
|
|
366
|
+
destructiveHint: false,
|
|
367
|
+
idempotentHint: true,
|
|
368
|
+
openWorldHint: true,
|
|
369
|
+
}, async (args) => toolResult(await executeGetW2(args, context), context?.publicConnection));
|
|
370
|
+
// Register get_schedule_h tool (1.16.0)
|
|
371
|
+
server.tool("get_schedule_h", context?.publicConnection ? publicDescriptions.get_schedule_h : ("Get a download link for the household's Schedule H, for a tax year that has ended. Returns download_url, a " +
|
|
372
|
+
"link on nannykeeper.com that works for 15 minutes: give it to the user and tell them to open it in their " +
|
|
373
|
+
"browser to download the PDF. This tool never returns the PDF itself, and you must not open the link " +
|
|
374
|
+
"yourself. When the dashboard would not produce the form this answers schedule_h_unavailable with a reason " +
|
|
375
|
+
"(for example year_not_ended, or a question the family still has to answer in the dashboard); report that " +
|
|
376
|
+
"reason faithfully. NannyKeeper does not file the form. " +
|
|
377
|
+
"For a household other than the key's own, pass its employer_id."), {
|
|
378
|
+
tax_year: z.number().int().describe("A tax year that has ended, for example 2025."),
|
|
379
|
+
employer_id: EMPLOYER_ID_OPTIONAL,
|
|
380
|
+
}, {
|
|
381
|
+
title: "Get Schedule H Download Link",
|
|
382
|
+
// Not read-only: making a link writes an audit row. Safe to repeat.
|
|
383
|
+
readOnlyHint: false,
|
|
384
|
+
destructiveHint: false,
|
|
385
|
+
idempotentHint: true,
|
|
386
|
+
openWorldHint: true,
|
|
387
|
+
}, async (args) => toolResult(await executeGetScheduleH(args, context), context?.publicConnection));
|
|
270
388
|
return server;
|
|
271
389
|
}
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
import { type ToolContext } from "../context.ts";
|
|
11
11
|
/** Read Autopilot status for one employee, or list the employer's active enrollments. */
|
|
12
12
|
export declare function executeGetAutopilot(args: {
|
|
13
|
-
employer_id
|
|
13
|
+
employer_id?: string;
|
|
14
14
|
employee_id?: string;
|
|
15
15
|
}, context?: ToolContext): Promise<string>;
|
|
16
16
|
/** Manage an existing enrollment: pause / resume / skip / disable. */
|
|
17
17
|
export declare function executeManageAutopilot(args: {
|
|
18
|
-
employer_id
|
|
18
|
+
employer_id?: string;
|
|
19
19
|
employee_id: string;
|
|
20
20
|
action: "pause" | "resume" | "skip" | "disable";
|
|
21
21
|
through_date?: string;
|
package/dist/tools/autopilot.js
CHANGED
|
@@ -19,7 +19,9 @@ export async function executeGetAutopilot(args, context) {
|
|
|
19
19
|
if (!apiKey)
|
|
20
20
|
return missingKey();
|
|
21
21
|
try {
|
|
22
|
-
const params = new URLSearchParams(
|
|
22
|
+
const params = new URLSearchParams();
|
|
23
|
+
if (args.employer_id)
|
|
24
|
+
params.set("employer_id", args.employer_id);
|
|
23
25
|
if (args.employee_id)
|
|
24
26
|
params.set("employee_id", args.employee_id);
|
|
25
27
|
const response = await fetch(`${API_BASE}/api/v1/autopilot?${params.toString()}`, {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Household read tools: list_employees, get_payroll, get_pay_stub (1.15.0),
|
|
3
|
+
* get_w2 and get_schedule_h (1.16.0).
|
|
4
|
+
*
|
|
5
|
+
* list_employees is how an agent learns the employee_id every payroll tool
|
|
6
|
+
* needs (and the household's employer_id). Without it, an agent with a
|
|
7
|
+
* single-household key has no tool that returns either ID.
|
|
8
|
+
*/
|
|
9
|
+
import { type ToolContext } from "../context.ts";
|
|
10
|
+
export declare function executeListEmployees(args: {
|
|
11
|
+
employer_id?: string;
|
|
12
|
+
}, context?: ToolContext): Promise<string>;
|
|
13
|
+
export declare function executeGetPayroll(args: {
|
|
14
|
+
payroll_id?: string;
|
|
15
|
+
employer_id?: string;
|
|
16
|
+
}, context?: ToolContext): Promise<string>;
|
|
17
|
+
type ToolContent = {
|
|
18
|
+
type: "text";
|
|
19
|
+
text: string;
|
|
20
|
+
} | {
|
|
21
|
+
type: "resource";
|
|
22
|
+
resource: {
|
|
23
|
+
uri: string;
|
|
24
|
+
mimeType: string;
|
|
25
|
+
blob: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Returns a short text summary plus each stub as an embedded PDF resource,
|
|
30
|
+
* so the PDF reaches the client as a file rather than as ~120 KB of base64
|
|
31
|
+
* text in the model's context.
|
|
32
|
+
*/
|
|
33
|
+
export declare function executeGetPayStub(args: {
|
|
34
|
+
payroll_id: string;
|
|
35
|
+
employee_id?: string;
|
|
36
|
+
employer_id?: string;
|
|
37
|
+
}, context?: ToolContext): Promise<{
|
|
38
|
+
content: ToolContent[];
|
|
39
|
+
isError?: true;
|
|
40
|
+
}>;
|
|
41
|
+
export declare function executeGetW2(args: {
|
|
42
|
+
employee_id: string;
|
|
43
|
+
tax_year: number;
|
|
44
|
+
copy?: string;
|
|
45
|
+
employer_id?: string;
|
|
46
|
+
}, context?: ToolContext): Promise<string>;
|
|
47
|
+
export declare function executeGetScheduleH(args: {
|
|
48
|
+
tax_year: number;
|
|
49
|
+
employer_id?: string;
|
|
50
|
+
}, context?: ToolContext): Promise<string>;
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Household read tools: list_employees, get_payroll, get_pay_stub (1.15.0),
|
|
3
|
+
* get_w2 and get_schedule_h (1.16.0).
|
|
4
|
+
*
|
|
5
|
+
* list_employees is how an agent learns the employee_id every payroll tool
|
|
6
|
+
* needs (and the household's employer_id). Without it, an agent with a
|
|
7
|
+
* single-household key has no tool that returns either ID.
|
|
8
|
+
*/
|
|
9
|
+
import { getToolContext } from "../context.js";
|
|
10
|
+
const MISSING_KEY = "NANNYKEEPER_API_KEY environment variable is not set. Get a key at nannykeeper.com/developers/keys";
|
|
11
|
+
async function getJson(path, init, context) {
|
|
12
|
+
const { apiKey, apiBase } = getToolContext(context);
|
|
13
|
+
if (!apiKey)
|
|
14
|
+
return { ok: false, text: JSON.stringify({ error: MISSING_KEY }) };
|
|
15
|
+
try {
|
|
16
|
+
const response = await fetch(`${apiBase}${path}`, {
|
|
17
|
+
...init,
|
|
18
|
+
headers: {
|
|
19
|
+
Authorization: `Bearer ${apiKey}`,
|
|
20
|
+
"Content-Type": "application/json",
|
|
21
|
+
...(init.headers ?? {}),
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
const data = await response.json();
|
|
25
|
+
if (!response.ok) {
|
|
26
|
+
return {
|
|
27
|
+
ok: false,
|
|
28
|
+
text: JSON.stringify({
|
|
29
|
+
error: data.error?.message || `API error: ${response.status}`,
|
|
30
|
+
// The stable name of the refusal (payroll_not_completed,
|
|
31
|
+
// w2_not_generated, schedule_h_unavailable), which the tool
|
|
32
|
+
// descriptions tell an agent to look for.
|
|
33
|
+
code: data.error?.code,
|
|
34
|
+
details: data.error?.details,
|
|
35
|
+
}),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return { ok: true, data };
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
return {
|
|
42
|
+
ok: false,
|
|
43
|
+
text: JSON.stringify({
|
|
44
|
+
error: `Network error: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
45
|
+
}),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export async function executeListEmployees(args, context) {
|
|
50
|
+
const params = new URLSearchParams();
|
|
51
|
+
if (args.employer_id)
|
|
52
|
+
params.set("employer_id", args.employer_id);
|
|
53
|
+
const query = params.toString();
|
|
54
|
+
const result = await getJson(`/api/v1/employees${query ? `?${query}` : ""}`, { method: "GET" }, context);
|
|
55
|
+
return result.ok ? JSON.stringify(result.data) : result.text;
|
|
56
|
+
}
|
|
57
|
+
export async function executeGetPayroll(args, context) {
|
|
58
|
+
const params = new URLSearchParams();
|
|
59
|
+
if (args.employer_id)
|
|
60
|
+
params.set("employer_id", args.employer_id);
|
|
61
|
+
const query = params.toString();
|
|
62
|
+
// One payroll is scoped by its own household on the server, so only the
|
|
63
|
+
// list takes employer_id.
|
|
64
|
+
const path = args.payroll_id
|
|
65
|
+
? `/api/v1/payroll/${encodeURIComponent(args.payroll_id)}`
|
|
66
|
+
: `/api/v1/payrolls${query ? `?${query}` : ""}`;
|
|
67
|
+
const result = await getJson(path, { method: "GET" }, context);
|
|
68
|
+
return result.ok ? JSON.stringify(result.data) : result.text;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Returns a short text summary plus each stub as an embedded PDF resource,
|
|
72
|
+
* so the PDF reaches the client as a file rather than as ~120 KB of base64
|
|
73
|
+
* text in the model's context.
|
|
74
|
+
*/
|
|
75
|
+
export async function executeGetPayStub(args, context) {
|
|
76
|
+
const result = await getJson("/api/v1/documents/paystub", {
|
|
77
|
+
method: "POST",
|
|
78
|
+
body: JSON.stringify({
|
|
79
|
+
payroll_id: args.payroll_id,
|
|
80
|
+
...(args.employee_id ? { employee_id: args.employee_id } : {}),
|
|
81
|
+
...(args.employer_id ? { employer_id: args.employer_id } : {}),
|
|
82
|
+
}),
|
|
83
|
+
}, context);
|
|
84
|
+
if (!result.ok) {
|
|
85
|
+
return { content: [{ type: "text", text: result.text }], isError: true };
|
|
86
|
+
}
|
|
87
|
+
const data = result.data.data;
|
|
88
|
+
const documents = data?.documents ?? [];
|
|
89
|
+
const summary = {
|
|
90
|
+
payroll_id: data?.payroll_id ?? args.payroll_id,
|
|
91
|
+
documents: documents.map((d) => d.error
|
|
92
|
+
? { employee_id: d.employee_id, error: d.error }
|
|
93
|
+
: {
|
|
94
|
+
employee_id: d.employee_id,
|
|
95
|
+
document_id: d.document_id,
|
|
96
|
+
file_name: d.file_name,
|
|
97
|
+
attached: Boolean(d.data),
|
|
98
|
+
}),
|
|
99
|
+
};
|
|
100
|
+
const content = [{ type: "text", text: JSON.stringify(summary) }];
|
|
101
|
+
for (const d of documents) {
|
|
102
|
+
if (!d.data || !d.document_id)
|
|
103
|
+
continue;
|
|
104
|
+
content.push({
|
|
105
|
+
type: "resource",
|
|
106
|
+
resource: {
|
|
107
|
+
uri: `nannykeeper://pay-stubs/${d.document_id}/${encodeURIComponent(d.file_name ?? "pay-stub.pdf")}`,
|
|
108
|
+
mimeType: d.mime_type || "application/pdf",
|
|
109
|
+
blob: d.data,
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
return { content };
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* One tax form, as a DOWNLOAD LINK and never as the PDF (1.16.0).
|
|
117
|
+
*
|
|
118
|
+
* ⛔ A W-2 prints the employee's full Social Security number, and a tool
|
|
119
|
+
* result is read by the assistant's model. So these tools always ask the API
|
|
120
|
+
* for `delivery: "link"`: the result is a link on nannykeeper.com that works
|
|
121
|
+
* for 15 minutes, and the person opens it in their own browser. The pay stub
|
|
122
|
+
* is attached as a file because it shows only the last four digits; do not
|
|
123
|
+
* "align" these two with it.
|
|
124
|
+
*/
|
|
125
|
+
async function getTaxFormLink(path, body, context) {
|
|
126
|
+
const result = await getJson(path, { method: "POST", body: JSON.stringify({ ...body, delivery: "link" }) }, context);
|
|
127
|
+
if (!result.ok)
|
|
128
|
+
return result.text;
|
|
129
|
+
const data = result.data.data;
|
|
130
|
+
const { download, document: _document, ...rest } = data ?? {};
|
|
131
|
+
if (!download?.url) {
|
|
132
|
+
return JSON.stringify({ error: "NannyKeeper did not return a download link. Ask again in a minute." });
|
|
133
|
+
}
|
|
134
|
+
return JSON.stringify({
|
|
135
|
+
...rest,
|
|
136
|
+
file_name: download.file_name,
|
|
137
|
+
download_url: download.url,
|
|
138
|
+
expires_at: download.expires_at,
|
|
139
|
+
instructions: "Give the user this link and tell them to open it in their browser to download the PDF. " +
|
|
140
|
+
"It works for 15 minutes. Do not open or fetch the link yourself.",
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
export async function executeGetW2(args, context) {
|
|
144
|
+
return getTaxFormLink("/api/v1/documents/w2", {
|
|
145
|
+
employee_id: args.employee_id,
|
|
146
|
+
tax_year: args.tax_year,
|
|
147
|
+
...(args.copy ? { copy: args.copy } : {}),
|
|
148
|
+
...(args.employer_id ? { employer_id: args.employer_id } : {}),
|
|
149
|
+
}, context);
|
|
150
|
+
}
|
|
151
|
+
export async function executeGetScheduleH(args, context) {
|
|
152
|
+
return getTaxFormLink("/api/v1/documents/schedule-h", {
|
|
153
|
+
tax_year: args.tax_year,
|
|
154
|
+
...(args.employer_id ? { employer_id: args.employer_id } : {}),
|
|
155
|
+
}, context);
|
|
156
|
+
}
|
package/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"manifest_version": "0.3",
|
|
3
3
|
"name": "nannykeeper",
|
|
4
|
-
"version": "1.
|
|
5
|
-
"description": "Calculate US household employer (nanny) taxes for all 50 states.
|
|
4
|
+
"version": "1.16.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.",
|
|
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.
|
|
3
|
+
"version": "1.16.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": [
|