Star 历史趋势
数据来源: GitHub API · 生成自 Stargazers.cn
README.md

QuickBooks Online MCP Server

A comprehensive Model Context Protocol (MCP) server for QuickBooks Online

License: MIT Tools Entities Reports Coverage Tests

Quick Start | Available Tools | Authentication | Documentation


Overview

This MCP server provides complete QuickBooks Online API integration for Claude Code and other MCP-compatible clients. It includes full CRUD operations for 29 entity types and 11 financial reports, giving you comprehensive access to QuickBooks Online functionality.

Key Features

  • 144 Total Tools - Complete coverage of QuickBooks Online API
  • 29 Entity Types - Full CRUD operations (Create, Read, Update, Delete, Search)
  • 11 Financial Reports - Balance Sheet, P&L, Cash Flow, and more
  • OAuth 2.0 Authentication - Secure token-based authentication
  • TypeScript - Full type safety with Zod validation
  • Tested - Jest test suite with ESM support

Note: this is a local MCP server. It runs as a stdio subprocess on the developer's or partner's machine and authenticates to a QuickBooks Online company.

Before you start: This MCP server is easy to run once authenticated, but QuickBooks Online integration is gated by Intuit's OAuth app setup. You must register an app on the Intuit Developer Portal and complete a one-time, browser-based OAuth handshake. Sandbox supports http://localhost redirect URIs; production requires a public HTTPS callback for the initial authorization. After that initial handshake, the server runs locally without further browser interaction (until the 100-day refresh window lapses). See Authentication for full details.


Quick Start

Installation

# Clone the repository git clone https://github.com/your-username/mcp-quickbooks-online.git cd mcp-quickbooks-online # Install dependencies npm install # Build the project npm run build

Configuration

Copy the template .env.example to .env in the root directory and fill in your values:

cp .env.example .env
QUICKBOOKS_CLIENT_ID=your_client_id QUICKBOOKS_CLIENT_SECRET=your_client_secret QUICKBOOKS_ENVIRONMENT=sandbox QUICKBOOKS_REFRESH_TOKEN=your_refresh_token QUICKBOOKS_REALM_ID=your_realm_id # Optional: restrict which tool categories are registered (default: all enabled) # QUICKBOOKS_DISABLE_WRITE=true # suppress create_* tools # QUICKBOOKS_DISABLE_UPDATE=true # suppress update_* tools # QUICKBOOKS_DISABLE_DELETE=true # suppress delete_* tools

.env is gitignored so your real credentials stay local.

Claude Code Integration

Add to your Claude Code MCP configuration:

{ "mcpServers": { "quickbooks": { "command": "node", "args": ["path/to/mcp-quickbooks-online/dist/index.js"], "env": { "QUICKBOOKS_CLIENT_ID": "your_client_id", "QUICKBOOKS_CLIENT_SECRET": "your_client_secret", "QUICKBOOKS_REFRESH_TOKEN": "your_refresh_token", "QUICKBOOKS_REALM_ID": "your_realm_id", "QUICKBOOKS_ENVIRONMENT": "sandbox", "QUICKBOOKS_DISABLE_WRITE": "false", "QUICKBOOKS_DISABLE_UPDATE": "false", "QUICKBOOKS_DISABLE_DELETE": "false" } } } }

Set any of the DISABLE_* flags to "true" to prevent that category of tools from being registered. Read tools (get_*, search_*) are always available.


Available Tools

Entities

Complete CRUD operations are available for all entity types:

EntityCreateGetUpdateDeleteSearch
Customer
Invoice
Estimate
Bill
Vendor
Employee
Account-
Item
Journal Entry
Bill Payment
Purchase
Payment
Sales Receipt
Credit Memo
Refund Receipt
Purchase Order
Vendor Credit
Deposit
Transfer
Time Activity
Class-
Department-
Term-
Payment Method-
Tax Code---
Tax Rate---
Tax Agency---
Company Info---
Attachable

Reports

ReportTool NameDescription
Balance Sheetget_balance_sheetAssets, liabilities, and equity snapshot
Profit & Lossget_profit_and_lossIncome and expenses over a period
Cash Flowget_cash_flowCash inflows and outflows
Trial Balanceget_trial_balanceDebit and credit balances
General Ledgerget_general_ledgerComplete transaction history
Customer Salesget_customer_salesSales by customer
Aged Receivablesget_aged_receivablesOutstanding customer invoices
Aged Receivables Detailget_aged_receivables_detailDetailed aging breakdown
Customer Balanceget_customer_balanceCurrent customer balances
Aged Payablesget_aged_payablesOutstanding vendor bills
Vendor Expensesget_vendor_expensesExpenses by vendor

Tool Reference

Customer Tools
ToolDescription
create_customerCreate a new customer
get_customerGet customer by ID
update_customerUpdate customer details
delete_customerDelete a customer
search_customersSearch customers with filters
Invoice Tools
ToolDescription
create_invoiceCreate a new invoice
get_invoiceGet invoice by ID
update_invoiceUpdate invoice details
delete_invoiceDelete/void an invoice
search_invoicesSearch invoices with filters
Payment Tools
ToolDescription
create_paymentRecord a customer payment
get_paymentGet payment by ID
update_paymentUpdate payment details
delete_paymentVoid a payment
search_paymentsSearch payments with filters
Bill & Vendor Tools
ToolDescription
create_billCreate a new bill
get_billGet bill by ID
update_billUpdate bill details
delete_billDelete a bill
search_billsSearch bills with filters
create_vendorCreate a new vendor
get_vendorGet vendor by ID
update_vendorUpdate vendor details
delete_vendorDelete a vendor
search_vendorsSearch vendors with filters
create_bill_paymentCreate a bill payment
get_bill_paymentGet bill payment by ID
update_bill_paymentUpdate bill payment
delete_bill_paymentDelete a bill payment
search_bill_paymentsSearch bill payments
Sales Receipt & Credit Memo Tools
ToolDescription
create_sales_receiptCreate a sales receipt
get_sales_receiptGet sales receipt by ID
update_sales_receiptUpdate sales receipt
delete_sales_receiptVoid a sales receipt
search_sales_receiptsSearch sales receipts
create_credit_memoCreate a credit memo
get_credit_memoGet credit memo by ID
update_credit_memoUpdate credit memo
delete_credit_memoVoid a credit memo
search_credit_memosSearch credit memos
create_refund_receiptCreate a refund receipt
get_refund_receiptGet refund receipt by ID
update_refund_receiptUpdate refund receipt
delete_refund_receiptVoid a refund receipt
search_refund_receiptsSearch refund receipts
Banking Tools
ToolDescription
create_depositCreate a bank deposit
get_depositGet deposit by ID
update_depositUpdate deposit details
delete_depositDelete a deposit
search_depositsSearch deposits
create_transferCreate an account transfer
get_transferGet transfer by ID
update_transferUpdate transfer details
delete_transferDelete a transfer
search_transfersSearch transfers
Purchase Order & Vendor Credit Tools
ToolDescription
create_purchase_orderCreate a purchase order
get_purchase_orderGet purchase order by ID
update_purchase_orderUpdate purchase order
delete_purchase_orderDelete a purchase order
search_purchase_ordersSearch purchase orders
create_vendor_creditCreate a vendor credit
get_vendor_creditGet vendor credit by ID
update_vendor_creditUpdate vendor credit
delete_vendor_creditDelete a vendor credit
search_vendor_creditsSearch vendor credits
Time Tracking Tools
ToolDescription
create_time_activityCreate a time activity
get_time_activityGet time activity by ID
update_time_activityUpdate time activity
delete_time_activityDelete a time activity
search_time_activitiesSearch time activities
Classification Tools
ToolDescription
create_classCreate a class
get_classGet class by ID
update_classUpdate class details
search_classesSearch classes
create_departmentCreate a department
get_departmentGet department by ID
update_departmentUpdate department
search_departmentsSearch departments
Settings Tools
ToolDescription
create_termCreate a payment term
get_termGet term by ID
update_termUpdate term details
search_termsSearch terms
create_payment_methodCreate a payment method
get_payment_methodGet payment method by ID
update_payment_methodUpdate payment method
search_payment_methodsSearch payment methods
Tax Tools
ToolDescription
get_tax_codeGet tax code by ID
search_tax_codesSearch tax codes
get_tax_rateGet tax rate by ID
search_tax_ratesSearch tax rates
get_tax_agencyGet tax agency by ID
search_tax_agenciesSearch tax agencies
Company & Attachments
ToolDescription
get_company_infoGet company information
update_company_infoUpdate company info
create_attachableCreate an attachment
get_attachableGet attachment by ID
update_attachableUpdate attachment
delete_attachableDelete an attachment
search_attachablesSearch attachments

Authentication

This server uses OAuth 2.0 to authenticate to a QuickBooks Online company. You'll set up an app on the Intuit Developer Portal and connect it to either a sandbox (for development) or your production QBO company.

Important: Sandbox vs Production

ModeWhen to useRedirect URI acceptedSetup difficulty
SandboxDevelopment, testing, demoshttp://localhost:8000/callback worksEasy
ProductionReal company dataLocalhost rejected — must be a public HTTPS URLHarder (see below)

If you only want to read your own company's data, you still need to set up an app — Intuit does not offer per-user API keys. There is no shortcut around the OAuth + app-creation flow.

Sandbox Setup (recommended for first run)

  1. Go to the Intuit Developer Portal and create a new app
  2. Open the app → Settings (left sidebar) → Redirect URIs → add: http://localhost:8000/callback
  3. Get your Client ID and Client Secret from the app's Keys & Credentials page (Development keys)
  4. Create or use a sandbox company under the Sandbox top-level menu item in the dev portal
  5. Set QUICKBOOKS_ENVIRONMENT=sandbox in your .env
  6. Run npm run auth to complete the OAuth handshake — your browser will open, you sign in to the sandbox company, tokens are saved to .env

Production Setup

The Intuit Developer Portal rejects http://localhost redirect URIs in production mode — every contributor hits this. Two known workarounds:

  1. ngrok tunnel (most common): run ngrok http 8000, then on your Intuit app go to Settings → Redirect URIs and add the generated https://<id>.ngrok-free.app/callback URL. Use that URL for the OAuth handshake, then revert to localhost afterwards.
  2. Deploy a small public callback handler (e.g., on a VPS or serverless function) that captures the auth code and hands it back to your local setup. More involved; only needed if you can't use ngrok.

After completing the production OAuth handshake, the refresh token is what matters — once it's in .env, you no longer need the public redirect URL for day-to-day use. Refresh tokens auto-rotate; the server persists the new token on each refresh.

Once you have tokens

QUICKBOOKS_CLIENT_ID=your_client_id QUICKBOOKS_CLIENT_SECRET=your_client_secret QUICKBOOKS_REFRESH_TOKEN=your_refresh_token QUICKBOOKS_REALM_ID=your_realm_id QUICKBOOKS_ENVIRONMENT=sandbox # or 'production'

Common pitfalls

  • .env loaded from the wrong directory. The server resolves .env relative to the compiled module, not your shell's CWD. If you launch via Claude Desktop, this matters — make sure you're on current main.
  • Redirect URI mismatch. The URI you register in the Intuit portal must match exactly — protocol, host, port, path. http://localhost:8000/callback .

Development

Building

npm run build

Testing

npm test

The test suite includes 396 tests with 100% code coverage across all metrics (statements, branches, functions, lines).

Project Structure

src/
├── clients/          # QuickBooks API client
├── handlers/         # Business logic handlers (87 files)
├── tools/           # MCP tool definitions
├── helpers/         # Utility functions
├── types/           # TypeScript types
└── index.ts         # Server entry point

tests/
├── unit/            # Unit tests (396 tests)
│   ├── handlers/    # Handler tests (15 test files)
│   └── helpers/     # Helper tests
└── mocks/           # Test mocks

docs/
├── ARCHITECTURE.md  # System architecture & design patterns
├── TESTING.md       # Testing guide & patterns
└── plans/           # Development plans

Documentation

DocumentDescription
CHANGELOG.mdVersion history and all changes
docs/ARCHITECTURE.mdSystem architecture, patterns, and design decisions
docs/TESTING.mdTesting strategy, ESM patterns, and coverage guide

Error Handling

If you encounter connection errors:

  1. Verify all environment variables are set correctly
  2. Check that tokens are valid and not expired
  3. Ensure the QuickBooks app has the correct redirect URIs
  4. For sandbox testing, use QUICKBOOKS_ENVIRONMENT=sandbox

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Tool naming convention

All tool names must follow the {verb}_{entity} convention using underscores. The verb prefix determines CRUD Restriction Mode behaviour:

PrefixCategorySuppressed by
create_WRITEQUICKBOOKS_DISABLE_WRITE=true
update_UPDATEQUICKBOOKS_DISABLE_UPDATE=true
delete_DELETEQUICKBOOKS_DISABLE_DELETE=true
get_, search_, read_READnever

New tools that do not follow this convention will not be correctly categorised and may appear or be suppressed unexpectedly.


License

MIT License - see LICENSE for details.


Acknowledgments

关于 About

The QuickBooks MCP Server lets AI assistants access QuickBooks data via a standard interface. It uses the Model Context Protocol to expose QBO features as callable tools, enabling developers to build AI apps that fetch real-time QBO data through MCP.

语言 Languages

TypeScript95.8%
JavaScript4.2%

提交活跃度 Commit Activity

代码提交热力图
过去 52 周的开发活跃度
41
Total Commits
峰值: 14次/周
Less
More

核心贡献者 Contributors