zoho-bookkeeper-mcp

zoho-bookkeeper-mcp

MCP server for Zoho Books integration, enabling AI agents to perform bookkeeping operations like managing journals, expenses, bills, invoices, and file attachments.

Category
访问服务器

README

Zoho Bookkeeper MCP Server

A Model Context Protocol (MCP) server for Zoho Books integration, designed for bookkeeping workflows with AI agents.

Why This Exists

The official Zoho MCP service (zohomcp.com) has limitations:

  • Cannot upload file attachments - The MCP schema incorrectly maps binary file parameters as query strings
  • Too many tools - 100+ tools exhaust AI tool limits quickly
  • Difficult control over tool selection - The mcp.zoho.com interface is troublesome and cannot be used by agents

This custom MCP server provides:

  • Proper multipart/form-data file uploads for attachments
  • Curated set of 49 tools for bookkeeping workflows
  • Auto-refreshing OAuth tokens (1-hour lifetime with 5-minute buffer)
  • Both stdio (CLI) and HTTP stream transports

Features

  • Full CRUD operations for journals, expenses, bills, and invoices
  • File attachments with proper multipart upload support (PDF, images, Office documents)
  • Chart of accounts management and transaction queries
  • Bank account integration and transaction listing
  • Contact management for customers and vendors
  • OAuth 2.0 with automatic token refresh
  • Health checks for container orchestration

Available Tools (49 total)

Category Tools Description
Organizations 2 List orgs, get org details
Chart of Accounts 4 List/get/create accounts, list transactions
Journals 9 Full CRUD + publish + attachments
Expenses 6 Full CRUD + receipt attachments
Bills 6 Full CRUD + attachments
Invoices 5 List/get + attachments
Contacts 2 List/get customers and vendors
Vendors 4 Vendor-specific list/get/create/update workflows
Bank Accounts 11 List accounts/transactions + matching + categorization workflows

Prerequisites

  • Node.js 20+
  • Zoho Books account with API access
  • Zoho OAuth 2.0 credentials (see Configuration)

Installation

Option 1: Run with npx (Recommended for Desktop Agents)

npx zoho-bookkeeper-mcp

Option 2: Install globally

npm install -g zoho-bookkeeper-mcp
zoho-bookkeeper-mcp

Option 3: Docker

docker build -t zoho-bookkeeper-mcp .
docker run -p 8004:8004 \
  -e ZOHO_CLIENT_ID=your_client_id \
  -e ZOHO_CLIENT_SECRET=your_client_secret \
  -e ZOHO_REFRESH_TOKEN=your_refresh_token \
  zoho-bookkeeper-mcp

Option 4: From source

git clone https://github.com/bu5hm4nn/zoho-bookkeeper-mcp.git
cd zoho-bookkeeper-mcp
pnpm install
pnpm build

Configuration

Run the interactive setup:

pnpm setup

This will guide you through:

  1. Creating a Zoho Self-Client application
  2. Entering your Client ID and Secret
  3. Generating and exchanging an authorization code
  4. Saving credentials to .env

Manual Configuration

If you prefer manual setup, copy .env.example to .env and follow the Zoho OAuth Documentation to obtain:

  • ZOHO_CLIENT_ID - from Zoho API Console
  • ZOHO_CLIENT_SECRET - from Zoho API Console
  • ZOHO_REFRESH_TOKEN - obtained via OAuth authorization code flow with scope ZohoBooks.fullaccess.all

Environment Variables

The .env file should contain:

# Required
ZOHO_CLIENT_ID=1000.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ZOHO_CLIENT_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ZOHO_REFRESH_TOKEN=1000.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# Optional
ZOHO_API_URL=https://www.zohoapis.com/books/v3  # Default (US datacenter)
ZOHO_ORGANIZATION_ID=123456789                   # Default org ID (optional)
PORT=8004                                         # HTTP server port
HOST=0.0.0.0                                      # HTTP server host

Regional API URLs:

  • US (default): https://www.zohoapis.com/books/v3
  • EU: https://www.zohoapis.eu/books/v3
  • IN: https://www.zohoapis.in/books/v3
  • AU: https://www.zohoapis.com.au/books/v3

Integration with Chat Agents

Claude Desktop

Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "zoho-bookkeeper": {
      "command": "npx",
      "args": ["zoho-bookkeeper-mcp"],
      "env": {
        "ZOHO_CLIENT_ID": "your_client_id",
        "ZOHO_CLIENT_SECRET": "your_client_secret",
        "ZOHO_REFRESH_TOKEN": "your_refresh_token"
      }
    }
  }
}

Or if installed globally:

{
  "mcpServers": {
    "zoho-bookkeeper": {
      "command": "zoho-bookkeeper-mcp",
      "env": {
        "ZOHO_CLIENT_ID": "your_client_id",
        "ZOHO_CLIENT_SECRET": "your_client_secret",
        "ZOHO_REFRESH_TOKEN": "your_refresh_token"
      }
    }
  }
}

LibreChat

Add to your librechat.yaml:

mcpServers:
  zoho-bookkeeper:
    type: streamable-http
    url: http://mcp-zoho-bookkeeper:8004/mcp
    timeout: 30000

And to your docker-compose.yml:

services:
  mcp-zoho-bookkeeper:
    build:
      context: ./path/to/zoho-bookkeeper-mcp
    container_name: mcp-zoho-bookkeeper
    restart: unless-stopped
    environment:
      PORT: 8004
      ZOHO_CLIENT_ID: ${ZOHO_CLIENT_ID}
      ZOHO_CLIENT_SECRET: ${ZOHO_CLIENT_SECRET}
      ZOHO_REFRESH_TOKEN: ${ZOHO_REFRESH_TOKEN}
    ports:
      - "8004:8004"
    healthcheck:
      test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8004/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 30s

Generic MCP Client (HTTP)

Start the HTTP server:

# Using pnpm
pnpm serve

# Or directly
node dist/server.js

Connect to http://localhost:8004/mcp using streamable-http transport.

Generic MCP Client (stdio)

# Using pnpm
pnpm start

# Or directly
node dist/bin.js

Usage Examples

Get Organization ID (Required First Step)

Most tools require an organization_id. Get it first:

Use the list_organizations tool to get your Zoho organization ID

Create a Journal Entry

Create a journal entry dated 2025-01-15 with:
- Debit Office Supplies (account_id: 123456) for $150
- Credit Business Checking (account_id: 789012) for $150
Reference: "Office supplies purchase"

Attach a Receipt

Upload the file /path/to/receipt.pdf to journal 4567890123456

List Recent Expenses

List all expenses from the last 30 days

Development

Setup

git clone https://github.com/bu5hm4nn/zoho-bookkeeper-mcp.git
cd zoho-bookkeeper-mcp
pnpm install

Commands

pnpm build        # Build TypeScript to dist/
pnpm dev          # Run with hot reload (HTTP server)
pnpm serve:dev    # Same as dev
pnpm start        # Run stdio transport
pnpm serve        # Run HTTP server

pnpm test         # Run all tests
pnpm test:unit    # Run unit tests only
pnpm test:watch   # Run tests in watch mode
pnpm test:coverage # Run tests with coverage

pnpm lint         # Check for linting errors
pnpm lint:fix     # Fix linting errors
pnpm format       # Format code with Prettier
pnpm format:check # Check formatting

Project Structure

zoho-bookkeeper-mcp/
├── src/
│   ├── index.ts           # Main MCP server setup
│   ├── server.ts          # HTTP server entry point
│   ├── bin.ts             # CLI entry point (stdio)
│   ├── config.ts          # Configuration management
│   ├── api/
│   │   ├── client.ts      # Zoho API client helpers
│   │   └── types.ts       # TypeScript type definitions
│   ├── auth/
│   │   └── oauth.ts       # OAuth token management
│   ├── tools/
│   │   ├── organizations.ts
│   │   ├── chart-of-accounts.ts
│   │   ├── journals.ts
│   │   ├── expenses.ts
│   │   ├── bills.ts
│   │   ├── invoices.ts
│   │   ├── contacts.ts
│   │   └── bank-accounts.ts
│   ├── utils/
│   │   ├── errors.ts
│   │   ├── mime-types.ts
│   │   └── response-parser.ts
│   └── __tests__/         # Test files
├── dist/                   # Compiled JavaScript
├── Dockerfile
├── package.json
└── tsconfig.json

API Endpoints

When running as HTTP server:

Endpoint Description
GET /health Health check (returns JSON status)
POST /mcp MCP protocol endpoint (streamable-http)

Troubleshooting

"Invalid OAuth token" errors

  1. Verify your refresh token is valid
  2. Check that your Zoho app has the ZohoBooks.fullaccess.all scope
  3. Ensure the correct regional API URL is set

"Organization not found" errors

  1. Use list_organizations first to get valid org IDs
  2. Set ZOHO_ORGANIZATION_ID env var for default org

Attachment upload fails

  1. Verify the file path is accessible to the server
  2. Check file type is supported (PDF, PNG, JPG, GIF, DOC, DOCX, XLS, XLSX)
  3. Ensure file size is within Zoho's limits

Rate limiting

This server uses ~3k tokens per request vs ~30k for the hosted Zoho MCP (100+ tools). If you still hit rate limits, add delays between requests.

Tech Stack

  • Runtime: Node.js 20+
  • Framework: FastMCP
  • Language: TypeScript
  • Auth: OAuth 2.0 with refresh token flow
  • Build: tsup
  • Testing: Vitest
  • Linting: ESLint + Prettier

License

MIT License - see LICENSE for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

Related Projects

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选