@nannykeeper/mcp-server 1.18.0 → 1.19.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 +2 -0
- package/CLAUDE.md +2 -0
- package/README.md +29 -0
- package/dist/params.d.ts +11 -0
- package/dist/params.js +15 -0
- package/dist/public-profile.js +1 -0
- package/dist/server.js +6 -11
- package/dist/tools/list-payrolls.js +2 -5
- package/dist/tools/tax-payment.d.ts +34 -0
- package/dist/tools/tax-payment.js +130 -0
- package/dist/tools/void-payroll.d.ts +38 -0
- package/dist/tools/void-payroll.js +106 -0
- package/manifest.json +1 -1
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -15,9 +15,11 @@ Calculate US household employer (nanny) taxes for all 50 states + DC.
|
|
|
15
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
|
|
16
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
|
|
17
17
|
- `get_quarter_taxes(year, quarter, employer_id?)`: the quarter as the household's Taxes page shows it, with the checklist of what to pay or file and by when. A null amount means NannyKeeper will not stand behind a figure yet; give the `waiting_on` reason and never report it as $0
|
|
18
|
+
- `record_tax_payment(year, quarter, destination, expected_amount | amount, closes_filing?, idempotency_key, employer_id?)`: record that the household PAID a quarter's tax (federal or a state destination id); reminders stop once it covers what is owed (a state `amount` below that is an installment unless `closes_filing`). It only adds a payment: corrections go to the Taxes page. Only after the user says they paid; NannyKeeper never sends the payment. `figures_changed` means the figure moved: show the new one and ask before retrying
|
|
18
19
|
- `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.
|
|
19
20
|
- `get_autopilot(employer_id?, employee_id?)` — reads existing Autopilot enrollments
|
|
20
21
|
- `manage_autopilot(employee_id, action, ..., employer_id?)` — pauses, resumes, skips, or disables an existing enrollment; never enrolls
|
|
22
|
+
- `void_payroll(payroll_id, confirmation_code?, reason?, employer_id?)`: voids a payroll that has not moved money (a draft, or a scheduled direct deposit whose debit has not started), in two steps. Call it with `payroll_id` only first: nothing is voided, and you get the payroll and a `confirmation_code`. Show the user the payroll and get their yes, then call again with the code and a reason. A payroll with money on the move, or a completed one, is refused with `app_url`: give the user that link and do not retry
|
|
21
23
|
|
|
22
24
|
## When to Use
|
|
23
25
|
- User asks about nanny taxes, household employer taxes, or paying a caregiver
|
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
|
+
- `record_tax_payment`: records a payment the household made, through `POST /api/v1/taxes/payments`, which drives the Taxes page's own `markFederalPaid` / `recordDestinationPayment`. ⛔ Never a parallel write path, and never a figure nobody saw: `expected_amount` must equal what `get_quarter_taxes` states, `amount` is the household's own. Registered from its own module (`registerRecordTaxPayment`). `idempotency_key` is required and sent as the Idempotency-Key header. `closes_filing` (state, with `amount`) is the page's "I paid a different amount". Annotated destructive: it turns off reminders (added 1.19.0)
|
|
13
14
|
- `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)
|
|
14
15
|
- `calculate_nanny_taxes` — Full federal + state tax breakdown
|
|
15
16
|
- `check_threshold` — Whether wages trigger employer tax obligations
|
|
@@ -17,6 +18,7 @@ Calculate nanny taxes for all 50 US states.
|
|
|
17
18
|
- `run_payroll` — End-to-end payroll: create, approve, and process (or schedule) in a single call. Finalized response reflects real status (`processing` / `pending_funding` / `completed` / **`scheduled`** as of 1.5.0). No UI intervention needed. (Starter+ required)
|
|
18
19
|
- `get_autopilot` — Read Autopilot (recurring auto-run payroll) status for an employee, or list an employer's active enrollments (Plus/Professional, `ach` scope)
|
|
19
20
|
- `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
|
|
21
|
+
- `void_payroll`: the two-step safe void over `POST /api/v1/payroll/:id/void`. The first call writes nothing and returns the payroll and a 10-minute confirmation code bound to that payroll and key; only the second call, with the code and a reason, voids, through the app's own `voidPayroll`. ⛔ Only a draft or a scheduled direct deposit whose debit has not started; everything else is refused with an app link. The tool passes the API through and never retries or mints a code itself. Registered from its own module, `tools/void-payroll.ts`
|
|
20
22
|
- `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.
|
|
21
23
|
|
|
22
24
|
**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.
|
package/README.md
CHANGED
|
@@ -120,6 +120,35 @@ A null amount means NannyKeeper will not stand behind a figure yet, and `waiting
|
|
|
120
120
|
- `quarter` (required): 1 to 4
|
|
121
121
|
- `employer_id` (optional)
|
|
122
122
|
|
|
123
|
+
### `record_tax_payment`
|
|
124
|
+
|
|
125
|
+
Record that the household paid a quarter's tax to the IRS or a state agency, as the Taxes page's "I've paid this" does; once the payment covers what is owed, NannyKeeper stops reminding them about it. NannyKeeper never sends the payment: call it only after the household has paid (added 1.19.0). Read the quarter with `get_quarter_taxes` first.
|
|
126
|
+
|
|
127
|
+
Send exactly one figure. `expected_amount` means they paid what NannyKeeper showed (`federal.due_now`, or the destination's `amount_owed`), and it must still be the current figure: if a payroll changed it, the answer is `figures_changed` with `current_amount`, and nothing is recorded. `amount` is what they actually paid; for a state agency it is an installment unless it covers what is owed or you also send `closes_filing: true` (the agency billed that amount and it settles the filing). `already_recorded: true` means nothing new was written, and `already_recorded_different` means a different payment is already on file. The tool only adds a payment; corrections are made on the Taxes page.
|
|
128
|
+
|
|
129
|
+
**Parameters:**
|
|
130
|
+
- `year` (required): the tax year, for example 2026
|
|
131
|
+
- `quarter` (required): 1 to 4
|
|
132
|
+
- `destination` (required): `federal`, or a `state_destinations` id from `get_quarter_taxes`
|
|
133
|
+
- `expected_amount` or `amount` (exactly one)
|
|
134
|
+
- `idempotency_key` (required): a new unique key per payment; reuse it only to retry that payment
|
|
135
|
+
- `payment_date` (optional): YYYY-MM-DD, defaults to today in US Eastern time
|
|
136
|
+
- `closes_filing` (optional, with `amount`, state agencies only)
|
|
137
|
+
- `payment_method`, `confirmation_number`, `notes` (optional)
|
|
138
|
+
- `employer_id` (optional)
|
|
139
|
+
|
|
140
|
+
### `void_payroll`
|
|
141
|
+
|
|
142
|
+
Void a payroll that has not moved any money: a draft, or a scheduled direct deposit whose bank debit has not started. Two calls, never one. The first, with `payroll_id` only, voids nothing and returns the payroll (employees, pay period, gross, pay date) and a `confirmation_code` that works for 10 minutes for that payroll and key. Show the user the payroll and get their confirmation, then call again with the code and a `reason`.
|
|
143
|
+
|
|
144
|
+
A payroll with money already on the move, or a completed one, is refused with `payroll_not_voidable_via_api` and an `app_url`: the user voids it in the NannyKeeper app. A payroll whose debit started between the two calls is refused the same way at the second call. A refused code (`confirmation_expired`, `confirmation_invalid`, `payroll_changed`) voids nothing; start again from the first call.
|
|
145
|
+
|
|
146
|
+
**Parameters:**
|
|
147
|
+
- `payroll_id` (required)
|
|
148
|
+
- `confirmation_code` (optional): left out on the first call
|
|
149
|
+
- `reason` (required with the code)
|
|
150
|
+
- `employer_id` (optional)
|
|
151
|
+
|
|
123
152
|
### `calculate_nanny_taxes`
|
|
124
153
|
|
|
125
154
|
Calculate employer and employee tax obligations for a household employee.
|
package/dist/params.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* `employer_id` on every household tool (1.15.0). The API defaults it to the
|
|
4
|
+
* household the key belongs to, so a single-household caller never needs it.
|
|
5
|
+
* Do not make it required again: list_employees is the only place an agent
|
|
6
|
+
* can learn it, and a required parameter it cannot fill stops the flow.
|
|
7
|
+
*
|
|
8
|
+
* Shared, never copied: a tool registered from its own module imports it
|
|
9
|
+
* here, so a change reaches every tool.
|
|
10
|
+
*/
|
|
11
|
+
export declare const EMPLOYER_ID_OPTIONAL: z.ZodOptional<z.ZodString>;
|
package/dist/params.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* `employer_id` on every household tool (1.15.0). The API defaults it to the
|
|
4
|
+
* household the key belongs to, so a single-household caller never needs it.
|
|
5
|
+
* Do not make it required again: list_employees is the only place an agent
|
|
6
|
+
* can learn it, and a required parameter it cannot fill stops the flow.
|
|
7
|
+
*
|
|
8
|
+
* Shared, never copied: a tool registered from its own module imports it
|
|
9
|
+
* here, so a change reaches every tool.
|
|
10
|
+
*/
|
|
11
|
+
export const EMPLOYER_ID_OPTIONAL = z
|
|
12
|
+
.string()
|
|
13
|
+
.uuid()
|
|
14
|
+
.optional()
|
|
15
|
+
.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.");
|
package/dist/public-profile.js
CHANGED
|
@@ -11,6 +11,7 @@ export const publicDescriptions = {
|
|
|
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.",
|
|
13
13
|
get_quarter_taxes: "Get a quarter's tax figures as the household's NannyKeeper Taxes page shows them: a checklist of what to pay or file, to whom and by when (an item of kind rec has no hard deadline this quarter but may still be owed), the optional federal estimated payment for the IRS installment, each state agency's due date and amount, and per-state lines. A null amount means NannyKeeper will not stand behind a figure yet; give the returned reason and never report it as $0 or nothing owed. NannyKeeper does not file or pay for the household. Safe to repeat.",
|
|
14
|
+
record_tax_payment: "Record that the household paid a quarter's tax to the IRS or a state agency; once that covers what is owed, NannyKeeper stops reminding them. NannyKeeper does not send the payment; call this only after the user says they paid. Read the quarter with get_quarter_taxes first. Send expected_amount when they paid the figure it showed, or amount with what they actually paid (add closes_filing for a state agency when that amount settles the filing). If the figure changed or NannyKeeper will not confirm one, show the user the returned reason and ask before trying again. Use one idempotency_key per payment and reuse it only to retry that payment. It only adds a payment: it cannot change or remove one already recorded, so send corrections to the Taxes page in NannyKeeper.",
|
|
14
15
|
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.",
|
|
15
16
|
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.",
|
|
16
17
|
};
|
package/dist/server.js
CHANGED
|
@@ -8,19 +8,11 @@ import { executeStateFilingStatus, stateFilingStatusTool, } from "./tools/state-
|
|
|
8
8
|
import { executeGetAutopilot, executeManageAutopilot } from "./tools/autopilot.js";
|
|
9
9
|
import { reimbursementsParam } from "./tools/reimbursements.js";
|
|
10
10
|
import { registerListPayrolls } from "./tools/list-payrolls.js";
|
|
11
|
+
import { registerVoidPayroll } from "./tools/void-payroll.js";
|
|
12
|
+
import { EMPLOYER_ID_OPTIONAL } from "./params.js";
|
|
11
13
|
import { executeGetPayStub, executeGetW2, executeGetScheduleH, executeGetQuarterTaxes, executeGetPayroll, executeListEmployees, } from "./tools/household.js";
|
|
12
14
|
import { publicDescriptions, toolResult } from "./public-profile.js";
|
|
13
|
-
|
|
14
|
-
* `employer_id` on every household tool (1.15.0). The API defaults it to the
|
|
15
|
-
* household the key belongs to, so a single-household caller never needs it.
|
|
16
|
-
* Do not make it required again: list_employees is the only place an agent
|
|
17
|
-
* can learn it, and a required parameter it cannot fill stops the flow.
|
|
18
|
-
*/
|
|
19
|
-
const EMPLOYER_ID_OPTIONAL = z
|
|
20
|
-
.string()
|
|
21
|
-
.uuid()
|
|
22
|
-
.optional()
|
|
23
|
-
.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.");
|
|
15
|
+
import { registerRecordTaxPayment } from "./tools/tax-payment.js";
|
|
24
16
|
/**
|
|
25
17
|
* Cap on array elements plus object members in one tools/call `arguments`
|
|
26
18
|
* (GHSA-46jr-4wx8-v453). The SDK counts them before validation and
|
|
@@ -429,5 +421,8 @@ export function createNannyKeeperServer(version, context) {
|
|
|
429
421
|
idempotentHint: true,
|
|
430
422
|
openWorldHint: true,
|
|
431
423
|
}, async (args) => toolResult(await executeGetQuarterTaxes(args, context), context?.publicConnection));
|
|
424
|
+
// record_tax_payment (write), registered from its own module.
|
|
425
|
+
registerRecordTaxPayment(server, context, EMPLOYER_ID_OPTIONAL);
|
|
426
|
+
registerVoidPayroll(server, context);
|
|
432
427
|
return server;
|
|
433
428
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { CLIENT_HEADER, getToolContext } from "../context.js";
|
|
3
|
+
import { EMPLOYER_ID_OPTIONAL } from "../params.js";
|
|
3
4
|
import { toolResult } from "../public-profile.js";
|
|
4
5
|
export const LIST_PAYROLLS_DESCRIPTION = "List the household's payrolls, newest first, each with its status, pay period, pay date, total gross pay, " +
|
|
5
6
|
"total net pay, employer taxes and the employee_ids it paid. Filter with employee_id (only payrolls that paid " +
|
|
@@ -70,11 +71,7 @@ export function registerListPayrolls(server, context) {
|
|
|
70
71
|
pay_date_to: DATE.optional().describe("Optional. Latest pay date to include, YYYY-MM-DD."),
|
|
71
72
|
limit: z.number().int().min(1).max(100).optional().describe("Optional. How many payrolls to return, 1 to 100 (default 25)."),
|
|
72
73
|
cursor: z.string().max(200).optional().describe("Optional. The next_cursor from a previous call, for the next page."),
|
|
73
|
-
employer_id:
|
|
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."),
|
|
74
|
+
employer_id: EMPLOYER_ID_OPTIONAL,
|
|
78
75
|
}, {
|
|
79
76
|
title: "List Payrolls",
|
|
80
77
|
readOnlyHint: true,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* record_tax_payment: record that the household paid a
|
|
3
|
+
* quarter's tax to the IRS or a state agency, through
|
|
4
|
+
* POST /api/v1/taxes/payments, which drives the Taxes page's own "I've paid
|
|
5
|
+
* this" and "Record payment".
|
|
6
|
+
*
|
|
7
|
+
* ⛔ Passed through unchanged, like get_quarter_taxes: a refusal carries the
|
|
8
|
+
* reason and the quarter as it stands, and a tool that summarised it could
|
|
9
|
+
* hide that nothing was recorded.
|
|
10
|
+
*/
|
|
11
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
import { type ToolContext } from "../context.ts";
|
|
14
|
+
export interface RecordTaxPaymentArgs {
|
|
15
|
+
year: number;
|
|
16
|
+
quarter: number;
|
|
17
|
+
destination: string;
|
|
18
|
+
expected_amount?: number;
|
|
19
|
+
amount?: number;
|
|
20
|
+
payment_date?: string;
|
|
21
|
+
payment_method?: string;
|
|
22
|
+
confirmation_number?: string;
|
|
23
|
+
notes?: string;
|
|
24
|
+
closes_filing?: boolean;
|
|
25
|
+
idempotency_key: string;
|
|
26
|
+
employer_id?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare function executeRecordTaxPayment(args: RecordTaxPaymentArgs, context?: ToolContext): Promise<string>;
|
|
29
|
+
/**
|
|
30
|
+
* Registered from here rather than inline in server.ts, so parallel tool
|
|
31
|
+
* additions do not collide there. `employerId` is server.ts's shared
|
|
32
|
+
* EMPLOYER_ID_OPTIONAL, passed in so its wording stays in one place.
|
|
33
|
+
*/
|
|
34
|
+
export declare function registerRecordTaxPayment(server: McpServer, context: ToolContext | undefined, employerId: z.ZodOptional<z.ZodString>): void;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* record_tax_payment: record that the household paid a
|
|
3
|
+
* quarter's tax to the IRS or a state agency, through
|
|
4
|
+
* POST /api/v1/taxes/payments, which drives the Taxes page's own "I've paid
|
|
5
|
+
* this" and "Record payment".
|
|
6
|
+
*
|
|
7
|
+
* ⛔ Passed through unchanged, like get_quarter_taxes: a refusal carries the
|
|
8
|
+
* reason and the quarter as it stands, and a tool that summarised it could
|
|
9
|
+
* hide that nothing was recorded.
|
|
10
|
+
*/
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
import { CLIENT_HEADER, getToolContext } from "../context.js";
|
|
13
|
+
import { publicDescriptions, toolResult } from "../public-profile.js";
|
|
14
|
+
export async function executeRecordTaxPayment(args, context) {
|
|
15
|
+
const { apiKey, apiBase } = getToolContext(context);
|
|
16
|
+
if (!apiKey) {
|
|
17
|
+
return JSON.stringify({
|
|
18
|
+
error: "NANNYKEEPER_API_KEY environment variable is not set. Get a key at nannykeeper.com/developers/keys",
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
const { idempotency_key: idempotencyKey, ...body } = args;
|
|
22
|
+
try {
|
|
23
|
+
const response = await fetch(`${apiBase}/api/v1/taxes/payments`, {
|
|
24
|
+
method: "POST",
|
|
25
|
+
headers: {
|
|
26
|
+
Authorization: `Bearer ${apiKey}`,
|
|
27
|
+
"Content-Type": "application/json",
|
|
28
|
+
"Idempotency-Key": idempotencyKey,
|
|
29
|
+
...CLIENT_HEADER,
|
|
30
|
+
},
|
|
31
|
+
// Undefined members drop out of the JSON, so the API sees exactly the
|
|
32
|
+
// one figure the agent chose.
|
|
33
|
+
body: JSON.stringify(body),
|
|
34
|
+
});
|
|
35
|
+
const data = await response.json();
|
|
36
|
+
if (!response.ok) {
|
|
37
|
+
return JSON.stringify({
|
|
38
|
+
error: data.error?.message || `API error: ${response.status}`,
|
|
39
|
+
// The stable name of the refusal (figures_changed, figure_unavailable,
|
|
40
|
+
// nothing_due, annual_filing_needs_amount, destination_not_found),
|
|
41
|
+
// which the tool description tells an agent to act on.
|
|
42
|
+
code: data.error?.code,
|
|
43
|
+
details: data.error?.details,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return JSON.stringify(data);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
return JSON.stringify({
|
|
50
|
+
error: `Network error: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Registered from here rather than inline in server.ts, so parallel tool
|
|
56
|
+
* additions do not collide there. `employerId` is server.ts's shared
|
|
57
|
+
* EMPLOYER_ID_OPTIONAL, passed in so its wording stays in one place.
|
|
58
|
+
*/
|
|
59
|
+
export function registerRecordTaxPayment(server, context, employerId) {
|
|
60
|
+
server.tool("record_tax_payment", context?.publicConnection ? publicDescriptions.record_tax_payment : ("Record that the household PAID a quarter's tax to the IRS or a state agency, as the Taxes page's \"I've paid " +
|
|
61
|
+
"this\" does; once the payment covers what is owed, NannyKeeper stops reminding them about it. NannyKeeper " +
|
|
62
|
+
"never sends the payment: only call this " +
|
|
63
|
+
"after the user tells you they paid. First call get_quarter_taxes for the same year and quarter. `destination` is " +
|
|
64
|
+
"\"federal\" or a state_destinations id from that answer. Send exactly one figure: `expected_amount` when they paid " +
|
|
65
|
+
"the amount get_quarter_taxes showed (federal.due_now, or that destination's amount_owed), or `amount` with what " +
|
|
66
|
+
"they actually paid. A state `amount` below what is owed counts as an installment and the reminders continue; " +
|
|
67
|
+
"if the agency billed exactly that amount and the user says it settles the filing, also send closes_filing true. " +
|
|
68
|
+
"If the answer is figures_changed, the figure moved since you read it: show the user the " +
|
|
69
|
+
"new figure and ask before trying again. figure_unavailable, nothing_due or annual_filing_needs_amount mean " +
|
|
70
|
+
"NannyKeeper will not confirm a figure here: ask the user what they paid and send it as `amount`. " +
|
|
71
|
+
"already_recorded_different means a different payment is already on file and nothing was recorded: tell the " +
|
|
72
|
+
"user and ask. already_settled means the user already marked that filing paid; changes are made on the Taxes " +
|
|
73
|
+
"page. Pass the " +
|
|
74
|
+
"user's own date as payment_date when you know it; it defaults to today in US Eastern time. Use one new " +
|
|
75
|
+
"idempotency_key per payment and reuse it only to retry that same payment. already_recorded true means " +
|
|
76
|
+
"nothing new was written. This tool only ADDS a payment: it cannot change or remove one already recorded " +
|
|
77
|
+
"(its method, confirmation number, date or amount), and calling it again with amount records a second " +
|
|
78
|
+
"payment. For a correction, send the user to the Taxes page in NannyKeeper. " +
|
|
79
|
+
"For a household other than the key's own, pass its employer_id."), {
|
|
80
|
+
year: z.number().int().min(2020).max(2100).describe("The tax year, for example 2026."),
|
|
81
|
+
quarter: z.number().int().min(1).max(4).describe("The calendar quarter, 1 to 4."),
|
|
82
|
+
destination: z
|
|
83
|
+
.string()
|
|
84
|
+
.max(64)
|
|
85
|
+
.describe("\"federal\", or a state_destinations id from get_quarter_taxes, for example MD-UI."),
|
|
86
|
+
expected_amount: z
|
|
87
|
+
.number()
|
|
88
|
+
.min(0.01)
|
|
89
|
+
.max(1_000_000)
|
|
90
|
+
.optional()
|
|
91
|
+
.describe("Paid as shown: the dollar figure get_quarter_taxes returned for this destination. Send this or amount, never both."),
|
|
92
|
+
amount: z
|
|
93
|
+
.number()
|
|
94
|
+
.min(0.01)
|
|
95
|
+
.max(1_000_000)
|
|
96
|
+
.optional()
|
|
97
|
+
.describe("What the household actually paid, in dollars to the cent. Send this or expected_amount, never both."),
|
|
98
|
+
payment_date: z
|
|
99
|
+
.string()
|
|
100
|
+
.regex(/^\d{4}-\d{2}-\d{2}$/)
|
|
101
|
+
.optional()
|
|
102
|
+
.describe("Optional. The day they paid, YYYY-MM-DD. Defaults to today in US Eastern time."),
|
|
103
|
+
payment_method: z
|
|
104
|
+
.enum(["eftps", "check", "direct_pay", "state_portal", "carrier_portal", "other"])
|
|
105
|
+
.optional()
|
|
106
|
+
.describe("Optional. How they paid: eftps or direct_pay for the IRS, state_portal or carrier_portal for a state."),
|
|
107
|
+
confirmation_number: z.string().max(100).optional().describe("Optional. The confirmation number the IRS or agency gave them."),
|
|
108
|
+
notes: z.string().max(500).optional().describe("Optional. A note to keep with the payment."),
|
|
109
|
+
closes_filing: z
|
|
110
|
+
.boolean()
|
|
111
|
+
.optional()
|
|
112
|
+
.describe("Optional, with amount on a state agency only: the user's figure closes that filing, as \"I paid a different amount\" on the Taxes page does."),
|
|
113
|
+
idempotency_key: z
|
|
114
|
+
.string()
|
|
115
|
+
.min(8)
|
|
116
|
+
.max(255)
|
|
117
|
+
.describe("A new unique string (a UUID) for this payment. Reuse it only to retry the same payment after an error."),
|
|
118
|
+
employer_id: employerId,
|
|
119
|
+
}, {
|
|
120
|
+
title: "Record Tax Payment",
|
|
121
|
+
readOnlyHint: false,
|
|
122
|
+
// It moves no money, but it turns off a household's tax reminders, so
|
|
123
|
+
// clients should confirm it with the user like any other consequential
|
|
124
|
+
// write.
|
|
125
|
+
destructiveHint: true,
|
|
126
|
+
// Repeating it with the same idempotency_key returns the first answer.
|
|
127
|
+
idempotentHint: true,
|
|
128
|
+
openWorldHint: true,
|
|
129
|
+
}, async (args) => toolResult(await executeRecordTaxPayment(args, context), context?.publicConnection));
|
|
130
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* void_payroll: the "safe void", over
|
|
3
|
+
* `POST /api/v1/payroll/:id/void`.
|
|
4
|
+
*
|
|
5
|
+
* Two calls, never one. Without `confirmation_code` the API writes nothing and
|
|
6
|
+
* answers with the payroll (employees, period, gross, pay date) and a code
|
|
7
|
+
* that works for 10 minutes, bound to that payroll and this key. The void
|
|
8
|
+
* happens only when the code comes back, so the assistant has to show the
|
|
9
|
+
* family what it is about to undo and get a yes.
|
|
10
|
+
*
|
|
11
|
+
* Only a draft, or a scheduled direct deposit whose debit has not started.
|
|
12
|
+
* Anything with money on the move, and every completed payroll, is refused
|
|
13
|
+
* with a link to void it in the app: money that is already on the move is
|
|
14
|
+
* never voided from an assistant.
|
|
15
|
+
*
|
|
16
|
+
* ⛔ The tool passes the API's answer through. It never retries a refusal and
|
|
17
|
+
* never mints or remembers a code itself; the API owns both.
|
|
18
|
+
*/
|
|
19
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
20
|
+
import { type ToolContext } from "../context.ts";
|
|
21
|
+
export declare const voidPayrollTool: {
|
|
22
|
+
readonly name: "void_payroll";
|
|
23
|
+
readonly description: string;
|
|
24
|
+
};
|
|
25
|
+
export declare function executeVoidPayroll(args: {
|
|
26
|
+
payroll_id: string;
|
|
27
|
+
confirmation_code?: string;
|
|
28
|
+
reason?: string;
|
|
29
|
+
employer_id?: string;
|
|
30
|
+
}, context?: ToolContext): Promise<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Registered from this module, like `list_payrolls`, so the tool owns its
|
|
33
|
+
* whole surface. Two calls: the first returns the payroll and a confirmation
|
|
34
|
+
* code and writes nothing; the second, with the code, voids. Only a draft or a
|
|
35
|
+
* scheduled direct deposit whose debit has not started; the API refuses
|
|
36
|
+
* everything else with a link to the app.
|
|
37
|
+
*/
|
|
38
|
+
export declare function registerVoidPayroll(server: McpServer, context?: ToolContext): void;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* void_payroll: the "safe void", over
|
|
3
|
+
* `POST /api/v1/payroll/:id/void`.
|
|
4
|
+
*
|
|
5
|
+
* Two calls, never one. Without `confirmation_code` the API writes nothing and
|
|
6
|
+
* answers with the payroll (employees, period, gross, pay date) and a code
|
|
7
|
+
* that works for 10 minutes, bound to that payroll and this key. The void
|
|
8
|
+
* happens only when the code comes back, so the assistant has to show the
|
|
9
|
+
* family what it is about to undo and get a yes.
|
|
10
|
+
*
|
|
11
|
+
* Only a draft, or a scheduled direct deposit whose debit has not started.
|
|
12
|
+
* Anything with money on the move, and every completed payroll, is refused
|
|
13
|
+
* with a link to void it in the app: money that is already on the move is
|
|
14
|
+
* never voided from an assistant.
|
|
15
|
+
*
|
|
16
|
+
* ⛔ The tool passes the API's answer through. It never retries a refusal and
|
|
17
|
+
* never mints or remembers a code itself; the API owns both.
|
|
18
|
+
*/
|
|
19
|
+
import { z } from "zod";
|
|
20
|
+
import { CLIENT_HEADER, getToolContext } from "../context.js";
|
|
21
|
+
import { EMPLOYER_ID_OPTIONAL } from "../params.js";
|
|
22
|
+
import { toolResult } from "../public-profile.js";
|
|
23
|
+
export const voidPayrollTool = {
|
|
24
|
+
name: "void_payroll",
|
|
25
|
+
description: "Void a payroll that has not moved any money: a draft, or a scheduled direct deposit whose bank debit has " +
|
|
26
|
+
"not started. Two steps. First call it with payroll_id only: nothing is voided, and you get the payroll " +
|
|
27
|
+
"(employees, pay period, gross, pay date) and a confirmation_code that works for 10 minutes. Show the user " +
|
|
28
|
+
"that payroll and ask them to confirm. Only after they say yes, call it again with the same payroll_id, the " +
|
|
29
|
+
"confirmation_code and a short reason. A payroll with money already on the move (approved, processing, " +
|
|
30
|
+
"funded or paid) or a completed one is refused with code payroll_not_voidable_via_api and an app_url: give " +
|
|
31
|
+
"the user that link to void it in the NannyKeeper app, and do not retry. If the code is refused " +
|
|
32
|
+
"(confirmation_expired, confirmation_invalid, payroll_changed), start again from the first step and confirm " +
|
|
33
|
+
"with the user again. For a household other than the key's own, pass its employer_id.",
|
|
34
|
+
};
|
|
35
|
+
/** The hosted (public listing) copy: no sign-up or pricing prompts. */
|
|
36
|
+
const VOID_PAYROLL_PUBLIC_DESCRIPTION = "Void a payroll that has not moved any money: a draft, or a scheduled direct deposit whose debit has not started. Two steps: call with payroll_id only to get the payroll and a confirmation_code (nothing is voided), show the user that payroll and get their explicit confirmation, then call again with the code and a reason. A payroll with money already on the move, or a completed one, is refused with an app_url; give the user that link and do not retry.";
|
|
37
|
+
export async function executeVoidPayroll(args, context) {
|
|
38
|
+
const { apiKey, apiBase } = getToolContext(context);
|
|
39
|
+
if (!apiKey) {
|
|
40
|
+
return JSON.stringify({
|
|
41
|
+
error: "NANNYKEEPER_API_KEY environment variable is not set. Get a key at nannykeeper.com/developers/keys",
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
const response = await fetch(`${apiBase}/api/v1/payroll/${encodeURIComponent(args.payroll_id)}/void`, {
|
|
46
|
+
method: "POST",
|
|
47
|
+
headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json", ...CLIENT_HEADER },
|
|
48
|
+
body: JSON.stringify({
|
|
49
|
+
...(args.confirmation_code ? { confirmation_code: args.confirmation_code } : {}),
|
|
50
|
+
...(args.reason ? { reason: args.reason } : {}),
|
|
51
|
+
...(args.employer_id ? { employer_id: args.employer_id } : {}),
|
|
52
|
+
}),
|
|
53
|
+
});
|
|
54
|
+
const data = await response.json();
|
|
55
|
+
if (!response.ok) {
|
|
56
|
+
if (response.status === 429) {
|
|
57
|
+
return JSON.stringify({ error: "Rate limit exceeded. Please wait before retrying." });
|
|
58
|
+
}
|
|
59
|
+
return JSON.stringify({
|
|
60
|
+
error: data.error?.message || `API error: ${response.status}`,
|
|
61
|
+
// The stable name of the refusal, which the description tells the
|
|
62
|
+
// agent to act on (payroll_not_voidable_via_api, confirmation_expired…).
|
|
63
|
+
code: data.error?.code,
|
|
64
|
+
details: data.error?.details,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return JSON.stringify(data);
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
return JSON.stringify({
|
|
71
|
+
error: `Network error: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Registered from this module, like `list_payrolls`, so the tool owns its
|
|
77
|
+
* whole surface. Two calls: the first returns the payroll and a confirmation
|
|
78
|
+
* code and writes nothing; the second, with the code, voids. Only a draft or a
|
|
79
|
+
* scheduled direct deposit whose debit has not started; the API refuses
|
|
80
|
+
* everything else with a link to the app.
|
|
81
|
+
*/
|
|
82
|
+
export function registerVoidPayroll(server, context) {
|
|
83
|
+
server.tool(voidPayrollTool.name, context?.publicConnection ? VOID_PAYROLL_PUBLIC_DESCRIPTION : voidPayrollTool.description, {
|
|
84
|
+
payroll_id: z.string().uuid().describe("The payroll id from get_payroll, list_payrolls or run_payroll."),
|
|
85
|
+
confirmation_code: z
|
|
86
|
+
.string()
|
|
87
|
+
.min(1)
|
|
88
|
+
.max(1024)
|
|
89
|
+
.optional()
|
|
90
|
+
.describe("Leave it out on the first call. Then pass the code the first call returned, only after the user confirmed."),
|
|
91
|
+
reason: z
|
|
92
|
+
.string()
|
|
93
|
+
.trim()
|
|
94
|
+
.min(1)
|
|
95
|
+
.max(500)
|
|
96
|
+
.optional()
|
|
97
|
+
.describe("Required with confirmation_code: why the payroll is being voided, in a few words (for example 'Wrong hours')."),
|
|
98
|
+
employer_id: EMPLOYER_ID_OPTIONAL,
|
|
99
|
+
}, {
|
|
100
|
+
title: "Void Payroll",
|
|
101
|
+
readOnlyHint: false,
|
|
102
|
+
destructiveHint: true,
|
|
103
|
+
idempotentHint: false,
|
|
104
|
+
openWorldHint: true,
|
|
105
|
+
}, async (args) => toolResult(await executeVoidPayroll(args, context), context?.publicConnection));
|
|
106
|
+
}
|
package/manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"manifest_version": "0.3",
|
|
3
3
|
"name": "nannykeeper",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.19.0",
|
|
5
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",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nannykeeper/mcp-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.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": [
|