@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.
Files changed (87) hide show
  1. package/README.md +106 -348
  2. package/dist/agent-onboarding.d.ts +1 -1
  3. package/dist/agent-onboarding.js +3 -3
  4. package/dist/canary/mcp-harness.d.ts +1 -1
  5. package/dist/canary/mcp-harness.js +4 -1
  6. package/dist/capability-truth.js +20 -12
  7. package/dist/claude-candidate-contract.d.ts +482 -0
  8. package/dist/claude-candidate-contract.js +87 -0
  9. package/dist/claude-output-privacy.d.ts +17 -0
  10. package/dist/claude-output-privacy.js +249 -0
  11. package/dist/claude-profile.d.ts +18 -0
  12. package/dist/claude-profile.js +260 -0
  13. package/dist/client-interface.d.ts +26 -20
  14. package/dist/client.d.ts +65 -29
  15. package/dist/client.js +278 -167
  16. package/dist/demo-client.d.ts +28 -21
  17. package/dist/demo-client.js +32 -14
  18. package/dist/deposit-contract.d.ts +29 -0
  19. package/dist/deposit-contract.js +76 -0
  20. package/dist/fetch-no-redirect.d.ts +3 -0
  21. package/dist/fetch-no-redirect.js +16 -0
  22. package/dist/fiscal-aliases.d.ts +2 -2
  23. package/dist/fiscal-aliases.js +2 -2
  24. package/dist/fiscal-period.d.ts +26 -0
  25. package/dist/fiscal-period.js +31 -0
  26. package/dist/google-profile.d.ts +19 -0
  27. package/dist/google-profile.js +122 -0
  28. package/dist/index.js +31 -7
  29. package/dist/logger.d.ts +1 -1
  30. package/dist/logger.js +2 -2
  31. package/dist/muse-profile.d.ts +19 -0
  32. package/dist/muse-profile.js +122 -0
  33. package/dist/observability.js +3 -2
  34. package/dist/openai-profile.d.ts +2 -2
  35. package/dist/openai-profile.js +37 -11
  36. package/dist/openai-review-contract.d.ts +1 -1
  37. package/dist/openai-review-contract.js +4 -5
  38. package/dist/openai-review-oauth.d.ts +107 -7
  39. package/dist/openai-review-oauth.js +161 -17
  40. package/dist/prompts/register-all.js +32 -78
  41. package/dist/redaction.d.ts +5 -0
  42. package/dist/redaction.js +9 -0
  43. package/dist/resources/register-all.js +150 -54
  44. package/dist/retry-after.d.ts +19 -0
  45. package/dist/retry-after.js +84 -0
  46. package/dist/server-composition.d.ts +6 -2
  47. package/dist/server-composition.js +46 -5
  48. package/dist/tool-exposure.d.ts +7 -5
  49. package/dist/tool-exposure.js +21 -13
  50. package/dist/tools/audit_gl.js +8 -8
  51. package/dist/tools/backend-availability.d.ts +8 -29
  52. package/dist/tools/backend-availability.js +31 -30
  53. package/dist/tools/bank_rules.js +66 -15
  54. package/dist/tools/banking.js +5 -13
  55. package/dist/tools/clients.js +254 -6
  56. package/dist/tools/deposits.js +107 -97
  57. package/dist/tools/einvoice.d.ts +17 -3
  58. package/dist/tools/einvoice.js +59 -12
  59. package/dist/tools/fiscal.d.ts +3 -4
  60. package/dist/tools/fiscal.js +93 -60
  61. package/dist/tools/gestoria.js +15 -7
  62. package/dist/tools/hr.js +41 -11
  63. package/dist/tools/igic.d.ts +9 -8
  64. package/dist/tools/igic.js +34 -64
  65. package/dist/tools/impuesto_sociedades.d.ts +4 -5
  66. package/dist/tools/impuesto_sociedades.js +16 -37
  67. package/dist/tools/intelligence.js +164 -10
  68. package/dist/tools/invoices.js +109 -42
  69. package/dist/tools/kitchen.js +19 -9
  70. package/dist/tools/quotes.js +86 -25
  71. package/dist/tools/recurring.js +26 -25
  72. package/dist/tools/register-all.d.ts +2 -2
  73. package/dist/tools/register-all.js +9 -6
  74. package/dist/tools/search.d.ts +19 -0
  75. package/dist/tools/search.js +84 -0
  76. package/dist/tools/shared.d.ts +18 -38
  77. package/dist/tools/shared.js +96 -30
  78. package/dist/tools/team.js +8 -16
  79. package/dist/tools/time.js +4 -12
  80. package/dist/tools/vendors.js +242 -6
  81. package/dist/types.d.ts +3 -1
  82. package/dist/workflows/daily-operational-brief.d.ts +163 -0
  83. package/dist/workflows/daily-operational-brief.js +881 -0
  84. package/docs/agent-onboarding.json +15 -5
  85. package/package.json +26 -12
  86. package/dist/tools/onboarding.d.ts +0 -19
  87. package/dist/tools/onboarding.js +0 -64
@@ -68,11 +68,11 @@
68
68
  "FRIHET_TOOL_MODE": "grouped"
69
69
  },
70
70
  "counts": {
71
- "toolNames": 162,
72
- "readOnly": 82,
71
+ "toolNames": 161,
72
+ "readOnly": 81,
73
73
  "writesFrihet": 80,
74
- "externalInteraction": 36,
75
- "destructive": 61,
74
+ "externalInteraction": 37,
75
+ "destructive": 60,
76
76
  "resources": 11,
77
77
  "prompts": 10
78
78
  }
@@ -88,7 +88,7 @@
88
88
  {
89
89
  "call": "resources/read frihet://tax/rates",
90
90
  "kind": "read",
91
- "note": "Authoritative IVA / IGIC / IPSI table. Do not recall a rate from memory."
91
+ "note": "Spanish statutory IVA / IGIC / IPSI reference schedule. Do not recall a rate from memory; server validates transaction math."
92
92
  },
93
93
  {
94
94
  "call": "list_clients",
@@ -109,14 +109,17 @@
109
109
  "delete_quote",
110
110
  "delete_recurring_invoice",
111
111
  "delete_time_entry",
112
+ "face_submit",
112
113
  "match_transaction_to_invoice",
113
114
  "period_close",
114
115
  "period_reopen",
115
116
  "refund_deposit",
116
117
  "refund_sale",
117
118
  "remove_team_member",
119
+ "run_recurring_now",
118
120
  "send_invoice",
119
121
  "send_quote",
122
+ "ticketbai_submit",
120
123
  "verifactu_resubmit"
121
124
  ],
122
125
  "externalSideEffects": [
@@ -262,6 +265,13 @@
262
265
  "money_movement"
263
266
  ]
264
267
  },
268
+ {
269
+ "tool": "run_recurring_now",
270
+ "effects": [
271
+ "webhook_delivery_or_configuration",
272
+ "fiscal_or_einvoice_submission"
273
+ ]
274
+ },
265
275
  {
266
276
  "tool": "send_einvoice",
267
277
  "effects": [
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@frihet/mcp-server",
3
- "version": "1.17.0",
4
- "description": "AI-native MCP server for Frihet ERP — 157 canonical operations for invoicing, expenses, CRM, banking, POS and ES/EU fiscal workflows, with conservative capability and side-effect metadata.",
3
+ "version": "2.0.1",
4
+ "description": "AI-native MCP server for Frihet ERP — 156 canonical operations for invoicing, expenses, CRM, banking, POS and ES/EU fiscal workflows, with conservative capability and side-effect metadata.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "bin": {
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "scripts": {
11
11
  "build": "tsc",
12
- "test": "npm run build && node --test dist/__tests__/openai-profile.test.js dist/__tests__/openai-client-tax-id-contract.test.js dist/__tests__/tool-exposure.test.js dist/__tests__/fiscal-aliases.test.js dist/__tests__/einvoice-tools.test.js dist/__tests__/einvoice-day4-tools.test.js dist/__tests__/expenses-tools.test.js dist/__tests__/stay-tools.test.js dist/__tests__/pos-tools.test.js dist/__tests__/kitchen-tools.test.js dist/__tests__/banking-tools.test.js dist/__tests__/banking-client-contract.test.js dist/__tests__/pagination-cursor-param.test.js dist/__tests__/fiscal-tools.test.js dist/__tests__/time-tools.test.js dist/__tests__/recurring-tools.test.js dist/__tests__/team-tools.test.js dist/__tests__/team-tools-real-sdk.test.js dist/__tests__/d4b-hr-payroll-onboarding-tools.test.js dist/__tests__/hr-payroll-period-contract.test.js dist/__tests__/webhook-crm-reviewed-contract.test.js dist/__tests__/audit-server-version.test.js dist/__tests__/openai-full-compose.test.js dist/__tests__/openai-review-descriptor.test.js dist/__tests__/contract.test.js dist/__tests__/observability-redaction.test.js dist/__tests__/security-containment-gate0.test.js dist/__tests__/intelligence-duplicate-invoice.test.js dist/__tests__/get-envelope-unwrap-regression.test.js dist/__tests__/binary-content-types.test.js dist/__tests__/api-error-remediation.test.js dist/__tests__/mutation-unwrap-and-schema-regression.test.js dist/__tests__/schema-envelope-guard.test.js dist/__tests__/paginated-strict-output.test.js dist/__tests__/demo-mode.test.js dist/__tests__/idempotency-key-contract.test.js dist/__tests__/source-header-contract.test.js dist/__tests__/truth-in-descriptions.test.js dist/__tests__/mcp-baseline-mutation.test.js dist/__tests__/forms-elicitation.test.js dist/__tests__/agent-onboarding.test.js scripts/__tests__/openai-worker-review-wire.test.mjs scripts/__tests__/sync-openapi-retry.test.mjs scripts/__tests__/conformance-provenance.test.mjs scripts/__tests__/conformance-phase0.test.mjs scripts/__tests__/published-artifact-drift.test.mjs",
12
+ "test": "npm run build && node --test dist/__tests__/resources-eu-catalog.test.js && node --test dist/__tests__/resources-p1-contract.test.js dist/__tests__/openai-profile.test.js dist/__tests__/openai-client-tax-id-contract.test.js dist/__tests__/tool-exposure.test.js dist/__tests__/fiscal-aliases.test.js dist/__tests__/einvoice-tools.test.js dist/__tests__/einvoice-day4-tools.test.js dist/__tests__/expenses-tools.test.js dist/__tests__/stay-tools.test.js dist/__tests__/pos-tools.test.js dist/__tests__/kitchen-tools.test.js dist/__tests__/banking-tools.test.js dist/__tests__/banking-client-contract.test.js dist/__tests__/pagination-cursor-param.test.js dist/__tests__/fiscal-tools.test.js dist/__tests__/fiscal-period-contract.test.js dist/__tests__/time-tools.test.js dist/__tests__/deposits-tools.test.js dist/__tests__/recurring-tools.test.js dist/__tests__/team-tools.test.js dist/__tests__/team-tools-real-sdk.test.js dist/__tests__/d4b-hr-payroll-onboarding-tools.test.js dist/__tests__/hr-payroll-period-contract.test.js dist/__tests__/webhook-crm-reviewed-contract.test.js dist/__tests__/audit-server-version.test.js dist/__tests__/search-tools.test.js dist/__tests__/openai-full-compose.test.js dist/__tests__/openai-review-descriptor.test.js dist/__tests__/directory-profile-policy.test.js dist/__tests__/claude-profile.test.js dist/__tests__/claude-output-privacy.test.js dist/__tests__/claude-write-route-contract.test.js dist/__tests__/contract.test.js dist/__tests__/observability-redaction.test.js dist/__tests__/security-containment-gate0.test.js dist/__tests__/intelligence-duplicate-invoice.test.js dist/__tests__/get-envelope-unwrap-regression.test.js dist/__tests__/binary-content-types.test.js dist/__tests__/api-error-remediation.test.js dist/__tests__/mutation-unwrap-and-schema-regression.test.js dist/__tests__/schema-envelope-guard.test.js dist/__tests__/paginated-strict-output.test.js dist/__tests__/paginated-metadata-contract.test.js dist/__tests__/demo-mode.test.js dist/__tests__/idempotency-key-contract.test.js dist/__tests__/retry-after-contract.test.js dist/__tests__/source-header-contract.test.js dist/__tests__/no-provisioning-credential-to-public-api.test.js dist/__tests__/truth-in-descriptions.test.js dist/__tests__/mcp-baseline-mutation.test.js dist/__tests__/forms-elicitation.test.js dist/__tests__/agent-onboarding.test.js scripts/__tests__/openai-worker-review-wire.test.mjs scripts/__tests__/sync-openapi-retry.test.mjs scripts/__tests__/conformance-provenance.test.mjs scripts/__tests__/conformance-phase0.test.mjs scripts/__tests__/published-artifact-drift.test.mjs scripts/__tests__/cross-surface-authority.test.mjs scripts/__tests__/release-workflow-contract.test.mjs scripts/__tests__/openai-wrangler-resolution.test.mjs scripts/__tests__/audit-mcp-refs-detector.test.mjs scripts/__tests__/openai-public-surface.test.mjs scripts/__tests__/claude-plugin-package.test.mjs scripts/__tests__/claude-hosted-release.test.mjs scripts/__tests__/claude-hosted-acceptance.test.mjs scripts/__tests__/claude-oauth-provider.test.mjs scripts/__tests__/audit-mcp-refs-published-sot.test.mjs scripts/__tests__/claude-bootstrap-secrets.test.mjs scripts/__tests__/no-public-leak.test.mjs",
13
13
  "canary:mcp": "npm run build && node scripts/canary-mcp.mjs",
14
14
  "canary:mcp:check": "npm run build && node scripts/canary-mcp.mjs --check",
15
15
  "canary:mcp:snapshot": "npm run build && node scripts/canary-mcp.mjs --snapshot",
@@ -24,7 +24,10 @@
24
24
  "test:public-capability-truth": "npm run build && node --test dist/__tests__/public-capability-truth.test.js",
25
25
  "gate:openai-review-descriptor": "npm run build && node scripts/check-openai-review-descriptor.mjs",
26
26
  "generate:openai-submission": "npm run build && node scripts/generate-openai-submission.mjs --write",
27
- "gate:openai-submission": "npm run build && node scripts/generate-openai-submission.mjs --check && node scripts/validate-openai-submission-schema.mjs",
27
+ "gate:openai-submission": "npm run build && node scripts/generate-openai-submission.mjs --check && node scripts/validate-openai-submission-schema.mjs && node --test scripts/__tests__/openai-plugin-package.test.mjs",
28
+ "package:openai-plugin": "npm run gate:openai-submission && python3 scripts/package-openai-plugin.py",
29
+ "check:openai-public-surface": "node scripts/check-openai-public-surface.mjs",
30
+ "test:openai-public-surface": "node --test scripts/__tests__/openai-public-surface.test.mjs",
28
31
  "generate:public-capability-truth": "npm run build && node scripts/generate-public-capability-contract.mjs",
29
32
  "generate:agent-onboarding": "npm run build && node scripts/generate-agent-onboarding.mjs",
30
33
  "gate:agent-onboarding": "npm run build && node scripts/generate-agent-onboarding.mjs --check",
@@ -32,14 +35,21 @@
32
35
  "gate:public-capability-truth": "npm run build && node --test dist/__tests__/public-capability-truth.test.js && node scripts/generate-public-capability-contract.mjs --check",
33
36
  "start": "node dist/index.js",
34
37
  "postinstall": "node scripts/postinstall.js || true",
35
- "prepublishOnly": "node scripts/assert-publish-anchor.mjs && npm run gate:analytics && npm run build && npm run gate:agent-onboarding && npm run gate:public-capability-truth && npm run audit:mcp-refs -- --repo frihet-mcp && npm run gate:no-legacy-region && node scripts/check-no-analytics-emitters.mjs --built",
38
+ "prepublishOnly": "node scripts/assert-publish-anchor.mjs && npm run gate:analytics && npm run build && npm run gate:agent-onboarding && npm run gate:public-capability-truth && npm run audit:mcp-refs -- --repo frihet-mcp && npm run gate:no-legacy-region && node scripts/check-no-analytics-emitters.mjs --built && npm run gate:cross-surface-authority",
36
39
  "audit:mcp-refs": "node scripts/audit-mcp-refs.mjs",
37
40
  "audit:mcp-refs:fix": "node scripts/audit-mcp-refs.mjs --fix",
38
- "gate:no-leak": "bash scripts/no-public-leak.sh",
41
+ "gate:no-leak": "node --test scripts/__tests__/no-public-leak.test.mjs && bash scripts/no-public-leak.sh",
39
42
  "gate:no-legacy-region": "bash scripts/no-legacy-region.sh",
40
43
  "sync:openapi": "node scripts/sync-openapi.mjs",
41
44
  "gate:openapi-fresh": "node scripts/sync-openapi.mjs --check",
42
- "gate:openapi-fresh:live": "node scripts/sync-openapi.mjs --check --live"
45
+ "gate:openapi-fresh:live": "node scripts/sync-openapi.mjs --check --live",
46
+ "gate:cross-surface-authority": "node scripts/cross-surface-authority.mjs",
47
+ "cross-surface-authority:diff": "node scripts/cross-surface-authority.mjs --diff",
48
+ "cross-surface-authority:update": "node scripts/cross-surface-authority.mjs --update",
49
+ "test:cross-surface-authority": "node --test scripts/__tests__/cross-surface-authority.test.mjs",
50
+ "generate:claude-candidate": "npm run build && node scripts/generate-claude-candidate-contract.mjs",
51
+ "gate:claude-candidate": "npm run build && node --test dist/__tests__/claude-profile.test.js && node scripts/generate-claude-candidate-contract.mjs --check",
52
+ "gate:claude-hosted-source": "node scripts/check-claude-hosted-release.mjs --source-only"
43
53
  },
44
54
  "keywords": [
45
55
  "accounting",
@@ -69,7 +79,7 @@
69
79
  "tax-compliance",
70
80
  "gemini-cli",
71
81
  "freelancer",
72
- "small-business",
82
+ "business-management",
73
83
  "business-automation",
74
84
  "verifactu",
75
85
  "webhooks",
@@ -80,7 +90,7 @@
80
90
  "spanish-tax",
81
91
  "e-invoicing"
82
92
  ],
83
- "author": "BRTHLS <viktor@brthls.com>",
93
+ "author": "Frihet <hello@frihet.io>",
84
94
  "license": "MIT",
85
95
  "repository": {
86
96
  "type": "git",
@@ -96,7 +106,7 @@
96
106
  "url": "https://github.com/Frihet-io/frihet-mcp/issues"
97
107
  },
98
108
  "engines": {
99
- "node": ">=20"
109
+ "node": "^22.23.4 || ^24.22.1 || ^26.12.1"
100
110
  },
101
111
  "files": [
102
112
  "dist",
@@ -111,10 +121,14 @@
111
121
  "LICENSE"
112
122
  ],
113
123
  "dependencies": {
114
- "@modelcontextprotocol/sdk": "^1.27.0"
124
+ "@modelcontextprotocol/sdk": "1.31.0"
115
125
  },
116
126
  "overrides": {
117
- "hono": "~4.12.34"
127
+ "hono": ">=4.13.13",
128
+ "ip-address": ">=10.7.3",
129
+ "proxy-addr": ">=2.0.8",
130
+ "qs": ">=6.15.4",
131
+ "@ai-sdk/provider-utils": ">=4.0.33 <5"
118
132
  },
119
133
  "peerDependencies": {
120
134
  "zod": ">=3.25.1"
@@ -1,19 +0,0 @@
1
- /**
2
- * Onboarding tools for the Frihet MCP server — D4-B megasprint (2 tools).
3
- *
4
- * Tools:
5
- * 1. onboarding_status — current workspace onboarding state (completed/pending steps)
6
- * 2. onboarding_persona_set — set workspace persona (autonomo/empresa/agencia/gestoria)
7
- *
8
- * REST surface: /v1/onboarding/status, /v1/onboarding/persona
9
- *
10
- * Persona drives module visibility + default chart-of-accounts + onboarding checklist.
11
- * Persona can only be set once during onboarding; later changes require workspace admin.
12
- *
13
- * NOTE: ERP backend endpoints land in parallel D4-A wave. 404s propagate as isError
14
- * until backend ships.
15
- */
16
- import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
17
- import type { IFrihetClient } from "../client-interface.js";
18
- export declare function registerOnboardingTools(server: McpServer, client: IFrihetClient): void;
19
- //# sourceMappingURL=onboarding.d.ts.map
@@ -1,64 +0,0 @@
1
- /**
2
- * Onboarding tools for the Frihet MCP server — D4-B megasprint (2 tools).
3
- *
4
- * Tools:
5
- * 1. onboarding_status — current workspace onboarding state (completed/pending steps)
6
- * 2. onboarding_persona_set — set workspace persona (autonomo/empresa/agencia/gestoria)
7
- *
8
- * REST surface: /v1/onboarding/status, /v1/onboarding/persona
9
- *
10
- * Persona drives module visibility + default chart-of-accounts + onboarding checklist.
11
- * Persona can only be set once during onboarding; later changes require workspace admin.
12
- *
13
- * NOTE: ERP backend endpoints land in parallel D4-A wave. 404s propagate as isError
14
- * until backend ships.
15
- */
16
- import { z } from "zod/v4";
17
- import { withToolLogging, formatRecord, getContent, mutateContent, READ_ONLY_ANNOTATIONS, UPDATE_ANNOTATIONS, onboardingStatusOutput, onboardingPersonaResultOutput, } from "./shared.js";
18
- import { withBackendGuard } from "./backend-availability.js";
19
- export function registerOnboardingTools(server, client) {
20
- // -- onboarding_status --
21
- server.registerTool("onboarding_status", {
22
- title: "Onboarding Status",
23
- description: "Return the current workspace onboarding state — persona, completed steps, pending steps, " +
24
- "percent complete. Useful to drive in-app guidance, sales follow-up triggers, " +
25
- "and partner program tracking. " +
26
- "/ Devuelve el estado actual del onboarding del workspace (persona, pasos completados/pendientes).",
27
- annotations: READ_ONLY_ANNOTATIONS,
28
- inputSchema: {},
29
- outputSchema: onboardingStatusOutput,
30
- }, async () => withToolLogging("onboarding_status", () => withBackendGuard("onboarding_status", "/v1/onboarding/status", async () => {
31
- const result = await client.getOnboardingStatus();
32
- return {
33
- content: [getContent(formatRecord("Onboarding status", result))],
34
- structuredContent: result,
35
- };
36
- })));
37
- // -- onboarding_persona_set --
38
- server.registerTool("onboarding_persona_set", {
39
- title: "Set Onboarding Persona",
40
- description: "Set the workspace persona. Drives module visibility, default chart-of-accounts, " +
41
- "and onboarding checklist. Personas:\n" +
42
- " - 'autonomo' — self-employed (autonomo Spain)\n" +
43
- " - 'empresa' — small/medium business\n" +
44
- " - 'agencia' — agency / consultancy\n" +
45
- " - 'gestoria' — accounting firm (manages multiple client workspaces)\n" +
46
- "\n" +
47
- "Idempotent: setting the same persona again is a no-op. " +
48
- "/ Define la persona del workspace. Determina modulos visibles, plan contable y checklist.",
49
- annotations: UPDATE_ANNOTATIONS,
50
- inputSchema: {
51
- persona: z
52
- .enum(["autonomo", "empresa", "agencia", "gestoria"])
53
- .describe("Workspace persona / Persona del workspace"),
54
- },
55
- outputSchema: onboardingPersonaResultOutput,
56
- }, async ({ persona }) => withToolLogging("onboarding_persona_set", () => withBackendGuard("onboarding_persona_set", "/v1/onboarding/persona", async () => {
57
- const result = await client.setOnboardingPersona({ persona });
58
- return {
59
- content: [mutateContent(formatRecord("Persona set", result))],
60
- structuredContent: result,
61
- };
62
- })));
63
- }
64
- //# sourceMappingURL=onboarding.js.map