@t4dhg/mcp-factorial 1.1.0 → 3.0.0
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 -0
- package/README.md +175 -58
- package/dist/api.d.ts +424 -8
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +1156 -100
- package/dist/api.js.map +1 -1
- package/dist/audit.d.ts +86 -0
- package/dist/audit.d.ts.map +1 -0
- package/dist/audit.js +119 -0
- package/dist/audit.js.map +1 -0
- package/dist/cache.d.ts +88 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +169 -0
- package/dist/cache.js.map +1 -0
- package/dist/config.d.ts +57 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +112 -0
- package/dist/config.js.map +1 -0
- package/dist/confirmation.d.ts +118 -0
- package/dist/confirmation.d.ts.map +1 -0
- package/dist/confirmation.js +153 -0
- package/dist/confirmation.js.map +1 -0
- package/dist/errors.d.ts +133 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +251 -0
- package/dist/errors.js.map +1 -0
- package/dist/http-client.d.ts +80 -0
- package/dist/http-client.d.ts.map +1 -0
- package/dist/http-client.js +243 -0
- package/dist/http-client.js.map +1 -0
- package/dist/index.d.ts +12 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3272 -73
- package/dist/index.js.map +1 -1
- package/dist/pagination.d.ts +96 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/pagination.js +114 -0
- package/dist/pagination.js.map +1 -0
- package/dist/schemas.d.ts +1789 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +718 -0
- package/dist/schemas.js.map +1 -0
- package/dist/types.d.ts +61 -50
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +6 -1
- package/dist/types.js.map +1 -1
- package/dist/write-safety.d.ts +53 -0
- package/dist/write-safety.d.ts.map +1 -0
- package/dist/write-safety.js +239 -0
- package/dist/write-safety.js.map +1 -0
- package/llms.txt +115 -0
- package/package.json +63 -7
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2025 Taig Mac Carthy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,44 +1,68 @@
|
|
|
1
1
|
# MCP FactorialHR
|
|
2
2
|
|
|
3
|
-
> **
|
|
3
|
+
> **The definitive Model Context Protocol server for FactorialHR**
|
|
4
4
|
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
6
|
[](https://modelcontextprotocol.io/)
|
|
7
7
|
[](https://nodejs.org/)
|
|
8
|
+
[](https://www.npmjs.com/package/@t4dhg/mcp-factorial)
|
|
8
9
|
|
|
9
|
-
A Model Context Protocol (MCP) server that provides AI assistants like Claude with
|
|
10
|
+
A comprehensive Model Context Protocol (MCP) server that provides AI assistants like Claude with full access to FactorialHR. Manage employees, teams, time off, projects, training, recruiting, and more - all with built-in safety guardrails.
|
|
10
11
|
|
|
11
12
|
## Why This MCP Server?
|
|
12
13
|
|
|
13
|
-
- **
|
|
14
|
-
- **
|
|
15
|
-
- **
|
|
16
|
-
- **
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
|
33
|
-
|
|
34
|
-
|
|
|
35
|
-
|
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
|
14
|
+
- **Comprehensive Coverage**: 80+ tools spanning employees, teams, time off, attendance, projects, training, recruiting (ATS), and payroll
|
|
15
|
+
- **Full CRUD Operations**: Create, read, update, and delete across all major entities
|
|
16
|
+
- **Safety Guardrails**: High-risk operations require explicit confirmation
|
|
17
|
+
- **Audit Logging**: All write operations are logged for compliance
|
|
18
|
+
- **Enterprise Ready**: Built for companies who need AI integration with proper controls
|
|
19
|
+
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
### 80+ Tools
|
|
23
|
+
|
|
24
|
+
| Category | Tools | Operations |
|
|
25
|
+
| --------------- | ----- | ----------------------------------------------------------------------- |
|
|
26
|
+
| **Employees** | 6 | List, get, search, create, update, terminate |
|
|
27
|
+
| **Teams** | 5 | List, get, create, update, delete |
|
|
28
|
+
| **Locations** | 5 | List, get, create, update, delete |
|
|
29
|
+
| **Time Off** | 10 | List leaves/types/allowances, create, update, cancel, approve, reject |
|
|
30
|
+
| **Attendance** | 5 | List shifts, create, update, delete |
|
|
31
|
+
| **Projects** | 17 | Full CRUD for projects, tasks, workers, time records |
|
|
32
|
+
| **Training** | 14 | Full CRUD for trainings, sessions, enrollments |
|
|
33
|
+
| **Work Areas** | 6 | List, get, create, update, archive, unarchive |
|
|
34
|
+
| **ATS** | 16 | Job postings, candidates, applications, hiring stages, advance workflow |
|
|
35
|
+
| **Payroll** | 6 | List/get supplements, tax identifiers, family situations (read-only) |
|
|
36
|
+
| **Documents** | 4 | List/get folders and documents (read-only) |
|
|
37
|
+
| **Job Catalog** | 3 | List/get job roles and levels (read-only) |
|
|
38
|
+
| **Contracts** | 1 | Get employee contract history (read-only) |
|
|
39
|
+
|
|
40
|
+
### 5 MCP Resources
|
|
41
|
+
|
|
42
|
+
| Resource URI | Description |
|
|
43
|
+
| --------------------------------- | -------------------------------------------------- |
|
|
44
|
+
| `factorial://org-chart` | Complete organizational hierarchy (Markdown) |
|
|
45
|
+
| `factorial://employees/directory` | Employee directory by team (Markdown) |
|
|
46
|
+
| `factorial://locations/directory` | Location directory with employee counts (Markdown) |
|
|
47
|
+
| `factorial://timeoff/policies` | All leave types and policies (JSON) |
|
|
48
|
+
| `factorial://teams/{team_id}` | Team details with member list (JSON, templated) |
|
|
49
|
+
|
|
50
|
+
### 3 MCP Prompts
|
|
51
|
+
|
|
52
|
+
| Prompt | Description |
|
|
53
|
+
| ----------------------- | ----------------------------------------------------------------- |
|
|
54
|
+
| `onboard-employee` | Generate personalized onboarding checklists |
|
|
55
|
+
| `analyze-org-structure` | Analyze org structure (reporting lines, team sizes, distribution) |
|
|
56
|
+
| `timeoff-report` | Generate time off reports by team or date range |
|
|
57
|
+
|
|
58
|
+
### Architecture Features
|
|
59
|
+
|
|
60
|
+
- **Safety Guardrails**: High-risk operations (terminate, delete) marked for confirmation
|
|
61
|
+
- **Audit Logging**: All write operations logged with timestamps and context
|
|
62
|
+
- **Caching**: In-memory TTL-based caching (configurable by resource type)
|
|
63
|
+
- **Pagination**: All list operations support pagination
|
|
64
|
+
- **Retry Logic**: Exponential backoff with rate limit handling
|
|
65
|
+
- **Validation**: Runtime validation with Zod schemas
|
|
42
66
|
|
|
43
67
|
## Quick Start
|
|
44
68
|
|
|
@@ -83,36 +107,91 @@ Or pass it directly in the MCP config:
|
|
|
83
107
|
|
|
84
108
|
Once configured, ask Claude things like:
|
|
85
109
|
|
|
86
|
-
-
|
|
87
|
-
-
|
|
88
|
-
-
|
|
89
|
-
-
|
|
110
|
+
- _"Who's on the Engineering team?"_
|
|
111
|
+
- _"Create a new employee John Smith with email john@company.com"_
|
|
112
|
+
- _"Approve the pending time off request for employee 42"_
|
|
113
|
+
- _"Create a new project called Q1 Marketing Campaign"_
|
|
114
|
+
- _"Enroll Sarah in the Leadership Training program"_
|
|
115
|
+
- _"Show me all open job postings"_
|
|
116
|
+
- _"What candidates applied for the Senior Developer position?"_
|
|
90
117
|
|
|
91
118
|
## Getting an API Key
|
|
92
119
|
|
|
120
|
+
You'll need a FactorialHR API key to use this MCP server. Here's how to get one:
|
|
121
|
+
|
|
93
122
|
1. Log in to [FactorialHR](https://app.factorialhr.com) as an administrator
|
|
94
|
-
2.
|
|
95
|
-
3.
|
|
96
|
-
4.
|
|
123
|
+
2. Go to [**Settings → API keys**](https://app.factorialhr.com/settings/api-keys)
|
|
124
|
+
3. Click the **"New API key"** button
|
|
125
|
+
4. Give your key a descriptive name (e.g., "Claude Code" or "MCP Server")
|
|
126
|
+
5. Click **Create** - your API key will be displayed
|
|
127
|
+
6. **Copy the key immediately** - it's only shown once and cannot be retrieved later
|
|
128
|
+
7. Add the key to your `.env` file or MCP configuration
|
|
97
129
|
|
|
98
|
-
> **Important**: API keys have full access to FactorialHR and never expire. Store them securely and rotate them periodically.
|
|
130
|
+
> **Important**: API keys have full access to your FactorialHR data and never expire. Store them securely, never commit them to version control, and rotate them periodically.
|
|
99
131
|
|
|
100
132
|
## Use Cases
|
|
101
133
|
|
|
102
134
|
### For Managers
|
|
103
|
-
|
|
104
|
-
-
|
|
105
|
-
-
|
|
135
|
+
|
|
136
|
+
- Create and manage team structures
|
|
137
|
+
- Approve or reject time off requests
|
|
138
|
+
- Assign employees to projects
|
|
139
|
+
- Track project time records
|
|
140
|
+
- Monitor training enrollments
|
|
106
141
|
|
|
107
142
|
### For HR
|
|
108
|
-
|
|
109
|
-
-
|
|
110
|
-
-
|
|
143
|
+
|
|
144
|
+
- Onboard new employees with full data entry
|
|
145
|
+
- Manage job postings and recruiting pipeline
|
|
146
|
+
- Track candidate applications through hiring stages
|
|
147
|
+
- Generate org structure analysis
|
|
148
|
+
- Manage training programs and enrollments
|
|
111
149
|
|
|
112
150
|
### For Developers
|
|
151
|
+
|
|
113
152
|
- Build AI workflows that need employee context
|
|
114
153
|
- Create custom Claude integrations
|
|
115
|
-
- Automate
|
|
154
|
+
- Automate HR processes with AI assistance
|
|
155
|
+
- Generate reports and analytics
|
|
156
|
+
|
|
157
|
+
## Configuration Options
|
|
158
|
+
|
|
159
|
+
| Environment Variable | Description | Default |
|
|
160
|
+
| ----------------------- | ------------------------ | ------------ |
|
|
161
|
+
| `FACTORIAL_API_KEY` | Your FactorialHR API key | Required |
|
|
162
|
+
| `FACTORIAL_API_VERSION` | API version | `2025-10-01` |
|
|
163
|
+
| `FACTORIAL_TIMEOUT` | Request timeout (ms) | `30000` |
|
|
164
|
+
| `FACTORIAL_MAX_RETRIES` | Max retry attempts | `3` |
|
|
165
|
+
| `DEBUG` | Enable debug logging | `false` |
|
|
166
|
+
|
|
167
|
+
## Safety & Security
|
|
168
|
+
|
|
169
|
+
### High-Risk Operations
|
|
170
|
+
|
|
171
|
+
The following operations are marked as high-risk and should be used with care:
|
|
172
|
+
|
|
173
|
+
- `terminate_employee` - Terminates an employee (sets termination date)
|
|
174
|
+
- `delete_team` - Permanently deletes a team
|
|
175
|
+
- `delete_location` - Permanently deletes a location
|
|
176
|
+
- `delete_project` - Permanently deletes a project
|
|
177
|
+
- `delete_candidate` - Permanently deletes a candidate
|
|
178
|
+
|
|
179
|
+
### Read-Only Categories
|
|
180
|
+
|
|
181
|
+
Some categories are intentionally read-only for security:
|
|
182
|
+
|
|
183
|
+
- **Payroll**: Supplements, tax identifiers, family situations
|
|
184
|
+
- **Documents**: Folder and document metadata only
|
|
185
|
+
- **Contracts**: Historical contract data
|
|
186
|
+
|
|
187
|
+
### Audit Logging
|
|
188
|
+
|
|
189
|
+
All write operations (create, update, delete, approve, reject) are logged with:
|
|
190
|
+
|
|
191
|
+
- Timestamp
|
|
192
|
+
- Operation type
|
|
193
|
+
- Entity type and ID
|
|
194
|
+
- Changes made
|
|
116
195
|
|
|
117
196
|
## Development
|
|
118
197
|
|
|
@@ -127,6 +206,18 @@ npm install
|
|
|
127
206
|
# Build
|
|
128
207
|
npm run build
|
|
129
208
|
|
|
209
|
+
# Run tests
|
|
210
|
+
npm test
|
|
211
|
+
|
|
212
|
+
# Run tests with coverage
|
|
213
|
+
npm run test:coverage
|
|
214
|
+
|
|
215
|
+
# Lint
|
|
216
|
+
npm run lint
|
|
217
|
+
|
|
218
|
+
# Format
|
|
219
|
+
npm run format
|
|
220
|
+
|
|
130
221
|
# Run locally
|
|
131
222
|
FACTORIAL_API_KEY=your-key npm start
|
|
132
223
|
|
|
@@ -134,27 +225,53 @@ FACTORIAL_API_KEY=your-key npm start
|
|
|
134
225
|
npx @modelcontextprotocol/inspector
|
|
135
226
|
```
|
|
136
227
|
|
|
137
|
-
##
|
|
228
|
+
## Troubleshooting
|
|
229
|
+
|
|
230
|
+
### API Key Not Working
|
|
231
|
+
|
|
232
|
+
- Ensure the API key has appropriate permissions
|
|
233
|
+
- Check if the key has been revoked or expired
|
|
234
|
+
- Verify the key is set correctly in environment variables
|
|
235
|
+
|
|
236
|
+
### Rate Limiting
|
|
237
|
+
|
|
238
|
+
The server implements exponential backoff for rate limits. If you're hitting limits frequently:
|
|
239
|
+
|
|
240
|
+
- Reduce request frequency
|
|
241
|
+
- Use pagination with smaller page sizes
|
|
242
|
+
- Enable caching by avoiding cache-busting parameters
|
|
243
|
+
|
|
244
|
+
### Missing Data
|
|
245
|
+
|
|
246
|
+
- **`hired_on` field**: The FactorialHR API may not populate this for all employees
|
|
247
|
+
- **Team membership**: Some employees may not be assigned to teams
|
|
248
|
+
- **Empty responses**: Check if the resource exists in your Factorial account
|
|
249
|
+
|
|
250
|
+
## FAQ
|
|
251
|
+
|
|
252
|
+
**Q: Does this expose salary/payroll data?**
|
|
253
|
+
A: Payroll data (supplements, tax identifiers, family situations) is available read-only. No write operations for payroll are supported.
|
|
254
|
+
|
|
255
|
+
**Q: Can Claude modify data in Factorial?**
|
|
256
|
+
A: Yes! Full CRUD operations are available for employees, teams, locations, time off, projects, training, and recruiting. High-risk operations are clearly marked.
|
|
138
257
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
| `FACTORIAL_API_KEY` | Your FactorialHR API key | Yes |
|
|
142
|
-
| `DEBUG` | Enable debug logging (`true`/`false`) | No |
|
|
258
|
+
**Q: How is data cached?**
|
|
259
|
+
A: Data is cached in-memory with TTLs: employees (5 min), teams (10 min), locations (15 min), contracts (3 min).
|
|
143
260
|
|
|
144
|
-
|
|
261
|
+
**Q: What FactorialHR API version is used?**
|
|
262
|
+
A: Version `2025-10-01` by default. Override with `FACTORIAL_API_VERSION` environment variable.
|
|
145
263
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
- **Employee IDs**: Higher employee IDs generally indicate more recent additions, but this is not guaranteed.
|
|
264
|
+
**Q: Are write operations logged?**
|
|
265
|
+
A: Yes, all write operations are logged via the audit module for compliance and debugging.
|
|
149
266
|
|
|
150
267
|
## Contributing
|
|
151
268
|
|
|
152
|
-
Contributions are welcome! Please
|
|
269
|
+
Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
153
270
|
|
|
154
271
|
## License
|
|
155
272
|
|
|
156
|
-
MIT © [
|
|
273
|
+
MIT © [Taig Mac Carthy](https://taigmaccarthy.com/)
|
|
157
274
|
|
|
158
275
|
---
|
|
159
276
|
|
|
160
|
-
|
|
277
|
+
_Built with the [Model Context Protocol](https://modelcontextprotocol.io/) by Anthropic_
|