IQ

intuit/quickbooks-online-mcp-server

开发工具
311 stars 0 forks 质量 91 趋势 91

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...

概览

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. - - Complete coverage of QuickBooks Online API - - Full CRUD operations (Create, Read, Update, Delete, Search) - - Balance Sheet, P&L, Cash Flow, and more - - Secure token-based authentication - - Full type safety with Zod validation - - 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. 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.

README

QuickBooks Online MCP Server


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:

Entity Create Get Update Delete Search
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

Report Tool Name Description
Balance Sheet get_balance_sheet Assets, liabilities, and equity snapshot
Profit & Loss get_profit_and_loss Income and expenses over a period
Cash Flow get_cash_flow Cash inflows and outflows
Trial Balance get_trial_balance Debit and credit balances
General Ledger get_general_ledger Complete transaction history
Customer Sales get_customer_sales Sales by customer
Aged Receivables get_aged_receivables Outstanding customer invoices
Aged Receivables Detail get_aged_receivables_detail Detailed aging breakdown
Customer Balance get_customer_balance Current customer balances
Aged Payables get_aged_payables Outstanding vendor bills
Vendor Expenses get_vendor_expenses Expenses by vendor

Tool Reference


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

Mode When to use Redirect URI accepted Setup difficulty
Sandbox Development, testing, demos http://localhost:8000/callback works Easy
Production Real company data Localhost rejected — must be a public HTTPS URL Harder (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.

  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://.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

Document Description
CHANGELOG.md Version history and all changes
docs/ARCHITECTURE.md System architecture, patterns, and design decisions
docs/TESTING.md Testing 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:

Prefix Category Suppressed by
create_ WRITE QUICKBOOKS_DISABLE_WRITE=true
update_ UPDATE QUICKBOOKS_DISABLE_UPDATE=true
delete_ DELETE QUICKBOOKS_DISABLE_DELETE=true
get_, search_, read_ READ never

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

View this README on GitHub

安装

This server does not publish a one-line install command.

Open the repository installation guide

配置

{ "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" } } } }