@goodsamsoftware/freshbooks-mcp 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +357 -357
- package/dist/tools/client/client-create.js +38 -38
- package/dist/tools/client/client-list.js +47 -47
- package/dist/tools/client/client-update.js +34 -34
- package/dist/tools/credit-note/creditnote-single.js +18 -18
- package/dist/tools/expense/expense-update.d.ts.map +1 -1
- package/dist/tools/expense/expense-update.js +4 -4
- package/dist/tools/expense/expense-update.js.map +1 -1
- package/dist/tools/invoice/invoice-list.js +40 -40
- package/dist/tools/project/project-create.js +34 -34
- package/dist/tools/project/project-delete.js +38 -38
- package/dist/tools/project/project-list.js +38 -38
- package/dist/tools/project/project-single.js +23 -23
- package/dist/tools/project/project-update.js +37 -37
- package/dist/tools/task/task-create.js +36 -36
- package/dist/tools/task/task-delete.js +35 -35
- package/dist/tools/task/task-list.js +28 -28
- package/dist/tools/task/task-single.js +25 -25
- package/dist/tools/task/task-update.js +39 -39
- package/dist/tools/time-entry/timeentry-create.js +49 -49
- package/dist/tools/time-entry/timeentry-delete.js +48 -48
- package/dist/tools/time-entry/timeentry-list.js +53 -53
- package/dist/tools/time-entry/timeentry-single.js +28 -28
- package/dist/tools/time-entry/timeentry-update.js +61 -61
- package/dist/tools/timer/timer-current.js +54 -54
- package/dist/tools/timer/timer-discard.js +41 -41
- package/dist/tools/timer/timer-start.js +43 -43
- package/dist/tools/timer/timer-stop.js +33 -33
- package/package.json +88 -88
package/README.md
CHANGED
|
@@ -1,357 +1,357 @@
|
|
|
1
|
-
# FreshBooks MCP Server
|
|
2
|
-
|
|
3
|
-
A Model Context Protocol (MCP) server providing complete FreshBooks integration for Claude and other MCP-compatible AI assistants.
|
|
4
|
-
|
|
5
|
-
[](https://opensource.org/licenses/MIT)
|
|
6
|
-
[](https://www.typescriptlang.org/)
|
|
7
|
-
[](#testing)
|
|
8
|
-
|
|
9
|
-
## Features
|
|
10
|
-
|
|
11
|
-
- **Complete SDK Parity** - 87 tools covering all major FreshBooks functionality
|
|
12
|
-
- **22 Entity Categories** - Full coverage of accounting, invoicing, time tracking, and more
|
|
13
|
-
- **Time Tracking** - Log time, manage timers, track billable hours
|
|
14
|
-
- **Invoicing & Billing** - Create invoices, manage bills, handle payments
|
|
15
|
-
- **Expense Management** - Track expenses, categorize spending, manage vendors
|
|
16
|
-
- **Client & Project Management** - Full CRM and project capabilities
|
|
17
|
-
- **Financial Reports** - Profit/loss, tax summaries, and more
|
|
18
|
-
- **OAuth2 Authentication** - Secure token-based authentication with auto-refresh
|
|
19
|
-
|
|
20
|
-
## Installation
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
npm install @goodsamsoftware/freshbooks-mcp
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Quick Start
|
|
27
|
-
|
|
28
|
-
The fastest way to get started is with our **hosted service** — no OAuth setup required.
|
|
29
|
-
|
|
30
|
-
### 1. Sign Up
|
|
31
|
-
|
|
32
|
-
Go to [freshbooks.goodsamsoftware.com](https://freshbooks.goodsamsoftware.com) and create an account (**14-day free trial**). Once you're in, connect your FreshBooks account from the dashboard.
|
|
33
|
-
|
|
34
|
-
### 2. Copy Your Configuration
|
|
35
|
-
|
|
36
|
-
From your dashboard, copy the configuration snippet provided. It works with both **Claude Desktop** and **Claude Code**.
|
|
37
|
-
|
|
38
|
-
**Claude Desktop** (`claude_desktop_config.json`):
|
|
39
|
-
```json
|
|
40
|
-
{
|
|
41
|
-
"mcpServers": {
|
|
42
|
-
"freshbooks": {
|
|
43
|
-
"command": "npx",
|
|
44
|
-
"args": ["mcp-remote", "https://freshbooks.goodsamsoftware.com/api/mcp", "--header", "Authorization:Bearer YOUR_TOKEN"]
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
**Claude Code** (`.mcp.json` in your project):
|
|
51
|
-
```json
|
|
52
|
-
{
|
|
53
|
-
"mcpServers": {
|
|
54
|
-
"freshbooks": {
|
|
55
|
-
"command": "npx",
|
|
56
|
-
"args": ["mcp-remote", "https://freshbooks.goodsamsoftware.com/api/mcp", "--header", "Authorization:Bearer YOUR_TOKEN"]
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### 3. Start Using
|
|
63
|
-
|
|
64
|
-
Example prompts:
|
|
65
|
-
- "Log 2 hours on the Website Redesign project"
|
|
66
|
-
- "Show me my time entries for this week"
|
|
67
|
-
- "Start a timer for client meeting"
|
|
68
|
-
- "Create an invoice for Acme Corp for $1,500"
|
|
69
|
-
- "What's my profit/loss this month?"
|
|
70
|
-
|
|
71
|
-
---
|
|
72
|
-
|
|
73
|
-
## Self-Hosted Setup
|
|
74
|
-
|
|
75
|
-
You can also run the MCP server locally with your own FreshBooks API application.
|
|
76
|
-
|
|
77
|
-
> **Note:** FreshBooks requires HTTPS for all OAuth callback URLs, including localhost. See [Local HTTPS Setup](#advanced-local-https-setup) below for instructions.
|
|
78
|
-
|
|
79
|
-
### 1. Get FreshBooks Credentials
|
|
80
|
-
|
|
81
|
-
1. Go to [FreshBooks Developer Portal](https://my.freshbooks.com/#/developer)
|
|
82
|
-
2. Create a new application
|
|
83
|
-
3. Set redirect URI to: `https://freshbooks.goodsamsoftware.com/callback`
|
|
84
|
-
4. Note your Client ID and Client Secret
|
|
85
|
-
|
|
86
|
-
### 2. Configure Claude Desktop
|
|
87
|
-
|
|
88
|
-
Add to your Claude Desktop configuration (`claude_desktop_config.json`):
|
|
89
|
-
|
|
90
|
-
```json
|
|
91
|
-
{
|
|
92
|
-
"mcpServers": {
|
|
93
|
-
"freshbooks": {
|
|
94
|
-
"command": "npx",
|
|
95
|
-
"args": ["@goodsamsoftware/freshbooks-mcp"],
|
|
96
|
-
"env": {
|
|
97
|
-
"FRESHBOOKS_CLIENT_ID": "your-client-id",
|
|
98
|
-
"FRESHBOOKS_CLIENT_SECRET": "your-client-secret",
|
|
99
|
-
"FRESHBOOKS_REDIRECT_URI": "https://freshbooks.goodsamsoftware.com/callback"
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
### 3. Authenticate
|
|
107
|
-
|
|
108
|
-
Ask Claude:
|
|
109
|
-
> "Connect me to FreshBooks"
|
|
110
|
-
|
|
111
|
-
Claude will guide you through OAuth authentication. After authorizing in FreshBooks, you'll see the authorization code on our [hosted callback page](https://freshbooks.goodsamsoftware.com) - just copy it and paste it back to Claude.
|
|
112
|
-
|
|
113
|
-
### 4. Start Using
|
|
114
|
-
|
|
115
|
-
Example prompts:
|
|
116
|
-
- "Log 2 hours on the Website Redesign project"
|
|
117
|
-
- "Show me my time entries for this week"
|
|
118
|
-
- "Start a timer for client meeting"
|
|
119
|
-
- "Create an invoice for Acme Corp for $1,500"
|
|
120
|
-
- "What's my profit/loss this month?"
|
|
121
|
-
|
|
122
|
-
## Available Tools (87 total)
|
|
123
|
-
|
|
124
|
-
### Authentication (5 tools)
|
|
125
|
-
| Tool | Description |
|
|
126
|
-
|------|-------------|
|
|
127
|
-
| `auth_status` | Check authentication status |
|
|
128
|
-
| `auth_get_url` | Get OAuth authorization URL |
|
|
129
|
-
| `auth_exchange_code` | Exchange auth code for tokens |
|
|
130
|
-
| `auth_refresh` | Refresh access token |
|
|
131
|
-
| `auth_revoke` | Revoke authentication |
|
|
132
|
-
|
|
133
|
-
### Time Tracking (5 tools)
|
|
134
|
-
| Tool | Description |
|
|
135
|
-
|------|-------------|
|
|
136
|
-
| `timeentry_list` | List time entries with filters |
|
|
137
|
-
| `timeentry_single` | Get time entry by ID |
|
|
138
|
-
| `timeentry_create` | Create time entry |
|
|
139
|
-
| `timeentry_update` | Update time entry |
|
|
140
|
-
| `timeentry_delete` | Delete time entry |
|
|
141
|
-
|
|
142
|
-
### Timer Management (4 tools)
|
|
143
|
-
| Tool | Description |
|
|
144
|
-
|------|-------------|
|
|
145
|
-
| `timer_start` | Start a timer |
|
|
146
|
-
| `timer_stop` | Stop timer and log time |
|
|
147
|
-
| `timer_current` | Get running timer(s) |
|
|
148
|
-
| `timer_discard` | Delete timer without logging |
|
|
149
|
-
|
|
150
|
-
### Invoicing (5 tools)
|
|
151
|
-
| Tool | Description |
|
|
152
|
-
|------|-------------|
|
|
153
|
-
| `invoice_list` | List invoices |
|
|
154
|
-
| `invoice_single` | Get invoice by ID |
|
|
155
|
-
| `invoice_create` | Create invoice |
|
|
156
|
-
| `invoice_update` | Update invoice |
|
|
157
|
-
| `invoice_delete` | Delete invoice |
|
|
158
|
-
|
|
159
|
-
### Clients (5 tools)
|
|
160
|
-
| Tool | Description |
|
|
161
|
-
|------|-------------|
|
|
162
|
-
| `client_list` | List clients |
|
|
163
|
-
| `client_single` | Get client by ID |
|
|
164
|
-
| `client_create` | Create client |
|
|
165
|
-
| `client_update` | Update client |
|
|
166
|
-
| `client_delete` | Delete client |
|
|
167
|
-
|
|
168
|
-
### Projects (5 tools)
|
|
169
|
-
| Tool | Description |
|
|
170
|
-
|------|-------------|
|
|
171
|
-
| `project_list` | List projects |
|
|
172
|
-
| `project_single` | Get project by ID |
|
|
173
|
-
| `project_create` | Create project |
|
|
174
|
-
| `project_update` | Update project |
|
|
175
|
-
| `project_delete` | Delete project |
|
|
176
|
-
|
|
177
|
-
### Expenses (5 tools)
|
|
178
|
-
| Tool | Description |
|
|
179
|
-
|------|-------------|
|
|
180
|
-
| `expense_list` | List expenses |
|
|
181
|
-
| `expense_single` | Get expense by ID |
|
|
182
|
-
| `expense_create` | Create expense |
|
|
183
|
-
| `expense_update` | Update expense |
|
|
184
|
-
| `expense_delete` | Delete expense |
|
|
185
|
-
|
|
186
|
-
### Bills & Payments (15 tools)
|
|
187
|
-
| Tool | Description |
|
|
188
|
-
|------|-------------|
|
|
189
|
-
| `bill_list` | List bills |
|
|
190
|
-
| `bill_single` | Get bill by ID |
|
|
191
|
-
| `bill_create` | Create bill |
|
|
192
|
-
| `bill_update` | Update bill |
|
|
193
|
-
| `bill_delete` | Delete bill |
|
|
194
|
-
| `billpayment_list` | List bill payments |
|
|
195
|
-
| `billpayment_single` | Get bill payment |
|
|
196
|
-
| `billpayment_create` | Create bill payment |
|
|
197
|
-
| `billpayment_update` | Update bill payment |
|
|
198
|
-
| `billpayment_delete` | Delete bill payment |
|
|
199
|
-
| `billvendor_list` | List vendors |
|
|
200
|
-
| `billvendor_single` | Get vendor by ID |
|
|
201
|
-
| `billvendor_create` | Create vendor |
|
|
202
|
-
| `billvendor_update` | Update vendor |
|
|
203
|
-
| `billvendor_delete` | Delete vendor |
|
|
204
|
-
|
|
205
|
-
### Additional Tools
|
|
206
|
-
|
|
207
|
-
| Category | Tools | Description |
|
|
208
|
-
|----------|-------|-------------|
|
|
209
|
-
| **Credit Notes** | 5 | Create, manage credit notes |
|
|
210
|
-
| **Expense Categories** | 3 | Manage expense categories |
|
|
211
|
-
| **Items** | 5 | Product/service catalog |
|
|
212
|
-
| **Journal Entries** | 5 | Manual accounting entries |
|
|
213
|
-
| **Journal Entry Accounts** | 3 | Chart of accounts |
|
|
214
|
-
| **Other Income** | 5 | Non-invoice income tracking |
|
|
215
|
-
| **Payments** | 5 | Invoice payment tracking |
|
|
216
|
-
| **Payment Options** | 2 | Payment gateway settings |
|
|
217
|
-
| **Reports** | 3 | Financial reports |
|
|
218
|
-
| **Services** | 5 | Billable service types |
|
|
219
|
-
| **Tasks** | 5 | Project task management |
|
|
220
|
-
| **User** | 1 | Current user info |
|
|
221
|
-
| **Callbacks** | 5 | Webhook management |
|
|
222
|
-
|
|
223
|
-
*See complete tool documentation in [docs/api/](docs/api/)*
|
|
224
|
-
|
|
225
|
-
## Configuration (Self-Hosted)
|
|
226
|
-
|
|
227
|
-
### Environment Variables
|
|
228
|
-
|
|
229
|
-
| Variable | Required | Description |
|
|
230
|
-
|----------|----------|-------------|
|
|
231
|
-
| `FRESHBOOKS_CLIENT_ID` | Yes | OAuth client ID |
|
|
232
|
-
| `FRESHBOOKS_CLIENT_SECRET` | Yes | OAuth client secret |
|
|
233
|
-
| `FRESHBOOKS_REDIRECT_URI` | Yes | OAuth redirect URI |
|
|
234
|
-
| `FRESHBOOKS_TOKEN_PATH` | No | Path for token storage |
|
|
235
|
-
| `LOG_LEVEL` | No | Logging level (debug, info, warn, error) |
|
|
236
|
-
|
|
237
|
-
### Advanced: Local HTTPS Setup
|
|
238
|
-
|
|
239
|
-
If you prefer to use a local callback instead of our hosted callback page, you can set up local HTTPS certificates with [mkcert](https://github.com/FiloSottile/mkcert):
|
|
240
|
-
|
|
241
|
-
**Windows (winget):**
|
|
242
|
-
```bash
|
|
243
|
-
winget install FiloSottile.mkcert
|
|
244
|
-
mkcert -install
|
|
245
|
-
mkdir certs
|
|
246
|
-
mkcert -key-file certs/localhost-key.pem -cert-file certs/localhost.pem localhost 127.0.0.1 ::1
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
**macOS (Homebrew):**
|
|
250
|
-
```bash
|
|
251
|
-
brew install mkcert
|
|
252
|
-
mkcert -install
|
|
253
|
-
mkdir certs
|
|
254
|
-
mkcert -key-file certs/localhost-key.pem -cert-file certs/localhost.pem localhost 127.0.0.1 ::1
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
**Linux:**
|
|
258
|
-
```bash
|
|
259
|
-
# Install mkcert (see https://github.com/FiloSottile/mkcert#installation)
|
|
260
|
-
mkcert -install
|
|
261
|
-
mkdir certs
|
|
262
|
-
mkcert -key-file certs/localhost-key.pem -cert-file certs/localhost.pem localhost 127.0.0.1 ::1
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
Then set your redirect URI to `https://localhost:3000/callback` in FreshBooks.
|
|
266
|
-
|
|
267
|
-
The certificates will be valid for 3 years and trusted by your system.
|
|
268
|
-
|
|
269
|
-
## Development
|
|
270
|
-
|
|
271
|
-
```bash
|
|
272
|
-
# Install dependencies
|
|
273
|
-
npm install
|
|
274
|
-
|
|
275
|
-
# Run in development mode
|
|
276
|
-
npm run dev
|
|
277
|
-
|
|
278
|
-
# Run tests
|
|
279
|
-
npm test
|
|
280
|
-
|
|
281
|
-
# Run tests with coverage
|
|
282
|
-
npm run test:coverage
|
|
283
|
-
|
|
284
|
-
# Type check
|
|
285
|
-
npm run typecheck
|
|
286
|
-
|
|
287
|
-
# Build for production
|
|
288
|
-
npm run build
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
## Testing
|
|
292
|
-
|
|
293
|
-
The project has comprehensive test coverage:
|
|
294
|
-
|
|
295
|
-
- **1,571 tests** across 93 test files
|
|
296
|
-
- **100% code coverage** requirement
|
|
297
|
-
- Mock factories for all FreshBooks entities
|
|
298
|
-
- Error scenario coverage
|
|
299
|
-
|
|
300
|
-
```bash
|
|
301
|
-
npm test # Run all tests
|
|
302
|
-
npm run test:coverage # Run with coverage report
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
## Architecture
|
|
306
|
-
|
|
307
|
-
```
|
|
308
|
-
src/
|
|
309
|
-
├── server.ts # MCP server entry point
|
|
310
|
-
├── auth/ # OAuth2 authentication
|
|
311
|
-
├── client/ # FreshBooks SDK wrapper
|
|
312
|
-
├── errors/ # Error normalization
|
|
313
|
-
├── tools/ # MCP tool implementations (22 categories)
|
|
314
|
-
│ ├── auth/ # Authentication tools
|
|
315
|
-
│ ├── time-entry/ # Time tracking
|
|
316
|
-
│ ├── timer/ # Timer management
|
|
317
|
-
│ ├── invoice/ # Invoicing
|
|
318
|
-
│ ├── client/ # Client management
|
|
319
|
-
│ ├── project/ # Projects
|
|
320
|
-
│ ├── expense/ # Expenses
|
|
321
|
-
│ ├── bill/ # Bills
|
|
322
|
-
│ └── ... # 14 more categories
|
|
323
|
-
└── config/ # Configuration
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
## Documentation
|
|
327
|
-
|
|
328
|
-
- [API Reference](docs/api/) - Complete tool documentation
|
|
329
|
-
- [Authentication Setup](docs/AUTH_SETUP.md) - OAuth configuration
|
|
330
|
-
- [Claude Guide](docs/claude/) - Claude-optimized usage examples
|
|
331
|
-
- [Examples](docs/examples/) - Workflow examples
|
|
332
|
-
|
|
333
|
-
## Error Handling
|
|
334
|
-
|
|
335
|
-
All errors are normalized to MCP format with helpful context:
|
|
336
|
-
|
|
337
|
-
```json
|
|
338
|
-
{
|
|
339
|
-
"code": -32005,
|
|
340
|
-
"message": "User-friendly message",
|
|
341
|
-
"data": {
|
|
342
|
-
"freshbooksError": { "code": "...", "message": "..." },
|
|
343
|
-
"recoverable": true,
|
|
344
|
-
"suggestion": "What to do next"
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
## License
|
|
350
|
-
|
|
351
|
-
MIT License - see [LICENSE](LICENSE) for details.
|
|
352
|
-
|
|
353
|
-
## Credits
|
|
354
|
-
|
|
355
|
-
- [FreshBooks Node.js SDK](https://github.com/freshbooks/freshbooks-nodejs-sdk)
|
|
356
|
-
- [Model Context Protocol](https://modelcontextprotocol.io)
|
|
357
|
-
- [MCP TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk)
|
|
1
|
+
# FreshBooks MCP Server
|
|
2
|
+
|
|
3
|
+
A Model Context Protocol (MCP) server providing complete FreshBooks integration for Claude and other MCP-compatible AI assistants.
|
|
4
|
+
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://www.typescriptlang.org/)
|
|
7
|
+
[](#testing)
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Complete SDK Parity** - 87 tools covering all major FreshBooks functionality
|
|
12
|
+
- **22 Entity Categories** - Full coverage of accounting, invoicing, time tracking, and more
|
|
13
|
+
- **Time Tracking** - Log time, manage timers, track billable hours
|
|
14
|
+
- **Invoicing & Billing** - Create invoices, manage bills, handle payments
|
|
15
|
+
- **Expense Management** - Track expenses, categorize spending, manage vendors
|
|
16
|
+
- **Client & Project Management** - Full CRM and project capabilities
|
|
17
|
+
- **Financial Reports** - Profit/loss, tax summaries, and more
|
|
18
|
+
- **OAuth2 Authentication** - Secure token-based authentication with auto-refresh
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @goodsamsoftware/freshbooks-mcp
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
The fastest way to get started is with our **hosted service** — no OAuth setup required.
|
|
29
|
+
|
|
30
|
+
### 1. Sign Up
|
|
31
|
+
|
|
32
|
+
Go to [freshbooks.goodsamsoftware.com](https://freshbooks.goodsamsoftware.com) and create an account (**14-day free trial**). Once you're in, connect your FreshBooks account from the dashboard.
|
|
33
|
+
|
|
34
|
+
### 2. Copy Your Configuration
|
|
35
|
+
|
|
36
|
+
From your dashboard, copy the configuration snippet provided. It works with both **Claude Desktop** and **Claude Code**.
|
|
37
|
+
|
|
38
|
+
**Claude Desktop** (`claude_desktop_config.json`):
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"mcpServers": {
|
|
42
|
+
"freshbooks": {
|
|
43
|
+
"command": "npx",
|
|
44
|
+
"args": ["mcp-remote", "https://freshbooks.goodsamsoftware.com/api/mcp", "--header", "Authorization:Bearer YOUR_TOKEN"]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Claude Code** (`.mcp.json` in your project):
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"mcpServers": {
|
|
54
|
+
"freshbooks": {
|
|
55
|
+
"command": "npx",
|
|
56
|
+
"args": ["mcp-remote", "https://freshbooks.goodsamsoftware.com/api/mcp", "--header", "Authorization:Bearer YOUR_TOKEN"]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 3. Start Using
|
|
63
|
+
|
|
64
|
+
Example prompts:
|
|
65
|
+
- "Log 2 hours on the Website Redesign project"
|
|
66
|
+
- "Show me my time entries for this week"
|
|
67
|
+
- "Start a timer for client meeting"
|
|
68
|
+
- "Create an invoice for Acme Corp for $1,500"
|
|
69
|
+
- "What's my profit/loss this month?"
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Self-Hosted Setup
|
|
74
|
+
|
|
75
|
+
You can also run the MCP server locally with your own FreshBooks API application.
|
|
76
|
+
|
|
77
|
+
> **Note:** FreshBooks requires HTTPS for all OAuth callback URLs, including localhost. See [Local HTTPS Setup](#advanced-local-https-setup) below for instructions.
|
|
78
|
+
|
|
79
|
+
### 1. Get FreshBooks Credentials
|
|
80
|
+
|
|
81
|
+
1. Go to [FreshBooks Developer Portal](https://my.freshbooks.com/#/developer)
|
|
82
|
+
2. Create a new application
|
|
83
|
+
3. Set redirect URI to: `https://freshbooks.goodsamsoftware.com/callback`
|
|
84
|
+
4. Note your Client ID and Client Secret
|
|
85
|
+
|
|
86
|
+
### 2. Configure Claude Desktop
|
|
87
|
+
|
|
88
|
+
Add to your Claude Desktop configuration (`claude_desktop_config.json`):
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"mcpServers": {
|
|
93
|
+
"freshbooks": {
|
|
94
|
+
"command": "npx",
|
|
95
|
+
"args": ["@goodsamsoftware/freshbooks-mcp"],
|
|
96
|
+
"env": {
|
|
97
|
+
"FRESHBOOKS_CLIENT_ID": "your-client-id",
|
|
98
|
+
"FRESHBOOKS_CLIENT_SECRET": "your-client-secret",
|
|
99
|
+
"FRESHBOOKS_REDIRECT_URI": "https://freshbooks.goodsamsoftware.com/callback"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 3. Authenticate
|
|
107
|
+
|
|
108
|
+
Ask Claude:
|
|
109
|
+
> "Connect me to FreshBooks"
|
|
110
|
+
|
|
111
|
+
Claude will guide you through OAuth authentication. After authorizing in FreshBooks, you'll see the authorization code on our [hosted callback page](https://freshbooks.goodsamsoftware.com) - just copy it and paste it back to Claude.
|
|
112
|
+
|
|
113
|
+
### 4. Start Using
|
|
114
|
+
|
|
115
|
+
Example prompts:
|
|
116
|
+
- "Log 2 hours on the Website Redesign project"
|
|
117
|
+
- "Show me my time entries for this week"
|
|
118
|
+
- "Start a timer for client meeting"
|
|
119
|
+
- "Create an invoice for Acme Corp for $1,500"
|
|
120
|
+
- "What's my profit/loss this month?"
|
|
121
|
+
|
|
122
|
+
## Available Tools (87 total)
|
|
123
|
+
|
|
124
|
+
### Authentication (5 tools)
|
|
125
|
+
| Tool | Description |
|
|
126
|
+
|------|-------------|
|
|
127
|
+
| `auth_status` | Check authentication status |
|
|
128
|
+
| `auth_get_url` | Get OAuth authorization URL |
|
|
129
|
+
| `auth_exchange_code` | Exchange auth code for tokens |
|
|
130
|
+
| `auth_refresh` | Refresh access token |
|
|
131
|
+
| `auth_revoke` | Revoke authentication |
|
|
132
|
+
|
|
133
|
+
### Time Tracking (5 tools)
|
|
134
|
+
| Tool | Description |
|
|
135
|
+
|------|-------------|
|
|
136
|
+
| `timeentry_list` | List time entries with filters |
|
|
137
|
+
| `timeentry_single` | Get time entry by ID |
|
|
138
|
+
| `timeentry_create` | Create time entry |
|
|
139
|
+
| `timeentry_update` | Update time entry |
|
|
140
|
+
| `timeentry_delete` | Delete time entry |
|
|
141
|
+
|
|
142
|
+
### Timer Management (4 tools)
|
|
143
|
+
| Tool | Description |
|
|
144
|
+
|------|-------------|
|
|
145
|
+
| `timer_start` | Start a timer |
|
|
146
|
+
| `timer_stop` | Stop timer and log time |
|
|
147
|
+
| `timer_current` | Get running timer(s) |
|
|
148
|
+
| `timer_discard` | Delete timer without logging |
|
|
149
|
+
|
|
150
|
+
### Invoicing (5 tools)
|
|
151
|
+
| Tool | Description |
|
|
152
|
+
|------|-------------|
|
|
153
|
+
| `invoice_list` | List invoices |
|
|
154
|
+
| `invoice_single` | Get invoice by ID |
|
|
155
|
+
| `invoice_create` | Create invoice |
|
|
156
|
+
| `invoice_update` | Update invoice |
|
|
157
|
+
| `invoice_delete` | Delete invoice |
|
|
158
|
+
|
|
159
|
+
### Clients (5 tools)
|
|
160
|
+
| Tool | Description |
|
|
161
|
+
|------|-------------|
|
|
162
|
+
| `client_list` | List clients |
|
|
163
|
+
| `client_single` | Get client by ID |
|
|
164
|
+
| `client_create` | Create client |
|
|
165
|
+
| `client_update` | Update client |
|
|
166
|
+
| `client_delete` | Delete client |
|
|
167
|
+
|
|
168
|
+
### Projects (5 tools)
|
|
169
|
+
| Tool | Description |
|
|
170
|
+
|------|-------------|
|
|
171
|
+
| `project_list` | List projects |
|
|
172
|
+
| `project_single` | Get project by ID |
|
|
173
|
+
| `project_create` | Create project |
|
|
174
|
+
| `project_update` | Update project |
|
|
175
|
+
| `project_delete` | Delete project |
|
|
176
|
+
|
|
177
|
+
### Expenses (5 tools)
|
|
178
|
+
| Tool | Description |
|
|
179
|
+
|------|-------------|
|
|
180
|
+
| `expense_list` | List expenses |
|
|
181
|
+
| `expense_single` | Get expense by ID |
|
|
182
|
+
| `expense_create` | Create expense |
|
|
183
|
+
| `expense_update` | Update expense |
|
|
184
|
+
| `expense_delete` | Delete expense |
|
|
185
|
+
|
|
186
|
+
### Bills & Payments (15 tools)
|
|
187
|
+
| Tool | Description |
|
|
188
|
+
|------|-------------|
|
|
189
|
+
| `bill_list` | List bills |
|
|
190
|
+
| `bill_single` | Get bill by ID |
|
|
191
|
+
| `bill_create` | Create bill |
|
|
192
|
+
| `bill_update` | Update bill |
|
|
193
|
+
| `bill_delete` | Delete bill |
|
|
194
|
+
| `billpayment_list` | List bill payments |
|
|
195
|
+
| `billpayment_single` | Get bill payment |
|
|
196
|
+
| `billpayment_create` | Create bill payment |
|
|
197
|
+
| `billpayment_update` | Update bill payment |
|
|
198
|
+
| `billpayment_delete` | Delete bill payment |
|
|
199
|
+
| `billvendor_list` | List vendors |
|
|
200
|
+
| `billvendor_single` | Get vendor by ID |
|
|
201
|
+
| `billvendor_create` | Create vendor |
|
|
202
|
+
| `billvendor_update` | Update vendor |
|
|
203
|
+
| `billvendor_delete` | Delete vendor |
|
|
204
|
+
|
|
205
|
+
### Additional Tools
|
|
206
|
+
|
|
207
|
+
| Category | Tools | Description |
|
|
208
|
+
|----------|-------|-------------|
|
|
209
|
+
| **Credit Notes** | 5 | Create, manage credit notes |
|
|
210
|
+
| **Expense Categories** | 3 | Manage expense categories |
|
|
211
|
+
| **Items** | 5 | Product/service catalog |
|
|
212
|
+
| **Journal Entries** | 5 | Manual accounting entries |
|
|
213
|
+
| **Journal Entry Accounts** | 3 | Chart of accounts |
|
|
214
|
+
| **Other Income** | 5 | Non-invoice income tracking |
|
|
215
|
+
| **Payments** | 5 | Invoice payment tracking |
|
|
216
|
+
| **Payment Options** | 2 | Payment gateway settings |
|
|
217
|
+
| **Reports** | 3 | Financial reports |
|
|
218
|
+
| **Services** | 5 | Billable service types |
|
|
219
|
+
| **Tasks** | 5 | Project task management |
|
|
220
|
+
| **User** | 1 | Current user info |
|
|
221
|
+
| **Callbacks** | 5 | Webhook management |
|
|
222
|
+
|
|
223
|
+
*See complete tool documentation in [docs/api/](docs/api/)*
|
|
224
|
+
|
|
225
|
+
## Configuration (Self-Hosted)
|
|
226
|
+
|
|
227
|
+
### Environment Variables
|
|
228
|
+
|
|
229
|
+
| Variable | Required | Description |
|
|
230
|
+
|----------|----------|-------------|
|
|
231
|
+
| `FRESHBOOKS_CLIENT_ID` | Yes | OAuth client ID |
|
|
232
|
+
| `FRESHBOOKS_CLIENT_SECRET` | Yes | OAuth client secret |
|
|
233
|
+
| `FRESHBOOKS_REDIRECT_URI` | Yes | OAuth redirect URI |
|
|
234
|
+
| `FRESHBOOKS_TOKEN_PATH` | No | Path for token storage |
|
|
235
|
+
| `LOG_LEVEL` | No | Logging level (debug, info, warn, error) |
|
|
236
|
+
|
|
237
|
+
### Advanced: Local HTTPS Setup
|
|
238
|
+
|
|
239
|
+
If you prefer to use a local callback instead of our hosted callback page, you can set up local HTTPS certificates with [mkcert](https://github.com/FiloSottile/mkcert):
|
|
240
|
+
|
|
241
|
+
**Windows (winget):**
|
|
242
|
+
```bash
|
|
243
|
+
winget install FiloSottile.mkcert
|
|
244
|
+
mkcert -install
|
|
245
|
+
mkdir certs
|
|
246
|
+
mkcert -key-file certs/localhost-key.pem -cert-file certs/localhost.pem localhost 127.0.0.1 ::1
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
**macOS (Homebrew):**
|
|
250
|
+
```bash
|
|
251
|
+
brew install mkcert
|
|
252
|
+
mkcert -install
|
|
253
|
+
mkdir certs
|
|
254
|
+
mkcert -key-file certs/localhost-key.pem -cert-file certs/localhost.pem localhost 127.0.0.1 ::1
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
**Linux:**
|
|
258
|
+
```bash
|
|
259
|
+
# Install mkcert (see https://github.com/FiloSottile/mkcert#installation)
|
|
260
|
+
mkcert -install
|
|
261
|
+
mkdir certs
|
|
262
|
+
mkcert -key-file certs/localhost-key.pem -cert-file certs/localhost.pem localhost 127.0.0.1 ::1
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Then set your redirect URI to `https://localhost:3000/callback` in FreshBooks.
|
|
266
|
+
|
|
267
|
+
The certificates will be valid for 3 years and trusted by your system.
|
|
268
|
+
|
|
269
|
+
## Development
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
# Install dependencies
|
|
273
|
+
npm install
|
|
274
|
+
|
|
275
|
+
# Run in development mode
|
|
276
|
+
npm run dev
|
|
277
|
+
|
|
278
|
+
# Run tests
|
|
279
|
+
npm test
|
|
280
|
+
|
|
281
|
+
# Run tests with coverage
|
|
282
|
+
npm run test:coverage
|
|
283
|
+
|
|
284
|
+
# Type check
|
|
285
|
+
npm run typecheck
|
|
286
|
+
|
|
287
|
+
# Build for production
|
|
288
|
+
npm run build
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
## Testing
|
|
292
|
+
|
|
293
|
+
The project has comprehensive test coverage:
|
|
294
|
+
|
|
295
|
+
- **1,571 tests** across 93 test files
|
|
296
|
+
- **100% code coverage** requirement
|
|
297
|
+
- Mock factories for all FreshBooks entities
|
|
298
|
+
- Error scenario coverage
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
npm test # Run all tests
|
|
302
|
+
npm run test:coverage # Run with coverage report
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
## Architecture
|
|
306
|
+
|
|
307
|
+
```
|
|
308
|
+
src/
|
|
309
|
+
├── server.ts # MCP server entry point
|
|
310
|
+
├── auth/ # OAuth2 authentication
|
|
311
|
+
├── client/ # FreshBooks SDK wrapper
|
|
312
|
+
├── errors/ # Error normalization
|
|
313
|
+
├── tools/ # MCP tool implementations (22 categories)
|
|
314
|
+
│ ├── auth/ # Authentication tools
|
|
315
|
+
│ ├── time-entry/ # Time tracking
|
|
316
|
+
│ ├── timer/ # Timer management
|
|
317
|
+
│ ├── invoice/ # Invoicing
|
|
318
|
+
│ ├── client/ # Client management
|
|
319
|
+
│ ├── project/ # Projects
|
|
320
|
+
│ ├── expense/ # Expenses
|
|
321
|
+
│ ├── bill/ # Bills
|
|
322
|
+
│ └── ... # 14 more categories
|
|
323
|
+
└── config/ # Configuration
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
## Documentation
|
|
327
|
+
|
|
328
|
+
- [API Reference](docs/api/) - Complete tool documentation
|
|
329
|
+
- [Authentication Setup](docs/AUTH_SETUP.md) - OAuth configuration
|
|
330
|
+
- [Claude Guide](docs/claude/) - Claude-optimized usage examples
|
|
331
|
+
- [Examples](docs/examples/) - Workflow examples
|
|
332
|
+
|
|
333
|
+
## Error Handling
|
|
334
|
+
|
|
335
|
+
All errors are normalized to MCP format with helpful context:
|
|
336
|
+
|
|
337
|
+
```json
|
|
338
|
+
{
|
|
339
|
+
"code": -32005,
|
|
340
|
+
"message": "User-friendly message",
|
|
341
|
+
"data": {
|
|
342
|
+
"freshbooksError": { "code": "...", "message": "..." },
|
|
343
|
+
"recoverable": true,
|
|
344
|
+
"suggestion": "What to do next"
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
## License
|
|
350
|
+
|
|
351
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
352
|
+
|
|
353
|
+
## Credits
|
|
354
|
+
|
|
355
|
+
- [FreshBooks Node.js SDK](https://github.com/freshbooks/freshbooks-nodejs-sdk)
|
|
356
|
+
- [Model Context Protocol](https://modelcontextprotocol.io)
|
|
357
|
+
- [MCP TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk)
|