formbro-mcp-server 1.0.0 → 1.0.2
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/README.md +386 -48
- package/dist/index.js +58 -14
- package/dist/index.js.map +1 -1
- package/dist/services/api-client.d.ts +7 -0
- package/dist/services/api-client.d.ts.map +1 -1
- package/dist/services/api-client.js +113 -2
- package/dist/services/api-client.js.map +1 -1
- package/dist/services/idempotency.d.ts +6 -0
- package/dist/services/idempotency.d.ts.map +1 -0
- package/dist/services/idempotency.js +9 -0
- package/dist/services/idempotency.js.map +1 -0
- package/dist/tools/applications-extra.d.ts +3 -0
- package/dist/tools/applications-extra.d.ts.map +1 -0
- package/dist/tools/applications-extra.js +62 -0
- package/dist/tools/applications-extra.js.map +1 -0
- package/dist/tools/audit.d.ts +3 -0
- package/dist/tools/audit.d.ts.map +1 -0
- package/dist/tools/audit.js +34 -0
- package/dist/tools/audit.js.map +1 -0
- package/dist/tools/employers.d.ts.map +1 -1
- package/dist/tools/employers.js +17 -29
- package/dist/tools/employers.js.map +1 -1
- package/dist/tools/export.d.ts +3 -0
- package/dist/tools/export.d.ts.map +1 -0
- package/dist/tools/export.js +247 -0
- package/dist/tools/export.js.map +1 -0
- package/dist/tools/extract.d.ts +3 -0
- package/dist/tools/extract.d.ts.map +1 -0
- package/dist/tools/extract.js +208 -0
- package/dist/tools/extract.js.map +1 -0
- package/dist/tools/find.js +1 -1
- package/dist/tools/find.js.map +1 -1
- package/dist/tools/patch.d.ts +10 -0
- package/dist/tools/patch.d.ts.map +1 -0
- package/dist/tools/patch.js +276 -0
- package/dist/tools/patch.js.map +1 -0
- package/dist/tools/program-keys.d.ts +3 -0
- package/dist/tools/program-keys.d.ts.map +1 -0
- package/dist/tools/program-keys.js +13 -0
- package/dist/tools/program-keys.js.map +1 -0
- package/dist/tools/system.d.ts +3 -0
- package/dist/tools/system.d.ts.map +1 -0
- package/dist/tools/system.js +84 -0
- package/dist/tools/system.js.map +1 -0
- package/dist/tools/validate.d.ts +3 -0
- package/dist/tools/validate.d.ts.map +1 -0
- package/dist/tools/validate.js +68 -0
- package/dist/tools/validate.js.map +1 -0
- package/dist/tools/write.d.ts +4 -0
- package/dist/tools/write.d.ts.map +1 -0
- package/dist/tools/write.js +786 -0
- package/dist/tools/write.js.map +1 -0
- package/package.json +7 -3
- package/server.json +67 -0
package/README.md
CHANGED
|
@@ -2,69 +2,110 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/formbro-mcp-server)
|
|
4
4
|
|
|
5
|
-
MCP server for FormBro immigration
|
|
5
|
+
MCP server for FormBro Canadian immigration application automation. It provides agent access to FormBro applications, applicants, employers, validation, export, and controlled write workflows through the Model Context Protocol.
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
|
|
9
|
+
- **Hosted MCP** - Use `https://mcp.formbro.ca/mcp` from Claude Code, Codex, Cursor, and other MCP clients.
|
|
10
|
+
- **Local stdio MCP** - Use `npx -y formbro-mcp-server` for Claude Desktop and offline debugging.
|
|
11
|
+
- **Toolset gating** - Public default is `system,read,validate`; write/export/audit tools require explicit opt-in.
|
|
12
|
+
- **Secure authentication** - Token-based FormBro API authentication with per-request bearer tokens for hosted HTTP.
|
|
13
|
+
- **Dual transport** - Supports stdio (local) and Streamable HTTP (hosted/self-hosted) modes.
|
|
14
|
+
|
|
15
|
+
## Hosted MCP Quick Start
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
claude mcp add --transport http formbro \
|
|
19
|
+
"https://mcp.formbro.ca/mcp?toolsets=system,read,validate" \
|
|
20
|
+
--header "Authorization: Bearer fb_your_token_here"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
For Codex:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
export FORMBRO_API_TOKEN=fb_your_token_here
|
|
27
|
+
codex mcp add formbro \
|
|
28
|
+
--url "https://mcp.formbro.ca/mcp?toolsets=system,read,validate" \
|
|
29
|
+
--bearer-token-env-var FORMBRO_API_TOKEN
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Use local stdio only when your client requires a local MCP process or you need offline debugging.
|
|
15
33
|
|
|
16
34
|
## Installation
|
|
17
35
|
|
|
36
|
+
### Option 1: Using npx
|
|
37
|
+
|
|
38
|
+
No installation needed - run directly:
|
|
39
|
+
|
|
18
40
|
```bash
|
|
19
|
-
|
|
20
|
-
|
|
41
|
+
npx -y formbro-mcp-server --toolsets=system,read,validate
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Option 2: Global Installation
|
|
21
45
|
|
|
22
|
-
|
|
46
|
+
```bash
|
|
23
47
|
npm install -g formbro-mcp-server
|
|
24
48
|
```
|
|
25
49
|
|
|
26
|
-
|
|
50
|
+
### Option 3: Local Installation
|
|
27
51
|
|
|
28
|
-
|
|
52
|
+
```bash
|
|
53
|
+
npm install formbro-mcp-server
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Quick Start
|
|
57
|
+
|
|
58
|
+
### Get Your API Token
|
|
59
|
+
|
|
60
|
+
1. Log in to FormBro
|
|
61
|
+
2. Navigate to Settings > API Tokens
|
|
62
|
+
3. Generate a new token (starts with `fb_`)
|
|
63
|
+
|
|
64
|
+
### Run the Server
|
|
65
|
+
|
|
66
|
+
#### stdio mode (for Claude Desktop)
|
|
29
67
|
|
|
30
68
|
```bash
|
|
31
|
-
FORMBRO_API_URL=https://
|
|
32
|
-
FORMBRO_API_TOKEN=
|
|
33
|
-
formbro-mcp-server
|
|
69
|
+
FORMBRO_API_URL=https://backend.formbro.ca \
|
|
70
|
+
FORMBRO_API_TOKEN=fb_your_token_here \
|
|
71
|
+
formbro-mcp-server --toolsets=system,read,validate
|
|
34
72
|
```
|
|
35
73
|
|
|
36
|
-
|
|
74
|
+
#### HTTP mode (for remote access / Claude Code HTTP)
|
|
37
75
|
|
|
38
76
|
```bash
|
|
39
|
-
FORMBRO_API_URL=https://
|
|
77
|
+
FORMBRO_API_URL=https://backend.formbro.ca \
|
|
40
78
|
TRANSPORT=http \
|
|
41
79
|
PORT=3000 \
|
|
42
|
-
formbro-mcp-server
|
|
80
|
+
formbro-mcp-server --toolsets=system,read,validate
|
|
43
81
|
```
|
|
44
82
|
|
|
83
|
+
**Note:** In HTTP mode, the token is provided per-request via the `Authorization` header, not in the environment.
|
|
84
|
+
|
|
45
85
|
## Configuration
|
|
46
86
|
|
|
47
87
|
### Environment Variables
|
|
48
88
|
|
|
49
|
-
| Variable | Required | Description | Default |
|
|
50
|
-
|
|
51
|
-
| `FORMBRO_API_URL` | Yes | Base URL of FormBro API | - |
|
|
52
|
-
| `FORMBRO_API_TOKEN` | Yes
|
|
53
|
-
| `TRANSPORT` | No | Transport mode: `stdio` or `http` | `stdio` |
|
|
54
|
-
| `PORT` | No | HTTP
|
|
89
|
+
| Variable | Required | Mode | Description | Default |
|
|
90
|
+
|----------|----------|------|-------------|---------|
|
|
91
|
+
| `FORMBRO_API_URL` | ✅ Yes | Both | Base URL of FormBro API | - |
|
|
92
|
+
| `FORMBRO_API_TOKEN` | ✅ Yes | stdio only | API token for authentication | - |
|
|
93
|
+
| `TRANSPORT` | No | Both | Transport mode: `stdio` or `http` | `stdio` |
|
|
94
|
+
| `PORT` or `MCP_PORT` | No | HTTP only | HTTP server port | `3000` |
|
|
55
95
|
|
|
56
|
-
|
|
96
|
+
## Connecting to Claude
|
|
57
97
|
|
|
58
|
-
|
|
59
|
-
2. Navigate to Settings > API Tokens
|
|
60
|
-
3. Generate a new token
|
|
98
|
+
### Claude Desktop Configuration
|
|
61
99
|
|
|
62
|
-
|
|
100
|
+
Claude Desktop uses **stdio transport** for local process communication.
|
|
63
101
|
|
|
64
|
-
|
|
102
|
+
#### Method 1: Using npx (Recommended)
|
|
65
103
|
|
|
66
104
|
Add to your `claude_desktop_config.json`:
|
|
67
105
|
|
|
106
|
+
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
107
|
+
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
108
|
+
|
|
68
109
|
```json
|
|
69
110
|
{
|
|
70
111
|
"mcpServers": {
|
|
@@ -72,78 +113,317 @@ Add to your `claude_desktop_config.json`:
|
|
|
72
113
|
"command": "npx",
|
|
73
114
|
"args": ["-y", "formbro-mcp-server"],
|
|
74
115
|
"env": {
|
|
75
|
-
"FORMBRO_API_URL": "https://
|
|
76
|
-
"FORMBRO_API_TOKEN": "
|
|
116
|
+
"FORMBRO_API_URL": "https://backend.formbro.ca",
|
|
117
|
+
"FORMBRO_API_TOKEN": "fb_your_token_here"
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
#### Method 2: Using global installation
|
|
125
|
+
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"mcpServers": {
|
|
129
|
+
"formbro": {
|
|
130
|
+
"command": "formbro-mcp-server",
|
|
131
|
+
"env": {
|
|
132
|
+
"FORMBRO_API_URL": "https://backend.formbro.ca",
|
|
133
|
+
"FORMBRO_API_TOKEN": "fb_your_token_here"
|
|
77
134
|
}
|
|
78
135
|
}
|
|
79
136
|
}
|
|
80
137
|
}
|
|
81
138
|
```
|
|
82
139
|
|
|
83
|
-
|
|
140
|
+
#### Method 3: Using local Node.js
|
|
141
|
+
|
|
142
|
+
```json
|
|
143
|
+
{
|
|
144
|
+
"mcpServers": {
|
|
145
|
+
"formbro": {
|
|
146
|
+
"command": "node",
|
|
147
|
+
"args": ["/path/to/formbro-mcp-server/dist/index.js"],
|
|
148
|
+
"env": {
|
|
149
|
+
"FORMBRO_API_URL": "https://backend.formbro.ca",
|
|
150
|
+
"FORMBRO_API_TOKEN": "fb_your_token_here"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**Restart Claude Desktop** after updating the configuration.
|
|
158
|
+
|
|
159
|
+
### Claude Code Configuration
|
|
160
|
+
|
|
161
|
+
Claude Code supports both **stdio** and **HTTP** transports.
|
|
162
|
+
|
|
163
|
+
#### Method 1: HTTP Transport (Recommended for Claude Code)
|
|
164
|
+
|
|
165
|
+
**Step 1**: Start the HTTP server
|
|
84
166
|
|
|
85
167
|
```bash
|
|
86
|
-
#
|
|
87
|
-
FORMBRO_API_URL=https://
|
|
168
|
+
# In a terminal, run:
|
|
169
|
+
FORMBRO_API_URL=https://backend.formbro.ca \
|
|
88
170
|
TRANSPORT=http \
|
|
171
|
+
PORT=3000 \
|
|
172
|
+
formbro-mcp-server
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Or create an `.env` file:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
# .env
|
|
179
|
+
FORMBRO_API_URL=https://backend.formbro.ca
|
|
180
|
+
TRANSPORT=http
|
|
181
|
+
MCP_PORT=3000
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Then run:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
89
187
|
formbro-mcp-server
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Step 2**: Add to Claude Code with your token
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
# Option A: Using Bearer token format
|
|
194
|
+
claude mcp add --transport http formbro http://localhost:3000/mcp \
|
|
195
|
+
--header "Authorization: Bearer fb_your_token_here"
|
|
90
196
|
|
|
91
|
-
#
|
|
197
|
+
# Option B: Direct token format (also supported)
|
|
92
198
|
claude mcp add --transport http formbro http://localhost:3000/mcp \
|
|
93
|
-
--header "Authorization:
|
|
199
|
+
--header "Authorization: fb_your_token_here"
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**Verify connection:**
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
claude mcp list
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
#### Method 2: stdio Transport
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
claude mcp add --transport stdio formbro -- \
|
|
212
|
+
env FORMBRO_API_URL=https://backend.formbro.ca \
|
|
213
|
+
FORMBRO_API_TOKEN=fb_your_token_here \
|
|
214
|
+
npx -y formbro-mcp-server
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
#### Method 3: stdio with global installation
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
claude mcp add --transport stdio formbro -- \
|
|
221
|
+
env FORMBRO_API_URL=https://backend.formbro.ca \
|
|
222
|
+
FORMBRO_API_TOKEN=fb_your_token_here \
|
|
223
|
+
formbro-mcp-server
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Managing MCP Servers in Claude Code
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
# List all MCP servers
|
|
230
|
+
claude mcp list
|
|
231
|
+
|
|
232
|
+
# Remove a server
|
|
233
|
+
claude mcp remove formbro
|
|
234
|
+
|
|
235
|
+
# Update server configuration
|
|
236
|
+
claude mcp remove formbro
|
|
237
|
+
claude mcp add --transport http formbro http://localhost:3000/mcp \
|
|
238
|
+
--header "Authorization: Bearer fb_new_token"
|
|
94
239
|
```
|
|
95
240
|
|
|
96
241
|
## Available Tools
|
|
97
242
|
|
|
98
|
-
### `formbro_find` (Recommended)
|
|
243
|
+
### `formbro_find` ⭐ (Recommended)
|
|
99
244
|
|
|
100
|
-
Smart search across all entity types with name matching
|
|
245
|
+
**Smart search across all entity types with intelligent name matching.**
|
|
246
|
+
|
|
247
|
+
**Why use this first?**
|
|
248
|
+
- Combines search and detail fetching in one call
|
|
249
|
+
- Handles "First Last" and "Last First" name order automatically
|
|
250
|
+
- Returns compact JSON optimized for AI processing
|
|
251
|
+
- Can include related applications in the same response
|
|
252
|
+
|
|
253
|
+
**Examples:**
|
|
101
254
|
|
|
102
255
|
```typescript
|
|
103
|
-
// Find
|
|
104
|
-
formbro_find({
|
|
256
|
+
// Find applicant by name
|
|
257
|
+
formbro_find({ name: "Zhang Wei" })
|
|
258
|
+
|
|
259
|
+
// Find with applications included
|
|
260
|
+
formbro_find({ name: "John Smith", include: ["applications"] })
|
|
105
261
|
|
|
106
|
-
//
|
|
107
|
-
formbro_find({
|
|
262
|
+
// Filter by program
|
|
263
|
+
formbro_find({ name: "Wei", program: "tr", include: ["applications"] })
|
|
264
|
+
|
|
265
|
+
// Limit results
|
|
266
|
+
formbro_find({ name: "Smith", limit: 10 })
|
|
108
267
|
```
|
|
109
268
|
|
|
269
|
+
**Parameters:**
|
|
270
|
+
- `name` (required): Name to search for. Supports full name in any order.
|
|
271
|
+
- `program` (optional): Filter by `"tr"`, `"pr"`, or `"lmia"`
|
|
272
|
+
- `include` (optional): Array of `["applications"]` or `["applications", "employer"]`
|
|
273
|
+
- `limit` (optional): Maximum results to return (1-20, default: 5)
|
|
274
|
+
|
|
110
275
|
### `formbro_list_applicants`
|
|
111
276
|
|
|
112
277
|
List applicants with search, program filtering, and pagination.
|
|
113
278
|
|
|
279
|
+
**Parameters:**
|
|
280
|
+
- `limit` (optional): Maximum results to return (1-100, default: 20)
|
|
281
|
+
- `offset` (optional): Number of results to skip for pagination (default: 0)
|
|
282
|
+
- `search` (optional): Search query to filter by name, email, etc.
|
|
283
|
+
- `program` (optional): Filter by program type (`"tr"`, `"pr"`, `"lmia"`)
|
|
284
|
+
- `response_format` (optional): `"markdown"` or `"json"` (default: `"markdown"`)
|
|
285
|
+
|
|
114
286
|
### `formbro_get_applicant`
|
|
115
287
|
|
|
116
288
|
Get detailed applicant information by ID.
|
|
117
289
|
|
|
290
|
+
**Parameters:**
|
|
291
|
+
- `id` (required): The applicant's unique identifier (MongoDB ObjectId)
|
|
292
|
+
- `response_format` (optional): `"markdown"` or `"json"` (default: `"markdown"`)
|
|
293
|
+
|
|
118
294
|
### `formbro_list_applications`
|
|
119
295
|
|
|
120
|
-
List applications by program type
|
|
296
|
+
List applications by program type with status filtering.
|
|
297
|
+
|
|
298
|
+
**Programs:**
|
|
299
|
+
- `tr` - Temporary Residence (Work permits, study permits, visitor visas)
|
|
300
|
+
- `pr` - Permanent Residence (Family sponsorship, Express Entry, PNP)
|
|
301
|
+
- `lmia` - Labour Market Impact Assessment (Employer applications)
|
|
302
|
+
|
|
303
|
+
**Parameters:**
|
|
304
|
+
- `limit` (optional): Maximum results to return (1-100, default: 20)
|
|
305
|
+
- `offset` (optional): Number of results to skip for pagination (default: 0)
|
|
306
|
+
- `search` (optional): Search query to filter by case name
|
|
307
|
+
- `program` (optional): Filter by program type (`"tr"`, `"pr"`, `"lmia"`)
|
|
308
|
+
- `status` (optional): Filter by status (`"draft"`, `"in_progress"`, `"submitted"`, `"approved"`, `"refused"`)
|
|
309
|
+
- `response_format` (optional): `"markdown"` or `"json"` (default: `"markdown"`)
|
|
121
310
|
|
|
122
311
|
### `formbro_get_application`
|
|
123
312
|
|
|
124
313
|
Get detailed application information by ID.
|
|
125
314
|
|
|
315
|
+
**Parameters:**
|
|
316
|
+
- `id` (required): The application's unique identifier (MongoDB ObjectId)
|
|
317
|
+
- `response_format` (optional): `"markdown"` or `"json"` (default: `"markdown"`)
|
|
318
|
+
|
|
126
319
|
### `formbro_list_employers`
|
|
127
320
|
|
|
128
321
|
List employers with search and pagination.
|
|
129
322
|
|
|
323
|
+
**Parameters:**
|
|
324
|
+
- `limit` (optional): Maximum results to return (1-100, default: 20)
|
|
325
|
+
- `offset` (optional): Number of results to skip for pagination (default: 0)
|
|
326
|
+
- `search` (optional): Search query to filter by company name, business number, etc.
|
|
327
|
+
- `response_format` (optional): `"markdown"` or `"json"` (default: `"markdown"`)
|
|
328
|
+
|
|
130
329
|
### `formbro_get_employer`
|
|
131
330
|
|
|
132
331
|
Get detailed employer information by ID.
|
|
133
332
|
|
|
333
|
+
**Parameters:**
|
|
334
|
+
- `id` (required): The employer's unique identifier (MongoDB ObjectId)
|
|
335
|
+
- `response_format` (optional): `"markdown"` or `"json"` (default: `"markdown"`)
|
|
336
|
+
|
|
134
337
|
## API Response Formats
|
|
135
338
|
|
|
136
339
|
All tools support two response formats:
|
|
137
340
|
|
|
138
|
-
-
|
|
139
|
-
-
|
|
341
|
+
- **`markdown`** (default) - Human-readable formatted output for Claude
|
|
342
|
+
- **`json`** - Machine-readable structured data
|
|
343
|
+
|
|
344
|
+
## HTTP API Endpoints
|
|
345
|
+
|
|
346
|
+
When running in HTTP mode, the server exposes:
|
|
347
|
+
|
|
348
|
+
### `GET /health`
|
|
349
|
+
|
|
350
|
+
Health check endpoint returning server status.
|
|
351
|
+
|
|
352
|
+
**Response:**
|
|
353
|
+
```json
|
|
354
|
+
{
|
|
355
|
+
"status": "ok",
|
|
356
|
+
"server": "formbro-mcp-server",
|
|
357
|
+
"version": "1.0.0",
|
|
358
|
+
"apiUrl": "https://backend.formbro.ca",
|
|
359
|
+
"apiConfigured": true
|
|
360
|
+
}
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
### `POST /mcp`
|
|
364
|
+
|
|
365
|
+
Main MCP endpoint using Streamable HTTP transport.
|
|
366
|
+
|
|
367
|
+
**Headers:**
|
|
368
|
+
```
|
|
369
|
+
Authorization: Bearer fb_your_token_here
|
|
370
|
+
Content-Type: application/json
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
**Request Body:** MCP protocol JSON-RPC message
|
|
374
|
+
|
|
375
|
+
### `GET /mcp`
|
|
376
|
+
|
|
377
|
+
Returns server information and available tools.
|
|
378
|
+
|
|
379
|
+
## Troubleshooting
|
|
380
|
+
|
|
381
|
+
### Claude Desktop Issues
|
|
382
|
+
|
|
383
|
+
**Server not connecting:**
|
|
384
|
+
1. Check the config file location is correct for your OS
|
|
385
|
+
2. Verify JSON syntax (use a JSON validator)
|
|
386
|
+
3. Ensure the token starts with `fb_`
|
|
387
|
+
4. Restart Claude Desktop after config changes
|
|
388
|
+
5. Check Claude Desktop logs: `~/Library/Logs/Claude/` (macOS)
|
|
389
|
+
|
|
390
|
+
**Token errors:**
|
|
391
|
+
1. Generate a new token from FormBro Settings
|
|
392
|
+
2. Ensure no extra spaces in the token
|
|
393
|
+
3. Token should start with `fb_`
|
|
394
|
+
|
|
395
|
+
### Claude Code Issues
|
|
396
|
+
|
|
397
|
+
**HTTP connection failed:**
|
|
398
|
+
1. Ensure the server is running (`curl http://localhost:3000/health`)
|
|
399
|
+
2. Check the port is not in use by another service
|
|
400
|
+
3. Verify the Authorization header format
|
|
401
|
+
4. Test with `curl`:
|
|
402
|
+
```bash
|
|
403
|
+
curl -X POST http://localhost:3000/mcp \
|
|
404
|
+
-H "Authorization: Bearer fb_your_token" \
|
|
405
|
+
-H "Content-Type: application/json" \
|
|
406
|
+
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
**stdio connection failed:**
|
|
410
|
+
1. Check if `npx` or `formbro-mcp-server` is in PATH
|
|
411
|
+
2. Verify environment variables are set correctly
|
|
412
|
+
3. Test manually:
|
|
413
|
+
```bash
|
|
414
|
+
FORMBRO_API_URL=https://backend.formbro.ca \
|
|
415
|
+
FORMBRO_API_TOKEN=fb_your_token \
|
|
416
|
+
formbro-mcp-server
|
|
417
|
+
```
|
|
140
418
|
|
|
141
419
|
## Development
|
|
142
420
|
|
|
421
|
+
### Setup
|
|
422
|
+
|
|
143
423
|
```bash
|
|
144
424
|
# Clone the repository
|
|
145
|
-
git clone https://github.com/
|
|
146
|
-
cd formbro
|
|
425
|
+
git clone https://github.com/jackyzhang69/formbro.git
|
|
426
|
+
cd formbro/mcp-server
|
|
147
427
|
|
|
148
428
|
# Install dependencies
|
|
149
429
|
pnpm install
|
|
@@ -155,6 +435,57 @@ pnpm build
|
|
|
155
435
|
pnpm dev
|
|
156
436
|
```
|
|
157
437
|
|
|
438
|
+
### Testing
|
|
439
|
+
|
|
440
|
+
```bash
|
|
441
|
+
# Test stdio mode
|
|
442
|
+
FORMBRO_API_URL=https://backend.formbro.ca \
|
|
443
|
+
FORMBRO_API_TOKEN=fb_your_token \
|
|
444
|
+
pnpm start
|
|
445
|
+
|
|
446
|
+
# Test HTTP mode
|
|
447
|
+
FORMBRO_API_URL=https://backend.formbro.ca \
|
|
448
|
+
TRANSPORT=http \
|
|
449
|
+
PORT=3000 \
|
|
450
|
+
pnpm start
|
|
451
|
+
|
|
452
|
+
# Test health endpoint
|
|
453
|
+
curl http://localhost:3000/health
|
|
454
|
+
|
|
455
|
+
# Test MCP endpoint
|
|
456
|
+
curl -X POST http://localhost:3000/mcp \
|
|
457
|
+
-H "Authorization: Bearer fb_your_token" \
|
|
458
|
+
-H "Content-Type: application/json" \
|
|
459
|
+
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
### Project Structure
|
|
463
|
+
|
|
464
|
+
```
|
|
465
|
+
mcp-server/
|
|
466
|
+
├── src/
|
|
467
|
+
│ ├── index.ts # Main entry point, transport setup
|
|
468
|
+
│ ├── services/
|
|
469
|
+
│ │ └── api-client.ts # FormBro API client
|
|
470
|
+
│ └── tools/
|
|
471
|
+
│ ├── find.ts # Smart find tool
|
|
472
|
+
│ ├── applicants.ts # Applicant tools
|
|
473
|
+
│ ├── applications.ts # Application tools
|
|
474
|
+
│ └── employers.ts # Employer tools
|
|
475
|
+
├── dist/ # Compiled JavaScript (generated)
|
|
476
|
+
├── package.json
|
|
477
|
+
├── tsconfig.json
|
|
478
|
+
└── README.md
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
## Security Notes
|
|
482
|
+
|
|
483
|
+
- **Token Security**: Never commit API tokens to version control
|
|
484
|
+
- **HTTP Mode**: Uses per-request authentication via `Authorization` header
|
|
485
|
+
- **stdio Mode**: Token is passed via environment variables (process-scoped)
|
|
486
|
+
- **Production**: Use HTTPS for HTTP transport in production environments
|
|
487
|
+
- **Token Format**: All FormBro API tokens start with `fb_`
|
|
488
|
+
|
|
158
489
|
## License
|
|
159
490
|
|
|
160
491
|
MIT
|
|
@@ -164,3 +495,10 @@ MIT
|
|
|
164
495
|
- [FormBro](https://formbro.com)
|
|
165
496
|
- [Model Context Protocol](https://modelcontextprotocol.io)
|
|
166
497
|
- [npm Package](https://www.npmjs.com/package/formbro-mcp-server)
|
|
498
|
+
- [GitHub Repository](https://github.com/jackyzhang69/formbro/tree/main/mcp-server)
|
|
499
|
+
|
|
500
|
+
## Support
|
|
501
|
+
|
|
502
|
+
For issues and questions:
|
|
503
|
+
- GitHub Issues: https://github.com/jackyzhang69/formbro/issues
|
|
504
|
+
- FormBro Support: support@formbro.com
|
package/dist/index.js
CHANGED
|
@@ -21,9 +21,34 @@ import { registerApplicantTools } from "./tools/applicants.js";
|
|
|
21
21
|
import { registerApplicationTools } from "./tools/applications.js";
|
|
22
22
|
import { registerEmployerTools } from "./tools/employers.js";
|
|
23
23
|
import { registerFindTool } from "./tools/find.js";
|
|
24
|
+
import { registerSystemTools } from "./tools/system.js";
|
|
25
|
+
import { registerReadExtraTools } from "./tools/applications-extra.js";
|
|
26
|
+
import { registerValidateTools } from "./tools/validate.js";
|
|
27
|
+
import { registerWriteTools } from "./tools/write.js";
|
|
28
|
+
import { registerPatchTools } from "./tools/patch.js";
|
|
29
|
+
import { registerAuditTools } from "./tools/audit.js";
|
|
30
|
+
import { registerExtractTools } from "./tools/extract.js";
|
|
31
|
+
import { registerExportTools } from "./tools/export.js";
|
|
32
|
+
// Toolset configuration
|
|
33
|
+
const TOOLSETS = ["system", "read", "validate", "write", "patch", "extract", "export", "audit"];
|
|
34
|
+
const DEFAULT_TOOLSETS = ["system", "read", "validate"];
|
|
35
|
+
function parseToolsetsFromFlag() {
|
|
36
|
+
const flag = process.argv.find((a) => a.startsWith("--toolsets="))?.split("=")[1];
|
|
37
|
+
if (!flag)
|
|
38
|
+
return new Set(DEFAULT_TOOLSETS);
|
|
39
|
+
return new Set(flag.split(",").filter((t) => TOOLSETS.includes(t)));
|
|
40
|
+
}
|
|
41
|
+
function parseToolsetsFromQuery(query) {
|
|
42
|
+
if (!query)
|
|
43
|
+
return parseToolsetsFromFlag();
|
|
44
|
+
const requested = new Set(query.split(",").filter((t) => TOOLSETS.includes(t)));
|
|
45
|
+
return requested.size > 0 ? requested : parseToolsetsFromFlag();
|
|
46
|
+
}
|
|
47
|
+
// Used for stdio mode (startup-time only)
|
|
48
|
+
const enabledToolsets = parseToolsetsFromFlag();
|
|
24
49
|
// Server configuration
|
|
25
50
|
const SERVER_NAME = "formbro-mcp-server";
|
|
26
|
-
const SERVER_VERSION = "1.0.
|
|
51
|
+
const SERVER_VERSION = "1.0.2";
|
|
27
52
|
/**
|
|
28
53
|
* Validate required environment variables for STDIO mode
|
|
29
54
|
*/
|
|
@@ -56,18 +81,35 @@ function validateEnvironmentHttp() {
|
|
|
56
81
|
return { apiUrl };
|
|
57
82
|
}
|
|
58
83
|
/**
|
|
59
|
-
* Create and configure the MCP server
|
|
84
|
+
* Create and configure the MCP server with the given toolsets
|
|
60
85
|
*/
|
|
61
|
-
function createServer() {
|
|
86
|
+
function createServer(toolsets = enabledToolsets) {
|
|
62
87
|
const server = new McpServer({
|
|
63
88
|
name: SERVER_NAME,
|
|
64
89
|
version: SERVER_VERSION
|
|
65
90
|
});
|
|
66
|
-
// Register
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
91
|
+
// Register tools based on enabled toolsets
|
|
92
|
+
if (toolsets.has("system"))
|
|
93
|
+
registerSystemTools(server);
|
|
94
|
+
if (toolsets.has("read")) {
|
|
95
|
+
registerFindTool(server);
|
|
96
|
+
registerApplicantTools(server);
|
|
97
|
+
registerApplicationTools(server);
|
|
98
|
+
registerEmployerTools(server);
|
|
99
|
+
registerReadExtraTools(server);
|
|
100
|
+
}
|
|
101
|
+
if (toolsets.has("validate"))
|
|
102
|
+
registerValidateTools(server);
|
|
103
|
+
if (toolsets.has("write"))
|
|
104
|
+
registerWriteTools(server);
|
|
105
|
+
if (toolsets.has("patch"))
|
|
106
|
+
registerPatchTools(server);
|
|
107
|
+
if (toolsets.has("audit"))
|
|
108
|
+
registerAuditTools(server);
|
|
109
|
+
if (toolsets.has("extract"))
|
|
110
|
+
registerExtractTools(server);
|
|
111
|
+
if (toolsets.has("export"))
|
|
112
|
+
registerExportTools(server);
|
|
71
113
|
return server;
|
|
72
114
|
}
|
|
73
115
|
/**
|
|
@@ -135,9 +177,11 @@ async function runHttp() {
|
|
|
135
177
|
}
|
|
136
178
|
// Create API client with the provided token
|
|
137
179
|
const apiClient = createApiClientWithToken(token);
|
|
180
|
+
// Parse toolsets from query param (default: system,read,validate)
|
|
181
|
+
const toolsets = parseToolsetsFromQuery(req.query.toolsets);
|
|
138
182
|
// Run the MCP request with the token-specific API client
|
|
139
183
|
await runWithApiClient(apiClient, async () => {
|
|
140
|
-
const server = createServer();
|
|
184
|
+
const server = createServer(toolsets);
|
|
141
185
|
// Create new transport for each request (stateless)
|
|
142
186
|
const transport = new StreamableHTTPServerTransport({
|
|
143
187
|
sessionIdGenerator: undefined,
|
|
@@ -236,8 +280,8 @@ ENVIRONMENT VARIABLES:
|
|
|
236
280
|
FORMBRO_API_URL Base URL of FormBro API (required)
|
|
237
281
|
Example: https://api.formbro.com
|
|
238
282
|
|
|
239
|
-
FORMBRO_API_TOKEN Your FormBro API token
|
|
240
|
-
|
|
283
|
+
FORMBRO_API_TOKEN Your FormBro API token
|
|
284
|
+
Required for stdio mode
|
|
241
285
|
|
|
242
286
|
TRANSPORT Transport mode (optional, default: stdio)
|
|
243
287
|
- stdio: For local CLI integration
|
|
@@ -252,9 +296,8 @@ EXAMPLES:
|
|
|
252
296
|
FORMBRO_API_TOKEN=your-token \\
|
|
253
297
|
formbro-mcp-server
|
|
254
298
|
|
|
255
|
-
# Run with HTTP transport
|
|
299
|
+
# Run with HTTP transport
|
|
256
300
|
FORMBRO_API_URL=https://api.formbro.com \\
|
|
257
|
-
FORMBRO_API_TOKEN=your-token \\
|
|
258
301
|
TRANSPORT=http \\
|
|
259
302
|
PORT=8080 \\
|
|
260
303
|
formbro-mcp-server
|
|
@@ -270,7 +313,8 @@ AVAILABLE TOOLS:
|
|
|
270
313
|
|
|
271
314
|
CONNECTING FROM CLAUDE CODE:
|
|
272
315
|
# For HTTP transport
|
|
273
|
-
claude mcp add --transport http formbro http://localhost:3000/mcp
|
|
316
|
+
claude mcp add --transport http formbro http://localhost:3000/mcp \\
|
|
317
|
+
--header "Authorization: Bearer YOUR_FORMBRO_API_TOKEN"
|
|
274
318
|
|
|
275
319
|
# For stdio transport
|
|
276
320
|
claude mcp add --transport stdio formbro -- \\
|