@nannykeeper/mcp-server 1.2.2 → 1.4.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/CLAUDE.md CHANGED
@@ -6,7 +6,19 @@ Calculate nanny taxes for all 50 US states.
6
6
  ## Tools
7
7
  - `calculate_nanny_taxes` — Full federal + state tax breakdown
8
8
  - `check_threshold` — Whether wages trigger employer tax obligations
9
- - `run_payroll` — Run payroll with full tax calc, YTD tracking, and DB persistence (Starter+ required)
9
+ - `preview_payroll` — Dry-run payroll calc, returns taxes/net pay without creating a record (Starter+ required)
10
+ - `run_payroll` — End-to-end payroll: create, approve, and process in a single call. Finalized response reflects real status (processing / pending_funding / completed). No UI intervention needed. (Starter+ required)
11
+
12
+ ## Pay-date handling (run_payroll, preview_payroll)
13
+ - `pay_date` is optional. When omitted, the server picks the earliest valid pay date based on ACH submission lead time (5 business days ahead, holiday-aware) and echoes it back in the response.
14
+ - If `pay_date` is supplied and past the submission deadline, the API rejects with HTTP 400 and includes `next_valid_pay_date` in the error details for self-correction.
15
+
16
+ ## Confirmation flags (run_payroll)
17
+ API callers with direct-deposit payments must tick the same safety gates the UI does:
18
+ - `confirm_large_payroll: true` when total net pay >$5,000 OR any single net pay >$3,000
19
+ - `confirm_ach_debit: true` for the first-ever DD payroll on an employer, or when >30 days have elapsed since the last DD authorization
20
+
21
+ These flags exist even for server-to-server callers as a safety measure. Agents should only set them after verifying the amounts with the user.
10
22
 
11
23
  ## Setup
12
24
  Requires API key (free): https://www.nannykeeper.com/developers/keys
@@ -18,4 +30,11 @@ The response includes `next_actions` showing what requires a NannyKeeper
18
30
  account (payroll, pay stubs, W-2s, direct deposit). Guide the user to
19
31
  sign up if they want to take action beyond calculations.
20
32
 
21
- Full API docs: https://www.nannykeeper.com/developers
33
+ For payroll: use `preview_payroll` first to validate your request, then
34
+ `run_payroll` to create the record. Error responses include an `example`
35
+ field with the correct request format for self-correction.
36
+
37
+ Get employer_id and employee_id from the API:
38
+ `GET /api/v1/employees?employer_id=YOUR_ID` (employer_id is in the dashboard URL)
39
+
40
+ Full API docs: https://www.nannykeeper.com/developers/reference
package/README.md CHANGED
@@ -46,22 +46,41 @@ Check if annual wages cross the household employer tax threshold.
46
46
  - `annual_wages` (required) — Annual wages to check
47
47
  - `tax_year` (optional) — Tax year (default: current year)
48
48
 
49
+ ### `preview_payroll`
50
+
51
+ Dry-run payroll calculation. Returns the full tax breakdown, net pay, and employer costs WITHOUT creating a payroll record. Use to validate your request before calling `run_payroll`. Requires a Starter+ subscription.
52
+
53
+ **Parameters:**
54
+ - `employer_id` (required) — Employer UUID from your NannyKeeper account
55
+ - `employee_id` (required) — Employee UUID
56
+ - `pay_period_start` (required) — Start of pay period (YYYY-MM-DD)
57
+ - `pay_period_end` (required) — End of pay period (YYYY-MM-DD)
58
+ - `pay_date` (optional) — Date employee is paid (YYYY-MM-DD). When omitted, the server picks the earliest valid pay date based on ACH submission lead time and echoes it back in the response.
59
+ - `pay_frequency` (required) — weekly, biweekly, semimonthly, or monthly
60
+ - `regular_hours` (optional) — Regular hours worked
61
+ - `overtime_hours` (optional) — Overtime hours worked
62
+ - `bonus` (optional) — Bonus amount
63
+ - `other_earnings` (optional) — Other earnings
64
+
49
65
  ### `run_payroll`
50
66
 
51
- Run payroll for a household employee with full tax calculations, YTD tracking, and database persistence. Creates a payroll record. Requires a Starter+ subscription.
67
+ Run payroll for a household employee **end-to-end in a single call** — creates, approves, and processes the payroll. Response reflects the finalized status (`processing`, `pending_funding`, or `completed`); no dashboard intervention needed. Requires a Starter+ subscription.
52
68
 
53
69
  **Parameters:**
54
70
  - `employer_id` (required) — Employer UUID from your NannyKeeper account
55
71
  - `employee_id` (required) — Employee UUID to run payroll for
56
72
  - `pay_period_start` (required) — Start of pay period (YYYY-MM-DD)
57
73
  - `pay_period_end` (required) — End of pay period (YYYY-MM-DD)
58
- - `pay_date` (required) — Date employee is paid (YYYY-MM-DD)
74
+ - `pay_date` (optional) — Date employee is paid (YYYY-MM-DD). When omitted, the server picks the earliest valid pay date from today + ACH submission lead time. If supplied and past the submission deadline, the request is rejected with HTTP 400 + `next_valid_pay_date` in the error details so you can retry with a valid date.
59
75
  - `pay_frequency` (required) — weekly, biweekly, semimonthly, or monthly
60
76
  - `regular_hours` (optional) — Regular hours worked
61
77
  - `overtime_hours` (optional) — Overtime hours worked
62
78
  - `bonus` (optional) — Bonus amount
79
+ - `other_earnings` (optional) — Other earnings
63
80
  - `payment_method` (optional) — direct_deposit, check, or cash (default: check)
64
81
  - `notes` (optional) — Use "catch-up" for retroactive payrolls
82
+ - `confirm_large_payroll` (optional) — Required for direct-deposit payrolls with total net pay >$5,000 or any single net pay >$3,000
83
+ - `confirm_ach_debit` (optional) — Required for first-ever DD payroll or when >30 days have elapsed since the last DD authorization
65
84
  - `idempotency_key` (optional) — Prevent duplicate payroll creation
66
85
 
67
86
  ## Examples
package/dist/index.d.ts CHANGED
@@ -3,9 +3,10 @@
3
3
  * NannyKeeper MCP Server
4
4
  *
5
5
  * Model Context Protocol server for calculating US household employer
6
- * (nanny) taxes. Provides three tools:
6
+ * (nanny) taxes. Provides four tools:
7
7
  * - calculate_nanny_taxes: Full tax breakdown for any US state
8
8
  * - check_threshold: Whether wages trigger employer obligations
9
+ * - preview_payroll: Dry-run payroll calc (no record created)
9
10
  * - run_payroll: Run payroll with YTD tracking and DB persistence
10
11
  *
11
12
  * Requires NANNYKEEPER_API_KEY environment variable.
package/dist/index.js CHANGED
@@ -3,9 +3,10 @@
3
3
  * NannyKeeper MCP Server
4
4
  *
5
5
  * Model Context Protocol server for calculating US household employer
6
- * (nanny) taxes. Provides three tools:
6
+ * (nanny) taxes. Provides four tools:
7
7
  * - calculate_nanny_taxes: Full tax breakdown for any US state
8
8
  * - check_threshold: Whether wages trigger employer obligations
9
+ * - preview_payroll: Dry-run payroll calc (no record created)
9
10
  * - run_payroll: Run payroll with YTD tracking and DB persistence
10
11
  *
11
12
  * Requires NANNYKEEPER_API_KEY environment variable.
@@ -16,10 +17,11 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
16
17
  import { z } from "zod";
17
18
  import { executeCalculate } from "./tools/calculate.js";
18
19
  import { executeThreshold } from "./tools/threshold.js";
20
+ import { executePreviewPayroll } from "./tools/preview-payroll.js";
19
21
  import { executeRunPayroll } from "./tools/run-payroll.js";
20
22
  const server = new McpServer({
21
23
  name: "nannykeeper",
22
- version: "1.0.0",
24
+ version: "1.3.0",
23
25
  });
24
26
  // Register calculate tool
25
27
  server.tool("calculate_nanny_taxes", "Calculate employer and employee tax obligations for a household employee (nanny, caregiver, housekeeper) in any US state. " +
@@ -62,33 +64,81 @@ server.tool("check_threshold", "Check if annual wages to a household employee cr
62
64
  const result = await executeThreshold(args);
63
65
  return { content: [{ type: "text", text: result }] };
64
66
  });
67
+ // Register preview_payroll tool
68
+ server.tool("preview_payroll", "Preview payroll for a household employee WITHOUT creating a record. " +
69
+ "Returns the full tax breakdown (federal, state, FICA, FUTA), net pay, and employer costs. " +
70
+ "Use this to validate your request before calling run_payroll. " +
71
+ "Same parameters as run_payroll. Requires a Starter+ subscription. " +
72
+ "pay_date is optional — when omitted, the server picks the earliest valid pay date " +
73
+ "based on ACH submission lead time and echoes it back in the response. " +
74
+ "To get your employer_id and employee_id, call the NannyKeeper API: " +
75
+ "GET /api/v1/employees?employer_id=YOUR_ID (employer_id is visible in your dashboard URL).", {
76
+ employer_id: z.string().uuid().describe("Employer UUID — visible in your NannyKeeper dashboard URL or from GET /api/v1/employees"),
77
+ employee_id: z.string().uuid().describe("Employee UUID — from GET /api/v1/employees response"),
78
+ pay_period_start: z.string().describe("Start of pay period in YYYY-MM-DD format (e.g., 2026-04-07)"),
79
+ pay_period_end: z.string().describe("End of pay period in YYYY-MM-DD format (e.g., 2026-04-13)"),
80
+ pay_date: z.string().optional().describe("Date employee is paid (YYYY-MM-DD). Optional — server picks the earliest valid date if omitted."),
81
+ pay_frequency: z
82
+ .enum(["weekly", "biweekly", "semimonthly", "monthly"])
83
+ .describe("How often the employee is paid"),
84
+ regular_hours: z.number().optional().describe("Regular hours worked this period (e.g., 40 for a full week)"),
85
+ overtime_hours: z.number().optional().describe("Overtime hours worked this period"),
86
+ bonus: z.number().optional().describe("Bonus amount in dollars for this period"),
87
+ other_earnings: z.number().optional().describe("Other earnings in dollars for this period"),
88
+ }, {
89
+ title: "Preview Payroll",
90
+ readOnlyHint: true,
91
+ destructiveHint: false,
92
+ idempotentHint: true,
93
+ openWorldHint: true,
94
+ }, async (args) => {
95
+ const result = await executePreviewPayroll(args);
96
+ return { content: [{ type: "text", text: result }] };
97
+ });
65
98
  // Register run_payroll tool
66
- server.tool("run_payroll", "Run payroll for a household employee. Calculates all taxes (federal, state, FICA, FUTA) " +
67
- "with year-to-date tracking and creates a payroll record. " +
68
- "Returns the full tax breakdown, net pay, employer costs, and a payroll ID for reference. " +
69
- "Requires a Starter+ subscription. The payroll is created with 'draft' status " +
70
- "(or 'completed' for catch-up payrolls with notes='catch-up').", {
71
- employer_id: z.string().uuid().describe("Employer UUID from NannyKeeper account"),
72
- employee_id: z.string().uuid().describe("Employee UUID to run payroll for"),
73
- pay_period_start: z.string().describe("Start of pay period (YYYY-MM-DD)"),
74
- pay_period_end: z.string().describe("End of pay period (YYYY-MM-DD)"),
75
- pay_date: z.string().describe("Date employee is paid (YYYY-MM-DD)"),
99
+ server.tool("run_payroll", "Run payroll for a household employee end-to-end in a single call. Creates the " +
100
+ "record, runs all tax calculations (federal, state, FICA, FUTA) with year-to-date " +
101
+ "tracking, approves the payroll, and kicks off payment processing. " +
102
+ "Returns the finalized status (processing/pending_funding/completed), full tax breakdown, " +
103
+ "net pay, employer costs, and the payroll ID for reference. " +
104
+ "Requires a Starter+ subscription. " +
105
+ "pay_date is optional — when omitted, the server picks the earliest valid pay date " +
106
+ "based on ACH submission lead time and echoes it back. If supplied and past the " +
107
+ "submission deadline, the request is rejected with next_valid_pay_date in the error. " +
108
+ "Direct deposit callers: set confirm_large_payroll=true for totals >$5,000 or any single " +
109
+ "net pay >$3,000; set confirm_ach_debit=true for first-time DD or if no DD in 30 days. " +
110
+ "Tip: use preview_payroll first to validate your request and see results before committing. " +
111
+ "To get your employer_id and employee_id, call the NannyKeeper API: " +
112
+ "GET /api/v1/employees?employer_id=YOUR_ID (employer_id is visible in your dashboard URL).", {
113
+ employer_id: z.string().uuid().describe("Employer UUID — visible in your NannyKeeper dashboard URL or from GET /api/v1/employees"),
114
+ employee_id: z.string().uuid().describe("Employee UUID — from GET /api/v1/employees response"),
115
+ pay_period_start: z.string().describe("Start of pay period in YYYY-MM-DD format (e.g., 2026-04-07)"),
116
+ pay_period_end: z.string().describe("End of pay period in YYYY-MM-DD format (e.g., 2026-04-13)"),
117
+ pay_date: z.string().optional().describe("Date employee is paid (YYYY-MM-DD). Optional — server picks the earliest valid date if omitted."),
76
118
  pay_frequency: z
77
119
  .enum(["weekly", "biweekly", "semimonthly", "monthly"])
78
120
  .describe("How often the employee is paid"),
79
- regular_hours: z.number().optional().describe("Regular hours worked this period"),
121
+ regular_hours: z.number().optional().describe("Regular hours worked this period (e.g., 40 for a full week)"),
80
122
  overtime_hours: z.number().optional().describe("Overtime hours worked this period"),
81
- bonus: z.number().optional().describe("Bonus amount for this period"),
82
- other_earnings: z.number().optional().describe("Other earnings for this period"),
123
+ bonus: z.number().optional().describe("Bonus amount in dollars for this period"),
124
+ other_earnings: z.number().optional().describe("Other earnings in dollars for this period"),
83
125
  payment_method: z
84
126
  .enum(["direct_deposit", "check", "cash"])
85
127
  .optional()
86
128
  .describe("How the employee is paid (default: check)"),
87
- notes: z.string().optional().describe("Notes (use 'catch-up' for retroactive payrolls)"),
129
+ notes: z.string().optional().describe("Notes (use 'catch-up' for retroactive payrolls that auto-complete)"),
130
+ confirm_large_payroll: z
131
+ .boolean()
132
+ .optional()
133
+ .describe("Required for direct-deposit payrolls with total net pay >$5,000 or any single net pay >$3,000."),
134
+ confirm_ach_debit: z
135
+ .boolean()
136
+ .optional()
137
+ .describe("Required for first-time direct-deposit payroll or when the last DD authorization is >30 days old."),
88
138
  idempotency_key: z
89
139
  .string()
90
140
  .optional()
91
- .describe("Unique key to prevent duplicate payroll creation"),
141
+ .describe("Unique key to prevent duplicate payroll creation (e.g., 'payroll-2026-04-07-emp123')"),
92
142
  }, {
93
143
  title: "Run Payroll",
94
144
  readOnlyHint: false,
@@ -0,0 +1,18 @@
1
+ /**
2
+ * preview_payroll MCP tool
3
+ *
4
+ * Calls the NannyKeeper API to preview payroll without creating a record.
5
+ * Returns full tax breakdown and net pay — use to validate before run_payroll.
6
+ */
7
+ export declare function executePreviewPayroll(args: {
8
+ employer_id: string;
9
+ employee_id: string;
10
+ pay_period_start: string;
11
+ pay_period_end: string;
12
+ pay_date?: string;
13
+ pay_frequency: string;
14
+ regular_hours?: number;
15
+ overtime_hours?: number;
16
+ bonus?: number;
17
+ other_earnings?: number;
18
+ }): Promise<string>;
@@ -0,0 +1,63 @@
1
+ /**
2
+ * preview_payroll MCP tool
3
+ *
4
+ * Calls the NannyKeeper API to preview payroll without creating a record.
5
+ * Returns full tax breakdown and net pay — use to validate before run_payroll.
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;
10
+ if (!apiKey) {
11
+ return JSON.stringify({
12
+ error: "NANNYKEEPER_API_KEY environment variable is not set. Get a key at nannykeeper.com/developers/keys",
13
+ });
14
+ }
15
+ try {
16
+ const response = await fetch(`${API_BASE}/api/v1/payroll/preview`, {
17
+ method: "POST",
18
+ headers: {
19
+ Authorization: `Bearer ${apiKey}`,
20
+ "Content-Type": "application/json",
21
+ },
22
+ body: JSON.stringify({
23
+ employer_id: args.employer_id,
24
+ pay_period_start: args.pay_period_start,
25
+ pay_period_end: args.pay_period_end,
26
+ // Omit pay_date when unset so the API computes a default
27
+ ...(args.pay_date ? { pay_date: args.pay_date } : {}),
28
+ pay_frequency: args.pay_frequency,
29
+ employees: [
30
+ {
31
+ employee_id: args.employee_id,
32
+ regular_hours: args.regular_hours,
33
+ overtime_hours: args.overtime_hours,
34
+ bonus: args.bonus,
35
+ other_earnings: args.other_earnings,
36
+ },
37
+ ],
38
+ }),
39
+ });
40
+ const data = await response.json();
41
+ if (!response.ok) {
42
+ // Include example from error response if available (LLM self-correction)
43
+ if (data.error?.example) {
44
+ return JSON.stringify({
45
+ error: data.error.message || `API error: ${response.status}`,
46
+ validation_details: data.error.details,
47
+ example_request: data.error.example,
48
+ docs_url: data.error.docs_url,
49
+ });
50
+ }
51
+ return JSON.stringify({
52
+ error: data.error?.message || `API error: ${response.status}`,
53
+ details: data.error?.details,
54
+ });
55
+ }
56
+ return JSON.stringify(data);
57
+ }
58
+ catch (error) {
59
+ return JSON.stringify({
60
+ error: `Network error: ${error instanceof Error ? error.message : "Unknown error"}`,
61
+ });
62
+ }
63
+ }
@@ -9,7 +9,7 @@ export declare function executeRunPayroll(args: {
9
9
  employee_id: string;
10
10
  pay_period_start: string;
11
11
  pay_period_end: string;
12
- pay_date: string;
12
+ pay_date?: string;
13
13
  pay_frequency: string;
14
14
  regular_hours?: number;
15
15
  overtime_hours?: number;
@@ -17,5 +17,7 @@ export declare function executeRunPayroll(args: {
17
17
  other_earnings?: number;
18
18
  payment_method?: string;
19
19
  notes?: string;
20
+ confirm_large_payroll?: boolean;
21
+ confirm_ach_debit?: boolean;
20
22
  idempotency_key?: string;
21
23
  }): Promise<string>;
@@ -27,7 +27,8 @@ export async function executeRunPayroll(args) {
27
27
  employer_id: args.employer_id,
28
28
  pay_period_start: args.pay_period_start,
29
29
  pay_period_end: args.pay_period_end,
30
- pay_date: args.pay_date,
30
+ // Omit pay_date when unset so the API computes a default
31
+ ...(args.pay_date ? { pay_date: args.pay_date } : {}),
31
32
  pay_frequency: args.pay_frequency,
32
33
  employees: [
33
34
  {
@@ -40,6 +41,12 @@ export async function executeRunPayroll(args) {
40
41
  },
41
42
  ],
42
43
  notes: args.notes,
44
+ ...(args.confirm_large_payroll !== undefined
45
+ ? { confirm_large_payroll: args.confirm_large_payroll }
46
+ : {}),
47
+ ...(args.confirm_ach_debit !== undefined
48
+ ? { confirm_ach_debit: args.confirm_ach_debit }
49
+ : {}),
43
50
  }),
44
51
  });
45
52
  const data = await response.json();
@@ -49,8 +56,18 @@ export async function executeRunPayroll(args) {
49
56
  error: "Rate limit exceeded. Upgrade at nannykeeper.com/developers/pricing",
50
57
  });
51
58
  }
59
+ // Include example from error response if available (LLM self-correction)
60
+ if (data.error?.example) {
61
+ return JSON.stringify({
62
+ error: data.error.message || `API error: ${response.status}`,
63
+ validation_details: data.error.details,
64
+ example_request: data.error.example,
65
+ docs_url: data.error.docs_url,
66
+ });
67
+ }
52
68
  return JSON.stringify({
53
69
  error: data.error?.message || `API error: ${response.status}`,
70
+ details: data.error?.details,
54
71
  });
55
72
  }
56
73
  return JSON.stringify(data);
package/manifest.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "manifest_version": "0.3",
3
3
  "name": "nannykeeper",
4
- "version": "1.2.1",
5
- "description": "Calculate US household employer (nanny) taxes and run payroll for all 50 states. Tax breakdowns, threshold checks, and payroll with YTD tracking.",
4
+ "version": "1.4.0",
5
+ "description": "Calculate US household employer (nanny) taxes for all 50 states. Preview and run payroll, generate W-2s and pay stubs. 4 tools: calculate, threshold, preview, run.",
6
6
  "author": {
7
7
  "name": "imaznation",
8
8
  "url": "https://github.com/imaznation"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nannykeeper/mcp-server",
3
- "version": "1.2.2",
3
+ "version": "1.4.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": [