@frihet/mcp-server 1.17.0 → 2.0.1
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 +106 -348
- package/dist/agent-onboarding.d.ts +1 -1
- package/dist/agent-onboarding.js +3 -3
- package/dist/canary/mcp-harness.d.ts +1 -1
- package/dist/canary/mcp-harness.js +4 -1
- package/dist/capability-truth.js +20 -12
- package/dist/claude-candidate-contract.d.ts +482 -0
- package/dist/claude-candidate-contract.js +87 -0
- package/dist/claude-output-privacy.d.ts +17 -0
- package/dist/claude-output-privacy.js +249 -0
- package/dist/claude-profile.d.ts +18 -0
- package/dist/claude-profile.js +260 -0
- package/dist/client-interface.d.ts +26 -20
- package/dist/client.d.ts +65 -29
- package/dist/client.js +278 -167
- package/dist/demo-client.d.ts +28 -21
- package/dist/demo-client.js +32 -14
- package/dist/deposit-contract.d.ts +29 -0
- package/dist/deposit-contract.js +76 -0
- package/dist/fetch-no-redirect.d.ts +3 -0
- package/dist/fetch-no-redirect.js +16 -0
- package/dist/fiscal-aliases.d.ts +2 -2
- package/dist/fiscal-aliases.js +2 -2
- package/dist/fiscal-period.d.ts +26 -0
- package/dist/fiscal-period.js +31 -0
- package/dist/google-profile.d.ts +19 -0
- package/dist/google-profile.js +122 -0
- package/dist/index.js +31 -7
- package/dist/logger.d.ts +1 -1
- package/dist/logger.js +2 -2
- package/dist/muse-profile.d.ts +19 -0
- package/dist/muse-profile.js +122 -0
- package/dist/observability.js +3 -2
- package/dist/openai-profile.d.ts +2 -2
- package/dist/openai-profile.js +37 -11
- package/dist/openai-review-contract.d.ts +1 -1
- package/dist/openai-review-contract.js +4 -5
- package/dist/openai-review-oauth.d.ts +107 -7
- package/dist/openai-review-oauth.js +161 -17
- package/dist/prompts/register-all.js +32 -78
- package/dist/redaction.d.ts +5 -0
- package/dist/redaction.js +9 -0
- package/dist/resources/register-all.js +150 -54
- package/dist/retry-after.d.ts +19 -0
- package/dist/retry-after.js +84 -0
- package/dist/server-composition.d.ts +6 -2
- package/dist/server-composition.js +46 -5
- package/dist/tool-exposure.d.ts +7 -5
- package/dist/tool-exposure.js +21 -13
- package/dist/tools/audit_gl.js +8 -8
- package/dist/tools/backend-availability.d.ts +8 -29
- package/dist/tools/backend-availability.js +31 -30
- package/dist/tools/bank_rules.js +66 -15
- package/dist/tools/banking.js +5 -13
- package/dist/tools/clients.js +254 -6
- package/dist/tools/deposits.js +107 -97
- package/dist/tools/einvoice.d.ts +17 -3
- package/dist/tools/einvoice.js +59 -12
- package/dist/tools/fiscal.d.ts +3 -4
- package/dist/tools/fiscal.js +93 -60
- package/dist/tools/gestoria.js +15 -7
- package/dist/tools/hr.js +41 -11
- package/dist/tools/igic.d.ts +9 -8
- package/dist/tools/igic.js +34 -64
- package/dist/tools/impuesto_sociedades.d.ts +4 -5
- package/dist/tools/impuesto_sociedades.js +16 -37
- package/dist/tools/intelligence.js +164 -10
- package/dist/tools/invoices.js +109 -42
- package/dist/tools/kitchen.js +19 -9
- package/dist/tools/quotes.js +86 -25
- package/dist/tools/recurring.js +26 -25
- package/dist/tools/register-all.d.ts +2 -2
- package/dist/tools/register-all.js +9 -6
- package/dist/tools/search.d.ts +19 -0
- package/dist/tools/search.js +84 -0
- package/dist/tools/shared.d.ts +18 -38
- package/dist/tools/shared.js +96 -30
- package/dist/tools/team.js +8 -16
- package/dist/tools/time.js +4 -12
- package/dist/tools/vendors.js +242 -6
- package/dist/types.d.ts +3 -1
- package/dist/workflows/daily-operational-brief.d.ts +163 -0
- package/dist/workflows/daily-operational-brief.js +881 -0
- package/docs/agent-onboarding.json +15 -5
- package/package.json +26 -12
- package/dist/tools/onboarding.d.ts +0 -19
- package/dist/tools/onboarding.js +0 -64
|
@@ -126,6 +126,21 @@ export interface IFrihetClient {
|
|
|
126
126
|
createWebhook(data: CreateWebhookInput): Promise<CreateWebhookResult>;
|
|
127
127
|
updateWebhook(id: string, data: UpdateWebhookInput): Promise<Webhook>;
|
|
128
128
|
deleteWebhook(id: string): Promise<void>;
|
|
129
|
+
globalSearch(params: {
|
|
130
|
+
q: string;
|
|
131
|
+
types?: ReadonlyArray<"invoices" | "expenses" | "vendors" | "clients" | "products">;
|
|
132
|
+
limit?: number;
|
|
133
|
+
offset?: number;
|
|
134
|
+
}): Promise<{
|
|
135
|
+
data: Record<string, unknown>[];
|
|
136
|
+
total: number;
|
|
137
|
+
limit: number;
|
|
138
|
+
offset: number;
|
|
139
|
+
hasMore: boolean;
|
|
140
|
+
query: string;
|
|
141
|
+
types: ReadonlyArray<"invoices" | "expenses" | "vendors" | "clients" | "products">;
|
|
142
|
+
truncated?: boolean;
|
|
143
|
+
}>;
|
|
129
144
|
listClientContacts(clientId: string, params?: {
|
|
130
145
|
limit?: number;
|
|
131
146
|
offset?: number;
|
|
@@ -206,14 +221,9 @@ export interface IFrihetClient {
|
|
|
206
221
|
}>;
|
|
207
222
|
exportEInvoice(params: {
|
|
208
223
|
invoiceId: string;
|
|
209
|
-
format:
|
|
224
|
+
format: import("./client.js").McpEInvoiceExportFormat;
|
|
210
225
|
signed?: boolean;
|
|
211
|
-
}): Promise<
|
|
212
|
-
xmlUrl: string;
|
|
213
|
-
filename: string;
|
|
214
|
-
format: string;
|
|
215
|
-
signed: boolean;
|
|
216
|
-
}>;
|
|
226
|
+
}): Promise<import("./client.js").EInvoiceExportResult>;
|
|
217
227
|
faceSubmit(params: {
|
|
218
228
|
invoiceId: string;
|
|
219
229
|
mode: "mock" | "sandbox" | "production";
|
|
@@ -387,7 +397,7 @@ export interface IFrihetClient {
|
|
|
387
397
|
updateTeamMemberRole(memberId: string, role: string): Promise<Record<string, unknown>>;
|
|
388
398
|
removeTeamMember(memberId: string): Promise<void>;
|
|
389
399
|
approveGLEntry(entryId: string, notes?: string): Promise<Record<string, unknown>>;
|
|
390
|
-
rejectGLEntry(entryId: string,
|
|
400
|
+
rejectGLEntry(entryId: string, note: string): Promise<Record<string, unknown>>;
|
|
391
401
|
getGLEntryAuditLog(entryId: string): Promise<Record<string, unknown>>;
|
|
392
402
|
addCustomPortalDomain(data: {
|
|
393
403
|
domain: string;
|
|
@@ -429,15 +439,13 @@ export interface IFrihetClient {
|
|
|
429
439
|
}): Promise<import("./types.js").PaginatedResponse<Record<string, unknown>>>;
|
|
430
440
|
createBankRule(data: {
|
|
431
441
|
name: string;
|
|
432
|
-
|
|
442
|
+
bankConditions: Array<{
|
|
433
443
|
field: string;
|
|
434
444
|
operator: string;
|
|
435
445
|
value: string;
|
|
436
446
|
}>;
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
value: string;
|
|
440
|
-
}>;
|
|
447
|
+
action: string;
|
|
448
|
+
actionConfig: Record<string, unknown>;
|
|
441
449
|
isActive?: boolean;
|
|
442
450
|
}): Promise<Record<string, unknown>>;
|
|
443
451
|
sendGestoriaMessage(data: {
|
|
@@ -480,7 +488,9 @@ export interface IFrihetClient {
|
|
|
480
488
|
};
|
|
481
489
|
}): Promise<Record<string, unknown>>;
|
|
482
490
|
getGestoriaAgingConsolidated(params?: {
|
|
483
|
-
|
|
491
|
+
workspaceIds?: string[];
|
|
492
|
+
asOf?: string;
|
|
493
|
+
bustCache?: boolean;
|
|
484
494
|
}): Promise<Record<string, unknown>>;
|
|
485
495
|
listLeaves(params?: {
|
|
486
496
|
employeeId?: string;
|
|
@@ -509,8 +519,8 @@ export interface IFrihetClient {
|
|
|
509
519
|
employeeId: string;
|
|
510
520
|
mood?: string;
|
|
511
521
|
location?: string;
|
|
512
|
-
}): Promise<Record<string, unknown>>;
|
|
513
|
-
attendanceClockOut(entryId: string): Promise<Record<string, unknown>>;
|
|
522
|
+
}, idempotencyKey?: string): Promise<Record<string, unknown>>;
|
|
523
|
+
attendanceClockOut(entryId: string, idempotencyKey?: string): Promise<Record<string, unknown>>;
|
|
514
524
|
getOvertimeReport(params: {
|
|
515
525
|
period: string;
|
|
516
526
|
employeeId?: string;
|
|
@@ -533,10 +543,6 @@ export interface IFrihetClient {
|
|
|
533
543
|
getPayrollChecklist(params: {
|
|
534
544
|
month: string;
|
|
535
545
|
}): Promise<Record<string, unknown>>;
|
|
536
|
-
getOnboardingStatus(): Promise<Record<string, unknown>>;
|
|
537
|
-
setOnboardingPersona(data: {
|
|
538
|
-
persona: "autonomo" | "empresa" | "agencia" | "gestoria";
|
|
539
|
-
}): Promise<Record<string, unknown>>;
|
|
540
546
|
getPermissionsMatrix(): Promise<Record<string, unknown>>;
|
|
541
547
|
getMyPermissions(): Promise<Record<string, unknown>>;
|
|
542
548
|
getCurrentPeriod(params?: {
|
package/dist/client.d.ts
CHANGED
|
@@ -63,11 +63,30 @@ export interface XmlDocument {
|
|
|
63
63
|
}
|
|
64
64
|
/** `/invoices/:id/xml` serves XML or a Factur-X PDF, depending on storage MIME. */
|
|
65
65
|
export type EInvoiceDocument = XmlDocument | BinaryDocument;
|
|
66
|
+
/** Ergonomic values accepted by the MCP `einvoice_export` tool. This is
|
|
67
|
+
* deliberately narrower than the asynchronous dispatch/validation format
|
|
68
|
+
* family: the public export API exposes only the EN16931 Factur-X profile. */
|
|
69
|
+
export type McpEInvoiceExportFormat = "facturae" | "xrechnung-cii" | "xrechnung-ubl" | "facturx-en16931" | "fatturapa" | "peppol-bis-3" | "fa-2-ksef" | "ubl" | "cii";
|
|
70
|
+
/** Exact, case-sensitive enum accepted by the ERP export endpoint. */
|
|
71
|
+
export type ApiEInvoiceExportFormat = "Facturae" | "XRechnung-CII" | "XRechnung-UBL" | "Factur-X" | "FatturaPA" | "PEPPOL-BIS-3" | "FA-2-KSeF" | "UBL" | "CII";
|
|
72
|
+
export interface EInvoiceExportResult {
|
|
73
|
+
xml: string;
|
|
74
|
+
contentType: string;
|
|
75
|
+
filename: string;
|
|
76
|
+
signed: boolean;
|
|
77
|
+
format: ApiEInvoiceExportFormat;
|
|
78
|
+
}
|
|
79
|
+
export declare function isLocalInputValidationError(error: unknown): boolean;
|
|
80
|
+
export declare function toApiEInvoiceExportFormat(format: string): ApiEInvoiceExportFormat;
|
|
66
81
|
export declare class FrihetApiError extends Error {
|
|
67
82
|
readonly statusCode: number;
|
|
68
83
|
readonly errorCode: string;
|
|
69
84
|
readonly detail?: string | undefined;
|
|
70
|
-
|
|
85
|
+
/** Backend correlation id (`meta.requestId` or `X-Request-Id`); carried for diagnostics, never echoed to agents. */
|
|
86
|
+
readonly requestId?: string | undefined;
|
|
87
|
+
constructor(statusCode: number, errorCode: string, message?: string, detail?: string | undefined,
|
|
88
|
+
/** Backend correlation id (`meta.requestId` or `X-Request-Id`); carried for diagnostics, never echoed to agents. */
|
|
89
|
+
requestId?: string | undefined);
|
|
71
90
|
}
|
|
72
91
|
export interface FrihetClientOptions {
|
|
73
92
|
/**
|
|
@@ -76,17 +95,22 @@ export interface FrihetClientOptions {
|
|
|
76
95
|
*/
|
|
77
96
|
timeoutMs?: number;
|
|
78
97
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
98
|
+
* Cumulative time one call may sleep across 429 retries. A server-requested
|
|
99
|
+
* wait that does not fit is never shortened: the call fails with a
|
|
100
|
+
* `rate_limit_deferred` error carrying the wait to honor. Defaults to 30000.
|
|
82
101
|
*/
|
|
83
|
-
|
|
102
|
+
retryBudgetMs?: number;
|
|
103
|
+
/** Test seams: timer and wall clock used for 429 waits. */
|
|
104
|
+
sleep?: (ms: number) => Promise<void>;
|
|
105
|
+
now?: () => number;
|
|
84
106
|
}
|
|
85
107
|
export declare class FrihetClient {
|
|
86
108
|
private readonly apiKey;
|
|
87
109
|
private readonly baseUrl;
|
|
88
110
|
private readonly timeoutMs;
|
|
89
|
-
private readonly
|
|
111
|
+
private readonly retryBudgetMs;
|
|
112
|
+
private readonly sleepFn;
|
|
113
|
+
private readonly nowFn;
|
|
90
114
|
constructor(apiKey: string, baseUrl?: string, options?: FrihetClientOptions);
|
|
91
115
|
private request;
|
|
92
116
|
/** Fetch a raw response. The caller owns timeout and body consumption. */
|
|
@@ -101,7 +125,13 @@ export declare class FrihetClient {
|
|
|
101
125
|
* A 429 may retry, matching the generic JSON client path.
|
|
102
126
|
*/
|
|
103
127
|
private requestDocument;
|
|
104
|
-
|
|
128
|
+
/**
|
|
129
|
+
* Wait before the next 429 retry: the server's `Retry-After` when it parses
|
|
130
|
+
* (RFC 9110 §10.2.3), otherwise exponential backoff. Either wait that does
|
|
131
|
+
* not fit the remaining cumulative budget is deferred to the caller; a server
|
|
132
|
+
* wait is never shortened into an early retry.
|
|
133
|
+
*/
|
|
134
|
+
private rateLimitDelayMs;
|
|
105
135
|
/**
|
|
106
136
|
* Wrapper for endpoints whose backend wraps the payload in a `{ data, meta }`
|
|
107
137
|
* envelope. This is the UNIFORM convention across the Frihet `/v1` REST API:
|
|
@@ -130,12 +160,12 @@ export declare class FrihetClient {
|
|
|
130
160
|
* Only unwraps when the body is an object carrying a `data` property that is
|
|
131
161
|
* itself a (non-array) object — i.e. a genuine single-object envelope. It is
|
|
132
162
|
* deliberately distinct from {@link requestPaginated}, which keeps the
|
|
133
|
-
*
|
|
163
|
+
* list rows and pagination fields while omitting transport metadata. If the body is
|
|
134
164
|
* not an envelope (legacy endpoints that return the item directly), it is
|
|
135
165
|
* returned unchanged so existing callers keep working.
|
|
136
166
|
*/
|
|
137
167
|
private requestUnwrapped;
|
|
138
|
-
/**
|
|
168
|
+
/** Validate list rows and emit only the declared MCP pagination envelope. */
|
|
139
169
|
private requestPaginated;
|
|
140
170
|
listInvoices(params?: {
|
|
141
171
|
limit?: number;
|
|
@@ -280,6 +310,21 @@ export declare class FrihetClient {
|
|
|
280
310
|
createWebhook(data: CreateWebhookInput): Promise<CreateWebhookResult>;
|
|
281
311
|
updateWebhook(id: string, data: UpdateWebhookInput): Promise<Webhook>;
|
|
282
312
|
deleteWebhook(id: string): Promise<void>;
|
|
313
|
+
globalSearch(params: {
|
|
314
|
+
q: string;
|
|
315
|
+
types?: ReadonlyArray<"invoices" | "expenses" | "vendors" | "clients" | "products">;
|
|
316
|
+
limit?: number;
|
|
317
|
+
offset?: number;
|
|
318
|
+
}): Promise<{
|
|
319
|
+
data: Record<string, unknown>[];
|
|
320
|
+
total: number;
|
|
321
|
+
limit: number;
|
|
322
|
+
offset: number;
|
|
323
|
+
hasMore: boolean;
|
|
324
|
+
query: string;
|
|
325
|
+
types: ReadonlyArray<"invoices" | "expenses" | "vendors" | "clients" | "products">;
|
|
326
|
+
truncated?: boolean;
|
|
327
|
+
}>;
|
|
283
328
|
listClientContacts(clientId: string, params?: {
|
|
284
329
|
limit?: number;
|
|
285
330
|
offset?: number;
|
|
@@ -357,14 +402,9 @@ export declare class FrihetClient {
|
|
|
357
402
|
}>;
|
|
358
403
|
exportEInvoice(params: {
|
|
359
404
|
invoiceId: string;
|
|
360
|
-
format:
|
|
405
|
+
format: McpEInvoiceExportFormat;
|
|
361
406
|
signed?: boolean;
|
|
362
|
-
}): Promise<
|
|
363
|
-
xmlUrl: string;
|
|
364
|
-
filename: string;
|
|
365
|
-
format: string;
|
|
366
|
-
signed: boolean;
|
|
367
|
-
}>;
|
|
407
|
+
}): Promise<EInvoiceExportResult>;
|
|
368
408
|
faceSubmit(params: {
|
|
369
409
|
invoiceId: string;
|
|
370
410
|
mode: "mock" | "sandbox" | "production";
|
|
@@ -580,10 +620,12 @@ export declare class FrihetClient {
|
|
|
580
620
|
};
|
|
581
621
|
}): Promise<Record<string, unknown>>;
|
|
582
622
|
getGestoriaAgingConsolidated(params?: {
|
|
583
|
-
|
|
623
|
+
workspaceIds?: string[];
|
|
624
|
+
asOf?: string;
|
|
625
|
+
bustCache?: boolean;
|
|
584
626
|
}): Promise<Record<string, unknown>>;
|
|
585
627
|
approveGLEntry(entryId: string, notes?: string): Promise<Record<string, unknown>>;
|
|
586
|
-
rejectGLEntry(entryId: string,
|
|
628
|
+
rejectGLEntry(entryId: string, note: string): Promise<Record<string, unknown>>;
|
|
587
629
|
getGLEntryAuditLog(entryId: string): Promise<Record<string, unknown>>;
|
|
588
630
|
addCustomPortalDomain(data: {
|
|
589
631
|
domain: string;
|
|
@@ -625,15 +667,13 @@ export declare class FrihetClient {
|
|
|
625
667
|
}): Promise<PaginatedResponse<Record<string, unknown>>>;
|
|
626
668
|
createBankRule(data: {
|
|
627
669
|
name: string;
|
|
628
|
-
|
|
670
|
+
bankConditions: Array<{
|
|
629
671
|
field: string;
|
|
630
672
|
operator: string;
|
|
631
673
|
value: string;
|
|
632
674
|
}>;
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
value: string;
|
|
636
|
-
}>;
|
|
675
|
+
action: string;
|
|
676
|
+
actionConfig: Record<string, unknown>;
|
|
637
677
|
isActive?: boolean;
|
|
638
678
|
}): Promise<Record<string, unknown>>;
|
|
639
679
|
listLeaves(params?: {
|
|
@@ -663,8 +703,8 @@ export declare class FrihetClient {
|
|
|
663
703
|
employeeId: string;
|
|
664
704
|
mood?: string;
|
|
665
705
|
location?: string;
|
|
666
|
-
}): Promise<Record<string, unknown>>;
|
|
667
|
-
attendanceClockOut(entryId: string): Promise<Record<string, unknown>>;
|
|
706
|
+
}, idempotencyKey?: string): Promise<Record<string, unknown>>;
|
|
707
|
+
attendanceClockOut(entryId: string, idempotencyKey?: string): Promise<Record<string, unknown>>;
|
|
668
708
|
getOvertimeReport(params: {
|
|
669
709
|
period: string;
|
|
670
710
|
employeeId?: string;
|
|
@@ -687,10 +727,6 @@ export declare class FrihetClient {
|
|
|
687
727
|
getPayrollChecklist(params: {
|
|
688
728
|
month: string;
|
|
689
729
|
}): Promise<Record<string, unknown>>;
|
|
690
|
-
getOnboardingStatus(): Promise<Record<string, unknown>>;
|
|
691
|
-
setOnboardingPersona(data: {
|
|
692
|
-
persona: "autonomo" | "empresa" | "agencia" | "gestoria";
|
|
693
|
-
}): Promise<Record<string, unknown>>;
|
|
694
730
|
getPermissionsMatrix(): Promise<Record<string, unknown>>;
|
|
695
731
|
getMyPermissions(): Promise<Record<string, unknown>>;
|
|
696
732
|
getCurrentPeriod(params?: {
|