FreshBooks MCP
An MCP server that connects Claude Code to a FreshBooks account for time entries,
expenses and draft invoices, plus two companion skills: hours-report, which estimates attended hours from Claude Code session
transcripts, and freshbooks-timesheet, which turns those hours into FreshBooks time
entries — with a human review step before anything is pushed.
Pieces
src/freshbooks_mcp/ — Python MCP server (FastMCP, stdio). OAuth2 against the
FreshBooks API; tools for projects, clients, expense categories, and idempotent
time-entry and expense upserts, and draft invoices built from logged time.
skills/hours-report/ — Claude Code skill (with scripts/session_hours.py) that
reconstructs attended time per day and per project from ~/.claude/projects/*/*.jsonl,
separating it from session wall-clock and rounding to billable increments. Usable on
its own; freshbooks-timesheet depends on it. This repo is where it is maintained; the
ATeam-MCP plugin carries a byte-identical copy, because Claude Code plugins have no
dependency mechanism and a skill that invokes another skill's script must bundle it.
skills/freshbooks-timesheet/ — Claude Code skill that orchestrates:
hours-report → label→project mapping → proposed-entries table → approval → log_time.
~/.freshbooks-mcp/ — local state: OAuth tokens, label→project mapping, and
ledgers of the time-entry, expense and invoice ids this tool created (so re-syncs update
instead of duplicate, and hand-entered records are never touched).
Setup
1. Create a FreshBooks app (one time)
- Go to https://my.freshbooks.com/#/developer and create an application.
- Scopes:
user:profile:read, user:clients:read, user:projects:read,
user:time_entries:read, user:time_entries:write, user:expenses:read,
user:expenses:write, user:invoices:read, user:invoices:write.
Existing installs: the invoice scopes are new in 0.3.0. Add them to the app in the
developer portal, then reconnect (get_auth_url → submit_auth_code, step 4) so the
token carries them.
- Redirect URI:
https://localhost:8414/callback (it never needs to serve anything —
FreshBooks requires an HTTPS URI, and the auth flow copies the code from the address bar).
- Note the Client ID and Client Secret.
2. Store the app credentials
Create ~/.freshbooks-mcp/credentials.json (mode 0600):
{"client_id": "<your-client-id>", "client_secret": "<your-client-secret>"}
(Alternatively set FRESHBOOKS_CLIENT_ID / FRESHBOOKS_CLIENT_SECRET env vars on the
server registration. redirect_uri defaults to https://localhost:8414/callback; add
it to the JSON only if your app registered something else.)
3. Install the plugin
The MCP server and both skills ship as one Claude Code plugin. This repo is its own
marketplace, so a clone is all anyone needs:
git clone [email protected]:tritchey/FreshBooks-MCP.git
claude plugin marketplace add ./FreshBooks-MCP
claude plugin install freshbooks
The repo is private, so this stays between people who already have access to it; nothing
is published anywhere public. Restart Claude Code afterwards to pick up the server.
Requires uv on PATH — the server is launched with
uv run --directory ${CLAUDE_PLUGIN_ROOT}, which resolves wherever the plugin landed.
Step 2's credentials live in ~/.freshbooks-mcp/, outside the plugin, so they survive
installs and updates.
Upgrading from the symlink setup? Remove the old wiring first, or you get duplicate
skills and two freshbooks servers:
claude mcp remove --scope user freshbooks
rm ~/.claude/skills/freshbooks-timesheet ~/.claude/skills/hours-report
Removing the hours-report symlink is safe once the ATeam-MCP plugin is installed too —
it carries its own copy, and nothing references the ~/.claude/skills/ path any more.
4. Authenticate (one time, and again only if tokens are lost)
In a Claude Code session: ask Claude to connect to FreshBooks. It calls get_auth_url;
open the URL, approve, and the browser lands on the (non-loading) redirect page — copy
the code= value from the address bar and give it to Claude, which calls
submit_auth_code. whoami confirms the connection. Tokens auto-refresh from then on;
refresh tokens are single-use, so the server persists each new pair atomically.
Scopes are bound to the app, and a token only carries the scopes the app had when it was
issued. After adding scopes to an existing app (the expenses scopes, say), repeat this
step so a new token is issued with them; until then the expense tools fail with an
insufficient_scope error that says which scope is missing.
5. Working on the plugin itself
Plugin installs are copies, so edits in the repo will not show up in an installed plugin.
For development, skip the install and symlink instead: