@baref00t/mcp-server 0.2.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.
Files changed (187) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +109 -0
  3. package/dist/auth.d.ts +28 -0
  4. package/dist/auth.d.ts.map +1 -0
  5. package/dist/auth.js +58 -0
  6. package/dist/auth.js.map +1 -0
  7. package/dist/config.d.ts +33 -0
  8. package/dist/config.d.ts.map +1 -0
  9. package/dist/config.js +124 -0
  10. package/dist/config.js.map +1 -0
  11. package/dist/env.d.ts +41 -0
  12. package/dist/env.d.ts.map +1 -0
  13. package/dist/env.js +37 -0
  14. package/dist/env.js.map +1 -0
  15. package/dist/logger.d.ts +3 -0
  16. package/dist/logger.d.ts.map +1 -0
  17. package/dist/logger.js +31 -0
  18. package/dist/logger.js.map +1 -0
  19. package/dist/registry.d.ts +58 -0
  20. package/dist/registry.d.ts.map +1 -0
  21. package/dist/registry.js +94 -0
  22. package/dist/registry.js.map +1 -0
  23. package/dist/sdkCache.d.ts +20 -0
  24. package/dist/sdkCache.d.ts.map +1 -0
  25. package/dist/sdkCache.js +65 -0
  26. package/dist/sdkCache.js.map +1 -0
  27. package/dist/server.d.ts +25 -0
  28. package/dist/server.d.ts.map +1 -0
  29. package/dist/server.js +144 -0
  30. package/dist/server.js.map +1 -0
  31. package/dist/telemetry.d.ts +8 -0
  32. package/dist/telemetry.d.ts.map +1 -0
  33. package/dist/telemetry.js +32 -0
  34. package/dist/telemetry.js.map +1 -0
  35. package/dist/tools/distributor/getUsage.d.ts +12 -0
  36. package/dist/tools/distributor/getUsage.d.ts.map +1 -0
  37. package/dist/tools/distributor/getUsage.js +25 -0
  38. package/dist/tools/distributor/getUsage.js.map +1 -0
  39. package/dist/tools/distributor/listPartners.d.ts +12 -0
  40. package/dist/tools/distributor/listPartners.d.ts.map +1 -0
  41. package/dist/tools/distributor/listPartners.js +20 -0
  42. package/dist/tools/distributor/listPartners.js.map +1 -0
  43. package/dist/tools/index.d.ts +8 -0
  44. package/dist/tools/index.d.ts.map +1 -0
  45. package/dist/tools/index.js +102 -0
  46. package/dist/tools/index.js.map +1 -0
  47. package/dist/tools/partner/createCustomer.d.ts +27 -0
  48. package/dist/tools/partner/createCustomer.d.ts.map +1 -0
  49. package/dist/tools/partner/createCustomer.js +29 -0
  50. package/dist/tools/partner/createCustomer.js.map +1 -0
  51. package/dist/tools/partner/createKey.d.ts +6 -0
  52. package/dist/tools/partner/createKey.d.ts.map +1 -0
  53. package/dist/tools/partner/createKey.js +18 -0
  54. package/dist/tools/partner/createKey.js.map +1 -0
  55. package/dist/tools/partner/createWebhook.d.ts +18 -0
  56. package/dist/tools/partner/createWebhook.d.ts.map +1 -0
  57. package/dist/tools/partner/createWebhook.js +36 -0
  58. package/dist/tools/partner/createWebhook.js.map +1 -0
  59. package/dist/tools/partner/deleteWebhook.d.ts +12 -0
  60. package/dist/tools/partner/deleteWebhook.d.ts.map +1 -0
  61. package/dist/tools/partner/deleteWebhook.js +25 -0
  62. package/dist/tools/partner/deleteWebhook.js.map +1 -0
  63. package/dist/tools/partner/getAssessment.d.ts +12 -0
  64. package/dist/tools/partner/getAssessment.d.ts.map +1 -0
  65. package/dist/tools/partner/getAssessment.js +20 -0
  66. package/dist/tools/partner/getAssessment.js.map +1 -0
  67. package/dist/tools/partner/getAssessmentReport.d.ts +12 -0
  68. package/dist/tools/partner/getAssessmentReport.d.ts.map +1 -0
  69. package/dist/tools/partner/getAssessmentReport.js +28 -0
  70. package/dist/tools/partner/getAssessmentReport.js.map +1 -0
  71. package/dist/tools/partner/getAssessmentStatus.d.ts +12 -0
  72. package/dist/tools/partner/getAssessmentStatus.d.ts.map +1 -0
  73. package/dist/tools/partner/getAssessmentStatus.js +21 -0
  74. package/dist/tools/partner/getAssessmentStatus.js.map +1 -0
  75. package/dist/tools/partner/getBilling.d.ts +6 -0
  76. package/dist/tools/partner/getBilling.d.ts.map +1 -0
  77. package/dist/tools/partner/getBilling.js +20 -0
  78. package/dist/tools/partner/getBilling.js.map +1 -0
  79. package/dist/tools/partner/getBranding.d.ts +6 -0
  80. package/dist/tools/partner/getBranding.d.ts.map +1 -0
  81. package/dist/tools/partner/getBranding.js +18 -0
  82. package/dist/tools/partner/getBranding.js.map +1 -0
  83. package/dist/tools/partner/getConsentUrl.d.ts +18 -0
  84. package/dist/tools/partner/getConsentUrl.d.ts.map +1 -0
  85. package/dist/tools/partner/getConsentUrl.js +43 -0
  86. package/dist/tools/partner/getConsentUrl.js.map +1 -0
  87. package/dist/tools/partner/getCustomer.d.ts +12 -0
  88. package/dist/tools/partner/getCustomer.d.ts.map +1 -0
  89. package/dist/tools/partner/getCustomer.js +20 -0
  90. package/dist/tools/partner/getCustomer.js.map +1 -0
  91. package/dist/tools/partner/getPaymentPortalUrl.d.ts +6 -0
  92. package/dist/tools/partner/getPaymentPortalUrl.d.ts.map +1 -0
  93. package/dist/tools/partner/getPaymentPortalUrl.js +19 -0
  94. package/dist/tools/partner/getPaymentPortalUrl.js.map +1 -0
  95. package/dist/tools/partner/getPlanBilling.d.ts +6 -0
  96. package/dist/tools/partner/getPlanBilling.d.ts.map +1 -0
  97. package/dist/tools/partner/getPlanBilling.js +38 -0
  98. package/dist/tools/partner/getPlanBilling.js.map +1 -0
  99. package/dist/tools/partner/inviteMember.d.ts +15 -0
  100. package/dist/tools/partner/inviteMember.d.ts.map +1 -0
  101. package/dist/tools/partner/inviteMember.js +25 -0
  102. package/dist/tools/partner/inviteMember.js.map +1 -0
  103. package/dist/tools/partner/listAssessments.d.ts +18 -0
  104. package/dist/tools/partner/listAssessments.d.ts.map +1 -0
  105. package/dist/tools/partner/listAssessments.js +27 -0
  106. package/dist/tools/partner/listAssessments.js.map +1 -0
  107. package/dist/tools/partner/listCustomers.d.ts +6 -0
  108. package/dist/tools/partner/listCustomers.d.ts.map +1 -0
  109. package/dist/tools/partner/listCustomers.js +27 -0
  110. package/dist/tools/partner/listCustomers.js.map +1 -0
  111. package/dist/tools/partner/listKeys.d.ts +6 -0
  112. package/dist/tools/partner/listKeys.d.ts.map +1 -0
  113. package/dist/tools/partner/listKeys.js +20 -0
  114. package/dist/tools/partner/listKeys.js.map +1 -0
  115. package/dist/tools/partner/listMembers.d.ts +6 -0
  116. package/dist/tools/partner/listMembers.d.ts.map +1 -0
  117. package/dist/tools/partner/listMembers.js +19 -0
  118. package/dist/tools/partner/listMembers.js.map +1 -0
  119. package/dist/tools/partner/listWebhookDeliveries.d.ts +15 -0
  120. package/dist/tools/partner/listWebhookDeliveries.d.ts.map +1 -0
  121. package/dist/tools/partner/listWebhookDeliveries.js +32 -0
  122. package/dist/tools/partner/listWebhookDeliveries.js.map +1 -0
  123. package/dist/tools/partner/listWebhooks.d.ts +6 -0
  124. package/dist/tools/partner/listWebhooks.d.ts.map +1 -0
  125. package/dist/tools/partner/listWebhooks.js +18 -0
  126. package/dist/tools/partner/listWebhooks.js.map +1 -0
  127. package/dist/tools/partner/mailDisconnect.d.ts +6 -0
  128. package/dist/tools/partner/mailDisconnect.d.ts.map +1 -0
  129. package/dist/tools/partner/mailDisconnect.js +18 -0
  130. package/dist/tools/partner/mailDisconnect.js.map +1 -0
  131. package/dist/tools/partner/mailSendTest.d.ts +6 -0
  132. package/dist/tools/partner/mailSendTest.d.ts.map +1 -0
  133. package/dist/tools/partner/mailSendTest.js +20 -0
  134. package/dist/tools/partner/mailSendTest.js.map +1 -0
  135. package/dist/tools/partner/mailSetMode.d.ts +12 -0
  136. package/dist/tools/partner/mailSetMode.d.ts.map +1 -0
  137. package/dist/tools/partner/mailSetMode.js +26 -0
  138. package/dist/tools/partner/mailSetMode.js.map +1 -0
  139. package/dist/tools/partner/mailSetSharedMailbox.d.ts +12 -0
  140. package/dist/tools/partner/mailSetSharedMailbox.d.ts.map +1 -0
  141. package/dist/tools/partner/mailSetSharedMailbox.js +25 -0
  142. package/dist/tools/partner/mailSetSharedMailbox.js.map +1 -0
  143. package/dist/tools/partner/mailStartConnect.d.ts +12 -0
  144. package/dist/tools/partner/mailStartConnect.d.ts.map +1 -0
  145. package/dist/tools/partner/mailStartConnect.js +28 -0
  146. package/dist/tools/partner/mailStartConnect.js.map +1 -0
  147. package/dist/tools/partner/mailStatus.d.ts +6 -0
  148. package/dist/tools/partner/mailStatus.d.ts.map +1 -0
  149. package/dist/tools/partner/mailStatus.js +19 -0
  150. package/dist/tools/partner/mailStatus.js.map +1 -0
  151. package/dist/tools/partner/removeMember.d.ts +12 -0
  152. package/dist/tools/partner/removeMember.d.ts.map +1 -0
  153. package/dist/tools/partner/removeMember.js +25 -0
  154. package/dist/tools/partner/removeMember.js.map +1 -0
  155. package/dist/tools/partner/resendMemberInvite.d.ts +12 -0
  156. package/dist/tools/partner/resendMemberInvite.d.ts.map +1 -0
  157. package/dist/tools/partner/resendMemberInvite.js +24 -0
  158. package/dist/tools/partner/resendMemberInvite.js.map +1 -0
  159. package/dist/tools/partner/revokeKey.d.ts +12 -0
  160. package/dist/tools/partner/revokeKey.d.ts.map +1 -0
  161. package/dist/tools/partner/revokeKey.js +25 -0
  162. package/dist/tools/partner/revokeKey.js.map +1 -0
  163. package/dist/tools/partner/sendConsentEmail.d.ts +18 -0
  164. package/dist/tools/partner/sendConsentEmail.d.ts.map +1 -0
  165. package/dist/tools/partner/sendConsentEmail.js +50 -0
  166. package/dist/tools/partner/sendConsentEmail.js.map +1 -0
  167. package/dist/tools/partner/testWebhook.d.ts +12 -0
  168. package/dist/tools/partner/testWebhook.d.ts.map +1 -0
  169. package/dist/tools/partner/testWebhook.js +25 -0
  170. package/dist/tools/partner/testWebhook.js.map +1 -0
  171. package/dist/tools/partner/triggerAssessment.d.ts +18 -0
  172. package/dist/tools/partner/triggerAssessment.d.ts.map +1 -0
  173. package/dist/tools/partner/triggerAssessment.js +26 -0
  174. package/dist/tools/partner/triggerAssessment.js.map +1 -0
  175. package/dist/tools/partner/updateBranding.d.ts +31 -0
  176. package/dist/tools/partner/updateBranding.d.ts.map +1 -0
  177. package/dist/tools/partner/updateBranding.js +44 -0
  178. package/dist/tools/partner/updateBranding.js.map +1 -0
  179. package/dist/tools/partner/updateMember.d.ts +26 -0
  180. package/dist/tools/partner/updateMember.d.ts.map +1 -0
  181. package/dist/tools/partner/updateMember.js +35 -0
  182. package/dist/tools/partner/updateMember.js.map +1 -0
  183. package/dist/tools/partner/updateWebhook.d.ts +41 -0
  184. package/dist/tools/partner/updateWebhook.d.ts.map +1 -0
  185. package/dist/tools/partner/updateWebhook.js +42 -0
  186. package/dist/tools/partner/updateWebhook.js.map +1 -0
  187. package/package.json +62 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Support. While redistributing the Work or
166
+ Derivative Works thereof, You may accept and charge a fee for,
167
+ acceptance of support, warranty, indemnity, or other liability
168
+ obligations and/or rights consistent with this License. However, in
169
+ accepting such obligations, You may act only on Your own behalf
170
+ and on Your sole responsibility, not on behalf of any other
171
+ Contributor, and only if You agree to indemnify, defend, and hold
172
+ each Contributor harmless for any liability incurred by, or claims
173
+ asserted against, such Contributor by reason of your accepting any
174
+ such warranty or support.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same page as the copyright notice for easier identification within
187
+ third-party files.
188
+
189
+ Copyright 2026 baref00t.io
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
200
+ implied. See the License for the specific language governing
201
+ permissions and limitations under the License.
package/README.md ADDED
@@ -0,0 +1,109 @@
1
+ # `@baref00t/mcp-server`
2
+
3
+ [![License: Apache-2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
4
+
5
+ Hosted multi-tenant Model Context Protocol (MCP) server that exposes the [baref00t](https://baref00t.io) Partner + Distributor APIs to AI assistants — Claude Desktop, Cursor, ChatGPT remote MCP, generic MCP clients.
6
+
7
+ ## Hosted endpoint
8
+
9
+ | Env | URL |
10
+ |---|---|
11
+ | Production | `https://mcp.baref00t.io/mcp` |
12
+ | Staging | `https://mcp.sandbox.baref00t.io/mcp` |
13
+
14
+ ## Quick start (Claude Desktop)
15
+
16
+ `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
17
+
18
+ ```json
19
+ {
20
+ "mcpServers": {
21
+ "baref00t": {
22
+ "url": "https://mcp.baref00t.io/mcp",
23
+ "headers": {
24
+ "Authorization": "Bearer pk_live_YOUR_PARTNER_KEY"
25
+ }
26
+ }
27
+ }
28
+ }
29
+ ```
30
+
31
+ Restart Claude Desktop. Ask: **"List my baref00t customers"**.
32
+
33
+ ## Authentication
34
+
35
+ Pass your existing baref00t Partner or Distributor API key in any of these headers:
36
+
37
+ ```
38
+ Authorization: Bearer pk_live_…
39
+ X-Partner-Key: pk_live_…
40
+ X-Distributor-Key: dk_live_…
41
+ ```
42
+
43
+ Key prefix routes to the right scope. Partner keys see partner tools, distributor keys see distributor tools.
44
+
45
+ Get an API key at https://www.baref00t.io → Settings → API keys.
46
+
47
+ ## v0.1 tool catalogue
48
+
49
+ ### Partner (8 tools, scope=`pk_*`)
50
+
51
+ | Tool | What it does |
52
+ |---|---|
53
+ | `partner_list_customers` | List all customers in the partner account |
54
+ | `partner_get_customer` | Fetch one customer by id |
55
+ | `partner_create_customer` | Create a new customer (requires Microsoft Entra tenant id) |
56
+ | `partner_list_assessments` | List runs, filter by month/product/customer |
57
+ | `partner_get_assessment` | Fetch one assessment by id |
58
+ | `partner_trigger_assessment` | Start a new assessment (costs 1 quota credit) |
59
+ | `partner_get_assessment_status` | Poll status of a running assessment |
60
+ | `partner_get_plan_billing` | Plan + monthly quota usage + allowed products |
61
+
62
+ ### Distributor (2 tools, scope=`dk_*`)
63
+
64
+ | Tool | What it does |
65
+ |---|---|
66
+ | `distributor_list_partners` | List sub-partners (optionally filtered by status) |
67
+ | `distributor_get_usage` | Aggregated month usage across all sub-partners |
68
+
69
+ Read-only + safe-creates only in v0.1. Bulk operations, key rotation, deletes, and sub-partner provisioning land behind a `--enable-write-tools` flag in v0.2.
70
+
71
+ ## Local self-host
72
+
73
+ ```bash
74
+ npm install -g @baref00t/mcp-server
75
+ BAREF00T_API_BASE=https://api.baref00t.io baref00t-mcp-server
76
+ # Listens on :8080
77
+ ```
78
+
79
+ Then configure your MCP client to point at `http://localhost:8080/mcp` instead of the hosted URL. (The server itself is stateless multi-tenant — your API key still travels per-request.)
80
+
81
+ Or via Docker:
82
+
83
+ ```bash
84
+ docker run -d -p 8080:8080 \
85
+ -e BAREF00T_API_BASE=https://api.baref00t.io \
86
+ ghcr.io/becloudsmart-com/baref00t-mcp:latest
87
+ ```
88
+
89
+ ## Operational config (KV-backed)
90
+
91
+ When deployed to our hosted ACA, the following config lives in Key Vault and can be rotated **without redeploying** (server picks up changes within 30s):
92
+
93
+ | Secret | Default | Purpose |
94
+ |---|---|---|
95
+ | `MCPLogLevel` | `info` | Pino log level |
96
+ | `MCPToolConcurrency` | `8` | Per-key in-flight cap (protects partner's upstream quota) |
97
+ | `MCPAllowedKeyPrefixes` | `pk_live_,dk_live_` (prod) | Security knob — emergency-revoke a key class |
98
+ | `MCPEnabledTools` | `` (all) | Per-tool kill-switch |
99
+ | `MCPFeatureFlags` | `{}` | Future toggles (OAuth shim, write tools, streaming) |
100
+
101
+ Local dev reads these from env vars (e.g. `MCP_LOG_LEVEL=debug`).
102
+
103
+ ## Privacy notice
104
+
105
+ When you use this server with an AI assistant, the **assistant's provider** (Anthropic / OpenAI / etc.) sees the tool call inputs + outputs you ask the AI to make — including customer email addresses, assessment scores, and other Partner-API data. baref00t doesn't control how the AI provider stores those interactions. Confirm your contractual basis with your AI provider before connecting a partner key that has access to real customer data.
106
+
107
+ ## License
108
+
109
+ [Apache-2.0](LICENSE).
package/dist/auth.d.ts ADDED
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Per-request key extraction + scope routing.
3
+ *
4
+ * Accepts either:
5
+ * Authorization: Bearer pk_live_… (or dk_live_…)
6
+ * X-Partner-Key: pk_live_…
7
+ * X-Distributor-Key: dk_live_…
8
+ *
9
+ * Validates the prefix against the runtime-configurable allow-list
10
+ * (`MCPAllowedKeyPrefixes` in KV). Unknown prefix → 401.
11
+ */
12
+ import type { IncomingMessage } from 'node:http';
13
+ export type Scope = 'partner' | 'distributor';
14
+ export interface ExtractedKey {
15
+ scope: Scope;
16
+ apiKey: string;
17
+ }
18
+ export interface AuthError {
19
+ status: number;
20
+ body: {
21
+ error: {
22
+ code: string;
23
+ message: string;
24
+ };
25
+ };
26
+ }
27
+ export declare function extractKey(req: IncomingMessage): Promise<ExtractedKey | AuthError>;
28
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAGhD,MAAM,MAAM,KAAK,GAAG,SAAS,GAAG,aAAa,CAAA;AAE7C,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,KAAK,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE;QAAE,KAAK,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAA;CACnD;AAED,wBAAsB,UAAU,CAC9B,GAAG,EAAE,eAAe,GACnB,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAgDnC"}
package/dist/auth.js ADDED
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Per-request key extraction + scope routing.
3
+ *
4
+ * Accepts either:
5
+ * Authorization: Bearer pk_live_… (or dk_live_…)
6
+ * X-Partner-Key: pk_live_…
7
+ * X-Distributor-Key: dk_live_…
8
+ *
9
+ * Validates the prefix against the runtime-configurable allow-list
10
+ * (`MCPAllowedKeyPrefixes` in KV). Unknown prefix → 401.
11
+ */
12
+ import { getConfig } from './config.js';
13
+ export async function extractKey(req) {
14
+ const auth = req.headers['authorization'];
15
+ const partnerHdr = req.headers['x-partner-key'];
16
+ const distributorHdr = req.headers['x-distributor-key'];
17
+ let raw;
18
+ if (typeof auth === 'string' && auth.toLowerCase().startsWith('bearer ')) {
19
+ raw = auth.slice(7).trim();
20
+ }
21
+ else if (typeof partnerHdr === 'string') {
22
+ raw = partnerHdr.trim();
23
+ }
24
+ else if (typeof distributorHdr === 'string') {
25
+ raw = distributorHdr.trim();
26
+ }
27
+ if (!raw) {
28
+ return {
29
+ status: 401,
30
+ body: {
31
+ error: {
32
+ code: 'UNAUTHORIZED',
33
+ message: 'Missing API key. Send `Authorization: Bearer pk_live_…` (or dk_live_…) or X-Partner-Key / X-Distributor-Key.',
34
+ },
35
+ },
36
+ };
37
+ }
38
+ // Prefix check against runtime-configurable allow-list.
39
+ const config = await getConfig();
40
+ const lower = raw.toLowerCase();
41
+ const allowed = config.allowedKeyPrefixes.find((p) => lower.startsWith(p));
42
+ if (!allowed) {
43
+ return {
44
+ status: 401,
45
+ body: {
46
+ error: {
47
+ code: 'UNRECOGNISED_KEY_PREFIX',
48
+ message: 'API key prefix is not in the allow-list. Expected one of: ' +
49
+ config.allowedKeyPrefixes.join(', '),
50
+ },
51
+ },
52
+ };
53
+ }
54
+ // Scope routing — first 3 chars determine partner vs distributor.
55
+ const scope = allowed.startsWith('pk_') ? 'partner' : 'distributor';
56
+ return { scope, apiKey: raw };
57
+ }
58
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAcvC,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,GAAoB;IAEpB,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;IACzC,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;IAC/C,MAAM,cAAc,GAAG,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAA;IAEvD,IAAI,GAAuB,CAAA;IAC3B,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QACzE,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;IAC5B,CAAC;SAAM,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;QAC1C,GAAG,GAAG,UAAU,CAAC,IAAI,EAAE,CAAA;IACzB,CAAC;SAAM,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE,CAAC;QAC9C,GAAG,GAAG,cAAc,CAAC,IAAI,EAAE,CAAA;IAC7B,CAAC;IAED,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO;YACL,MAAM,EAAE,GAAG;YACX,IAAI,EAAE;gBACJ,KAAK,EAAE;oBACL,IAAI,EAAE,cAAc;oBACpB,OAAO,EACL,8GAA8G;iBACjH;aACF;SACF,CAAA;IACH,CAAC;IAED,wDAAwD;IACxD,MAAM,MAAM,GAAG,MAAM,SAAS,EAAE,CAAA;IAChC,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,EAAE,CAAA;IAC/B,MAAM,OAAO,GAAG,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1E,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO;YACL,MAAM,EAAE,GAAG;YACX,IAAI,EAAE;gBACJ,KAAK,EAAE;oBACL,IAAI,EAAE,yBAAyB;oBAC/B,OAAO,EACL,4DAA4D;wBAC5D,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC;iBACvC;aACF;SACF,CAAA;IACH,CAAC;IAED,kEAAkE;IAClE,MAAM,KAAK,GAAU,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAA;IAC1E,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAA;AAC/B,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * KV-backed runtime config loader.
3
+ *
4
+ * Reads operational config from Azure Key Vault (when `KV_NAME` is set) with
5
+ * a short TTL cache so partners can rotate values without redeploying:
6
+ *
7
+ * - MCPLogLevel → log level (trace/debug/info/warn/error/fatal)
8
+ * - MCPToolConcurrency → per-key in-flight concurrency cap (default 8)
9
+ * - MCPAllowedKeyPrefixes → CSV of accepted API-key prefixes
10
+ * - MCPEnabledTools → CSV of enabled tool names ('' = all)
11
+ * - MCPFeatureFlags → JSON object of named feature flags
12
+ *
13
+ * In local development (no KV_NAME), values fall back to env vars / defaults
14
+ * so the server can run with `pnpm dev`.
15
+ */
16
+ export interface RuntimeConfig {
17
+ logLevel: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
18
+ toolConcurrency: number;
19
+ /** Lowercase key-prefix list — every accepted prefix is checked exactly. */
20
+ allowedKeyPrefixes: string[];
21
+ /** Empty array means "all enabled". */
22
+ enabledTools: string[];
23
+ featureFlags: Record<string, boolean>;
24
+ }
25
+ /**
26
+ * Get the live runtime config. Reads KV at most once every 30s; returns the
27
+ * cached value otherwise. Falls back to env-var defaults if KV is unavailable
28
+ * or the secret is missing.
29
+ */
30
+ export declare function getConfig(): Promise<RuntimeConfig>;
31
+ /** Test-only: reset cache. */
32
+ export declare function _resetConfigCache(): void;
33
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AASH,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAA;IACjE,eAAe,EAAE,MAAM,CAAA;IACvB,4EAA4E;IAC5E,kBAAkB,EAAE,MAAM,EAAE,CAAA;IAC5B,uCAAuC;IACvC,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACtC;AA+BD;;;;GAIG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,aAAa,CAAC,CA+CxD;AAoBD,8BAA8B;AAC9B,wBAAgB,iBAAiB,SAGhC"}
package/dist/config.js ADDED
@@ -0,0 +1,124 @@
1
+ /**
2
+ * KV-backed runtime config loader.
3
+ *
4
+ * Reads operational config from Azure Key Vault (when `KV_NAME` is set) with
5
+ * a short TTL cache so partners can rotate values without redeploying:
6
+ *
7
+ * - MCPLogLevel → log level (trace/debug/info/warn/error/fatal)
8
+ * - MCPToolConcurrency → per-key in-flight concurrency cap (default 8)
9
+ * - MCPAllowedKeyPrefixes → CSV of accepted API-key prefixes
10
+ * - MCPEnabledTools → CSV of enabled tool names ('' = all)
11
+ * - MCPFeatureFlags → JSON object of named feature flags
12
+ *
13
+ * In local development (no KV_NAME), values fall back to env vars / defaults
14
+ * so the server can run with `pnpm dev`.
15
+ */
16
+ import { DefaultAzureCredential } from '@azure/identity';
17
+ import { SecretClient } from '@azure/keyvault-secrets';
18
+ import { env } from './env.js';
19
+ import { logger } from './logger.js';
20
+ const TTL_MS = 30_000;
21
+ /** Recomputed each call so tests + runtime env edits are honored. */
22
+ function defaults() {
23
+ return {
24
+ logLevel: process.env['MCP_LOG_LEVEL'] || 'info',
25
+ toolConcurrency: Number(process.env['MCP_TOOL_CONCURRENCY']) || 8,
26
+ allowedKeyPrefixes: (process.env['MCP_ALLOWED_KEY_PREFIXES'] || 'pk_live_,pk_test_,dk_live_,dk_test_')
27
+ .split(',')
28
+ .map((s) => s.trim().toLowerCase())
29
+ .filter(Boolean),
30
+ enabledTools: (process.env['MCP_ENABLED_TOOLS'] || '')
31
+ .split(',')
32
+ .map((s) => s.trim())
33
+ .filter(Boolean),
34
+ featureFlags: parseJsonOrEmpty(process.env['MCP_FEATURE_FLAGS'] ?? '{}'),
35
+ };
36
+ }
37
+ let _client = null;
38
+ let _cached = null;
39
+ function client() {
40
+ const e = env();
41
+ if (!e.KV_NAME)
42
+ return null;
43
+ if (_client)
44
+ return _client;
45
+ const credential = new DefaultAzureCredential();
46
+ _client = new SecretClient(`https://${e.KV_NAME}.vault.azure.net`, credential);
47
+ return _client;
48
+ }
49
+ /**
50
+ * Get the live runtime config. Reads KV at most once every 30s; returns the
51
+ * cached value otherwise. Falls back to env-var defaults if KV is unavailable
52
+ * or the secret is missing.
53
+ */
54
+ export async function getConfig() {
55
+ if (_cached && Date.now() - _cached.loadedAt < TTL_MS)
56
+ return _cached.value;
57
+ const c = client();
58
+ if (!c) {
59
+ _cached = { value: defaults(), loadedAt: Date.now() };
60
+ return _cached.value;
61
+ }
62
+ const merged = { ...defaults() };
63
+ const log = logger();
64
+ await Promise.all([
65
+ fetchSecret(c, 'MCPLogLevel').then((v) => {
66
+ if (v && /^(trace|debug|info|warn|error|fatal)$/.test(v)) {
67
+ merged.logLevel = v;
68
+ }
69
+ }),
70
+ fetchSecret(c, 'MCPToolConcurrency').then((v) => {
71
+ const n = Number(v);
72
+ if (Number.isFinite(n) && n > 0)
73
+ merged.toolConcurrency = Math.floor(n);
74
+ }),
75
+ fetchSecret(c, 'MCPAllowedKeyPrefixes').then((v) => {
76
+ if (v) {
77
+ merged.allowedKeyPrefixes = v
78
+ .split(',')
79
+ .map((s) => s.trim().toLowerCase())
80
+ .filter(Boolean);
81
+ }
82
+ }),
83
+ fetchSecret(c, 'MCPEnabledTools').then((v) => {
84
+ if (v !== undefined) {
85
+ merged.enabledTools = v
86
+ .split(',')
87
+ .map((s) => s.trim())
88
+ .filter(Boolean);
89
+ }
90
+ }),
91
+ fetchSecret(c, 'MCPFeatureFlags').then((v) => {
92
+ if (v)
93
+ merged.featureFlags = parseJsonOrEmpty(v);
94
+ }),
95
+ ]).catch((err) => {
96
+ log.warn({ err: err instanceof Error ? err.message : String(err) }, 'config: KV read failed; using defaults');
97
+ });
98
+ _cached = { value: merged, loadedAt: Date.now() };
99
+ return merged;
100
+ }
101
+ async function fetchSecret(c, name) {
102
+ try {
103
+ const s = await c.getSecret(name);
104
+ return s.value;
105
+ }
106
+ catch {
107
+ return undefined;
108
+ }
109
+ }
110
+ function parseJsonOrEmpty(raw) {
111
+ try {
112
+ const v = JSON.parse(raw);
113
+ return typeof v === 'object' && v !== null ? v : {};
114
+ }
115
+ catch {
116
+ return {};
117
+ }
118
+ }
119
+ /** Test-only: reset cache. */
120
+ export function _resetConfigCache() {
121
+ _cached = null;
122
+ _client = null;
123
+ }
124
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,MAAM,MAAM,GAAG,MAAM,CAAA;AAYrB,qEAAqE;AACrE,SAAS,QAAQ;IACf,OAAO;QACL,QAAQ,EAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAA+B,IAAI,MAAM;QAC/E,eAAe,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC,IAAI,CAAC;QACjE,kBAAkB,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,IAAI,qCAAqC,CAAC;aACnG,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;aAClC,MAAM,CAAC,OAAO,CAAC;QAClB,YAAY,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,EAAE,CAAC;aACnD,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;aACpB,MAAM,CAAC,OAAO,CAAC;QAClB,YAAY,EAAE,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,IAAI,CAAC;KACzE,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,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,wCAAwC,CAAC,CAAA;IAC/G,CAAC,CAAC,CAAA;IAEF,OAAO,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAA;IACjD,OAAO,MAAM,CAAA;AACf,CAAC;AAED,KAAK,UAAU,WAAW,CAAC,CAAe,EAAE,IAAY;IACtD,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;QACjC,OAAO,CAAC,CAAC,KAAK,CAAA;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAW;IACnC,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACzB,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAE,CAA6B,CAAC,CAAC,CAAC,EAAE,CAAA;IAClF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAA;IACX,CAAC;AACH,CAAC;AAED,8BAA8B;AAC9B,MAAM,UAAU,iBAAiB;IAC/B,OAAO,GAAG,IAAI,CAAA;IACd,OAAO,GAAG,IAAI,CAAA;AAChB,CAAC"}
package/dist/env.d.ts ADDED
@@ -0,0 +1,41 @@
1
+ /**
2
+ * MCP server environment configuration.
3
+ *
4
+ * Splits between Bicep-provisioned literals (NODE_ENV, AZURE_CLIENT_ID,
5
+ * KV_NAME, BAREF00T_API_BASE, etc.) and KV-backed runtime-mutable config
6
+ * (MCP_LOG_LEVEL, MCP_TOOL_CONCURRENCY, MCP_ALLOWED_KEY_PREFIXES,
7
+ * MCP_ENABLED_TOOLS, MCP_FEATURE_FLAGS).
8
+ *
9
+ * KV reads are short-lived per the Sprint 3 plan (30s TTL) so partners can
10
+ * rotate operational config without redeploys.
11
+ */
12
+ import { z } from 'zod';
13
+ declare const envSchema: z.ZodObject<{
14
+ NODE_ENV: z.ZodDefault<z.ZodEnum<["development", "production", "test"]>>;
15
+ PORT: z.ZodDefault<z.ZodNumber>;
16
+ AZURE_CLIENT_ID: z.ZodOptional<z.ZodString>;
17
+ KV_NAME: z.ZodOptional<z.ZodString>;
18
+ APPLICATIONINSIGHTS_CONNECTION_STRING: z.ZodOptional<z.ZodString>;
19
+ BAREF00T_API_BASE: z.ZodDefault<z.ZodString>;
20
+ ENVIRONMENT: z.ZodDefault<z.ZodString>;
21
+ }, "strip", z.ZodTypeAny, {
22
+ NODE_ENV: "development" | "production" | "test";
23
+ PORT: number;
24
+ BAREF00T_API_BASE: string;
25
+ ENVIRONMENT: string;
26
+ AZURE_CLIENT_ID?: string | undefined;
27
+ KV_NAME?: string | undefined;
28
+ APPLICATIONINSIGHTS_CONNECTION_STRING?: string | undefined;
29
+ }, {
30
+ NODE_ENV?: "development" | "production" | "test" | undefined;
31
+ PORT?: number | undefined;
32
+ AZURE_CLIENT_ID?: string | undefined;
33
+ KV_NAME?: string | undefined;
34
+ APPLICATIONINSIGHTS_CONNECTION_STRING?: string | undefined;
35
+ BAREF00T_API_BASE?: string | undefined;
36
+ ENVIRONMENT?: string | undefined;
37
+ }>;
38
+ export type McpEnv = z.infer<typeof envSchema>;
39
+ export declare function env(): McpEnv;
40
+ export {};
41
+ //# sourceMappingURL=env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;EAeb,CAAA;AAEF,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAA;AAI9C,wBAAgB,GAAG,IAAI,MAAM,CAU5B"}
package/dist/env.js ADDED
@@ -0,0 +1,37 @@
1
+ /**
2
+ * MCP server environment configuration.
3
+ *
4
+ * Splits between Bicep-provisioned literals (NODE_ENV, AZURE_CLIENT_ID,
5
+ * KV_NAME, BAREF00T_API_BASE, etc.) and KV-backed runtime-mutable config
6
+ * (MCP_LOG_LEVEL, MCP_TOOL_CONCURRENCY, MCP_ALLOWED_KEY_PREFIXES,
7
+ * MCP_ENABLED_TOOLS, MCP_FEATURE_FLAGS).
8
+ *
9
+ * KV reads are short-lived per the Sprint 3 plan (30s TTL) so partners can
10
+ * rotate operational config without redeploys.
11
+ */
12
+ import { z } from 'zod';
13
+ const envSchema = z.object({
14
+ NODE_ENV: z.enum(['development', 'production', 'test']).default('production'),
15
+ PORT: z.coerce.number().int().min(1).max(65535).default(8080),
16
+ AZURE_CLIENT_ID: z.string().optional().describe('User-assigned MI client id (Azure)'),
17
+ KV_NAME: z.string().min(1).optional().describe('Key Vault name for runtime config reads'),
18
+ APPLICATIONINSIGHTS_CONNECTION_STRING: z.string().optional(),
19
+ BAREF00T_API_BASE: z
20
+ .string()
21
+ .url()
22
+ .default('https://api.baref00t.io'),
23
+ ENVIRONMENT: z.string().default('local'),
24
+ });
25
+ let _env = null;
26
+ export function env() {
27
+ if (!_env) {
28
+ const result = envSchema.safeParse(process.env);
29
+ if (!result.success) {
30
+ const lines = result.error.issues.map((i) => ` - ${i.path.join('.')}: ${i.message}`);
31
+ throw new Error(['MCP server env invalid:', ...lines].join('\n'));
32
+ }
33
+ _env = result.data;
34
+ }
35
+ return _env;
36
+ }
37
+ //# sourceMappingURL=env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,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