FreshBooks MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
FreshBooks MCP Server
⚠️ For AI Agents: This repository includes an OI.md file with comprehensive installation and configuration instructions specifically designed for AI agents installing this server in OI OS (Brain Trust 4) environments. Please refer to OI.md for step-by-step setup instructions, intent mappings, parameter rules, and troubleshooting guidance.
Freshbooks Mcp Server
A Model Context Protocol (MCP) server for integrating FreshBooks with GenAI applications.
Overview
Small business accounting software
Related MCP server: freee Accounting MCP Server
Features
Comprehensive FreshBooks API coverage
Multiple authentication methods
Enterprise-ready with rate limiting
Full error handling and retry logic
Async support for better performance
Prerequisites
Python 3.8 or higher
pip (Python package manager)
FreshBooks account with API access
Installation
Install from Source
Clone this repository:
git clone https://github.com/OI-OS/freshbooks-mcp-server.git
cd freshbooks-mcp-serverInstall dependencies:
pip install -e .Or install dependencies directly:
pip install httpx pydantic pydantic-settings python-dotenv mcpCopy
.env.exampleto.env:
cp .env.example .envConfigure your FreshBooks credentials in
.env:FRESHBOOKS_API_TOKEN- Your FreshBooks API token (for simple authentication)FRESHBOOKS_BUSINESS_ID- Your FreshBooks business ID (for simple authentication)FRESHBOOKS_CLIENT_ID- Your OAuth client ID (for OAuth authentication)FRESHBOOKS_CLIENT_SECRET- Your OAuth client secret (for OAuth authentication)
Note: Never commit your .env file or token files to version control. They are already excluded in .gitignore.
AI Installation Guide (OI OS / Brain Trust 4)
This section provides step-by-step instructions for AI assistants to install and configure the FreshBooks MCP server in OI OS environments.
Step 1: Install via OI Command
./oi install https://github.com/OI-OS/freshbooks-mcp-server.gitThe installation will:
Clone the repository to
MCP-servers/freshbooks-mcp-server/Install Python dependencies
Auto-detect the server type
Step 2: Build and Install Dependencies
cd MCP-servers/freshbooks-mcp-server
pip3 install -e .Step 3: Configure OAuth Credentials
Add the following to your project root .env file:
# FreshBooks OAuth Configuration
FRESHBOOKS_CLIENT_ID=your_client_id_here
FRESHBOOKS_CLIENT_SECRET=your_client_secret_here
FRESHBOOKS_REDIRECT_URI=https://localhost:8080/callback
# FreshBooks Account Information (obtained after authentication)
FRESHBOOKS_ACCOUNT_ID=your_account_id_here
FRESHBOOKS_BUSINESS_ID=your_business_id_here
FRESHBOOKS_BUSINESS_NAME=your_business_name
FRESHBOOKS_USER_EMAIL=your_email@example.com
FRESHBOOKS_USER_NAME=Your NameStep 4: Connect the Server
Connect the OAuth server variant:
export FRESHBOOKS_CLIENT_ID=your_client_id_here
export FRESHBOOKS_CLIENT_SECRET=your_client_secret_here
export FRESHBOOKS_REDIRECT_URI=https://localhost:8080/callback
./brain-trust4 connect freshbooks-mcp-server python3 ./MCP-servers/freshbooks-mcp-server/src/freshbooks_mcp/simple_oauth_server.pyStep 5: Authenticate (First Time)
The OAuth flow requires manual browser interaction. Two methods:
Method A: Automatic Authentication (Interactive)
./brain-trust4 call freshbooks-mcp-server authenticate '{}'This will:
Open a browser for OAuth authorization
Wait for user to complete authorization
Exchange authorization code for access token
Save token to
~/.freshbooks_token
Note: This command may timeout if run non-interactively. Use Method B for automation.
Method B: Manual Token Exchange
Get Authorization URL:
# Manually construct or trigger OAuth URL # URL format: https://auth.freshbooks.com/oauth/authorize?response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=https://localhost:8080/callbackUser completes authorization in browser and receives authorization code
Exchange code for access token:
export FRESHBOOKS_CLIENT_ID=your_client_id_here export FRESHBOOKS_CLIENT_SECRET=your_client_secret_here export FRESHBOOKS_REDIRECT_URI=https://localhost:8080/callback python3 -c " import asyncio import httpx import json import os import time async def exchange_code(): client_id = os.getenv('FRESHBOOKS_CLIENT_ID') client_secret = os.getenv('FRESHBOOKS_CLIENT_SECRET') redirect_uri = os.getenv('FRESHBOOKS_REDIRECT_URI') auth_code = 'AUTHORIZATION_CODE_FROM_USER' # Replace with actual code async with httpx.AsyncClient() as client: response = await client.post( 'https://api.freshbooks.com/auth/oauth/token', data={ 'grant_type': 'authorization_code', 'client_id': client_id, 'client_secret': client_secret, 'redirect_uri': redirect_uri, 'code': auth_code }, headers={'Content-Type': 'application/x-www-form-urlencoded'} ) result = response.json() print('Access Token:', result['access_token']) print('Account ID:', result['account_id']) print('Business ID:', result['business_id']) return result result = asyncio.run(exchange_code()) "Save token to
~/.freshbooks_token:python3 -c " import json import time import os token_data = { 'access_token': 'ACCESS_TOKEN_FROM_STEP_3', 'account_id': 'ACCOUNT_ID_FROM_STEP_3', 'business_id': 'BUSINESS_ID_FROM_STEP_3', 'timestamp': time.time() } token_file = os.path.expanduser('~/.freshbooks_token') with open(token_file, 'w') as f: json.dump(token_data, f) print('✅ Token saved to', token_file) "Optional: Save as FRESHBOOKS_API_TOKEN
The OAuth access token can also be used as
FRESHBOOKS_API_TOKENfor the standard server. Add to.env:FRESHBOOKS_API_TOKEN=your_oauth_access_token_here FRESHBOOKS_BUSINESS_ID=your_business_id_hereImportant: OAuth tokens expire in ~12 hours. The OAuth server automatically handles token refresh, while the standard server will need manual token updates.
Step 6: Verify Installation
Test the connection:
./oi "get freshbooks clients"Or directly:
./brain-trust4 call freshbooks-mcp-server get_clients '{}'Troubleshooting for AI Installations
"Not authenticated" error: Run authentication flow (Step 5)
Token expired: Re-authenticate or use OAuth server which auto-refreshes
Environment variables not found: Export them before connecting server, or add to
.envand source itModule not found: Ensure
pip3 install -e .completed successfully in the server directory
Quick Reference Commands
# Install
./oi install https://github.com/OI-OS/freshbooks-mcp-server.git
# Connect OAuth server
export FRESHBOOKS_CLIENT_ID=... FRESHBOOKS_CLIENT_SECRET=... FRESHBOOKS_REDIRECT_URI=...
./brain-trust4 connect freshbooks-mcp-server python3 ./MCP-servers/freshbooks-mcp-server/src/freshbooks_mcp/simple_oauth_server.py
# Connect standard server (if you have API token)
./brain-trust4 connect freshbooks-api python3 ./MCP-servers/freshbooks-mcp-server/src/freshbooks_mcp/server.py
# Test
./oi "get freshbooks clients"Configuration for AI Clients
Using with Cursor
Open Cursor settings
Navigate to Features → Model Context Protocol
Click Edit Config or manually edit your MCP settings file:
macOS/Linux:
~/.cursor/mcp.jsonor project-level.cursor/mcp.jsonWindows:
%APPDATA%\Cursor\mcp.jsonor project-level.cursor\mcp.json
Add the FreshBooks MCP server configuration:
{
"mcpServers": {
"freshbooks": {
"command": "python3",
"args": ["/absolute/path/to/freshbooks-mcp-server/src/freshbooks_mcp/server.py"],
"env": {
"FRESHBOOKS_API_TOKEN": "your_freshbooks_api_token_here",
"FRESHBOOKS_BUSINESS_ID": "your_business_id_here"
}
}
}
}For OAuth authentication, use:
{
"mcpServers": {
"freshbooks-oauth": {
"command": "python3",
"args": ["/absolute/path/to/freshbooks-mcp-server/src/freshbooks_mcp/simple_oauth_server.py"],
"env": {
"FRESHBOOKS_CLIENT_ID": "your_oauth_client_id_here",
"FRESHBOOKS_CLIENT_SECRET": "your_oauth_client_secret_here"
}
}
}
}Alternative: Using project-level configuration
Create .cursor/mcp.json in your project root:
{
"mcpServers": {
"freshbooks": {
"command": "python3",
"args": ["./MCP-servers/freshbooks-mcp-server/src/freshbooks_mcp/server.py"],
"env": {
"FRESHBOOKS_API_TOKEN": "${FRESHBOOKS_API_TOKEN}",
"FRESHBOOKS_BUSINESS_ID": "${FRESHBOOKS_BUSINESS_ID}"
}
}
}
}Restart Cursor to apply changes
Using with Claude Desktop
Locate your Claude Desktop configuration file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/claude/claude_desktop_config.json
Edit the configuration file and add:
{
"mcpServers": {
"freshbooks": {
"command": "python3",
"args": ["/absolute/path/to/freshbooks-mcp-server/src/freshbooks_mcp/server.py"],
"env": {
"FRESHBOOKS_API_TOKEN": "your_freshbooks_api_token_here",
"FRESHBOOKS_BUSINESS_ID": "your_business_id_here"
}
}
}
}Save the file and restart Claude Desktop
Using with VS Code (with MCP Extension)
Install an MCP extension for VS Code (if available)
Create or edit
.vscode/mcp.jsonin your project:
{
"servers": {
"freshbooks": {
"command": "python3",
"args": ["/absolute/path/to/freshbooks-mcp-server/src/freshbooks_mcp/server.py"],
"env": {
"FRESHBOOKS_API_TOKEN": "your_freshbooks_api_token_here",
"FRESHBOOKS_BUSINESS_ID": "your_business_id_here"
},
"type": "stdio"
}
}
}Using with Continue.dev
Open your Continue.dev configuration file:
Location:
~/.continue/config.json(or%USERPROFILE%\.continue\config.jsonon Windows)
Add to the
mcpServersarray:
{
"mcpServers": [
{
"name": "freshbooks",
"command": "python3",
"args": ["/absolute/path/to/freshbooks-mcp-server/src/freshbooks_mcp/server.py"],
"env": {
"FRESHBOOKS_API_TOKEN": "your_freshbooks_api_token_here",
"FRESHBOOKS_BUSINESS_ID": "your_business_id_here"
}
}
]
}Restart Continue.dev
Server Variants
This repository includes multiple server implementations:
Standard Server (
src/freshbooks_mcp/server.py) - Uses MCP SDK with simple API token authenticationOAuth Server (
src/freshbooks_mcp/oauth_server.py) - Full OAuth flow with token refreshSimple OAuth Server (
src/freshbooks_mcp/simple_oauth_server.py) - Simplified OAuth with interactive authenticationRaw MCP Server (
mcp_server.py) - Direct MCP protocol implementationSimple Server (
simple_server.py) - Minimal implementation for testing
Choose the server that best fits your authentication needs.
Quick Start
To test the server manually:
# Using the standard server
python3 src/freshbooks_mcp/server.py
# Or using the run script
python3 run_server.pyThe server communicates via stdio (standard input/output) for MCP protocol.
Available Tools
Once configured, the following FreshBooks tools will be available to your AI assistant:
Read Operations
get_clients- Get all clients from your FreshBooks accountget_invoices- Retrieve all invoicesget_projects- Get all projectsget_expenses- Retrieve all expensesget_time_entries- Get all time tracking entries
Write Operations (OAuth Server Only)
create_client- Create a new client in FreshBookscreate_invoice- Create a new invoicecreate_project- Create a new project
OAuth-Specific Tools (OAuth Server)
authenticate- Start the OAuth authentication flow (opens browser for authorization)
Troubleshooting
Server Not Appearing in Cursor/Claude
Check Python path: Ensure
python3is in your PATH. Test with:which python3 # macOS/Linux where python3 # WindowsVerify absolute paths: Use absolute paths in your MCP configuration. Relative paths may not work.
Check environment variables: Ensure your FreshBooks credentials are correctly set in the
envsection of your MCP configuration.Restart the client: After making configuration changes, fully restart Cursor, Claude Desktop, or your AI client.
Check logs: Look for error messages in:
Cursor: View → Output → select "Model Context Protocol"
Claude Desktop: Check application logs
Authentication Issues
API Token: Ensure your
FRESHBOOKS_API_TOKENis valid and has proper permissionsBusiness ID: Verify your
FRESHBOOKS_BUSINESS_IDmatches your FreshBooks accountOAuth: For OAuth servers, ensure your
FRESHBOOKS_CLIENT_IDandFRESHBOOKS_CLIENT_SECRETare correct
Python Module Not Found
If you get "ModuleNotFoundError", install dependencies:
cd /path/to/freshbooks-mcp-server
pip install -e .Getting FreshBooks API Credentials
API Token Authentication:
Log in to your FreshBooks account
Go to Settings → Integrations → API
Generate an API token
Note your Business/Account ID
OAuth Authentication:
Create a new OAuth application
Set redirect URI:
https://localhost:8080/callbackCopy Client ID and Client Secret
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - see LICENSE file for details
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Invoicing, expenses, accounting analytics. OAuth 2.1 dynamic client registration, no API key.
Document sharing, invoicing, and personal finance platform. 15+ AI tools via OAuth 2.1.
Connect QuickBooks Online to AI agents with secure read or write access across multiple companies.
Query your books, company data, business health, and ship invoices from your AI assistant.
Related MCP Servers
- AlicenseBqualityDmaintenanceProduction-grade MCP server for FreshBooks. 25 tools for invoices, clients, expenses, payments, time tracking, projects, estimates, and financial reports. OAuth2 with automatic token refresh.253MIT
- AlicenseBqualityCmaintenanceEnables AI assistants to interact with freee accounting software API for managing companies, transactions, invoices, and reports via OAuth authentication.603MIT
- FlicenseNot gradedqualityDmaintenanceProvides 29 tools for Claude to query and update FreshBooks directly, including invoices, clients, estimates, expenses, payments, timesheets, and reports.-
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with FreshBooks accounting API for managing clients, invoices, payments, and more through natural language.-