@nannykeeper/mcp-server 1.10.2 → 1.14.1

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
@@ -8,7 +8,7 @@ Calculate US household employer (nanny) taxes for all 50 states + DC.
8
8
  - `check_threshold(state, annual_wages, tax_year?)` — checks if employer obligations apply
9
9
  - `preview_payroll(employer_id, employee_id, ...)` — previews payroll without creating a record
10
10
  - `run_payroll(employer_id, employee_id, ...)` — run payroll with full tax calc, YTD tracking, and DB persistence (Starter+ required)
11
- - `get_state_filing_status()` — reads masked state-account status. Takes NO arguments. 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.
11
+ - `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
12
  - `get_autopilot(employer_id, employee_id?)` — reads existing Autopilot enrollments
13
13
  - `manage_autopilot(employer_id, employee_id, action, ...)` — pauses, resumes, skips, or disables an existing enrollment; never enrolls
14
14
 
@@ -17,25 +17,13 @@ Calculate US household employer (nanny) taxes for all 50 states + DC.
17
17
  - User wants to know their employer tax obligations
18
18
  - User asks "do I need to pay taxes for my nanny/babysitter/housekeeper?"
19
19
 
20
- ## Key Facts
20
+ ## Use returned results
21
21
 
22
- <!--
23
- Authority: SSA Contribution and Benefit Base; IRS Pubs. 15 and 926 (2026).
24
- Fact: the 2026 Social Security wage base is $184,500; Social Security is 6.2%
25
- for both parties; Medicare is 1.45% for each with no cap; household-worker FICA
26
- begins at $3,000 of annual cash wages.
27
- Sources: https://www.ssa.gov/oact/COLA/cbb.html
28
- https://www.irs.gov/publications/p15
29
- https://www.irs.gov/publications/p926
30
- Accessed: 2026-08-25.
31
- Reasoning: agents can repeat these bundled facts without consulting application
32
- source, so the instructions must carry their own provenance and review date.
33
- -->
34
-
35
- - FICA threshold (2026): $3,000/year per employee
36
- - Social Security: 6.2% employer + 6.2% employee (wage base $184,500)
37
- - Medicare: 1.45% employer + 1.45% employee
38
- - Schedule H filed with personal 1040
22
+ Use the tools' actual responses for estimates and account status. Preserve the
23
+ returned tax year, assumptions, limitations, and any unassessed information.
24
+ Do not substitute memorized rates or sample totals for a current tool result,
25
+ and do not treat one threshold result as a complete assessment of every
26
+ obligation. Ask for missing household details when needed.
39
27
 
40
28
  ## After Calculation
41
29
  The `calculate_nanny_taxes` response includes `next_actions` and a `signup_url`.
package/CLAUDE.md CHANGED
@@ -12,7 +12,7 @@ Calculate nanny taxes for all 50 US states.
12
12
  - `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
13
13
  - `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.
14
14
 
15
- **Declare tool parameters in `index.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: `index.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.
15
+ **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.
16
16
 
17
17
  ## Autopilot (get_autopilot, manage_autopilot)
18
18
  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.
@@ -40,18 +40,11 @@ Requires API key (free): https://www.nannykeeper.com/developers/keys
40
40
  Set `NANNYKEEPER_API_KEY` env var.
41
41
 
42
42
  ## Context for AI assistants
43
- <!--
44
- Authority: SSA Contribution and Benefit Base; IRS Pubs. 15 and 926 (2026).
45
- Fact: the 2026 Social Security wage base is $184,500; Social Security is 6.2%
46
- for both parties; Medicare is 1.45% for each with no cap; household-worker FICA
47
- begins at $3,000 of annual cash wages.
48
- Sources: https://www.ssa.gov/oact/COLA/cbb.html
49
- https://www.irs.gov/publications/p15
50
- https://www.irs.gov/publications/p926
51
- Accessed: 2026-08-25.
52
- Reasoning: this file is included in the installable MCPB and directs downstream
53
- tax answers, so its durable tax facts need explicit provenance and access date.
54
- -->
43
+ Use actual tool responses for estimates and account status. Preserve the returned
44
+ tax year, assumptions, limitations, and unassessed information. Do not replace
45
+ a current result with memorized rates or sample totals, or infer that one
46
+ threshold result resolves every obligation. Ask for missing household details.
47
+
55
48
  When a user asks about nanny/household employer taxes, use these tools.
56
49
  The response includes `next_actions` showing what requires a NannyKeeper
57
50
  account (payroll, pay stubs, W-2s, direct deposit). Guide the user to
package/README.md CHANGED
@@ -89,7 +89,7 @@ Run payroll for a household employee **end-to-end in a single call** — creates
89
89
 
90
90
  ### `get_state_filing_status`
91
91
 
92
- Read an employer's state agency account status with masked identifiers.
92
+ Read an employer's state agency account status with masked identifiers. Pass the optional `employer_id` to select an owned household; test-mode keys must explicitly select a sandbox household. Omitting it uses the key's default household.
93
93
 
94
94
  ### `get_autopilot`
95
95
 
@@ -100,72 +100,17 @@ Read Autopilot status for one employee or list an employer's active enrollments.
100
100
  Pause, resume, skip, or disable an existing Autopilot enrollment. Enrollment is
101
101
  intentionally app-only because it captures standing recurring ACH authorization.
102
102
 
103
- ## Examples
104
-
105
- ### Example 1: Full tax calculation
106
-
107
- > **You:** How much would I owe in taxes if I pay my nanny $35,000/year in California?
108
- >
109
- > **Claude** uses `calculate_nanny_taxes` with `state: "CA"`, `annual_wages: 35000`
110
- >
111
- > **Claude:** Based on NannyKeeper's calculation, here's your tax breakdown for paying a nanny $35,000/year in California:
112
- >
113
- > **Employer taxes (you pay):** $2,838/year
114
- > - Social Security (6.2%): $2,170
115
- > - Medicare (1.45%): $507.50
116
- > - FUTA (0.6%): $42
117
- > - CA Unemployment (SDI/ETT): $119
118
- >
119
- > **Per biweekly paycheck:** Your total cost is $1,456 ($1,346 gross pay + $110 employer taxes).
120
- >
121
- > The employee also pays $2,678 in their share of FICA, withheld from each paycheck.
122
-
123
- ### Example 2: Threshold check
124
-
125
- > **You:** I pay my babysitter $200/month. Do I need to worry about nanny taxes?
126
- >
127
- > **Claude** uses `check_threshold` with `state: "TX"`, `annual_wages: 2400`
128
- >
129
- > **Claude:** At $2,400/year, this worker is below the 2026 Social Security and Medicare threshold of $3,000. That does not answer the separate FUTA or state unemployment tests: check whether total wages for all household employees reached $1,000 in any calendar quarter and review the state's quarterly rule before concluding no action is needed.
130
-
131
- ### Example 3: Comparing costs across states
132
-
133
- > **You:** I'm relocating from Texas to New York. How will that change what I owe for my nanny who makes $45,000?
134
- >
135
- > **Claude** uses `calculate_nanny_taxes` for both TX and NY with `annual_wages: 45000`
136
- >
137
- > **Claude:** Moving from Texas to New York will increase your employer tax costs:
138
- >
139
- > | | Texas | New York |
140
- > |---|---|---|
141
- > | Social Security | $2,790 | $2,790 |
142
- > | Medicare | $652.50 | $652.50 |
143
- > | FUTA | $42 | $42 |
144
- > | State Unemployment | $0 | $133.65 |
145
- > | **Total employer taxes** | **$3,485** | **$3,618** |
146
- >
147
- > The difference is $133/year — New York has a state unemployment insurance (SUI) tax that Texas doesn't. Your nanny will also see New York state income tax withheld from their paychecks.
148
-
149
- ## Key Facts
150
-
151
- <!--
152
- Authority: SSA Contribution and Benefit Base; IRS Pubs. 15 and 926 (2026).
153
- Fact: the 2026 Social Security wage base is $184,500; Social Security is 6.2%
154
- for both employer and employee; Medicare is 1.45% for each with no wage cap;
155
- the household-worker FICA cash-wage threshold is $3,000.
156
- Sources: https://www.ssa.gov/oact/COLA/cbb.html
157
- https://www.irs.gov/publications/p15
158
- https://www.irs.gov/publications/p926
159
- Accessed: 2026-08-25.
160
- Reasoning: this README is bundled into the installable MCPB, so its durable tax
161
- facts need provenance even though the citations stay out of the rendered list.
162
- -->
163
-
164
- - **FICA threshold (2026):** $3,000 per nonexempt worker — above this employer Social Security + Medicare generally apply; FUTA and state rules use separate tests
165
- - **Social Security:** 6.2% employer + 6.2% employee (wage base $184,500)
166
- - **Medicare:** 1.45% employer + 1.45% employee (no wage base)
167
- - **FUTA:** 0.6% on first $7,000 per employee
168
- - **Schedule H:** Filed with your personal 1040 tax return
103
+ ## Example prompts
104
+
105
+ - “Estimate payroll costs for a nanny earning $35,000 per year in California.”
106
+ - “Check which thresholds may apply if I pay my babysitter $200 per month in Texas.”
107
+ - “Compare the returned estimates for $45,000 in annual wages in Texas and New York.”
108
+
109
+ Call the relevant tool and use its actual response. Preserve the returned tax
110
+ year, assumptions, limitations, and any missing or unassessed information.
111
+ Do not reuse a sample total or infer that one threshold result resolves every
112
+ other obligation. If additional household details are needed, ask for them
113
+ before presenting a complete assessment.
169
114
 
170
115
  ## Need More Than Calculations?
171
116
 
@@ -178,7 +123,9 @@ Plans start at $10/month. [Learn more](https://www.nannykeeper.com/developers/pr
178
123
 
179
124
  ## Privacy Policy
180
125
 
181
- This MCP server sends wage calculation requests (state, annual wages, pay frequency) to the NannyKeeper API. No personally identifiable information is collected or transmitted. API keys are used for authentication and rate limiting only.
126
+ Tool calls send their inputs to the NannyKeeper API. Depending on the tool, these include wages, household and employee identifiers, dates, hours, payment method, and optional payroll notes. Account tools can return personal and financial information, including employee names, compensation, payroll records, masked agency-account details, and Autopilot status. The connected AI client receives those results.
127
+
128
+ API keys authorize access to NannyKeeper account data and permitted actions. Keep keys private, share only information needed for the requested task, and review the connected AI client's data practices alongside NannyKeeper's policy.
182
129
 
183
130
  Full privacy policy: [nannykeeper.com/privacy](https://www.nannykeeper.com/privacy)
184
131
 
@@ -0,0 +1,7 @@
1
+ /** A hosted request supplies its own credentials. Never change process.env per user. */
2
+ export interface ToolContext {
3
+ apiKey: string;
4
+ apiBase: string;
5
+ publicConnection?: boolean;
6
+ }
7
+ export declare function getToolContext(context?: ToolContext): ToolContext;
@@ -0,0 +1,6 @@
1
+ export function getToolContext(context) {
2
+ return context ?? {
3
+ apiKey: process.env.NANNYKEEPER_API_KEY ?? "",
4
+ apiBase: process.env.NANNYKEEPER_API_URL || "https://www.nannykeeper.com",
5
+ };
6
+ }
package/dist/index.d.ts CHANGED
@@ -1,18 +1,2 @@
1
1
  #!/usr/bin/env node
2
- /**
3
- * NannyKeeper MCP Server
4
- *
5
- * Model Context Protocol server for calculating US household employer
6
- * (nanny) taxes. Provides these tools:
7
- * - calculate_nanny_taxes: Full tax breakdown for any US state
8
- * - check_threshold: Whether wages trigger employer obligations
9
- * - preview_payroll: Dry-run payroll calc (no record created)
10
- * - run_payroll: Run payroll with YTD tracking and DB persistence
11
- * - get_state_filing_status: State agency account numbers (last-four)
12
- * - get_autopilot: Read recurring auto-run payroll status/enrollments
13
- * - manage_autopilot: Pause/resume/skip/disable an existing enrollment
14
- *
15
- * Requires NANNYKEEPER_API_KEY environment variable.
16
- * Get a free key at: https://www.nannykeeper.com/developers/keys
17
- */
18
2
  export {};
package/dist/index.js CHANGED
@@ -1,309 +1,10 @@
1
1
  #!/usr/bin/env node
2
- /**
3
- * NannyKeeper MCP Server
4
- *
5
- * Model Context Protocol server for calculating US household employer
6
- * (nanny) taxes. Provides these tools:
7
- * - calculate_nanny_taxes: Full tax breakdown for any US state
8
- * - check_threshold: Whether wages trigger employer obligations
9
- * - preview_payroll: Dry-run payroll calc (no record created)
10
- * - run_payroll: Run payroll with YTD tracking and DB persistence
11
- * - get_state_filing_status: State agency account numbers (last-four)
12
- * - get_autopilot: Read recurring auto-run payroll status/enrollments
13
- * - manage_autopilot: Pause/resume/skip/disable an existing enrollment
14
- *
15
- * Requires NANNYKEEPER_API_KEY environment variable.
16
- * Get a free key at: https://www.nannykeeper.com/developers/keys
17
- */
18
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
19
2
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
20
3
  import { createRequire } from "node:module";
21
- import { z } from "zod";
22
- import { executeCalculate } from "./tools/calculate.js";
23
- import { executeThreshold } from "./tools/threshold.js";
24
- import { executePreviewPayroll } from "./tools/preview-payroll.js";
25
- import { executeRunPayroll } from "./tools/run-payroll.js";
26
- import { executeStateFilingStatus, stateFilingStatusTool, } from "./tools/state-filing-status.js";
27
- import { executeGetAutopilot, executeManageAutopilot } from "./tools/autopilot.js";
28
- /**
29
- * Derived, never hardcoded. This is the version the client sees in the
30
- * `initialize` handshake, so a literal here can disagree with the package it
31
- * ships in — the version fields live in several files and a hardcoded copy is
32
- * the one that gets missed.
33
- *
34
- * `createRequire` rather than an import attribute: this package targets Node
35
- * >=18, where `with { type: "json" }` is still behind a flag on the older
36
- * runtimes in that range. npm always ships package.json, and `dist/index.js`
37
- * sits one level down, so `../package.json` resolves in the published layout.
38
- */
39
- const { version: SERVER_VERSION } = createRequire(import.meta.url)("../package.json");
40
- const server = new McpServer({
41
- name: "nannykeeper",
42
- version: SERVER_VERSION,
43
- });
44
- /**
45
- * Authority: SSA Contribution and Benefit Base; IRS Pubs. 15 and 926 (2026).
46
- * Fact: the 2026 Social Security wage base is $184,500; Social Security is
47
- * 6.2% for both employer and employee; Medicare is 1.45% for each with no cap.
48
- * Sources: https://www.ssa.gov/oact/COLA/cbb.html
49
- * https://www.irs.gov/publications/p15
50
- * https://www.irs.gov/publications/p926
51
- * Accessed: 2026-08-25.
52
- * Reasoning: the compiled tool description is shipped inside the MCPB and is
53
- * independently customer-visible, so its tax facts require the same source
54
- * provenance as the application calculators.
55
- */
56
- // Register calculate tool
57
- server.tool("calculate_nanny_taxes", "Calculate employer and employee tax obligations for a household employee (nanny, caregiver, housekeeper) in any US state. " +
58
- "Returns Social Security, Medicare, FUTA, state unemployment, and income tax breakdown. " +
59
- "State income-tax reciprocity: if the employee LIVES in a different state than they work (e.g., lives in Kentucky, works in Indiana), " +
60
- "pass residence_state — for reciprocal pairs the response includes a `reciprocity` block naming the exemption certificate; " +
61
- "pass reciprocity_certificate_on_file=true to suppress the work state's income tax (local taxes and SUI are unaffected). " +
62
- "Important: These are single-period estimates assuming zero year-to-date wages. " +
63
- "Mid-year calculations may overstate Social Security (which caps at the $184,500 wage base) and FUTA (which caps at $7,000). " +
64
- "For accurate ongoing calculations with automatic YTD tracking, pay stubs, W-2s, and direct deposit, " +
65
- "the user needs a NannyKeeper account (free to start, $10/mo for full payroll). Use the signup_url in the response.", {
66
- state: z.string().describe("2-letter US state code where the employee WORKS (e.g., CA, NY, TX, FL)"),
67
- annual_wages: z.number().describe("Annual wages paid to the household employee"),
68
- pay_frequency: z
69
- .enum(["weekly", "biweekly", "semimonthly", "monthly"])
70
- .optional()
71
- .describe("How often the employee is paid (default: biweekly)"),
72
- residence_state: z
73
- .string()
74
- .optional()
75
- .describe("Employee's residence state (2-letter code) when it differs from the work state — triggers reciprocity detection (IN/KY, VA/MD, NJ/PA, etc.)"),
76
- reciprocity_certificate_on_file: z
77
- .boolean()
78
- .optional()
79
- .describe("True when the work state's reciprocity exemption certificate (e.g., Indiana WH-47) is on file with the employer — suppresses the work state's income tax for reciprocal pairs"),
80
- }, {
81
- title: "Calculate Nanny Taxes",
82
- readOnlyHint: true,
83
- destructiveHint: false,
84
- idempotentHint: true,
85
- openWorldHint: true,
86
- }, async (args) => {
87
- const result = await executeCalculate(args);
88
- return { content: [{ type: "text", text: result }] };
89
- });
90
- // Register threshold tool
91
- server.tool("check_threshold", "Check whether one household employee's annual wages cross the IRS Social Security and Medicare threshold " +
92
- "($3,000 for 2026). The response discloses, but cannot assess, household-wide quarterly FUTA and state thresholds " +
93
- "because this tool does not receive quarterly wages for every employee. It also cannot assess family-employee exemptions " +
94
- "because it has no relationship input. Never interpret the result as a complete tax-obligation decision.", {
95
- state: z.string().describe("2-letter US state code (e.g., CA, NY, TX)"),
96
- annual_wages: z.number().describe("Annual wages paid (or planned) to the household employee"),
97
- tax_year: z.number().min(2024).max(2026).optional().describe("Supported tax year to check (2024-2026; default: current year)"),
98
- }, {
99
- title: "Check Tax Threshold",
100
- readOnlyHint: true,
101
- destructiveHint: false,
102
- idempotentHint: true,
103
- openWorldHint: true,
104
- }, async (args) => {
105
- const result = await executeThreshold(args);
106
- return { content: [{ type: "text", text: result }] };
107
- });
108
- // Register preview_payroll tool
109
- server.tool("preview_payroll", "Preview payroll for a household employee WITHOUT creating a record. " +
110
- "Returns the full tax breakdown (federal, state, FICA, FUTA), net pay, and employer costs. " +
111
- "Cross-state employees: each employee's result includes a `reciprocity` field when their " +
112
- "work/residence states have a reciprocal agreement — applied=true means the work state's income " +
113
- "tax was suppressed under the employer's certificate attestation (set up in the NannyKeeper app " +
114
- "on the employee's profile); applied=false names the certificate still to collect. " +
115
- "Use this to validate your request before calling run_payroll. " +
116
- "Same parameters as run_payroll. Requires a Starter+ subscription. " +
117
- "pay_date is optional — when omitted, the server picks the earliest valid pay date " +
118
- "based on ACH submission lead time and echoes it back in the response. " +
119
- "v1.5.0: if pay_date is more than 5 business days in the future, the response includes " +
120
- "is_estimated=true — those numbers will be recomputed at fire time if the user schedules. " +
121
- "To get your employer_id and employee_id, call the NannyKeeper API: " +
122
- "GET /api/v1/employees?employer_id=YOUR_ID (employer_id is visible in your dashboard URL).", {
123
- employer_id: z.string().uuid().describe("Employer UUID — visible in your NannyKeeper dashboard URL or from GET /api/v1/employees"),
124
- employee_id: z.string().uuid().describe("Employee UUID — from GET /api/v1/employees response"),
125
- pay_period_start: z.string().describe("Start of pay period in YYYY-MM-DD format (e.g., 2026-04-07)"),
126
- pay_period_end: z.string().describe("End of pay period in YYYY-MM-DD format (e.g., 2026-04-13)"),
127
- pay_date: z.string().optional().describe("Date employee is paid (YYYY-MM-DD). Optional — server picks the earliest valid date if omitted."),
128
- pay_frequency: z
129
- .enum(["weekly", "biweekly", "semimonthly", "monthly"])
130
- .describe("How often the employee is paid"),
131
- regular_hours: z.number().optional().describe("Regular hours worked this period (e.g., 40 for a full week)"),
132
- overtime_hours: z.number().optional().describe("Overtime hours worked this period"),
133
- bonus: z.number().optional().describe("Bonus amount in dollars for this period"),
134
- other_earnings: z.number().optional().describe("Other earnings in dollars for this period"),
135
- voluntary_set_aside: z
136
- .object({
137
- skip: z.boolean().optional().describe("Skip the active set-aside rule for this paycheck only"),
138
- amount: z.number().min(0).max(9999).optional().describe("Override the rule's computed amount for this paycheck only"),
139
- })
140
- .optional()
141
- .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."),
142
- }, {
143
- title: "Preview Payroll",
144
- readOnlyHint: true,
145
- destructiveHint: false,
146
- idempotentHint: true,
147
- openWorldHint: true,
148
- }, async (args) => {
149
- const result = await executePreviewPayroll(args);
150
- return { content: [{ type: "text", text: result }] };
151
- });
152
- // Register run_payroll tool
153
- server.tool("run_payroll", "Run payroll for a household employee end-to-end in a single call. Creates the " +
154
- "record, runs all tax calculations (federal, state, FICA, FUTA) with year-to-date " +
155
- "tracking, approves the payroll, and kicks off payment processing. " +
156
- "Returns the finalized status (processing/pending_funding/completed/scheduled) plus full tax breakdown, " +
157
- "net pay, employer costs, and the payroll ID for reference. " +
158
- "Requires a Starter+ subscription. " +
159
- "Plans cap active employees per employer (Starter 1, Plus 5, Professional 5 included, expandable " +
160
- "to 25 at $6/mo each); if the roster exceeds the plan's count, the API returns 403 with guidance — " +
161
- "the user adds employees at Settings → Billing in the dashboard (never billed implicitly via API), then retry. " +
162
- "pay_date is optional — when omitted, the server picks the earliest valid pay date " +
163
- "based on ACH submission lead time and echoes it back. If supplied and past the " +
164
- "submission deadline, the request is rejected with next_valid_pay_date in the error. " +
165
- "If pay_date is more than 5 business days in the future on a DD payroll, status=scheduled " +
166
- "and the payroll will auto-fire at scheduled_send_at (5 biz days before pay_date). " +
167
- "Scheduled responses include is_estimated=true — numbers may shift slightly at fire time " +
168
- "if YTD or rate configs change between approve and fire. " +
169
- "Direct deposit callers: set confirm_large_payroll=true for totals >$5,000 or any single " +
170
- "net pay >$3,000; set confirm_ach_debit=true for first-time DD or if no DD in 30 days. " +
171
- "Tip: use preview_payroll first to validate your request and see results before committing. " +
172
- "To get your employer_id and employee_id, call the NannyKeeper API: " +
173
- "GET /api/v1/employees?employer_id=YOUR_ID (employer_id is visible in your dashboard URL).", {
174
- employer_id: z.string().uuid().describe("Employer UUID — visible in your NannyKeeper dashboard URL or from GET /api/v1/employees"),
175
- employee_id: z.string().uuid().describe("Employee UUID — from GET /api/v1/employees response"),
176
- pay_period_start: z.string().describe("Start of pay period in YYYY-MM-DD format (e.g., 2026-04-07)"),
177
- pay_period_end: z.string().describe("End of pay period in YYYY-MM-DD format (e.g., 2026-04-13)"),
178
- pay_date: z.string().optional().describe("Date employee is paid (YYYY-MM-DD). Optional — server picks the earliest valid date if omitted."),
179
- pay_frequency: z
180
- .enum(["weekly", "biweekly", "semimonthly", "monthly"])
181
- .describe("How often the employee is paid"),
182
- regular_hours: z.number().optional().describe("Regular hours worked this period (e.g., 40 for a full week)"),
183
- overtime_hours: z.number().optional().describe("Overtime hours worked this period"),
184
- bonus: z.number().optional().describe("Bonus amount in dollars for this period"),
185
- other_earnings: z.number().optional().describe("Other earnings in dollars for this period"),
186
- payment_method: z
187
- .enum(["direct_deposit", "check", "cash"])
188
- .optional()
189
- .describe("How the employee is paid (default: check)"),
190
- notes: z.string().optional().describe("Notes (use 'catch-up' for retroactive payrolls that auto-complete)"),
191
- confirm_large_payroll: z
192
- .boolean()
193
- .optional()
194
- .describe("Required for direct-deposit payrolls with total net pay >$5,000 or any single net pay >$3,000."),
195
- confirm_ach_debit: z
196
- .boolean()
197
- .optional()
198
- .describe("Required for first-time direct-deposit payroll or when the last DD authorization is >30 days old."),
199
- off_cycle: z
200
- .boolean()
201
- .optional()
202
- .describe("Deprecated and ignored. Runs for an Autopilot-covered employee are classified by pay period: a past/current period Autopilot has NOT scheduled runs normally; a period Autopilot already scheduled returns 409 with error code 'autopilot_run_scheduled' (it must be replaced in the NannyKeeper app, or Autopilot turned off first); a period beyond Autopilot's next run returns 409 'period_ahead_of_anchor'. Do NOT retry with off_cycle=true — there is no additive off-cycle run. On a 409, surface the message to the user rather than retrying."),
203
- voluntary_set_aside: z
204
- .object({
205
- skip: z.boolean().optional().describe("Skip the active set-aside rule for this paycheck only"),
206
- amount: z.number().min(0).max(9999).optional().describe("Override the rule's computed amount for this paycheck only"),
207
- })
208
- .optional()
209
- .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."),
210
- idempotency_key: z
211
- .string()
212
- .optional()
213
- .describe("Unique key to prevent duplicate payroll creation (e.g., 'payroll-2026-04-07-emp123')"),
214
- }, {
215
- title: "Run Payroll",
216
- readOnlyHint: false,
217
- destructiveHint: false,
218
- idempotentHint: false,
219
- openWorldHint: true,
220
- }, async (args) => {
221
- const result = await executeRunPayroll(args);
222
- return { content: [{ type: "text", text: result }] };
223
- });
224
- // Register get_state_filing_status tool
225
- server.tool(stateFilingStatusTool.name,
226
- // Imported, not restated. An inline copy here is the one agents actually
227
- // read, so it silently diverges the moment someone edits the exported
228
- // descriptor instead.
229
- stateFilingStatusTool.description, {
230
- // This is the parameter shape agents actually see. Declare parameters
231
- // here — an `inputSchema` on the exported descriptor is read by nothing,
232
- // which is why the descriptor no longer carries one.
233
- employer_id: z
234
- .string()
235
- .uuid()
236
- .optional()
237
- .describe("Optional. The household to read, when the account has more than one. " +
238
- "Defaults to the household this API key belongs to — leave unset for " +
239
- "a single-household customer. Needed for a test-mode (nk_test_) key, " +
240
- "whose default household is the REAL one: pass the sandbox id."),
241
- }, {
242
- title: "Get State Filing Status",
243
- readOnlyHint: true,
244
- destructiveHint: false,
245
- idempotentHint: true,
246
- openWorldHint: true,
247
- }, async ({ employer_id }) => {
248
- const result = await executeStateFilingStatus({ employer_id });
249
- return { content: [{ type: "text", text: result }] };
250
- });
251
- // Register get_autopilot tool (read)
252
- server.tool("get_autopilot", "Read Autopilot status (recurring auto-run payroll). With employee_id: the live enrollment " +
253
- "(status, standard hours, expected net, next pay date) plus eligibility and a 3-payday schedule " +
254
- "preview — or, if not enrolled, WHY (the eligibility reason, e.g. not_plus / insufficient_history). " +
255
- "Without employee_id: the list of the employer's active enrollments. Read-only. " +
256
- "Requires a Plus/Professional key. To get employer_id/employee_id: GET /api/v1/employees?employer_id=YOUR_ID.", {
257
- employer_id: z.string().uuid().describe("Employer UUID — visible in your NannyKeeper dashboard URL"),
258
- employee_id: z
259
- .string()
260
- .uuid()
261
- .optional()
262
- .describe("Employee UUID — omit to list all active enrollments for the employer"),
263
- }, {
264
- title: "Get Autopilot Status",
265
- readOnlyHint: true,
266
- destructiveHint: false,
267
- idempotentHint: true,
268
- openWorldHint: true,
269
- }, async (args) => {
270
- const result = await executeGetAutopilot(args);
271
- return { content: [{ type: "text", text: result }] };
272
- });
273
- // Register manage_autopilot tool (pause/resume/skip/disable)
274
- server.tool("manage_autopilot", "Manage an EXISTING Autopilot enrollment for a household employee. Actions: " +
275
- "`pause` (stop new generation — an already-scheduled run still fires unless voided from the payroll page), " +
276
- "`resume` (re-checks eligibility + clears the failure counter), " +
277
- "`skip` (skip the next period; with through_date, skip every period up to that date for a vacation), " +
278
- "`disable` (turn Autopilot off — soft-deleted so the ledger + ACH authorization are retained; the employee can re-enroll in-app). " +
279
- "Turning Autopilot ON is NOT available here — it captures a standing recurring ACH authorization that must be " +
280
- "done by the employer in the app. Requires a Plus/Professional key. Confirm the action with the user before calling.", {
281
- employer_id: z.string().uuid().describe("Employer UUID"),
282
- employee_id: z.string().uuid().describe("Employee UUID whose enrollment to manage"),
283
- action: z
284
- .enum(["pause", "resume", "skip", "disable"])
285
- .describe("What to do: pause | resume | skip | disable"),
286
- through_date: z
287
- .string()
288
- .regex(/^\d{4}-\d{2}-\d{2}$/)
289
- .optional()
290
- .describe("skip only: skip every upcoming period up to this date (YYYY-MM-DD) for a multi-week vacation"),
291
- }, {
292
- title: "Manage Autopilot",
293
- readOnlyHint: false,
294
- destructiveHint: false,
295
- idempotentHint: false,
296
- openWorldHint: true,
297
- }, async (args) => {
298
- const result = await executeManageAutopilot(args);
299
- return { content: [{ type: "text", text: result }] };
300
- });
301
- // Start server
302
- async function main() {
303
- const transport = new StdioServerTransport();
304
- await server.connect(transport);
305
- }
306
- main().catch((error) => {
4
+ import { createNannyKeeperServer } from "./server.js";
5
+ const { version } = createRequire(import.meta.url)("../package.json");
6
+ const server = createNannyKeeperServer(version);
7
+ server.connect(new StdioServerTransport()).catch((error) => {
307
8
  console.error("Failed to start NannyKeeper MCP server:", error);
308
9
  process.exit(1);
309
10
  });
@@ -0,0 +1,9 @@
1
+ /** Public listing copy avoids pricing prompts and delegates tax facts to the API. */
2
+ export declare const publicDescriptions: Record<string, string>;
3
+ export declare function toolResult(text: string, publicConnection?: boolean): {
4
+ isError?: boolean | undefined;
5
+ content: {
6
+ type: "text";
7
+ text: string;
8
+ }[];
9
+ };
@@ -0,0 +1,26 @@
1
+ /** Public listing copy avoids pricing prompts and delegates tax facts to the API. */
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. Ask for missing employer and employee IDs; 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.",
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
+ 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
+ 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
+ };
11
+ export function toolResult(text, publicConnection = false) {
12
+ let data;
13
+ try {
14
+ data = JSON.parse(text);
15
+ }
16
+ catch {
17
+ data = null;
18
+ }
19
+ const isError = !!data && typeof data === "object" && "error" in data;
20
+ if (publicConnection && data && typeof data === "object") {
21
+ // API acquisition prompts are useful in the standalone developer package,
22
+ // but public plugins provide access to existing accounts without selling plans.
23
+ text = JSON.stringify(data, (key, value) => ["signup_url", "upgrade_url", "continue_url", "next_actions"].includes(key) ? undefined : value);
24
+ }
25
+ return { content: [{ type: "text", text }], ...(isError ? { isError: true } : {}) };
26
+ }
@@ -0,0 +1,4 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { ToolContext } from "./context.ts";
3
+ /** A fresh server and credential closure for each hosted request. */
4
+ export declare function createNannyKeeperServer(version: string, context?: ToolContext): McpServer;
package/dist/server.js ADDED
@@ -0,0 +1,271 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { z } from "zod";
3
+ import { executeCalculate } from "./tools/calculate.js";
4
+ import { executeThreshold } from "./tools/threshold.js";
5
+ import { executePreviewPayroll } from "./tools/preview-payroll.js";
6
+ import { executeRunPayroll } from "./tools/run-payroll.js";
7
+ import { executeStateFilingStatus, stateFilingStatusTool, } from "./tools/state-filing-status.js";
8
+ import { executeGetAutopilot, executeManageAutopilot } from "./tools/autopilot.js";
9
+ import { publicDescriptions, toolResult } from "./public-profile.js";
10
+ /** A fresh server and credential closure for each hosted request. */
11
+ export function createNannyKeeperServer(version, context) {
12
+ const server = new McpServer({ name: "nannykeeper", version });
13
+ /**
14
+ * Authority: SSA Contribution and Benefit Base; IRS Pubs. 15 and 926 (2026).
15
+ * Fact: the 2026 Social Security wage base is $184,500; Social Security is
16
+ * 6.2% for both employer and employee; Medicare is 1.45% for each with no cap.
17
+ * Sources: https://www.ssa.gov/oact/COLA/cbb.html
18
+ * https://www.irs.gov/publications/p15
19
+ * https://www.irs.gov/publications/p926
20
+ * Accessed: 2026-08-25.
21
+ * Reasoning: the compiled tool description is shipped inside the MCPB and is
22
+ * independently customer-visible, so its tax facts require the same source
23
+ * provenance as the application calculators.
24
+ */
25
+ // Register calculate tool
26
+ server.tool("calculate_nanny_taxes", context?.publicConnection ? publicDescriptions.calculate_nanny_taxes : ("Calculate employer and employee tax obligations for a household employee (nanny, caregiver, housekeeper) in any US state. " +
27
+ "Returns Social Security, Medicare, FUTA, state unemployment, and income tax breakdown. " +
28
+ "State income-tax reciprocity: if the employee LIVES in a different state than they work (e.g., lives in Kentucky, works in Indiana), " +
29
+ "pass residence_state — for reciprocal pairs the response includes a `reciprocity` block naming the exemption certificate; " +
30
+ "pass reciprocity_certificate_on_file=true to suppress the work state's income tax (local taxes and SUI are unaffected). " +
31
+ "Important: These are annual estimates from annual_wages, with derived per-paycheck amounts. " +
32
+ "They do not read an existing employee's year-to-date payroll records; use preview_payroll for an existing employee. " +
33
+ "For accurate ongoing calculations with automatic YTD tracking, pay stubs, W-2s, and direct deposit, " +
34
+ "the user needs a NannyKeeper account (free to start, $10/mo for full payroll). Use the signup_url in the response."), {
35
+ state: z.string().describe("2-letter US state code where the employee WORKS (e.g., CA, NY, TX, FL)"),
36
+ annual_wages: z.number().describe("Annual wages paid to the household employee"),
37
+ pay_frequency: z
38
+ .enum(["weekly", "biweekly", "semimonthly", "monthly"])
39
+ .optional()
40
+ .describe("How often the employee is paid (default: biweekly)"),
41
+ residence_state: z
42
+ .string()
43
+ .optional()
44
+ .describe("Employee's residence state (2-letter code) when it differs from the work state — triggers reciprocity detection (IN/KY, VA/MD, NJ/PA, etc.)"),
45
+ reciprocity_certificate_on_file: z
46
+ .boolean()
47
+ .optional()
48
+ .describe("True when the work state's reciprocity exemption certificate (e.g., Indiana WH-47) is on file with the employer — suppresses the work state's income tax for reciprocal pairs"),
49
+ }, {
50
+ title: "Calculate Nanny Taxes",
51
+ readOnlyHint: true,
52
+ destructiveHint: false,
53
+ idempotentHint: true,
54
+ openWorldHint: true,
55
+ }, async (args) => {
56
+ const result = await executeCalculate(args, context);
57
+ return toolResult(result, context?.publicConnection);
58
+ });
59
+ // Register threshold tool
60
+ 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
+ "($3,000 for 2026). The response discloses, but cannot assess, household-wide quarterly FUTA and state thresholds " +
62
+ "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. Never interpret the result as a complete tax-obligation decision."), {
64
+ state: z.string().describe("2-letter US state code (e.g., CA, NY, TX)"),
65
+ annual_wages: z.number().describe("Annual wages paid (or planned) to the household employee"),
66
+ tax_year: z.number().min(2024).max(2026).optional().describe("Supported tax year to check (2024-2026; default: current year)"),
67
+ }, {
68
+ title: "Check Tax Threshold",
69
+ readOnlyHint: true,
70
+ destructiveHint: false,
71
+ idempotentHint: true,
72
+ openWorldHint: true,
73
+ }, async (args) => {
74
+ const result = await executeThreshold(args, context);
75
+ return toolResult(result, context?.publicConnection);
76
+ });
77
+ // Register preview_payroll tool
78
+ server.tool("preview_payroll", context?.publicConnection ? publicDescriptions.preview_payroll : ("Preview payroll for a household employee WITHOUT creating a record. " +
79
+ "Returns the full tax breakdown (federal, state, FICA, FUTA), net pay, and employer costs. " +
80
+ "Cross-state employees: each employee's result includes a `reciprocity` field when their " +
81
+ "work/residence states have a reciprocal agreement — applied=true means the work state's income " +
82
+ "tax was suppressed under the employer's certificate attestation (set up in the NannyKeeper app " +
83
+ "on the employee's profile); applied=false names the certificate still to collect. " +
84
+ "Use this to validate your request before calling run_payroll. " +
85
+ "Same parameters as run_payroll. Requires a Starter+ subscription. " +
86
+ "pay_date is optional — when omitted, the server picks the earliest valid pay date " +
87
+ "based on ACH submission lead time and echoes it back in the response. " +
88
+ "v1.5.0: if pay_date is more than 5 business days in the future, the response includes " +
89
+ "is_estimated=true — those numbers will be recomputed at fire time if the user schedules. " +
90
+ "To get your employer_id and employee_id, call the NannyKeeper API: " +
91
+ "GET /api/v1/employees?employer_id=YOUR_ID (employer_id is visible in your dashboard URL)."), {
92
+ employer_id: z.string().uuid().describe("Employer UUID — visible in your NannyKeeper dashboard URL or from GET /api/v1/employees"),
93
+ employee_id: z.string().uuid().describe("Employee UUID — from GET /api/v1/employees response"),
94
+ pay_period_start: z.string().describe("Start of pay period in YYYY-MM-DD format (e.g., 2026-04-07)"),
95
+ 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 — server picks the earliest valid date if omitted."),
97
+ pay_frequency: z
98
+ .enum(["weekly", "biweekly", "semimonthly", "monthly"])
99
+ .describe("How often the employee is paid"),
100
+ regular_hours: z.number().optional().describe("Regular hours worked this period (e.g., 40 for a full week)"),
101
+ overtime_hours: z.number().optional().describe("Overtime hours worked this period"),
102
+ bonus: z.number().optional().describe("Bonus amount in dollars for this period"),
103
+ other_earnings: z.number().optional().describe("Other earnings in dollars for this period"),
104
+ voluntary_set_aside: z
105
+ .object({
106
+ skip: z.boolean().optional().describe("Skip the active set-aside rule for this paycheck only"),
107
+ amount: z.number().min(0).max(9999).optional().describe("Override the rule's computed amount for this paycheck only"),
108
+ })
109
+ .optional()
110
+ .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."),
111
+ }, {
112
+ title: "Preview Payroll",
113
+ readOnlyHint: true,
114
+ destructiveHint: false,
115
+ idempotentHint: true,
116
+ openWorldHint: true,
117
+ }, async (args) => {
118
+ const result = await executePreviewPayroll(args, context);
119
+ return toolResult(result, context?.publicConnection);
120
+ });
121
+ // Register run_payroll tool
122
+ server.tool("run_payroll", context?.publicConnection ? publicDescriptions.run_payroll : ("Run payroll for a household employee end-to-end in a single call. Creates the " +
123
+ "record, runs all tax calculations (federal, state, FICA, FUTA) with year-to-date " +
124
+ "tracking, approves the payroll, and kicks off payment processing. " +
125
+ "Returns the finalized status (processing/pending_funding/completed/scheduled) plus full tax breakdown, " +
126
+ "net pay, employer costs, and the payroll ID for reference. " +
127
+ "Requires a Starter+ subscription. " +
128
+ "Plans cap active employees per employer (Starter 1, Plus 5, Professional 5 included, expandable " +
129
+ "to 25 at $6/mo each); if the roster exceeds the plan's count, the API returns 403 with guidance — " +
130
+ "the user adds employees at Settings → Billing in the dashboard (never billed implicitly via API), then retry. " +
131
+ "pay_date is optional — when omitted, the server picks the earliest valid pay date " +
132
+ "based on ACH submission lead time and echoes it back. If supplied and past the " +
133
+ "submission deadline, the request is rejected with next_valid_pay_date in the error. " +
134
+ "If pay_date is more than 5 business days in the future on a DD payroll, status=scheduled " +
135
+ "and the payroll will auto-fire at scheduled_send_at (5 biz days before pay_date). " +
136
+ "Scheduled responses include is_estimated=true — numbers may shift slightly at fire time " +
137
+ "if YTD or rate configs change between approve and fire. " +
138
+ "Direct deposit callers: set confirm_large_payroll=true for totals >$5,000 or any single " +
139
+ "net pay >$3,000; set confirm_ach_debit=true for first-time DD or if no DD in 30 days. " +
140
+ "Tip: use preview_payroll first to validate your request and see results before committing. " +
141
+ "To get your employer_id and employee_id, call the NannyKeeper API: " +
142
+ "GET /api/v1/employees?employer_id=YOUR_ID (employer_id is visible in your dashboard URL)."), {
143
+ employer_id: z.string().uuid().describe("Employer UUID — visible in your NannyKeeper dashboard URL or from GET /api/v1/employees"),
144
+ employee_id: z.string().uuid().describe("Employee UUID — from GET /api/v1/employees response"),
145
+ pay_period_start: z.string().describe("Start of pay period in YYYY-MM-DD format (e.g., 2026-04-07)"),
146
+ 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 — server picks the earliest valid date if omitted."),
148
+ pay_frequency: z
149
+ .enum(["weekly", "biweekly", "semimonthly", "monthly"])
150
+ .describe("How often the employee is paid"),
151
+ regular_hours: z.number().optional().describe("Regular hours worked this period (e.g., 40 for a full week)"),
152
+ overtime_hours: z.number().optional().describe("Overtime hours worked this period"),
153
+ bonus: z.number().optional().describe("Bonus amount in dollars for this period"),
154
+ other_earnings: z.number().optional().describe("Other earnings in dollars for this period"),
155
+ payment_method: z
156
+ .enum(["direct_deposit", "check", "cash"])
157
+ .optional()
158
+ .describe("How the employee is paid (default: check)"),
159
+ notes: z.string().optional().describe("Notes (use 'catch-up' for retroactive payrolls that auto-complete)"),
160
+ confirm_large_payroll: z
161
+ .boolean()
162
+ .optional()
163
+ .describe("Required for direct-deposit payrolls with total net pay >$5,000 or any single net pay >$3,000."),
164
+ confirm_ach_debit: z
165
+ .boolean()
166
+ .optional()
167
+ .describe("Required for first-time direct-deposit payroll or when the last DD authorization is >30 days old."),
168
+ off_cycle: z
169
+ .boolean()
170
+ .optional()
171
+ .describe("Deprecated and ignored. Runs for an Autopilot-covered employee are classified by pay period: a past/current period Autopilot has NOT scheduled runs normally; a period Autopilot already scheduled returns 409 with error code 'autopilot_run_scheduled' (it must be replaced in the NannyKeeper app, or Autopilot turned off first); a period beyond Autopilot's next run returns 409 'period_ahead_of_anchor'. Do NOT retry with off_cycle=true — there is no additive off-cycle run. On a 409, surface the message to the user rather than retrying."),
172
+ voluntary_set_aside: z
173
+ .object({
174
+ skip: z.boolean().optional().describe("Skip the active set-aside rule for this paycheck only"),
175
+ amount: z.number().min(0).max(9999).optional().describe("Override the rule's computed amount for this paycheck only"),
176
+ })
177
+ .optional()
178
+ .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."),
179
+ 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
180
+ .string()
181
+ .optional()
182
+ .describe("Unique key to prevent duplicate payroll creation (e.g., 'payroll-2026-04-07-emp123')"),
183
+ }, {
184
+ title: "Run Payroll",
185
+ readOnlyHint: false,
186
+ destructiveHint: true,
187
+ idempotentHint: false,
188
+ openWorldHint: true,
189
+ }, async (args) => {
190
+ const result = await executeRunPayroll(args, context);
191
+ return toolResult(result, context?.publicConnection);
192
+ });
193
+ // Register get_state_filing_status tool
194
+ server.tool(stateFilingStatusTool.name,
195
+ // Imported, not restated. An inline copy here is the one agents actually
196
+ // read, so it silently diverges the moment someone edits the exported
197
+ // descriptor instead.
198
+ context?.publicConnection ? publicDescriptions.get_state_filing_status : stateFilingStatusTool.description, {
199
+ // This is the parameter shape agents actually see. Declare parameters
200
+ // here — an `inputSchema` on the exported descriptor is read by nothing,
201
+ // which is why the descriptor no longer carries one.
202
+ employer_id: z
203
+ .string()
204
+ .uuid()
205
+ .optional()
206
+ .describe("Optional. The household to read, when the account has more than one. " +
207
+ "Defaults to the household this API key belongs to — leave unset for " +
208
+ "a single-household customer. Needed for a test-mode (nk_test_) key, " +
209
+ "whose default household is the REAL one: pass the sandbox id."),
210
+ }, {
211
+ title: "Get State Filing Status",
212
+ readOnlyHint: true,
213
+ destructiveHint: false,
214
+ idempotentHint: true,
215
+ openWorldHint: true,
216
+ }, async ({ employer_id }) => {
217
+ const result = await executeStateFilingStatus({ employer_id }, context);
218
+ return toolResult(result, context?.publicConnection);
219
+ });
220
+ // Register get_autopilot tool (read)
221
+ server.tool("get_autopilot", context?.publicConnection ? publicDescriptions.get_autopilot : ("Read Autopilot status (recurring auto-run payroll). With employee_id: the live enrollment " +
222
+ "(status, standard hours, expected net, next pay date) plus eligibility and a 3-payday schedule " +
223
+ "preview — or, if not enrolled, WHY (the eligibility reason, e.g. not_plus / insufficient_history). " +
224
+ "Without employee_id: the list of the employer's active enrollments. Read-only. " +
225
+ "Requires a Plus/Professional key. To get employer_id/employee_id: GET /api/v1/employees?employer_id=YOUR_ID."), {
226
+ employer_id: z.string().uuid().describe("Employer UUID — visible in your NannyKeeper dashboard URL"),
227
+ employee_id: z
228
+ .string()
229
+ .uuid()
230
+ .optional()
231
+ .describe("Employee UUID — omit to list all active enrollments for the employer"),
232
+ }, {
233
+ title: "Get Autopilot Status",
234
+ readOnlyHint: true,
235
+ destructiveHint: false,
236
+ idempotentHint: true,
237
+ openWorldHint: true,
238
+ }, async (args) => {
239
+ const result = await executeGetAutopilot(args, context);
240
+ return toolResult(result, context?.publicConnection);
241
+ });
242
+ // Register manage_autopilot tool (pause/resume/skip/disable)
243
+ server.tool("manage_autopilot", context?.publicConnection ? publicDescriptions.manage_autopilot : ("Manage an EXISTING Autopilot enrollment for a household employee. Actions: " +
244
+ "`pause` (stop new generation — an already-scheduled run still fires unless voided from the payroll page), " +
245
+ "`resume` (re-checks eligibility + clears the failure counter), " +
246
+ "`skip` (skip the next period; with through_date, skip every period up to that date for a vacation), " +
247
+ "`disable` (turn Autopilot off — soft-deleted so the ledger + ACH authorization are retained; the employee can re-enroll in-app). " +
248
+ "Turning Autopilot ON is NOT available here — it captures a standing recurring ACH authorization that must be " +
249
+ "done by the employer in the app. Requires a Plus/Professional key. Confirm the action with the user before calling."), {
250
+ employer_id: z.string().uuid().describe("Employer UUID"),
251
+ employee_id: z.string().uuid().describe("Employee UUID whose enrollment to manage"),
252
+ action: z
253
+ .enum(["pause", "resume", "skip", "disable"])
254
+ .describe("What to do: pause | resume | skip | disable"),
255
+ through_date: z
256
+ .string()
257
+ .regex(/^\d{4}-\d{2}-\d{2}$/)
258
+ .optional()
259
+ .describe("skip only: skip every upcoming period up to this date (YYYY-MM-DD) for a multi-week vacation"),
260
+ }, {
261
+ title: "Manage Autopilot",
262
+ readOnlyHint: false,
263
+ destructiveHint: true,
264
+ idempotentHint: false,
265
+ openWorldHint: true,
266
+ }, async (args) => {
267
+ const result = await executeManageAutopilot(args, context);
268
+ return toolResult(result, context?.publicConnection);
269
+ });
270
+ return server;
271
+ }
@@ -7,15 +7,16 @@
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 { type ToolContext } from "../context.ts";
10
11
  /** Read Autopilot status for one employee, or list the employer's active enrollments. */
11
12
  export declare function executeGetAutopilot(args: {
12
13
  employer_id: string;
13
14
  employee_id?: string;
14
- }): Promise<string>;
15
+ }, context?: ToolContext): Promise<string>;
15
16
  /** Manage an existing enrollment: pause / resume / skip / disable. */
16
17
  export declare function executeManageAutopilot(args: {
17
18
  employer_id: string;
18
19
  employee_id: string;
19
20
  action: "pause" | "resume" | "skip" | "disable";
20
21
  through_date?: string;
21
- }): Promise<string>;
22
+ }, context?: ToolContext): Promise<string>;
@@ -7,15 +7,15 @@
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
- const API_BASE = process.env.NANNYKEEPER_API_URL || "https://www.nannykeeper.com";
10
+ import { 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",
14
14
  });
15
15
  }
16
16
  /** Read Autopilot status for one employee, or list the employer's active enrollments. */
17
- export async function executeGetAutopilot(args) {
18
- const apiKey = process.env.NANNYKEEPER_API_KEY;
17
+ export async function executeGetAutopilot(args, context) {
18
+ const { apiKey, apiBase: API_BASE } = getToolContext(context);
19
19
  if (!apiKey)
20
20
  return missingKey();
21
21
  try {
@@ -38,8 +38,8 @@ export async function executeGetAutopilot(args) {
38
38
  }
39
39
  }
40
40
  /** Manage an existing enrollment: pause / resume / skip / disable. */
41
- export async function executeManageAutopilot(args) {
42
- const apiKey = process.env.NANNYKEEPER_API_KEY;
41
+ export async function executeManageAutopilot(args, context) {
42
+ const { apiKey, apiBase: API_BASE } = getToolContext(context);
43
43
  if (!apiKey)
44
44
  return missingKey();
45
45
  try {
@@ -3,16 +3,17 @@
3
3
  *
4
4
  * Calls the NannyKeeper API to calculate household employer taxes.
5
5
  */
6
+ import { type ToolContext } from "../context.ts";
6
7
  /**
7
8
  * ⛔ THE DESCRIPTOR CONST THAT USED TO LIVE HERE WAS DEAD AND HAS BEEN REMOVED.
8
9
  *
9
- * `index.ts` registers this tool with its own description, so the exported
10
+ * `server.ts` registers this tool with its own description, so the exported
10
11
  * const was imported by nothing — and had already drifted from the shipped
11
12
  * text in both directions. It has already bitten the sibling tool once: a
12
13
  * customer-facing prompt was rewritten in the dead copy while every agent kept
13
14
  * reading the stale live one.
14
15
  *
15
- * If you want a single definition here, export it AND import it in `index.ts`
16
+ * If you want a single definition here, export it AND import it in `server.ts`
16
17
  * (see `state-filing-status.ts`, which now does). A second copy nobody reads is
17
18
  * worse than no copy: it looks like the source of truth and silently is not.
18
19
  */
@@ -22,4 +23,4 @@ export declare function executeCalculate(args: {
22
23
  pay_frequency?: string;
23
24
  residence_state?: string;
24
25
  reciprocity_certificate_on_file?: boolean;
25
- }): Promise<string>;
26
+ }, context?: ToolContext): Promise<string>;
@@ -3,22 +3,22 @@
3
3
  *
4
4
  * Calls the NannyKeeper API to calculate household employer taxes.
5
5
  */
6
- const API_BASE = process.env.NANNYKEEPER_API_URL || "https://www.nannykeeper.com";
6
+ import { getToolContext } from "../context.js";
7
7
  /**
8
8
  * ⛔ THE DESCRIPTOR CONST THAT USED TO LIVE HERE WAS DEAD AND HAS BEEN REMOVED.
9
9
  *
10
- * `index.ts` registers this tool with its own description, so the exported
10
+ * `server.ts` registers this tool with its own description, so the exported
11
11
  * const was imported by nothing — and had already drifted from the shipped
12
12
  * text in both directions. It has already bitten the sibling tool once: a
13
13
  * customer-facing prompt was rewritten in the dead copy while every agent kept
14
14
  * reading the stale live one.
15
15
  *
16
- * If you want a single definition here, export it AND import it in `index.ts`
16
+ * If you want a single definition here, export it AND import it in `server.ts`
17
17
  * (see `state-filing-status.ts`, which now does). A second copy nobody reads is
18
18
  * worse than no copy: it looks like the source of truth and silently is not.
19
19
  */
20
- export async function executeCalculate(args) {
21
- const apiKey = process.env.NANNYKEEPER_API_KEY;
20
+ export async function executeCalculate(args, context) {
21
+ const { apiKey, apiBase: API_BASE } = getToolContext(context);
22
22
  if (!apiKey) {
23
23
  return JSON.stringify({
24
24
  error: "NANNYKEEPER_API_KEY environment variable is not set. Get a free key at nannykeeper.com/developers/keys",
@@ -47,7 +47,7 @@ export async function executeCalculate(args) {
47
47
  if (!response.ok) {
48
48
  if (response.status === 429) {
49
49
  return JSON.stringify({
50
- error: "Rate limit exceeded. Free tier allows 50 requests/day. Upgrade at nannykeeper.com/developers/pricing",
50
+ error: "Rate limit exceeded. Please wait before retrying.",
51
51
  });
52
52
  }
53
53
  return JSON.stringify({
@@ -4,6 +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 { type ToolContext } from "../context.ts";
7
8
  export declare function executePreviewPayroll(args: {
8
9
  employer_id: string;
9
10
  employee_id: string;
@@ -19,4 +20,4 @@ export declare function executePreviewPayroll(args: {
19
20
  skip?: boolean;
20
21
  amount?: number;
21
22
  };
22
- }): Promise<string>;
23
+ }, context?: ToolContext): Promise<string>;
@@ -4,9 +4,9 @@
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
- const API_BASE = process.env.NANNYKEEPER_API_URL || "https://www.nannykeeper.com";
8
- export async function executePreviewPayroll(args) {
9
- const apiKey = process.env.NANNYKEEPER_API_KEY;
7
+ import { getToolContext } from "../context.js";
8
+ export async function executePreviewPayroll(args, context) {
9
+ const { apiKey, apiBase: API_BASE } = getToolContext(context);
10
10
  if (!apiKey) {
11
11
  return JSON.stringify({
12
12
  error: "NANNYKEEPER_API_KEY environment variable is not set. Get a key at nannykeeper.com/developers/keys",
@@ -4,6 +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 { type ToolContext } from "../context.ts";
7
8
  export declare function executeRunPayroll(args: {
8
9
  employer_id: string;
9
10
  employee_id: string;
@@ -25,4 +26,4 @@ export declare function executeRunPayroll(args: {
25
26
  };
26
27
  off_cycle?: boolean;
27
28
  idempotency_key?: string;
28
- }): Promise<string>;
29
+ }, context?: ToolContext): Promise<string>;
@@ -4,9 +4,9 @@
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
- const API_BASE = process.env.NANNYKEEPER_API_URL || "https://www.nannykeeper.com";
8
- export async function executeRunPayroll(args) {
9
- const apiKey = process.env.NANNYKEEPER_API_KEY;
7
+ import { getToolContext } from "../context.js";
8
+ export async function executeRunPayroll(args, context) {
9
+ const { apiKey, apiBase: API_BASE } = getToolContext(context);
10
10
  if (!apiKey) {
11
11
  return JSON.stringify({
12
12
  error: "NANNYKEEPER_API_KEY environment variable is not set. Get a key at nannykeeper.com/developers/keys",
@@ -57,7 +57,7 @@ export async function executeRunPayroll(args) {
57
57
  if (!response.ok) {
58
58
  if (response.status === 429) {
59
59
  return JSON.stringify({
60
- error: "Rate limit exceeded. Upgrade at nannykeeper.com/developers/pricing",
60
+ error: "Rate limit exceeded. Please wait before retrying.",
61
61
  });
62
62
  }
63
63
  // Include example from error response if available (LLM self-correction)
@@ -18,8 +18,9 @@
18
18
  * via /settings/states or call the REST API explicitly with
19
19
  * confirmation context.
20
20
  */
21
+ import { type ToolContext } from "../context.ts";
21
22
  /**
22
- * The single definition of this tool's name and description. `index.ts` imports
23
+ * The single definition of this tool's name and description. `server.ts` imports
23
24
  * it rather than restating it: an inline copy there is the one agents actually
24
25
  * read, so edits made here would never reach a model.
25
26
  */
@@ -37,4 +38,4 @@ export declare const stateFilingStatusTool: {
37
38
  */
38
39
  export declare function executeStateFilingStatus(args?: {
39
40
  employer_id?: string;
40
- }): Promise<string>;
41
+ }, context?: ToolContext): Promise<string>;
@@ -18,9 +18,9 @@
18
18
  * via /settings/states or call the REST API explicitly with
19
19
  * confirmation context.
20
20
  */
21
- const API_BASE = process.env.NANNYKEEPER_API_URL || "https://www.nannykeeper.com";
21
+ import { getToolContext } from "../context.js";
22
22
  /**
23
- * The single definition of this tool's name and description. `index.ts` imports
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
25
25
  * read, so edits made here would never reach a model.
26
26
  */
@@ -38,8 +38,13 @@ export const stateFilingStatusTool = {
38
38
  "to go register for it. Use before generating " +
39
39
  "quarterly filing instructions, or when a customer asks 'do I have my " +
40
40
  "state account numbers set up?' Read-only — to update, use the REST " +
41
- "API or direct the customer to /settings/states.",
42
- // No `inputSchema` here on purpose: `index.ts` passes its own zod shape to
41
+ "API or direct the customer to /settings/states. The response also " +
42
+ "carries `obligations`: this household's FICA, FUTA and per-state " +
43
+ "unemployment status (started, not_started, exempt or unassessed), " +
44
+ "registration state, estimate, action and the agency's real due date. " +
45
+ "When `assessment` is incomplete or a status is unassessed, never tell " +
46
+ "the customer they owe nothing or are all set.",
47
+ // No `inputSchema` here on purpose: `server.ts` passes its own zod shape to
43
48
  // `server.tool()`, so a declaration here would reach no agent. Declare
44
49
  // parameters there.
45
50
  };
@@ -51,8 +56,8 @@ export const stateFilingStatusTool = {
51
56
  * `nk_test_` key and no way to name a household would therefore be refused on
52
57
  * every call, with no way to reach the sandbox it is meant to work against.
53
58
  */
54
- export async function executeStateFilingStatus(args) {
55
- const apiKey = process.env.NANNYKEEPER_API_KEY;
59
+ export async function executeStateFilingStatus(args, context) {
60
+ const { apiKey, apiBase: API_BASE } = getToolContext(context);
56
61
  if (!apiKey) {
57
62
  return JSON.stringify({
58
63
  error: "NANNYKEEPER_API_KEY environment variable is not set. Get a key at nannykeeper.com/developers/keys",
@@ -3,16 +3,17 @@
3
3
  *
4
4
  * Calls the NannyKeeper API to check one worker's annual FICA threshold.
5
5
  */
6
+ import { type ToolContext } from "../context.ts";
6
7
  /**
7
8
  * ⛔ THE DESCRIPTOR CONST THAT USED TO LIVE HERE WAS DEAD AND HAS BEEN REMOVED.
8
9
  *
9
- * `index.ts` registers this tool with its own description, so the exported
10
+ * `server.ts` registers this tool with its own description, so the exported
10
11
  * const was imported by nothing — and had already drifted from the shipped
11
12
  * text in both directions. It has already bitten the sibling tool once: a
12
13
  * customer-facing prompt was rewritten in the dead copy while every agent kept
13
14
  * reading the stale live one.
14
15
  *
15
- * If you want a single definition here, export it AND import it in `index.ts`
16
+ * If you want a single definition here, export it AND import it in `server.ts`
16
17
  * (see `state-filing-status.ts`, which now does). A second copy nobody reads is
17
18
  * worse than no copy: it looks like the source of truth and silently is not.
18
19
  */
@@ -20,4 +21,4 @@ export declare function executeThreshold(args: {
20
21
  state: string;
21
22
  annual_wages: number;
22
23
  tax_year?: number;
23
- }): Promise<string>;
24
+ }, context?: ToolContext): Promise<string>;
@@ -3,22 +3,22 @@
3
3
  *
4
4
  * Calls the NannyKeeper API to check one worker's annual FICA threshold.
5
5
  */
6
- const API_BASE = process.env.NANNYKEEPER_API_URL || "https://www.nannykeeper.com";
6
+ import { getToolContext } from "../context.js";
7
7
  /**
8
8
  * ⛔ THE DESCRIPTOR CONST THAT USED TO LIVE HERE WAS DEAD AND HAS BEEN REMOVED.
9
9
  *
10
- * `index.ts` registers this tool with its own description, so the exported
10
+ * `server.ts` registers this tool with its own description, so the exported
11
11
  * const was imported by nothing — and had already drifted from the shipped
12
12
  * text in both directions. It has already bitten the sibling tool once: a
13
13
  * customer-facing prompt was rewritten in the dead copy while every agent kept
14
14
  * reading the stale live one.
15
15
  *
16
- * If you want a single definition here, export it AND import it in `index.ts`
16
+ * If you want a single definition here, export it AND import it in `server.ts`
17
17
  * (see `state-filing-status.ts`, which now does). A second copy nobody reads is
18
18
  * worse than no copy: it looks like the source of truth and silently is not.
19
19
  */
20
- export async function executeThreshold(args) {
21
- const apiKey = process.env.NANNYKEEPER_API_KEY;
20
+ export async function executeThreshold(args, context) {
21
+ const { apiKey, apiBase: API_BASE } = getToolContext(context);
22
22
  if (!apiKey) {
23
23
  return JSON.stringify({
24
24
  error: "NANNYKEEPER_API_KEY environment variable is not set. Get a free key at nannykeeper.com/developers/keys",
package/manifest.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": "0.3",
3
3
  "name": "nannykeeper",
4
- "version": "1.10.2",
4
+ "version": "1.14.1",
5
5
  "description": "Calculate US household employer (nanny) taxes for all 50 states. Preview and run payroll, list state agency account numbers, and manage existing Autopilot enrollments. 7 tools: calculate_nanny_taxes, check_threshold, preview_payroll, run_payroll, 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.10.2",
3
+ "version": "1.14.1",
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": [
@@ -44,8 +44,8 @@
44
44
  "AGENTS.md"
45
45
  ],
46
46
  "scripts": {
47
- "_comment_prepublishOnly": "dist/ is gitignored, so it is refreshed only by a build in this directory. This hook runs immediately before packing, in whatever directory the publish runs from, so the compiled output always matches the source being published. Do not remove it.",
48
- "prepublishOnly": "npm run build",
47
+ "_comment_prepack": "dist/ is gitignored, so it is refreshed only by a build in this directory. This hook runs immediately before packing (npm pack AND npm publish), in whatever directory the publish runs from, so the compiled output always matches the source being published. Do not remove it.",
48
+ "prepack": "npm run build",
49
49
  "build": "tsc",
50
50
  "dev": "tsc --watch",
51
51
  "start": "node dist/index.js",
@@ -64,4 +64,4 @@
64
64
  "engines": {
65
65
  "node": ">=18"
66
66
  }
67
- }
67
+ }