kaizen-qbo-mcp-server 0.1.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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +72 -0
  3. package/package.json +19 -0
  4. package/server.mjs +243 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kaizen CFO
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # Kaizen QBO MCP Server
2
+
3
+ MCP server that connects Claude Code, Cursor, and other AI tools to QuickBooks Online via the Kaizen API.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ npm install @kaizencfo/qbo-mcp-server
9
+ ```
10
+
11
+ Add to your Claude Code settings (`~/.claude/settings.json`):
12
+
13
+ ```json
14
+ {
15
+ "mcpServers": {
16
+ "kaizen-qbo": {
17
+ "command": "npx",
18
+ "args": ["@kaizencfo/qbo-mcp-server"],
19
+ "env": {
20
+ "KAIZEN_API_KEY": "kaizen_live_sk_..."
21
+ }
22
+ }
23
+ }
24
+ }
25
+ ```
26
+
27
+ Or create a `config.json` next to the server:
28
+
29
+ ```json
30
+ {
31
+ "apiKey": "kaizen_live_sk_...",
32
+ "baseUrl": "https://api.kaizencfo.com"
33
+ }
34
+ ```
35
+
36
+ ## Tools
37
+
38
+ ### Read
39
+ | Tool | Description |
40
+ |------|-------------|
41
+ | `qbo_query` | Run SOQL queries (`SELECT * FROM Invoice WHERE ...`) |
42
+ | `qbo_report` | Pull reports (P&L, Balance Sheet, Cash Flow, etc.) |
43
+ | `qbo_get_entity` | Read a single entity by type + ID |
44
+ | `qbo_get_attachments` | Get file attachments for an entity |
45
+
46
+ ### Write
47
+ | Tool | Description |
48
+ |------|-------------|
49
+ | `qbo_create_invoice` | Create an invoice |
50
+ | `qbo_create_journal_entry` | Create a journal entry |
51
+ | `qbo_create_payment` | Create a payment |
52
+ | `qbo_create_bill` | Create a bill |
53
+ | `qbo_create_purchase` | Create a purchase/expense |
54
+ | `qbo_update_entity` | Sparse-update any entity |
55
+ | `qbo_void_invoice` | Void an invoice |
56
+
57
+ ## Examples
58
+
59
+ Once configured, ask Claude:
60
+
61
+ - "How much revenue did we do last month?"
62
+ - "Show me all unpaid invoices over $1,000"
63
+ - "Create a journal entry to reclassify $500 from Office Supplies to Marketing"
64
+ - "Pull the P&L for Q1 2026"
65
+
66
+ ## Get an API Key
67
+
68
+ Visit [kaizencfo.com](https://kaizencfo.com) to connect your QuickBooks Online account and get an API key.
69
+
70
+ ## License
71
+
72
+ MIT
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "kaizen-qbo-mcp-server",
3
+ "version": "0.1.0",
4
+ "description": "MCP server for QuickBooks Online — query, create, and manage QBO data via Claude Code or Cursor",
5
+ "type": "module",
6
+ "bin": {
7
+ "kaizen-qbo-mcp": "./server.mjs"
8
+ },
9
+ "main": "server.mjs",
10
+ "scripts": {
11
+ "start": "node server.mjs"
12
+ },
13
+ "keywords": ["mcp", "quickbooks", "qbo", "accounting", "claude", "cursor", "ai"],
14
+ "license": "MIT",
15
+ "dependencies": {
16
+ "@modelcontextprotocol/sdk": "^1.12.1",
17
+ "zod": "^3.24.4"
18
+ }
19
+ }
package/server.mjs ADDED
@@ -0,0 +1,243 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Kaizen QBO MCP Server
4
+ *
5
+ * Thin MCP wrapper over the Kaizen REST API. Exposes QuickBooks Online
6
+ * data as tools for Claude Code, Cursor, and any MCP-compatible client.
7
+ *
8
+ * Tools:
9
+ * qbo_query — Run a SOQL query (SELECT ... FROM ...)
10
+ * qbo_report — Pull a QBO report (P&L, Balance Sheet, etc.)
11
+ * qbo_get_entity — Read a single entity by type + ID
12
+ * qbo_get_attachments — Get attachments for an entity
13
+ * qbo_create_invoice — Create an invoice
14
+ * qbo_create_journal_entry — Create a journal entry
15
+ * qbo_create_payment — Create a payment
16
+ * qbo_create_bill — Create a bill
17
+ * qbo_create_purchase — Create a purchase
18
+ * qbo_update_entity — Update an entity (sparse update)
19
+ * qbo_void_invoice — Void an invoice
20
+ *
21
+ * Config:
22
+ * Set KAIZEN_API_KEY env var, or create config.json next to this file:
23
+ * { "apiKey": "kaizen_live_sk_...", "baseUrl": "https://api.kaizencfo.com" }
24
+ */
25
+
26
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
27
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
28
+ import { z } from "zod";
29
+ import { readFileSync } from "fs";
30
+ import { resolve, dirname } from "path";
31
+ import { fileURLToPath } from "url";
32
+
33
+ const __dirname = dirname(fileURLToPath(import.meta.url));
34
+
35
+ // ── Config ──────────────────────────────────────────────────────────────────
36
+
37
+ function loadConfig() {
38
+ // Env vars take priority
39
+ const apiKey = process.env.KAIZEN_API_KEY;
40
+ const baseUrl = process.env.KAIZEN_API_URL || "https://api.kaizencfo.com";
41
+
42
+ if (apiKey) return { apiKey, baseUrl };
43
+
44
+ // Fall back to config.json
45
+ try {
46
+ const cfg = JSON.parse(readFileSync(resolve(__dirname, "config.json"), "utf-8"));
47
+ return {
48
+ apiKey: cfg.apiKey,
49
+ baseUrl: cfg.baseUrl || baseUrl,
50
+ };
51
+ } catch {
52
+ console.error("No KAIZEN_API_KEY env var and no config.json found.");
53
+ console.error("Set KAIZEN_API_KEY or create config.json with { \"apiKey\": \"kaizen_live_sk_...\" }");
54
+ process.exit(1);
55
+ }
56
+ }
57
+
58
+ const config = loadConfig();
59
+
60
+ // ── API helper ──────────────────────────────────────────────────────────────
61
+
62
+ async function api(path, { method = "GET", body } = {}) {
63
+ const url = `${config.baseUrl}${path}`;
64
+ const opts = {
65
+ method,
66
+ headers: {
67
+ "Authorization": `Bearer ${config.apiKey}`,
68
+ "Content-Type": "application/json",
69
+ },
70
+ };
71
+ if (body) opts.body = JSON.stringify(body);
72
+
73
+ const res = await fetch(url, opts);
74
+ const data = await res.json();
75
+
76
+ if (!data.ok) {
77
+ throw new Error(data.error?.message || `API error: ${res.status}`);
78
+ }
79
+ return data.data;
80
+ }
81
+
82
+ function resultText(data) {
83
+ return JSON.stringify(data, null, 2);
84
+ }
85
+
86
+ // ── MCP Server ──────────────────────────────────────────────────────────────
87
+
88
+ const server = new McpServer({
89
+ name: "kaizen-qbo",
90
+ version: "0.1.0",
91
+ });
92
+
93
+ // ── Read Tools ──────────────────────────────────────────────────────────────
94
+
95
+ server.tool(
96
+ "qbo_query",
97
+ "Run a SOQL query against QuickBooks Online. Examples: SELECT * FROM Invoice WHERE TxnDate >= '2026-01-01' MAXRESULTS 10",
98
+ {
99
+ query: z.string().describe("SOQL query string"),
100
+ },
101
+ async ({ query }) => {
102
+ const data = await api("/v1/query", { method: "POST", body: { query } });
103
+ return { content: [{ type: "text", text: resultText(data) }] };
104
+ }
105
+ );
106
+
107
+ server.tool(
108
+ "qbo_report",
109
+ "Pull a QBO report. Reports: ProfitAndLoss, BalanceSheet, CashFlow, TrialBalance, GeneralLedger, AgedReceivables, AgedPayables, CustomerIncome, VendorExpenses",
110
+ {
111
+ report: z.string().describe("Report name (e.g. ProfitAndLoss)"),
112
+ params: z.string().optional().describe("Query params (e.g. start_date=2026-01-01&end_date=2026-03-31&accounting_method=Accrual)"),
113
+ },
114
+ async ({ report, params }) => {
115
+ const qs = params ? `?${params}` : "";
116
+ const data = await api(`/v1/reports/${report}${qs}`);
117
+ return { content: [{ type: "text", text: resultText(data) }] };
118
+ }
119
+ );
120
+
121
+ server.tool(
122
+ "qbo_get_entity",
123
+ "Read a single QBO entity by type and ID. Types: Invoice, Customer, Vendor, Bill, Payment, JournalEntry, Account, Item, Purchase, Estimate, CreditMemo, etc.",
124
+ {
125
+ type: z.string().describe("Entity type (e.g. Invoice, Customer)"),
126
+ id: z.string().describe("Entity ID"),
127
+ },
128
+ async ({ type, id }) => {
129
+ const data = await api(`/v1/entities/${type}/${id}`);
130
+ return { content: [{ type: "text", text: resultText(data) }] };
131
+ }
132
+ );
133
+
134
+ server.tool(
135
+ "qbo_get_attachments",
136
+ "Get file attachments (check images, receipts, etc.) for a QBO entity",
137
+ {
138
+ type: z.string().describe("Entity type (e.g. Invoice, Bill, Purchase)"),
139
+ id: z.string().describe("Entity ID"),
140
+ },
141
+ async ({ type, id }) => {
142
+ const data = await api(`/v1/entities/${type}/${id}/attachments`);
143
+ return { content: [{ type: "text", text: resultText(data) }] };
144
+ }
145
+ );
146
+
147
+ // ── Write Tools ─────────────────────────────────────────────────────────────
148
+
149
+ server.tool(
150
+ "qbo_create_invoice",
151
+ "Create a QBO invoice. Requires CustomerRef and at least one Line item.",
152
+ {
153
+ invoice: z.string().describe("Invoice JSON object (must include CustomerRef and Line array)"),
154
+ },
155
+ async ({ invoice }) => {
156
+ const data = await api("/v1/invoices", { method: "POST", body: JSON.parse(invoice) });
157
+ return { content: [{ type: "text", text: resultText(data) }] };
158
+ }
159
+ );
160
+
161
+ server.tool(
162
+ "qbo_create_journal_entry",
163
+ "Create a QBO journal entry. Requires Line array with JournalEntryLineDetail (PostingType, AccountRef).",
164
+ {
165
+ entry: z.string().describe("JournalEntry JSON object (must include Line array)"),
166
+ },
167
+ async ({ entry }) => {
168
+ const data = await api("/v1/journal-entries", { method: "POST", body: JSON.parse(entry) });
169
+ return { content: [{ type: "text", text: resultText(data) }] };
170
+ }
171
+ );
172
+
173
+ server.tool(
174
+ "qbo_create_payment",
175
+ "Create a QBO payment. Requires CustomerRef and TotalAmt.",
176
+ {
177
+ payment: z.string().describe("Payment JSON object"),
178
+ },
179
+ async ({ payment }) => {
180
+ const data = await api("/v1/payments", { method: "POST", body: JSON.parse(payment) });
181
+ return { content: [{ type: "text", text: resultText(data) }] };
182
+ }
183
+ );
184
+
185
+ server.tool(
186
+ "qbo_create_bill",
187
+ "Create a QBO bill. Requires VendorRef and Line array.",
188
+ {
189
+ bill: z.string().describe("Bill JSON object"),
190
+ },
191
+ async ({ bill }) => {
192
+ const data = await api("/v1/bills", { method: "POST", body: JSON.parse(bill) });
193
+ return { content: [{ type: "text", text: resultText(data) }] };
194
+ }
195
+ );
196
+
197
+ server.tool(
198
+ "qbo_create_purchase",
199
+ "Create a QBO purchase (expense/check). Requires AccountRef, PaymentType, and Line array.",
200
+ {
201
+ purchase: z.string().describe("Purchase JSON object"),
202
+ },
203
+ async ({ purchase }) => {
204
+ const data = await api("/v1/purchases", { method: "POST", body: JSON.parse(purchase) });
205
+ return { content: [{ type: "text", text: resultText(data) }] };
206
+ }
207
+ );
208
+
209
+ // ── Update/Delete Tools ─────────────────────────────────────────────────────
210
+
211
+ server.tool(
212
+ "qbo_update_entity",
213
+ "Update a QBO entity (sparse update). Must include Id and SyncToken from a prior read.",
214
+ {
215
+ type: z.string().describe("Entity type (e.g. Invoice, Customer)"),
216
+ id: z.string().describe("Entity ID"),
217
+ update: z.string().describe("JSON object with fields to update (must include SyncToken)"),
218
+ },
219
+ async ({ type, id, update }) => {
220
+ const data = await api(`/v1/entities/${type}/${id}`, {
221
+ method: "PATCH",
222
+ body: JSON.parse(update),
223
+ });
224
+ return { content: [{ type: "text", text: resultText(data) }] };
225
+ }
226
+ );
227
+
228
+ server.tool(
229
+ "qbo_void_invoice",
230
+ "Void a QBO invoice by ID.",
231
+ {
232
+ id: z.string().describe("Invoice ID to void"),
233
+ },
234
+ async ({ id }) => {
235
+ const data = await api(`/v1/invoices/${id}/void`, { method: "POST" });
236
+ return { content: [{ type: "text", text: resultText(data) }] };
237
+ }
238
+ );
239
+
240
+ // ── Start ───────────────────────────────────────────────────────────────────
241
+
242
+ const transport = new StdioServerTransport();
243
+ await server.connect(transport);