@frihet/mcp-server 1.16.6 → 2.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/README.md +168 -82
- package/dist/agent-onboarding.d.ts +98 -0
- package/dist/agent-onboarding.js +275 -0
- package/dist/api-origin.d.ts +9 -0
- package/dist/api-origin.js +41 -0
- package/dist/canary/mcp-harness.d.ts +77 -0
- package/dist/canary/mcp-harness.js +552 -0
- package/dist/capability-truth.d.ts +29 -0
- package/dist/capability-truth.js +262 -0
- 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 +240 -0
- package/dist/claude-profile.d.ts +18 -0
- package/dist/claude-profile.js +260 -0
- package/dist/client-interface.d.ts +47 -33
- package/dist/client.d.ts +172 -40
- package/dist/client.js +708 -165
- package/dist/demo-client.d.ts +41 -32
- package/dist/demo-client.js +202 -31
- package/dist/demo-fixtures.d.ts +3 -3
- package/dist/demo-fixtures.js +7 -7
- 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 +44 -0
- package/dist/fiscal-aliases.js +62 -0
- 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 +68 -59
- package/dist/logger.d.ts +2 -2
- package/dist/logger.js +140 -8
- package/dist/muse-profile.d.ts +19 -0
- package/dist/muse-profile.js +122 -0
- package/dist/observability.d.ts +18 -29
- package/dist/observability.js +194 -106
- package/dist/openai-profile.d.ts +26 -22
- package/dist/openai-profile.js +1193 -157
- package/dist/openai-review-contract.d.ts +15 -6
- package/dist/openai-review-contract.js +714 -41
- package/dist/openai-review-oauth.d.ts +149 -2
- package/dist/openai-review-oauth.js +220 -6
- package/dist/prompts/register-all.d.ts +2 -0
- package/dist/prompts/register-all.js +34 -78
- package/dist/public-capability-contract.d.ts +39 -0
- package/dist/public-capability-contract.js +186 -0
- package/dist/redaction.d.ts +15 -0
- package/dist/redaction.js +83 -0
- package/dist/resources/register-all.js +154 -64
- package/dist/retry-after.d.ts +19 -0
- package/dist/retry-after.js +84 -0
- package/dist/server-composition.d.ts +19 -0
- package/dist/server-composition.js +74 -0
- package/dist/tool-exposure.d.ts +31 -27
- package/dist/tool-exposure.js +211 -87
- package/dist/tools/accountingClose.d.ts +14 -5
- package/dist/tools/accountingClose.js +41 -23
- 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 +261 -15
- package/dist/tools/crm.js +22 -21
- package/dist/tools/deposits.js +114 -85
- package/dist/tools/einvoice.d.ts +16 -2
- package/dist/tools/einvoice.js +59 -12
- package/dist/tools/expenses.d.ts +16 -0
- package/dist/tools/expenses.js +47 -27
- 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.d.ts +2 -3
- package/dist/tools/hr.js +49 -20
- 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 +166 -12
- package/dist/tools/invoices.js +224 -54
- package/dist/tools/kitchen.js +19 -9
- package/dist/tools/payroll.d.ts +5 -8
- package/dist/tools/payroll.js +19 -32
- package/dist/tools/permissions.d.ts +4 -7
- package/dist/tools/permissions.js +11 -14
- package/dist/tools/products.js +6 -6
- package/dist/tools/quotes.js +172 -26
- 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 +1445 -109
- package/dist/tools/shared.js +478 -102
- package/dist/tools/team.js +24 -28
- package/dist/tools/time.js +4 -12
- package/dist/tools/vendors.js +249 -15
- package/dist/tools/webhooks.js +35 -30
- package/dist/types.d.ts +31 -5
- package/dist/workflows/daily-operational-brief.d.ts +163 -0
- package/dist/workflows/daily-operational-brief.js +881 -0
- package/docs/agent-onboarding.json +391 -0
- package/package.json +49 -12
- package/dist/tools/onboarding.d.ts +0 -19
- package/dist/tools/onboarding.js +0 -64
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public capability truth for the full Frihet MCP surfaces.
|
|
3
|
+
*
|
|
4
|
+
* Registration proves only that a tool name and handler exist. It does not
|
|
5
|
+
* prove that the backing API family is deployed, enabled for a workspace, or
|
|
6
|
+
* authorized for the caller. This profile adds a conservative, machine-readable
|
|
7
|
+
* fact to tools/list and corrects action annotations on the non-OpenAI surface.
|
|
8
|
+
*
|
|
9
|
+
* The OpenAI review profile reuses the same annotation corrections so every
|
|
10
|
+
* public surface reports side effects consistently.
|
|
11
|
+
*/
|
|
12
|
+
export const CAPABILITY_META_KEY = "io.frihet/capability";
|
|
13
|
+
const RUNTIME_CHECKED = new Set([
|
|
14
|
+
"anomaly_list",
|
|
15
|
+
"attendance_clock_in",
|
|
16
|
+
"attendance_clock_out",
|
|
17
|
+
"frihet_bank_rule_create",
|
|
18
|
+
"frihet_bank_rules_list",
|
|
19
|
+
"frihet_gl_entry_approve",
|
|
20
|
+
"frihet_gl_entry_audit_log",
|
|
21
|
+
"frihet_gl_entry_reject",
|
|
22
|
+
"frihet_portal_domain_add",
|
|
23
|
+
"frihet_portal_domain_remove",
|
|
24
|
+
"frihet_portal_domain_verify",
|
|
25
|
+
"frihet_portal_onboard_link_generate",
|
|
26
|
+
"frihet_tax_id_vies_lookup",
|
|
27
|
+
"gestoria_template_create",
|
|
28
|
+
"get_modelo_130_summary",
|
|
29
|
+
"get_modelo_303_summary",
|
|
30
|
+
"get_modelo_347_summary",
|
|
31
|
+
"get_modelo_390_summary",
|
|
32
|
+
"leave_approve",
|
|
33
|
+
"leave_cancel",
|
|
34
|
+
"leave_list",
|
|
35
|
+
"leave_reject",
|
|
36
|
+
"leave_request_create",
|
|
37
|
+
"overtime_report",
|
|
38
|
+
"payroll_checklist",
|
|
39
|
+
"payroll_export",
|
|
40
|
+
"period_close_status",
|
|
41
|
+
"permissions_matrix",
|
|
42
|
+
"permissions_me",
|
|
43
|
+
"verifactu_resubmit",
|
|
44
|
+
"verifactu_status",
|
|
45
|
+
"send_einvoice",
|
|
46
|
+
"get_einvoice_status",
|
|
47
|
+
"validate_einvoice_xml",
|
|
48
|
+
"export_datev",
|
|
49
|
+
"einvoice_export",
|
|
50
|
+
"face_submit",
|
|
51
|
+
"face_status",
|
|
52
|
+
"ticketbai_submit",
|
|
53
|
+
"ticketbai_status",
|
|
54
|
+
]);
|
|
55
|
+
const DEFERRED = new Set([
|
|
56
|
+
"period_close",
|
|
57
|
+
"period_reopen",
|
|
58
|
+
"gestoria_message_send",
|
|
59
|
+
"gestoria_messages_list",
|
|
60
|
+
"gestoria_template_bulk_send",
|
|
61
|
+
"gestoria_aging_consolidated",
|
|
62
|
+
"create_reservation",
|
|
63
|
+
"sync_channel",
|
|
64
|
+
]);
|
|
65
|
+
// No Frihet-ERP route exists: publicApi.ts serves /fiscal/modelo/{303,130,390,347}
|
|
66
|
+
// only, and has no /igic/* (modelo or AIEM) and no /is/modelo/* route. These
|
|
67
|
+
// handlers return NOT_DEPLOYED without a call (ksef_submit: labelled unavailable).
|
|
68
|
+
const UNAVAILABLE = new Set([
|
|
69
|
+
"ksef_submit",
|
|
70
|
+
"get_modelo_180_summary",
|
|
71
|
+
"frihet_modelo_415_summary",
|
|
72
|
+
"frihet_modelo_418_summary",
|
|
73
|
+
"frihet_modelo_425_summary",
|
|
74
|
+
"frihet_aiem_calculate",
|
|
75
|
+
"frihet_modelo_200_summary",
|
|
76
|
+
"frihet_modelo_202_summary",
|
|
77
|
+
]);
|
|
78
|
+
const DESTRUCTIVE_UPDATES = new Set([
|
|
79
|
+
// These writes can synchronously enqueue delivery to workspace webhooks.
|
|
80
|
+
// Once an external endpoint receives the event, that disclosure cannot be
|
|
81
|
+
// recalled even if the Frihet record itself remains editable.
|
|
82
|
+
"create_invoice",
|
|
83
|
+
"duplicate_invoice",
|
|
84
|
+
"create_credit_note",
|
|
85
|
+
"create_expense",
|
|
86
|
+
"create_quote",
|
|
87
|
+
"create_client",
|
|
88
|
+
"log_client_activity",
|
|
89
|
+
"create_product",
|
|
90
|
+
"frihet_gl_entry_approve",
|
|
91
|
+
"frihet_gl_entry_reject",
|
|
92
|
+
"send_einvoice",
|
|
93
|
+
"categorize_transaction",
|
|
94
|
+
"update_client",
|
|
95
|
+
"update_deposit",
|
|
96
|
+
"apply_deposit",
|
|
97
|
+
"refund_deposit",
|
|
98
|
+
"update_expense",
|
|
99
|
+
"leave_approve",
|
|
100
|
+
"leave_reject",
|
|
101
|
+
"leave_cancel",
|
|
102
|
+
"attendance_clock_out",
|
|
103
|
+
"update_invoice",
|
|
104
|
+
"send_invoice",
|
|
105
|
+
"mark_invoice_paid",
|
|
106
|
+
"update_kitchen_ticket",
|
|
107
|
+
"update_product",
|
|
108
|
+
"update_quote",
|
|
109
|
+
"send_quote",
|
|
110
|
+
"update_recurring_invoice",
|
|
111
|
+
"sync_channel",
|
|
112
|
+
"update_team_member_role",
|
|
113
|
+
"update_time_entry",
|
|
114
|
+
"update_vendor",
|
|
115
|
+
"update_webhook",
|
|
116
|
+
"match_transaction_to_invoice",
|
|
117
|
+
"verifactu_resubmit",
|
|
118
|
+
"pause_recurring_invoice",
|
|
119
|
+
"resume_recurring_invoice",
|
|
120
|
+
"run_recurring_now",
|
|
121
|
+
"frihet_portal_domain_verify",
|
|
122
|
+
"face_submit",
|
|
123
|
+
"ticketbai_submit",
|
|
124
|
+
"frihet_portal_domain_add",
|
|
125
|
+
]);
|
|
126
|
+
const NON_IDEMPOTENT = new Set([
|
|
127
|
+
"create_invoice",
|
|
128
|
+
"duplicate_invoice",
|
|
129
|
+
"create_credit_note",
|
|
130
|
+
"update_invoice",
|
|
131
|
+
"mark_invoice_paid",
|
|
132
|
+
"delete_invoice",
|
|
133
|
+
"create_expense",
|
|
134
|
+
"update_expense",
|
|
135
|
+
"create_quote",
|
|
136
|
+
"update_quote",
|
|
137
|
+
"delete_quote",
|
|
138
|
+
"create_client",
|
|
139
|
+
"log_client_activity",
|
|
140
|
+
"update_client",
|
|
141
|
+
"create_product",
|
|
142
|
+
"update_product",
|
|
143
|
+
"update_vendor",
|
|
144
|
+
"send_invoice",
|
|
145
|
+
"send_quote",
|
|
146
|
+
"sync_channel",
|
|
147
|
+
"verifactu_resubmit",
|
|
148
|
+
"frihet_portal_domain_verify",
|
|
149
|
+
"pause_recurring_invoice",
|
|
150
|
+
"resume_recurring_invoice",
|
|
151
|
+
]);
|
|
152
|
+
const WRITE_OVERRIDES = new Set([
|
|
153
|
+
"frihet_portal_domain_verify",
|
|
154
|
+
// signed=true exercises a workspace certificate. MCP annotations are
|
|
155
|
+
// static, so classify the whole export tool conservatively.
|
|
156
|
+
"einvoice_export",
|
|
157
|
+
]);
|
|
158
|
+
const EXTERNAL_SIDE_EFFECTS = {
|
|
159
|
+
create_invoice: ["webhook_delivery_or_configuration", "fiscal_or_einvoice_submission"],
|
|
160
|
+
duplicate_invoice: ["webhook_delivery_or_configuration"],
|
|
161
|
+
create_credit_note: ["webhook_delivery_or_configuration"],
|
|
162
|
+
run_recurring_now: ["webhook_delivery_or_configuration", "fiscal_or_einvoice_submission"],
|
|
163
|
+
update_invoice: ["webhook_delivery_or_configuration", "fiscal_or_einvoice_submission"],
|
|
164
|
+
mark_invoice_paid: ["webhook_delivery_or_configuration", "fiscal_or_einvoice_submission"],
|
|
165
|
+
delete_invoice: ["webhook_delivery_or_configuration", "fiscal_or_einvoice_submission"],
|
|
166
|
+
create_expense: ["webhook_delivery_or_configuration"],
|
|
167
|
+
update_expense: ["webhook_delivery_or_configuration"],
|
|
168
|
+
create_quote: ["webhook_delivery_or_configuration"],
|
|
169
|
+
update_quote: ["webhook_delivery_or_configuration"],
|
|
170
|
+
delete_quote: ["webhook_delivery_or_configuration"],
|
|
171
|
+
create_client: ["webhook_delivery_or_configuration"],
|
|
172
|
+
log_client_activity: ["webhook_delivery_or_configuration"],
|
|
173
|
+
update_client: ["webhook_delivery_or_configuration"],
|
|
174
|
+
create_product: ["webhook_delivery_or_configuration"],
|
|
175
|
+
update_product: ["webhook_delivery_or_configuration"],
|
|
176
|
+
send_invoice: [
|
|
177
|
+
"email_or_invitation",
|
|
178
|
+
"webhook_delivery_or_configuration",
|
|
179
|
+
"fiscal_or_einvoice_submission",
|
|
180
|
+
],
|
|
181
|
+
send_quote: ["email_or_invitation", "webhook_delivery_or_configuration"],
|
|
182
|
+
invite_team_member: ["email_or_invitation"],
|
|
183
|
+
create_webhook: ["webhook_delivery_or_configuration"],
|
|
184
|
+
update_webhook: ["webhook_delivery_or_configuration"],
|
|
185
|
+
delete_webhook: ["webhook_delivery_or_configuration"],
|
|
186
|
+
test_webhook: ["webhook_delivery_or_configuration"],
|
|
187
|
+
send_einvoice: ["fiscal_or_einvoice_submission"],
|
|
188
|
+
face_submit: ["fiscal_or_einvoice_submission"],
|
|
189
|
+
face_status: ["external_provider_read"],
|
|
190
|
+
ticketbai_submit: ["fiscal_or_einvoice_submission"],
|
|
191
|
+
verifactu_resubmit: ["fiscal_or_einvoice_submission"],
|
|
192
|
+
gestoria_message_send: ["email_or_invitation"],
|
|
193
|
+
gestoria_template_bulk_send: ["email_or_invitation"],
|
|
194
|
+
frihet_tax_id_vies_lookup: ["external_provider_read"],
|
|
195
|
+
frihet_portal_domain_add: ["external_provider_configuration"],
|
|
196
|
+
frihet_portal_domain_verify: [
|
|
197
|
+
"external_provider_read",
|
|
198
|
+
"external_provider_configuration",
|
|
199
|
+
],
|
|
200
|
+
frihet_portal_domain_remove: ["external_provider_configuration"],
|
|
201
|
+
refund_sale: ["money_movement"],
|
|
202
|
+
sync_channel: ["channel_sync"],
|
|
203
|
+
};
|
|
204
|
+
function callabilityFor(name) {
|
|
205
|
+
if (UNAVAILABLE.has(name))
|
|
206
|
+
return "unavailable";
|
|
207
|
+
if (DEFERRED.has(name))
|
|
208
|
+
return "deferred";
|
|
209
|
+
if (RUNTIME_CHECKED.has(name))
|
|
210
|
+
return "runtime_checked";
|
|
211
|
+
return "api_dependent";
|
|
212
|
+
}
|
|
213
|
+
export function correctToolAnnotations(name, annotations) {
|
|
214
|
+
const externalInteraction = Object.hasOwn(EXTERNAL_SIDE_EFFECTS, name);
|
|
215
|
+
return {
|
|
216
|
+
...annotations,
|
|
217
|
+
...(WRITE_OVERRIDES.has(name) ? { readOnlyHint: false } : {}),
|
|
218
|
+
...(DESTRUCTIVE_UPDATES.has(name) ? { destructiveHint: true } : {}),
|
|
219
|
+
...(NON_IDEMPOTENT.has(name) ? { idempotentHint: false } : {}),
|
|
220
|
+
...(externalInteraction ? { openWorldHint: true } : {}),
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
export function buildPublicCapabilityTruth(name, annotations) {
|
|
224
|
+
const effects = Object.hasOwn(EXTERNAL_SIDE_EFFECTS, name)
|
|
225
|
+
? EXTERNAL_SIDE_EFFECTS[name]
|
|
226
|
+
: [];
|
|
227
|
+
return {
|
|
228
|
+
registered: true,
|
|
229
|
+
callability: callabilityFor(name),
|
|
230
|
+
canonicalOperation: name,
|
|
231
|
+
writesFrihet: annotations?.readOnlyHint !== true,
|
|
232
|
+
externalInteraction: effects.length > 0,
|
|
233
|
+
externalSideEffects: effects,
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
export function buildLocalDiscoveryCapability(name) {
|
|
237
|
+
return {
|
|
238
|
+
registered: true,
|
|
239
|
+
callability: "local",
|
|
240
|
+
canonicalOperation: name,
|
|
241
|
+
writesFrihet: false,
|
|
242
|
+
externalInteraction: false,
|
|
243
|
+
externalSideEffects: [],
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
/** Must run after grouped exposure (when grouped) and before registration. */
|
|
247
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
248
|
+
export function applyPublicCapabilityTruth(server) {
|
|
249
|
+
const originalRegisterTool = server.registerTool.bind(server);
|
|
250
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
251
|
+
server.registerTool = (name, config, handler) => {
|
|
252
|
+
const annotations = correctToolAnnotations(name, config?.annotations);
|
|
253
|
+
const capability = buildPublicCapabilityTruth(name, annotations);
|
|
254
|
+
config.annotations = annotations;
|
|
255
|
+
config._meta = {
|
|
256
|
+
...(config?._meta ?? {}),
|
|
257
|
+
[CAPABILITY_META_KEY]: capability,
|
|
258
|
+
};
|
|
259
|
+
return originalRegisterTool(name, config, handler);
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
//# sourceMappingURL=capability-truth.js.map
|