@flexprice/mcp-server 2.0.1 → 2.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.
Files changed (114) hide show
  1. package/bin/mcp-server.js +343 -175
  2. package/bin/mcp-server.js.map +25 -21
  3. package/bun.lock +14 -14
  4. package/esm/funcs/invoicesRecalculateInvoice.d.ts +2 -2
  5. package/esm/funcs/invoicesRecalculateInvoice.js +3 -7
  6. package/esm/funcs/invoicesRecalculateInvoice.js.map +1 -1
  7. package/esm/funcs/invoicesRecalculateInvoiceV2.d.ts +16 -0
  8. package/esm/funcs/invoicesRecalculateInvoiceV2.d.ts.map +1 -0
  9. package/esm/funcs/invoicesRecalculateInvoiceV2.js +91 -0
  10. package/esm/funcs/invoicesRecalculateInvoiceV2.js.map +1 -0
  11. package/esm/landing-page.js +9 -9
  12. package/esm/landing-page.js.map +1 -1
  13. package/esm/lib/config.d.ts +6 -6
  14. package/esm/lib/config.d.ts.map +1 -1
  15. package/esm/lib/config.js +11 -4
  16. package/esm/lib/config.js.map +1 -1
  17. package/esm/lib/sdks.d.ts +1 -1
  18. package/esm/lib/sdks.d.ts.map +1 -1
  19. package/esm/lib/sdks.js +1 -1
  20. package/esm/lib/sdks.js.map +1 -1
  21. package/esm/mcp-server/cli/serve/command.js +1 -1
  22. package/esm/mcp-server/cli/serve/command.js.map +1 -1
  23. package/esm/mcp-server/cli/start/command.js +1 -1
  24. package/esm/mcp-server/cli/start/command.js.map +1 -1
  25. package/esm/mcp-server/flags.d.ts +1 -1
  26. package/esm/mcp-server/flags.d.ts.map +1 -1
  27. package/esm/mcp-server/mcp-server.js +1 -1
  28. package/esm/mcp-server/server.d.ts +1 -1
  29. package/esm/mcp-server/server.d.ts.map +1 -1
  30. package/esm/mcp-server/server.js +3 -1
  31. package/esm/mcp-server/server.js.map +1 -1
  32. package/esm/mcp-server/tools/invoicesRecalculateInvoice.js +2 -2
  33. package/esm/mcp-server/tools/invoicesRecalculateInvoice.js.map +1 -1
  34. package/esm/mcp-server/tools/invoicesRecalculateInvoiceV2.d.ts +7 -0
  35. package/esm/mcp-server/tools/invoicesRecalculateInvoiceV2.d.ts.map +1 -0
  36. package/esm/mcp-server/tools/invoicesRecalculateInvoiceV2.js +34 -0
  37. package/esm/mcp-server/tools/invoicesRecalculateInvoiceV2.js.map +1 -0
  38. package/esm/models/creditgrantexpirydurationunit.d.ts +1 -1
  39. package/esm/models/dtofeatureresponse.d.ts +2 -0
  40. package/esm/models/dtofeatureresponse.d.ts.map +1 -1
  41. package/esm/models/dtofeatureresponse.js +2 -0
  42. package/esm/models/dtofeatureresponse.js.map +1 -1
  43. package/esm/models/dtoinvoiceresponse.d.ts +1 -0
  44. package/esm/models/dtoinvoiceresponse.d.ts.map +1 -1
  45. package/esm/models/dtoinvoiceresponse.js +1 -0
  46. package/esm/models/dtoinvoiceresponse.js.map +1 -1
  47. package/esm/models/dtousageanalyticitem.d.ts +3 -0
  48. package/esm/models/dtousageanalyticitem.d.ts.map +1 -1
  49. package/esm/models/dtousageanalyticitem.js +3 -0
  50. package/esm/models/dtousageanalyticitem.js.map +1 -1
  51. package/esm/models/filtercondition.d.ts +2 -2
  52. package/esm/models/filtercondition.d.ts.map +1 -1
  53. package/esm/models/filtercondition.js +2 -2
  54. package/esm/models/filtercondition.js.map +1 -1
  55. package/esm/models/githubcomflexpriceflexpriceinternaldomainfeaturefeature.d.ts +2 -0
  56. package/esm/models/githubcomflexpriceflexpriceinternaldomainfeaturefeature.d.ts.map +1 -1
  57. package/esm/models/githubcomflexpriceflexpriceinternaldomainfeaturefeature.js +2 -0
  58. package/esm/models/githubcomflexpriceflexpriceinternaldomainfeaturefeature.js.map +1 -1
  59. package/esm/models/meteraggregation.d.ts +1 -0
  60. package/esm/models/meteraggregation.d.ts.map +1 -1
  61. package/esm/models/meteraggregation.js +1 -0
  62. package/esm/models/meteraggregation.js.map +1 -1
  63. package/esm/models/recalculateinvoiceop.d.ts +0 -1
  64. package/esm/models/recalculateinvoiceop.d.ts.map +1 -1
  65. package/esm/models/recalculateinvoiceop.js +0 -1
  66. package/esm/models/recalculateinvoiceop.js.map +1 -1
  67. package/esm/models/recalculateinvoicev2op.d.ts +11 -0
  68. package/esm/models/recalculateinvoicev2op.d.ts.map +1 -0
  69. package/esm/models/recalculateinvoicev2op.js +15 -0
  70. package/esm/models/recalculateinvoicev2op.js.map +1 -0
  71. package/esm/models/reportingunit.d.ts +8 -0
  72. package/esm/models/reportingunit.d.ts.map +1 -0
  73. package/esm/models/reportingunit.js +10 -0
  74. package/esm/models/reportingunit.js.map +1 -0
  75. package/esm/models/value.d.ts +10 -0
  76. package/esm/models/value.d.ts.map +1 -0
  77. package/esm/models/{githubcomflexpriceflexpriceinternaltypesvalue.js → value.js} +2 -2
  78. package/esm/models/value.js.map +1 -0
  79. package/esm/models/windowsize.d.ts +2 -2
  80. package/esm/models/windowsize.js +2 -2
  81. package/esm/models/windowsize.js.map +1 -1
  82. package/esm/tool-names.d.ts.map +1 -1
  83. package/esm/tool-names.js +5 -1
  84. package/esm/tool-names.js.map +1 -1
  85. package/esm/tsconfig.tsbuildinfo +1 -1
  86. package/manifest.json +17 -11
  87. package/package.json +1 -1
  88. package/src/funcs/invoicesRecalculateInvoice.ts +3 -7
  89. package/src/funcs/invoicesRecalculateInvoiceV2.ts +156 -0
  90. package/src/landing-page.ts +9 -9
  91. package/src/lib/config.ts +13 -6
  92. package/src/lib/sdks.ts +1 -1
  93. package/src/mcp-server/cli/serve/command.ts +1 -1
  94. package/src/mcp-server/cli/start/command.ts +1 -1
  95. package/src/mcp-server/flags.ts +1 -1
  96. package/src/mcp-server/mcp-server.ts +1 -1
  97. package/src/mcp-server/server.ts +4 -2
  98. package/src/mcp-server/tools/invoicesRecalculateInvoice.ts +2 -2
  99. package/src/mcp-server/tools/invoicesRecalculateInvoiceV2.ts +42 -0
  100. package/src/models/dtofeatureresponse.ts +3 -0
  101. package/src/models/dtoinvoiceresponse.ts +2 -0
  102. package/src/models/dtousageanalyticitem.ts +5 -0
  103. package/src/models/filtercondition.ts +3 -6
  104. package/src/models/githubcomflexpriceflexpriceinternaldomainfeaturefeature.ts +3 -0
  105. package/src/models/meteraggregation.ts +2 -0
  106. package/src/models/recalculateinvoiceop.ts +1 -7
  107. package/src/models/recalculateinvoicev2op.ts +38 -0
  108. package/src/models/reportingunit.ts +17 -0
  109. package/src/models/{githubcomflexpriceflexpriceinternaltypesvalue.ts → value.ts} +2 -4
  110. package/src/models/windowsize.ts +2 -2
  111. package/src/tool-names.ts +5 -1
  112. package/esm/models/githubcomflexpriceflexpriceinternaltypesvalue.d.ts +0 -10
  113. package/esm/models/githubcomflexpriceflexpriceinternaltypesvalue.d.ts.map +0 -1
  114. package/esm/models/githubcomflexpriceflexpriceinternaltypesvalue.js.map +0 -1
package/manifest.json CHANGED
@@ -10,9 +10,9 @@
10
10
  "server",
11
11
  "flexprice",
12
12
  "api",
13
- "provides"
13
+ "service"
14
14
  ],
15
- "long_description": "Flexprice API: Flexprice API provides billing, metering, and subscription management for SaaS and usage-based products. Use it to manage customers, plans, invoices, payments, usage events, and entitlements. Authenticate with an API key in the x-api-key header.",
15
+ "long_description": "Flexprice API: Flexprice API Service",
16
16
  "manifest_version": "0.3",
17
17
  "name": "@flexprice/mcp-server",
18
18
  "prompts": [],
@@ -24,19 +24,21 @@
24
24
  "args": [
25
25
  "${__dirname}/bin/mcp-server.js",
26
26
  "start",
27
- "--server-url",
28
- "${user_config.server_url}",
27
+ "--server-index",
28
+ "${user_config.server_index}",
29
29
  "--api-key-auth",
30
30
  "${user_config.api_key_auth}"
31
31
  ]
32
32
  }
33
33
  },
34
34
  "user_config": {
35
- "server_url": {
36
- "type": "string",
37
- "title": "Server URL",
38
- "description": "The URL of the server to connect to",
39
- "required": true
35
+ "server_index": {
36
+ "type": "number",
37
+ "title": "Server Index",
38
+ "description": "Available servers: [https://us.api.flexprice.io/v1, https://api.cloud.flexprice.io/v1]",
39
+ "required": false,
40
+ "default": "0",
41
+ "max": 1
40
42
  },
41
43
  "api_key_auth": {
42
44
  "type": "string",
@@ -46,7 +48,7 @@
46
48
  "sensitive": true
47
49
  }
48
50
  },
49
- "version": "2.0.1",
51
+ "version": "2.0.2",
50
52
  "tools": [
51
53
  {
52
54
  "name": "update-customer",
@@ -130,7 +132,11 @@
130
132
  },
131
133
  {
132
134
  "name": "recalculate-invoice",
133
- "description": "Recalculate invoice\n\nUse when subscription or usage data changed and you need to refresh a draft invoice before finalizing. Optional finalize=true to lock after recalc."
135
+ "description": "Recalculate invoice (default: voided invoice)\n\nCreates a fresh replacement invoice for a voided SUBSCRIPTION invoice covering the same billing period. The original voided invoice is linked to the new invoice via recalculated_invoice_id. Can only be called once per voided invoice."
136
+ },
137
+ {
138
+ "name": "recalculate-invoice-v2",
139
+ "description": "Recalculate draft invoice (v2)\n\nRecalculates a draft SUBSCRIPTION invoice in-place (replaces line items, reapplies credits/coupons/taxes). Use when subscription or usage data changed before finalizing."
134
140
  },
135
141
  {
136
142
  "name": "void-invoice",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flexprice/mcp-server",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "author": "flexprice",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -3,7 +3,7 @@
3
3
  */
4
4
 
5
5
  import { FlexpriceCore } from "../core.js";
6
- import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
6
+ import { encodeSimple } from "../lib/encodings.js";
7
7
  import { compactMap } from "../lib/primitives.js";
8
8
  import { safeParse } from "../lib/schemas.js";
9
9
  import { RequestOptions } from "../lib/sdks.js";
@@ -26,10 +26,10 @@ import { APICall, APIPromise } from "../types/async.js";
26
26
  import { Result } from "../types/fp.js";
27
27
 
28
28
  /**
29
- * Recalculate invoice
29
+ * Recalculate invoice (default: voided invoice)
30
30
  *
31
31
  * @remarks
32
- * Use when subscription or usage data changed and you need to refresh a draft invoice before finalizing. Optional finalize=true to lock after recalc.
32
+ * Creates a fresh replacement invoice for a voided SUBSCRIPTION invoice covering the same billing period. The original voided invoice is linked to the new invoice via recalculated_invoice_id. Can only be called once per voided invoice.
33
33
  */
34
34
  export function invoicesRecalculateInvoice(
35
35
  client$: FlexpriceCore,
@@ -93,9 +93,6 @@ async function $do(
93
93
  const path$ = pathToFunc("/invoices/{id}/recalculate")(
94
94
  pathParams$,
95
95
  );
96
- const query$ = encodeFormQuery({
97
- "finalize": payload$.finalize,
98
- });
99
96
 
100
97
  const headers$ = new Headers(compactMap({
101
98
  Accept: "application/json",
@@ -128,7 +125,6 @@ async function $do(
128
125
  baseURL: options?.serverURL,
129
126
  path: path$,
130
127
  headers: headers$,
131
- query: query$,
132
128
  body: body$,
133
129
  userAgent: client$._options.userAgent,
134
130
  timeoutMs: options?.timeoutMs || client$._options.timeoutMs
@@ -0,0 +1,156 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { FlexpriceCore } from "../core.js";
6
+ import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
7
+ import { compactMap } from "../lib/primitives.js";
8
+ import { safeParse } from "../lib/schemas.js";
9
+ import { RequestOptions } from "../lib/sdks.js";
10
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
+ import { pathToFunc } from "../lib/url.js";
12
+ import { APIError } from "../models/errors/apierror.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../models/errors/httpclienterrors.js";
20
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
21
+ import {
22
+ RecalculateInvoiceV2Request,
23
+ RecalculateInvoiceV2Request$zodSchema,
24
+ } from "../models/recalculateinvoicev2op.js";
25
+ import { APICall, APIPromise } from "../types/async.js";
26
+ import { Result } from "../types/fp.js";
27
+
28
+ /**
29
+ * Recalculate draft invoice (v2)
30
+ *
31
+ * @remarks
32
+ * Recalculates a draft SUBSCRIPTION invoice in-place (replaces line items, reapplies credits/coupons/taxes). Use when subscription or usage data changed before finalizing.
33
+ */
34
+ export function invoicesRecalculateInvoiceV2(
35
+ client$: FlexpriceCore,
36
+ request: RecalculateInvoiceV2Request,
37
+ options?: RequestOptions,
38
+ ): APIPromise<
39
+ Result<
40
+ Response,
41
+ | APIError
42
+ | SDKValidationError
43
+ | UnexpectedClientError
44
+ | InvalidRequestError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | ConnectionError
48
+ >
49
+ > {
50
+ return new APIPromise($do(
51
+ client$,
52
+ request,
53
+ options,
54
+ ));
55
+ }
56
+
57
+ async function $do(
58
+ client$: FlexpriceCore,
59
+ request: RecalculateInvoiceV2Request,
60
+ options?: RequestOptions,
61
+ ): Promise<
62
+ [
63
+ Result<
64
+ Response,
65
+ | APIError
66
+ | SDKValidationError
67
+ | UnexpectedClientError
68
+ | InvalidRequestError
69
+ | RequestAbortedError
70
+ | RequestTimeoutError
71
+ | ConnectionError
72
+ >,
73
+ APICall,
74
+ ]
75
+ > {
76
+ const parsed$ = safeParse(
77
+ request,
78
+ (value$) => RecalculateInvoiceV2Request$zodSchema.parse(value$),
79
+ "Input validation failed",
80
+ );
81
+ if (!parsed$.ok) {
82
+ return [parsed$, { status: "invalid" }];
83
+ }
84
+ const payload$ = parsed$.value;
85
+ const body$ = null;
86
+
87
+ const pathParams$ = {
88
+ id: encodeSimple("id", payload$.id, {
89
+ explode: false,
90
+ charEncoding: "percent",
91
+ }),
92
+ };
93
+ const path$ = pathToFunc("/invoices/{id}/recalculate-v2")(
94
+ pathParams$,
95
+ );
96
+ const query$ = encodeFormQuery({
97
+ "finalize": payload$.finalize,
98
+ });
99
+
100
+ const headers$ = new Headers(compactMap({
101
+ Accept: "application/json",
102
+ }));
103
+ const securityInput = await extractSecurity(client$._options.security);
104
+ const requestSecurity = resolveGlobalSecurity(securityInput);
105
+
106
+ const context = {
107
+ options: client$._options,
108
+ baseURL: options?.serverURL ?? client$._baseURL ?? "",
109
+ operationID: "recalculateInvoiceV2",
110
+ oAuth2Scopes: null,
111
+ resolvedSecurity: requestSecurity,
112
+ securitySource: client$._options.security,
113
+ retryConfig: options?.retries
114
+ || client$._options.retryConfig
115
+ || { strategy: "none" },
116
+ retryCodes: options?.retryCodes || [
117
+ "429",
118
+ "500",
119
+ "502",
120
+ "503",
121
+ "504",
122
+ ],
123
+ };
124
+
125
+ const requestRes = client$._createRequest(context, {
126
+ security: requestSecurity,
127
+ method: "POST",
128
+ baseURL: options?.serverURL,
129
+ path: path$,
130
+ headers: headers$,
131
+ query: query$,
132
+ body: body$,
133
+ userAgent: client$._options.userAgent,
134
+ timeoutMs: options?.timeoutMs || client$._options.timeoutMs
135
+ || -1,
136
+ }, options);
137
+ if (!requestRes.ok) {
138
+ return [requestRes, { status: "invalid" }];
139
+ }
140
+ const req$ = requestRes.value;
141
+
142
+ const doResult = await client$._do(req$, {
143
+ context,
144
+ errorCodes: [],
145
+ retryConfig: context.retryConfig,
146
+ retryCodes: context.retryCodes,
147
+ });
148
+ if (!doResult.ok) {
149
+ return [doResult, { status: "request-error", request: req$ }];
150
+ }
151
+ return [doResult, {
152
+ status: "complete",
153
+ "request": req$,
154
+ response: doResult.value,
155
+ }];
156
+ }
@@ -31,18 +31,18 @@ export function landingPageHTML(origin: string): string {
31
31
  "mcp-remote@0.1.25",
32
32
  `${o}/sse`,
33
33
  "--header",
34
- "server-url:${SERVER_URL}",
34
+ "server-index:${SERVER_INDEX}",
35
35
  "--header",
36
36
  "api-key-auth:${API_KEY_AUTH}",
37
37
  ],
38
38
  "env": {
39
- "SERVER_URL": "YOUR_VALUE_HERE",
39
+ "SERVER_INDEX": "YOUR_VALUE_HERE",
40
40
  "API_KEY_AUTH": "YOUR_VALUE_HERE",
41
41
  },
42
42
  };
43
43
  const codexConfig = `[mcp_servers.Flexprice]
44
44
  url = "${o}/sse"
45
- http_headers = { "server-url" = "YOUR_SERVER_URL", "api-key-auth" = "YOUR_API_KEY_AUTH" }`;
45
+ http_headers = { "server-index" = "YOUR_SERVER_INDEX", "api-key-auth" = "YOUR_API_KEY_AUTH" }`;
46
46
 
47
47
  return `
48
48
  <!DOCTYPE html>
@@ -680,7 +680,7 @@ http_headers = { "server-url" = "YOUR_SERVER_URL", "api-key-auth" = "YOUR_API_KE
680
680
  </svg>
681
681
  </button>
682
682
  <div class="popover-menu hidden" id="popover-menu">
683
- <a class="popover-button install-link" href="cursor://anysphere.cursor-deeplink/mcp/install?name=Flexprice&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyJAZmxleHByaWNlL21jcC1zZXJ2ZXIiLCJzdGFydCIsIi0tc2VydmVyLXVybCIsIiIsIi0tYXBpLWtleS1hdXRoIiwiIl19">
683
+ <a class="popover-button install-link" href="cursor://anysphere.cursor-deeplink/mcp/install?name=Flexprice&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyJAZmxleHByaWNlL21jcC1zZXJ2ZXIiLCJzdGFydCIsIi0tc2VydmVyLWluZGV4IiwiMCIsIi0tYXBpLWtleS1hdXRoIiwiIl19">
684
684
  Cursor
685
685
  </a>
686
686
  <button class="popover-button" onclick="showModal('claude-code')">
@@ -689,7 +689,7 @@ http_headers = { "server-url" = "YOUR_SERVER_URL", "api-key-auth" = "YOUR_API_KE
689
689
  <button class="popover-button" onclick="showModal('claude-desktop')">
690
690
  Claude Desktop
691
691
  </button>
692
- <a class="popover-button install-link" href="vscode://ms-vscode.vscode-mcp/install?name=Flexprice&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyJAZmxleHByaWNlL21jcC1zZXJ2ZXIiLCJzdGFydCIsIi0tc2VydmVyLXVybCIsIiIsIi0tYXBpLWtleS1hdXRoIiwiIl19">
692
+ <a class="popover-button install-link" href="vscode://ms-vscode.vscode-mcp/install?name=Flexprice&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyJAZmxleHByaWNlL21jcC1zZXJ2ZXIiLCJzdGFydCIsIi0tc2VydmVyLWluZGV4IiwiMCIsIi0tYXBpLWtleS1hdXRoIiwiIl19">
693
693
  VS Code
694
694
  </a>
695
695
  <button class="popover-button" onclick="showModal('gemini')">
@@ -712,7 +712,7 @@ http_headers = { "server-url" = "YOUR_SERVER_URL", "api-key-auth" = "YOUR_API_KE
712
712
  </div>
713
713
  </header>
714
714
  <div class="install-targets">
715
- <a tabindex="0" class="card install-target install-link" href="cursor://anysphere.cursor-deeplink/mcp/install?name=Flexprice&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyJAZmxleHByaWNlL21jcC1zZXJ2ZXIiLCJzdGFydCIsIi0tc2VydmVyLXVybCIsIiIsIi0tYXBpLWtleS1hdXRoIiwiIl19">
715
+ <a tabindex="0" class="card install-target install-link" href="cursor://anysphere.cursor-deeplink/mcp/install?name=Flexprice&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyJAZmxleHByaWNlL21jcC1zZXJ2ZXIiLCJzdGFydCIsIi0tc2VydmVyLWluZGV4IiwiMCIsIi0tYXBpLWtleS1hdXRoIiwiIl19">
716
716
  <div class="target">
717
717
  <img src="https://cursor.com/assets/images/logo.svg" alt="Cursor">
718
718
  <span>Cursor</span>
@@ -734,7 +734,7 @@ http_headers = { "server-url" = "YOUR_SERVER_URL", "api-key-auth" = "YOUR_API_KE
734
734
  <span>Claude Desktop</span>
735
735
  </div>
736
736
  </div>
737
- <a tabindex="0" class="card install-target install-link" href="vscode://ms-vscode.vscode-mcp/install?name=Flexprice&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyJAZmxleHByaWNlL21jcC1zZXJ2ZXIiLCJzdGFydCIsIi0tc2VydmVyLXVybCIsIiIsIi0tYXBpLWtleS1hdXRoIiwiIl19">
737
+ <a tabindex="0" class="card install-target install-link" href="vscode://ms-vscode.vscode-mcp/install?name=Flexprice&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyJAZmxleHByaWNlL21jcC1zZXJ2ZXIiLCJzdGFydCIsIi0tc2VydmVyLWluZGV4IiwiMCIsIi0tYXBpLWtleS1hdXRoIiwiIl19">
738
738
  <div class="target">
739
739
  <svg width="100" height="100" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
740
740
  <mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="100" height="100">
@@ -913,7 +913,7 @@ http_headers = { "server-url" = "YOUR_SERVER_URL", "api-key-auth" = "YOUR_API_KE
913
913
  <path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path>
914
914
  </svg>
915
915
  </button>
916
- <code class="code-snippet language-json" id="claude-cli-cmd">claude mcp add Flexprice -- npx -y @flexprice/mcp-server start --server-url --api-key-auth </code>
916
+ <code class="code-snippet language-json" id="claude-cli-cmd">claude mcp add Flexprice -- npx -y @flexprice/mcp-server start --server-index 0 --api-key-auth </code>
917
917
  </div>
918
918
  </div>
919
919
  </div>
@@ -964,7 +964,7 @@ http_headers = { "server-url" = "YOUR_SERVER_URL", "api-key-auth" = "YOUR_API_KE
964
964
  <path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path>
965
965
  </svg>
966
966
  </button>
967
- <code class="code-snippet language-json" id="gemini-config">gemini mcp add Flexprice -- npx -y @flexprice/mcp-server start --server-url --api-key-auth </code>
967
+ <code class="code-snippet language-json" id="gemini-config">gemini mcp add Flexprice -- npx -y @flexprice/mcp-server start --server-index 0 --api-key-auth </code>
968
968
  </div>
969
969
  </div>
970
970
  </div>
package/src/lib/config.ts CHANGED
@@ -12,7 +12,14 @@ import { Params, pathToFunc } from "./url.js";
12
12
  * Contains the list of servers available to the SDK
13
13
  */
14
14
  export const ServerList = [
15
- "/v1",
15
+ /**
16
+ * US Region
17
+ */
18
+ "https://us.api.flexprice.io/v1",
19
+ /**
20
+ * India Region
21
+ */
22
+ "https://api.cloud.flexprice.io/v1",
16
23
  ] as const;
17
24
 
18
25
  export type SDKOptions = {
@@ -27,9 +34,9 @@ export type SDKOptions = {
27
34
  */
28
35
  serverIdx?: number | undefined;
29
36
  /**
30
- * Specifies the server URL to be used by the SDK
37
+ * Allows overriding the default server URL used by the SDK
31
38
  */
32
- serverURL: string;
39
+ serverURL?: string | undefined;
33
40
  /**
34
41
  * Allows overriding the default user agent used by the SDK
35
42
  */
@@ -62,8 +69,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
62
69
  export const SDK_METADATA = {
63
70
  language: "typescript",
64
71
  openapiDocVersion: "1.0",
65
- sdkVersion: "2.0.1",
66
- genVersion: "2.845.12",
72
+ sdkVersion: "2.0.2",
73
+ genVersion: "2.852.1",
67
74
  userAgent:
68
- "speakeasy-sdk/mcp-typescript 2.0.1 2.845.12 1.0 @flexprice/mcp-server",
75
+ "speakeasy-sdk/mcp-typescript 2.0.2 2.852.1 1.0 @flexprice/mcp-server",
69
76
  } as const;
package/src/lib/sdks.ts CHANGED
@@ -84,7 +84,7 @@ export class ClientSDK {
84
84
  public readonly _baseURL: URL | null;
85
85
  public readonly _options: SDKOptions & { hooks?: SDKHooks };
86
86
 
87
- constructor(options: SDKOptions) {
87
+ constructor(options: SDKOptions = {}) {
88
88
  const opt = options as unknown;
89
89
  if (
90
90
  typeof opt === "object"
@@ -54,7 +54,7 @@ export const serveCommand = buildCommand({
54
54
  "server-url": {
55
55
  kind: "parsed",
56
56
  brief: "Overrides the default server URL used by the SDK",
57
- optional: false,
57
+ optional: true,
58
58
  parse: (value) => new URL(value).toString(),
59
59
  },
60
60
  "server-index": {
@@ -54,7 +54,7 @@ export const startCommand = buildCommand({
54
54
  "server-url": {
55
55
  kind: "parsed",
56
56
  brief: "Overrides the default server URL used by the SDK",
57
- optional: false,
57
+ optional: true,
58
58
  parse: (value) => new URL(value).toString(),
59
59
  },
60
60
  "server-index": {
@@ -12,6 +12,6 @@ export interface MCPServerFlags {
12
12
  readonly tool?: string[];
13
13
  readonly mode?: "dynamic" | undefined;
14
14
  readonly "api-key-auth"?: string | undefined;
15
- readonly "server-url": string;
15
+ readonly "server-url"?: string | undefined;
16
16
  readonly "server-index"?: SDKOptions["serverIdx"];
17
17
  }
@@ -21,7 +21,7 @@ const routes = buildRouteMap({
21
21
  export const app = buildApplication(routes, {
22
22
  name: "mcp",
23
23
  versionInfo: {
24
- currentVersion: "2.0.1",
24
+ currentVersion: "2.0.2",
25
25
  },
26
26
  });
27
27
 
@@ -39,6 +39,7 @@ import { tool$invoicesGetInvoicePdf } from "./tools/invoicesGetInvoicePdf.js";
39
39
  import { tool$invoicesGetInvoicePreview } from "./tools/invoicesGetInvoicePreview.js";
40
40
  import { tool$invoicesQueryInvoice } from "./tools/invoicesQueryInvoice.js";
41
41
  import { tool$invoicesRecalculateInvoice } from "./tools/invoicesRecalculateInvoice.js";
42
+ import { tool$invoicesRecalculateInvoiceV2 } from "./tools/invoicesRecalculateInvoiceV2.js";
42
43
  import { tool$invoicesTriggerInvoiceCommsWebhook } from "./tools/invoicesTriggerInvoiceCommsWebhook.js";
43
44
  import { tool$invoicesUpdateInvoice } from "./tools/invoicesUpdateInvoice.js";
44
45
  import { tool$invoicesUpdateInvoicePaymentStatus } from "./tools/invoicesUpdateInvoicePaymentStatus.js";
@@ -64,13 +65,13 @@ export function createMCPServer(deps: {
64
65
  dynamic?: boolean | undefined;
65
66
  scopes?: MCPScope[] | undefined;
66
67
  getSDK?: () => FlexpriceCore;
67
- serverURL: string;
68
+ serverURL?: string | undefined;
68
69
  security?: SDKOptions["security"] | undefined;
69
70
  serverIdx?: SDKOptions["serverIdx"] | undefined;
70
71
  }) {
71
72
  const server = new McpServer({
72
73
  name: "Flexprice",
73
- version: "2.0.1",
74
+ version: "2.0.2",
74
75
  });
75
76
 
76
77
  const getClient = deps.getSDK || (() =>
@@ -135,6 +136,7 @@ export function createMCPServer(deps: {
135
136
  tool(tool$invoicesAttemptInvoicePayment);
136
137
  tool(tool$invoicesGetInvoicePdf);
137
138
  tool(tool$invoicesRecalculateInvoice);
139
+ tool(tool$invoicesRecalculateInvoiceV2);
138
140
  tool(tool$invoicesVoidInvoice);
139
141
  tool(tool$eventsIngestEvent);
140
142
  tool(tool$eventsGetUsageAnalytics);
@@ -12,9 +12,9 @@ const args = {
12
12
 
13
13
  export const tool$invoicesRecalculateInvoice: ToolDefinition<typeof args> = {
14
14
  name: "recalculate-invoice",
15
- description: `Recalculate invoice
15
+ description: `Recalculate invoice (default: voided invoice)
16
16
 
17
- Use when subscription or usage data changed and you need to refresh a draft invoice before finalizing. Optional finalize=true to lock after recalc.`,
17
+ Creates a fresh replacement invoice for a voided SUBSCRIPTION invoice covering the same billing period. The original voided invoice is linked to the new invoice via recalculated_invoice_id. Can only be called once per voided invoice.`,
18
18
  annotations: {
19
19
  "title": "",
20
20
  "destructiveHint": false,
@@ -0,0 +1,42 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { invoicesRecalculateInvoiceV2 } from "../../funcs/invoicesRecalculateInvoiceV2.js";
6
+ import { RecalculateInvoiceV2Request$zodSchema } from "../../models/recalculateinvoicev2op.js";
7
+ import { formatResult, ToolDefinition } from "../tools.js";
8
+
9
+ const args = {
10
+ request: RecalculateInvoiceV2Request$zodSchema,
11
+ };
12
+
13
+ export const tool$invoicesRecalculateInvoiceV2: ToolDefinition<typeof args> = {
14
+ name: "recalculate-invoice-v2",
15
+ description: `Recalculate draft invoice (v2)
16
+
17
+ Recalculates a draft SUBSCRIPTION invoice in-place (replaces line items, reapplies credits/coupons/taxes). Use when subscription or usage data changed before finalizing.`,
18
+ annotations: {
19
+ "title": "",
20
+ "destructiveHint": false,
21
+ "idempotentHint": false,
22
+ "openWorldHint": false,
23
+ "readOnlyHint": false,
24
+ },
25
+ args,
26
+ tool: async (client, args, ctx) => {
27
+ const [result] = await invoicesRecalculateInvoiceV2(
28
+ client,
29
+ args.request,
30
+ { fetchOptions: { signal: ctx.signal } },
31
+ ).$inspect();
32
+
33
+ if (!result.ok) {
34
+ return {
35
+ content: [{ type: "text", text: result.error.message }],
36
+ isError: true,
37
+ };
38
+ }
39
+
40
+ return formatResult(result.value);
41
+ },
42
+ };
@@ -9,6 +9,7 @@ import {
9
9
  DtoMeterResponse$zodSchema,
10
10
  } from "./dtometerresponse.js";
11
11
  import { FeatureType, FeatureType$zodSchema } from "./featuretype.js";
12
+ import { ReportingUnit, ReportingUnit$zodSchema } from "./reportingunit.js";
12
13
  import { Status, Status$zodSchema } from "./status.js";
13
14
 
14
15
  export type DtoFeatureResponse = {
@@ -23,6 +24,7 @@ export type DtoFeatureResponse = {
23
24
  meter?: DtoMeterResponse | undefined;
24
25
  meter_id?: string | undefined;
25
26
  name?: string | undefined;
27
+ reporting_unit?: ReportingUnit | undefined;
26
28
  status?: Status | undefined;
27
29
  tenant_id?: string | undefined;
28
30
  type?: FeatureType | undefined;
@@ -45,6 +47,7 @@ export const DtoFeatureResponse$zodSchema: z.ZodType<DtoFeatureResponse> = z
45
47
  meter: DtoMeterResponse$zodSchema.optional(),
46
48
  meter_id: z.string().optional(),
47
49
  name: z.string().optional(),
50
+ reporting_unit: ReportingUnit$zodSchema.optional(),
48
51
  status: Status$zodSchema.optional(),
49
52
  tenant_id: z.string().optional(),
50
53
  type: FeatureType$zodSchema.optional(),
@@ -59,6 +59,7 @@ export type DtoInvoiceResponse = {
59
59
  payment_status?: PaymentStatus | undefined;
60
60
  period_end?: string | undefined;
61
61
  period_start?: string | undefined;
62
+ recalculated_invoice_id?: string | undefined;
62
63
  refunded_amount?: string | undefined;
63
64
  status?: Status | undefined;
64
65
  subscription?: DtoSubscriptionResponse | undefined;
@@ -109,6 +110,7 @@ export const DtoInvoiceResponse$zodSchema: z.ZodType<DtoInvoiceResponse> = z
109
110
  payment_status: PaymentStatus$zodSchema.optional(),
110
111
  period_end: z.string().optional(),
111
112
  period_start: z.string().optional(),
113
+ recalculated_invoice_id: z.string().optional(),
112
114
  refunded_amount: z.string().optional(),
113
115
  status: Status$zodSchema.optional(),
114
116
  subscription: z.lazy(() => DtoSubscriptionResponse$zodSchema).optional(),
@@ -29,6 +29,7 @@ import {
29
29
  GithubComFlexpriceFlexpriceInternalDomainPlanPlan$zodSchema,
30
30
  } from "./githubcomflexpriceflexpriceinternaldomainplanplan.js";
31
31
  import { MeterMeter, MeterMeter$zodSchema } from "./metermeter.js";
32
+ import { ReportingUnit, ReportingUnit$zodSchema } from "./reportingunit.js";
32
33
  import {
33
34
  SubscriptionSubscriptionLineItem,
34
35
  SubscriptionSubscriptionLineItem$zodSchema,
@@ -54,6 +55,7 @@ export type DtoUsageAnalyticItem = {
54
55
  price?: DtoPriceResponse | undefined;
55
56
  price_id?: string | undefined;
56
57
  properties?: { [k: string]: string } | undefined;
58
+ reporting_unit?: ReportingUnit | undefined;
57
59
  source?: string | undefined;
58
60
  sources?: Array<string> | undefined;
59
61
  sub_line_item_id?: string | undefined;
@@ -61,6 +63,7 @@ export type DtoUsageAnalyticItem = {
61
63
  subscription_line_item?: SubscriptionSubscriptionLineItem | undefined;
62
64
  total_cost?: string | undefined;
63
65
  total_usage?: string | undefined;
66
+ total_usage_display?: string | undefined;
64
67
  unit?: string | undefined;
65
68
  unit_plural?: string | undefined;
66
69
  window_size?: WindowSize | undefined;
@@ -89,6 +92,7 @@ export const DtoUsageAnalyticItem$zodSchema: z.ZodType<DtoUsageAnalyticItem> = z
89
92
  price: DtoPriceResponse$zodSchema.optional(),
90
93
  price_id: z.string().optional(),
91
94
  properties: z.record(z.string(), z.string()).optional(),
95
+ reporting_unit: ReportingUnit$zodSchema.optional(),
92
96
  source: z.string().optional(),
93
97
  sources: z.array(z.string()).optional(),
94
98
  sub_line_item_id: z.string().optional(),
@@ -97,6 +101,7 @@ export const DtoUsageAnalyticItem$zodSchema: z.ZodType<DtoUsageAnalyticItem> = z
97
101
  .optional(),
98
102
  total_cost: z.string().optional(),
99
103
  total_usage: z.string().optional(),
104
+ total_usage_display: z.string().optional(),
100
105
  unit: z.string().optional(),
101
106
  unit_plural: z.string().optional(),
102
107
  window_size: WindowSize$zodSchema.optional(),
@@ -8,21 +8,18 @@ import {
8
8
  FilterOperatorType,
9
9
  FilterOperatorType$zodSchema,
10
10
  } from "./filteroperatortype.js";
11
- import {
12
- GithubComFlexpriceFlexpriceInternalTypesValue,
13
- GithubComFlexpriceFlexpriceInternalTypesValue$zodSchema,
14
- } from "./githubcomflexpriceflexpriceinternaltypesvalue.js";
11
+ import { Value, Value$zodSchema } from "./value.js";
15
12
 
16
13
  export type FilterCondition = {
17
14
  data_type?: DataType | undefined;
18
15
  field?: string | undefined;
19
16
  operator?: FilterOperatorType | undefined;
20
- value?: GithubComFlexpriceFlexpriceInternalTypesValue | undefined;
17
+ value?: Value | undefined;
21
18
  };
22
19
 
23
20
  export const FilterCondition$zodSchema: z.ZodType<FilterCondition> = z.object({
24
21
  data_type: DataType$zodSchema.optional(),
25
22
  field: z.string().optional(),
26
23
  operator: FilterOperatorType$zodSchema.optional(),
27
- value: GithubComFlexpriceFlexpriceInternalTypesValue$zodSchema.optional(),
24
+ value: Value$zodSchema.optional(),
28
25
  });
@@ -5,6 +5,7 @@
5
5
  import * as z from "zod";
6
6
  import { AlertSettings, AlertSettings$zodSchema } from "./alertsettings.js";
7
7
  import { FeatureType, FeatureType$zodSchema } from "./featuretype.js";
8
+ import { ReportingUnit, ReportingUnit$zodSchema } from "./reportingunit.js";
8
9
  import { Status, Status$zodSchema } from "./status.js";
9
10
 
10
11
  export type GithubComFlexpriceFlexpriceInternalDomainFeatureFeature = {
@@ -18,6 +19,7 @@ export type GithubComFlexpriceFlexpriceInternalDomainFeatureFeature = {
18
19
  metadata?: { [k: string]: string } | undefined;
19
20
  meter_id?: string | undefined;
20
21
  name?: string | undefined;
22
+ reporting_unit?: ReportingUnit | undefined;
21
23
  status?: Status | undefined;
22
24
  tenant_id?: string | undefined;
23
25
  type?: FeatureType | undefined;
@@ -40,6 +42,7 @@ export const GithubComFlexpriceFlexpriceInternalDomainFeatureFeature$zodSchema:
40
42
  metadata: z.record(z.string(), z.string()).optional(),
41
43
  meter_id: z.string().optional(),
42
44
  name: z.string().optional(),
45
+ reporting_unit: ReportingUnit$zodSchema.optional(),
43
46
  status: Status$zodSchema.optional(),
44
47
  tenant_id: z.string().optional(),
45
48
  type: FeatureType$zodSchema.optional(),