freshbooks-mcp
MCP server for FreshBooks, providing tools to browse and manage invoices, clients, estimates, payments, expenses, projects, and time entries. Handles OAuth2 authorization and token rotation, enabling Claude to interact with FreshBooks accounting via natural language.
README
freshbooks-mcp
MCP server for FreshBooks — invoices, clients, estimates and payments, exposed to Claude as typed tools.
This project was developed and is maintained by AI (Claude Code). Use at your own discretion.
Install
npm install -g @chrischall/freshbooks-mcp
Setup
FreshBooks is OAuth2 only — there is no API key and no personal access token, so a one-time browser authorization is required.
- Register an app at https://my.freshbooks.com/#/developer. The redirect URI must be
HTTPS with no query string;
https://localhostworks and never needs to resolve. - Note the Client ID and Client Secret.
- Run the one-time bootstrap to obtain a refresh token — see
skills/freshbooks-curl, which ships the bootstrap script. - Configure:
FRESHBOOKS_CLIENT_ID=...
FRESHBOOKS_CLIENT_SECRET=...
FRESHBOOKS_REFRESH_TOKEN=... # from the bootstrap
FRESHBOOKS_REDIRECT_URI=https://localhost # optional; must match what you registered
FRESHBOOKS_TOKEN_STORE=~/.freshbooks-mcp/session.json # optional
⚠️ Refresh tokens rotate
FreshBooks issues a new refresh token on every refresh and immediately invalidates the
old one. This server persists each rotation to FRESHBOOKS_TOKEN_STORE (mode 0600)
before the refresh is considered complete, and prefers the stored token over the
environment value — the stored one has rotated past it.
Two consequences worth knowing:
- Do not point two tools at the same store. The MCP server and the
freshbooks-curlskill keep separate state files on purpose; sharing one makes them spend each other's tokens and locks both out. - If the store is lost, re-run the bootstrap. A spent refresh token cannot be recovered.
Changing FRESHBOOKS_REFRESH_TOKEN to a freshly bootstrapped value is detected and
adopted, so re-bootstrapping is the supported recovery path.
Tools
| Tool | Purpose |
|---|---|
freshbooks_get_identity |
Resolve accountId / businessId / businessUuid |
freshbooks_list_invoices / freshbooks_get_invoice |
Browse and fetch invoices |
freshbooks_list_clients / freshbooks_get_client |
Browse and fetch clients |
freshbooks_list_estimates / freshbooks_get_estimate |
Browse and fetch estimates |
freshbooks_list_payments / freshbooks_get_payment |
Browse and fetch payments |
freshbooks_list_items / freshbooks_get_item |
Browse and fetch catalogue items |
freshbooks_create_client |
Create a client — confirm-gated |
freshbooks_create_invoice |
Create an invoice — confirm-gated |
freshbooks_update_invoice |
Update an invoice — confirm-gated |
freshbooks_record_payment |
Record a payment against an invoice — confirm-gated |
freshbooks_accept_estimate |
Accept an estimate (action_accept) — confirm-gated, idempotent |
freshbooks_update_estimate |
Update an estimate's lines, notes, terms, presentation — confirm-gated |
freshbooks_send_estimate |
Email an estimate to the client (action_email) — confirm-gated |
freshbooks_decline_estimate |
Always fails: FreshBooks has no decline. Answers with the alternatives |
freshbooks_list_expenses / freshbooks_get_expense |
Browse and fetch expenses |
freshbooks_list_expense_categories |
Categories supplying categoryid for new expenses |
freshbooks_create_expense |
Record an expense — confirm-gated |
freshbooks_list_projects / freshbooks_get_project |
Projects (businessId-keyed) |
freshbooks_create_project |
Create a project — confirm-gated |
freshbooks_list_time_entries |
Tracked time, with total_logged / total_unbilled |
freshbooks_create_time_entry |
Log time in seconds — confirm-gated |
freshbooks_list_services |
Billable work types for projects and time entries |
freshbooks_list_records / freshbooks_get_record |
Generic accessor for the accounting long tail (taxes, credit notes, invoice profiles, tasks, staff, gateways, bills, bill vendors, bill payments, other income) |
Confirm-gated means the tool makes no network call unless confirm: true is passed;
without it you get a dry-run preview of exactly what would be sent.
Estimate writes
Acceptance is an action on the estimate, not a status field: status (int),
display_status and ui_status are computed and read-only, and they disagree with each
other by design (a viewed estimate reads status: 3, display_status: "viewed",
ui_status: "open"). Accepting is PUT estimates/estimates/{id} with
{"estimate": {"action_accept": true}} — see
docs/FRESHBOOKS-API.md for where that shape comes from.
- Accept is idempotent. An estimate already accepted (or invoiced) comes back with
changed: falseand no write is sent — acceptance cannot be undone through the API, so a repeat call must not re-fire it. - There is no decline. FreshBooks' estimate statuses are draft / sent / viewed /
replied / accepted / invoiced; no declined state, no
action_deny, noestimate.declinewebhook.freshbooks_decline_estimateexists only to say so and point at the alternatives, rather than leave an agent to invent a write that changes nothing. - Every write returns the re-fetched estimate, plus
before/afterstate andchanged/changedFields, so success is verified against the record rather than inferred from a200.changedcovers the status fields and the fields that write actually set, so a successful notes edit reportschanged: trueeven though no status moves. Onfreshbooks_send_estimateit describes the record only — emailing an already-sent estimate moves nothing, and retrying onchanged: falsewould send the client a second copy.
Writes require an owner/admin accounting account
FreshBooks separates the role you hold on a business from the role you hold on an
accounting account. You can own a business that has no accounting account
(account_id: null) while being only a client on the account you can actually see —
in which case reads succeed and every write returns 403 Permission Denied, even though
your OAuth token carries all the :write scopes.
freshbooks_get_identity reports accountRole and businessRole so this is visible up
front. If accountRole is client, the invoicing write tools will not work against that
account — that is an account permission, not a configuration problem.
Two things the API reports misleadingly
totalcounts records you may not be able to read. Expenses reportedtotal: 16while returning zero rows. List results attach anotewhen that happens, so it reads as a permission boundary rather than an empty account.- Projects and time tracking are keyed by
businessId, notaccountId, and paginate under ametablock instead of flatpage/pages/total. They also work on a business with no accounting account at all.
The three identifiers
FreshBooks hands out three non-interchangeable ids, and using the wrong one returns a bare 404 that reads like a missing record:
| Identifier | Used by |
|---|---|
accountId (alphanumeric) |
/accounting/account/…, /payments/account/… |
businessId (integer) |
/projects/business/…, /timetracking/business/… |
businessUuid (UUID) |
/accounting/businesses/… |
Call freshbooks_get_identity first. Full API notes, including the four different error
envelopes, are in docs/FRESHBOOKS-API.md.
Shell access without the server
skills/freshbooks-curl covers the same API from a
shell with curl + jq, including the OAuth bootstrap and rotation-safe token handling.
Development
npm install
npm run build
npm test
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。