@ferrlabs/mcp 4.0.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +373 -21
- package/README.md +40 -10
- package/dist/auth/__tests__/index.test.d.ts +2 -0
- package/dist/auth/__tests__/index.test.d.ts.map +1 -0
- package/dist/auth/__tests__/index.test.js +39 -0
- package/dist/auth/__tests__/oauth.test.d.ts +2 -0
- package/dist/auth/__tests__/oauth.test.d.ts.map +1 -0
- package/dist/auth/__tests__/oauth.test.js +26 -0
- package/dist/auth/index.d.ts +3 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +36 -0
- package/dist/auth/oauth.d.ts +12 -0
- package/dist/auth/oauth.d.ts.map +1 -0
- package/dist/auth/oauth.js +123 -0
- package/dist/auth/persistence.d.ts +4 -0
- package/dist/auth/persistence.d.ts.map +1 -0
- package/dist/auth/persistence.js +61 -0
- package/dist/tools/issues.d.ts.map +1 -1
- package/dist/tools/issues.js +2 -8
- package/dist/tools/orgs.d.ts.map +1 -1
- package/dist/tools/orgs.js +3 -9
- package/dist/tools/subscriptions.d.ts.map +1 -1
- package/dist/tools/subscriptions.js +2 -8
- package/dist/tools/tokens.d.ts.map +1 -1
- package/dist/tools/tokens.js +5 -11
- package/dist/tools/vaults.d.ts.map +1 -1
- package/dist/tools/vaults.js +2 -8
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,21 +1,373 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
Mozilla Public License Version 2.0
|
|
2
|
+
==================================
|
|
3
|
+
|
|
4
|
+
1. Definitions
|
|
5
|
+
--------------
|
|
6
|
+
|
|
7
|
+
1.1. "Contributor"
|
|
8
|
+
means each individual or legal entity that creates, contributes to
|
|
9
|
+
the creation of, or owns Covered Software.
|
|
10
|
+
|
|
11
|
+
1.2. "Contributor Version"
|
|
12
|
+
means the combination of the Contributions of others (if any) used
|
|
13
|
+
by a Contributor and that particular Contributor's Contribution.
|
|
14
|
+
|
|
15
|
+
1.3. "Contribution"
|
|
16
|
+
means Covered Software of a particular Contributor.
|
|
17
|
+
|
|
18
|
+
1.4. "Covered Software"
|
|
19
|
+
means Source Code Form to which the initial Contributor has attached
|
|
20
|
+
the notice in Exhibit A, the Executable Form of such Source Code
|
|
21
|
+
Form, and Modifications of such Source Code Form, in each case
|
|
22
|
+
including portions thereof.
|
|
23
|
+
|
|
24
|
+
1.5. "Incompatible With Secondary Licenses"
|
|
25
|
+
means
|
|
26
|
+
|
|
27
|
+
(a) that the initial Contributor has attached the notice described
|
|
28
|
+
in Exhibit B to the Covered Software; or
|
|
29
|
+
|
|
30
|
+
(b) that the Covered Software was made available under the terms of
|
|
31
|
+
version 1.1 or earlier of the License, but not also under the
|
|
32
|
+
terms of a Secondary License.
|
|
33
|
+
|
|
34
|
+
1.6. "Executable Form"
|
|
35
|
+
means any form of the work other than Source Code Form.
|
|
36
|
+
|
|
37
|
+
1.7. "Larger Work"
|
|
38
|
+
means a work that combines Covered Software with other material, in
|
|
39
|
+
a separate file or files, that is not Covered Software.
|
|
40
|
+
|
|
41
|
+
1.8. "License"
|
|
42
|
+
means this document.
|
|
43
|
+
|
|
44
|
+
1.9. "Licensable"
|
|
45
|
+
means having the right to grant, to the maximum extent possible,
|
|
46
|
+
whether at the time of the initial grant or subsequently, any and
|
|
47
|
+
all of the rights conveyed by this License.
|
|
48
|
+
|
|
49
|
+
1.10. "Modifications"
|
|
50
|
+
means any of the following:
|
|
51
|
+
|
|
52
|
+
(a) any file in Source Code Form that results from an addition to,
|
|
53
|
+
deletion from, or modification of the contents of Covered
|
|
54
|
+
Software; or
|
|
55
|
+
|
|
56
|
+
(b) any new file in Source Code Form that contains any Covered
|
|
57
|
+
Software.
|
|
58
|
+
|
|
59
|
+
1.11. "Patent Claims" of a Contributor
|
|
60
|
+
means any patent claim(s), including without limitation, method,
|
|
61
|
+
process, and apparatus claims, in any patent Licensable by such
|
|
62
|
+
Contributor that would be infringed, but for the grant of the
|
|
63
|
+
License, by the making, using, selling, offering for sale, having
|
|
64
|
+
made, import, or transfer of either its Contributions or its
|
|
65
|
+
Contributor Version.
|
|
66
|
+
|
|
67
|
+
1.12. "Secondary License"
|
|
68
|
+
means either the GNU General Public License, Version 2.0, the GNU
|
|
69
|
+
Lesser General Public License, Version 2.1, the GNU Affero General
|
|
70
|
+
Public License, Version 3.0, or any later versions of those
|
|
71
|
+
licenses.
|
|
72
|
+
|
|
73
|
+
1.13. "Source Code Form"
|
|
74
|
+
means the form of the work preferred for making modifications.
|
|
75
|
+
|
|
76
|
+
1.14. "You" (or "Your")
|
|
77
|
+
means an individual or a legal entity exercising rights under this
|
|
78
|
+
License. For legal entities, "You" includes any entity that
|
|
79
|
+
controls, is controlled by, or is under common control with You. For
|
|
80
|
+
purposes of this definition, "control" means (a) the power, direct
|
|
81
|
+
or indirect, to cause the direction or management of such entity,
|
|
82
|
+
whether by contract or otherwise, or (b) ownership of more than
|
|
83
|
+
fifty percent (50%) of the outstanding shares or beneficial
|
|
84
|
+
ownership of such entity.
|
|
85
|
+
|
|
86
|
+
2. License Grants and Conditions
|
|
87
|
+
--------------------------------
|
|
88
|
+
|
|
89
|
+
2.1. Grants
|
|
90
|
+
|
|
91
|
+
Each Contributor hereby grants You a world-wide, royalty-free,
|
|
92
|
+
non-exclusive license:
|
|
93
|
+
|
|
94
|
+
(a) under intellectual property rights (other than patent or trademark)
|
|
95
|
+
Licensable by such Contributor to use, reproduce, make available,
|
|
96
|
+
modify, display, perform, distribute, and otherwise exploit its
|
|
97
|
+
Contributions, either on an unmodified basis, with Modifications, or
|
|
98
|
+
as part of a Larger Work; and
|
|
99
|
+
|
|
100
|
+
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
|
101
|
+
for sale, have made, import, and otherwise transfer either its
|
|
102
|
+
Contributions or its Contributor Version.
|
|
103
|
+
|
|
104
|
+
2.2. Effective Date
|
|
105
|
+
|
|
106
|
+
The licenses granted in Section 2.1 with respect to any Contribution
|
|
107
|
+
become effective for each Contribution on the date the Contributor first
|
|
108
|
+
distributes such Contribution.
|
|
109
|
+
|
|
110
|
+
2.3. Limitations on Grant Scope
|
|
111
|
+
|
|
112
|
+
The licenses granted in this Section 2 are the only rights granted under
|
|
113
|
+
this License. No additional rights or licenses will be implied from the
|
|
114
|
+
distribution or licensing of Covered Software under this License.
|
|
115
|
+
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
|
116
|
+
Contributor:
|
|
117
|
+
|
|
118
|
+
(a) for any code that a Contributor has removed from Covered Software;
|
|
119
|
+
or
|
|
120
|
+
|
|
121
|
+
(b) for infringements caused by: (i) Your and any other third party's
|
|
122
|
+
modifications of Covered Software, or (ii) the combination of its
|
|
123
|
+
Contributions with other software (except as part of its Contributor
|
|
124
|
+
Version); or
|
|
125
|
+
|
|
126
|
+
(c) under Patent Claims infringed by Covered Software in the absence of
|
|
127
|
+
its Contributions.
|
|
128
|
+
|
|
129
|
+
This License does not grant any rights in the trademarks, service marks,
|
|
130
|
+
or logos of any Contributor (except as may be necessary to comply with
|
|
131
|
+
the notice requirements in Section 3.4).
|
|
132
|
+
|
|
133
|
+
2.4. Subsequent Licenses
|
|
134
|
+
|
|
135
|
+
No Contributor makes additional grants as a result of Your choice to
|
|
136
|
+
distribute the Covered Software under a subsequent version of this
|
|
137
|
+
License (see Section 10.2) or under the terms of a Secondary License (if
|
|
138
|
+
permitted under the terms of Section 3.3).
|
|
139
|
+
|
|
140
|
+
2.5. Representation
|
|
141
|
+
|
|
142
|
+
Each Contributor represents that the Contributor believes its
|
|
143
|
+
Contributions are its original creation(s) or it has sufficient rights
|
|
144
|
+
to grant the rights to its Contributions conveyed by this License.
|
|
145
|
+
|
|
146
|
+
2.6. Fair Use
|
|
147
|
+
|
|
148
|
+
This License is not intended to limit any rights You have under
|
|
149
|
+
applicable copyright doctrines of fair use, fair dealing, or other
|
|
150
|
+
equivalents.
|
|
151
|
+
|
|
152
|
+
2.7. Conditions
|
|
153
|
+
|
|
154
|
+
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
|
155
|
+
in Section 2.1.
|
|
156
|
+
|
|
157
|
+
3. Responsibilities
|
|
158
|
+
-------------------
|
|
159
|
+
|
|
160
|
+
3.1. Distribution of Source Form
|
|
161
|
+
|
|
162
|
+
All distribution of Covered Software in Source Code Form, including any
|
|
163
|
+
Modifications that You create or to which You contribute, must be under
|
|
164
|
+
the terms of this License. You must inform recipients that the Source
|
|
165
|
+
Code Form of the Covered Software is governed by the terms of this
|
|
166
|
+
License, and how they can obtain a copy of this License. You may not
|
|
167
|
+
attempt to alter or restrict the recipients' rights in the Source Code
|
|
168
|
+
Form.
|
|
169
|
+
|
|
170
|
+
3.2. Distribution of Executable Form
|
|
171
|
+
|
|
172
|
+
If You distribute Covered Software in Executable Form then:
|
|
173
|
+
|
|
174
|
+
(a) such Covered Software must also be made available in Source Code
|
|
175
|
+
Form, as described in Section 3.1, and You must inform recipients of
|
|
176
|
+
the Executable Form how they can obtain a copy of such Source Code
|
|
177
|
+
Form by reasonable means in a timely manner, at a charge no more
|
|
178
|
+
than the cost of distribution to the recipient; and
|
|
179
|
+
|
|
180
|
+
(b) You may distribute such Executable Form under the terms of this
|
|
181
|
+
License, or sublicense it under different terms, provided that the
|
|
182
|
+
license for the Executable Form does not attempt to limit or alter
|
|
183
|
+
the recipients' rights in the Source Code Form under this License.
|
|
184
|
+
|
|
185
|
+
3.3. Distribution of a Larger Work
|
|
186
|
+
|
|
187
|
+
You may create and distribute a Larger Work under terms of Your choice,
|
|
188
|
+
provided that You also comply with the requirements of this License for
|
|
189
|
+
the Covered Software. If the Larger Work is a combination of Covered
|
|
190
|
+
Software with a work governed by one or more Secondary Licenses, and the
|
|
191
|
+
Covered Software is not Incompatible With Secondary Licenses, this
|
|
192
|
+
License permits You to additionally distribute such Covered Software
|
|
193
|
+
under the terms of such Secondary License(s), so that the recipient of
|
|
194
|
+
the Larger Work may, at their option, further distribute the Covered
|
|
195
|
+
Software under the terms of either this License or such Secondary
|
|
196
|
+
License(s).
|
|
197
|
+
|
|
198
|
+
3.4. Notices
|
|
199
|
+
|
|
200
|
+
You may not remove or alter the substance of any license notices
|
|
201
|
+
(including copyright notices, patent notices, disclaimers of warranty,
|
|
202
|
+
or limitations of liability) contained within the Source Code Form of
|
|
203
|
+
the Covered Software, except that You may alter any license notices to
|
|
204
|
+
the extent required to remedy known factual inaccuracies.
|
|
205
|
+
|
|
206
|
+
3.5. Application of Additional Terms
|
|
207
|
+
|
|
208
|
+
You may choose to offer, and to charge a fee for, warranty, support,
|
|
209
|
+
indemnity or liability obligations to one or more recipients of Covered
|
|
210
|
+
Software. However, You may do so only on Your own behalf, and not on
|
|
211
|
+
behalf of any Contributor. You must make it absolutely clear that any
|
|
212
|
+
such warranty, support, indemnity, or liability obligation is offered by
|
|
213
|
+
You alone, and You hereby agree to indemnify every Contributor for any
|
|
214
|
+
liability incurred by such Contributor as a result of warranty, support,
|
|
215
|
+
indemnity or liability terms You offer. You may include additional
|
|
216
|
+
disclaimers of warranty and limitations of liability specific to any
|
|
217
|
+
jurisdiction.
|
|
218
|
+
|
|
219
|
+
4. Inability to Comply Due to Statute or Regulation
|
|
220
|
+
---------------------------------------------------
|
|
221
|
+
|
|
222
|
+
If it is impossible for You to comply with any of the terms of this
|
|
223
|
+
License with respect to some or all of the Covered Software due to
|
|
224
|
+
statute, judicial order, or regulation then You must: (a) comply with
|
|
225
|
+
the terms of this License to the maximum extent possible; and (b)
|
|
226
|
+
describe the limitations and the code they affect. Such description must
|
|
227
|
+
be placed in a text file included with all distributions of the Covered
|
|
228
|
+
Software under this License. Except to the extent prohibited by statute
|
|
229
|
+
or regulation, such description must be sufficiently detailed for a
|
|
230
|
+
recipient of ordinary skill to be able to understand it.
|
|
231
|
+
|
|
232
|
+
5. Termination
|
|
233
|
+
--------------
|
|
234
|
+
|
|
235
|
+
5.1. The rights granted under this License will terminate automatically
|
|
236
|
+
if You fail to comply with any of its terms. However, if You become
|
|
237
|
+
compliant, then the rights granted under this License from a particular
|
|
238
|
+
Contributor are reinstated (a) provisionally, unless and until such
|
|
239
|
+
Contributor explicitly and finally terminates Your grants, and (b) on an
|
|
240
|
+
ongoing basis, if such Contributor fails to notify You of the
|
|
241
|
+
non-compliance by some reasonable means prior to 60 days after You have
|
|
242
|
+
come back into compliance. Moreover, Your grants from a particular
|
|
243
|
+
Contributor are reinstated on an ongoing basis if such Contributor
|
|
244
|
+
notifies You of the non-compliance by some reasonable means, this is the
|
|
245
|
+
first time You have received notice of non-compliance with this License
|
|
246
|
+
from such Contributor, and You become compliant prior to 30 days after
|
|
247
|
+
Your receipt of the notice.
|
|
248
|
+
|
|
249
|
+
5.2. If You initiate litigation against any entity by asserting a patent
|
|
250
|
+
infringement claim (excluding declaratory judgment actions,
|
|
251
|
+
counter-claims, and cross-claims) alleging that a Contributor Version
|
|
252
|
+
directly or indirectly infringes any patent, then the rights granted to
|
|
253
|
+
You by any and all Contributors for the Covered Software under Section
|
|
254
|
+
2.1 of this License shall terminate.
|
|
255
|
+
|
|
256
|
+
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
|
257
|
+
end user license agreements (excluding distributors and resellers) which
|
|
258
|
+
have been validly granted by You or Your distributors under this License
|
|
259
|
+
prior to termination shall survive termination.
|
|
260
|
+
|
|
261
|
+
************************************************************************
|
|
262
|
+
* *
|
|
263
|
+
* 6. Disclaimer of Warranty *
|
|
264
|
+
* ------------------------- *
|
|
265
|
+
* *
|
|
266
|
+
* Covered Software is provided under this License on an "as is" *
|
|
267
|
+
* basis, without warranty of any kind, either expressed, implied, or *
|
|
268
|
+
* statutory, including, without limitation, warranties that the *
|
|
269
|
+
* Covered Software is free of defects, merchantable, fit for a *
|
|
270
|
+
* particular purpose or non-infringing. The entire risk as to the *
|
|
271
|
+
* quality and performance of the Covered Software is with You. *
|
|
272
|
+
* Should any Covered Software prove defective in any respect, You *
|
|
273
|
+
* (not any Contributor) assume the cost of any necessary servicing, *
|
|
274
|
+
* repair, or correction. This disclaimer of warranty constitutes an *
|
|
275
|
+
* essential part of this License. No use of any Covered Software is *
|
|
276
|
+
* authorized under this License except under this disclaimer. *
|
|
277
|
+
* *
|
|
278
|
+
************************************************************************
|
|
279
|
+
|
|
280
|
+
************************************************************************
|
|
281
|
+
* *
|
|
282
|
+
* 7. Limitation of Liability *
|
|
283
|
+
* -------------------------- *
|
|
284
|
+
* *
|
|
285
|
+
* Under no circumstances and under no legal theory, whether tort *
|
|
286
|
+
* (including negligence), contract, or otherwise, shall any *
|
|
287
|
+
* Contributor, or anyone who distributes Covered Software as *
|
|
288
|
+
* permitted above, be liable to You for any direct, indirect, *
|
|
289
|
+
* special, incidental, or consequential damages of any character *
|
|
290
|
+
* including, without limitation, damages for lost profits, loss of *
|
|
291
|
+
* goodwill, work stoppage, computer failure or malfunction, or any *
|
|
292
|
+
* and all other commercial damages or losses, even if such party *
|
|
293
|
+
* shall have been informed of the possibility of such damages. This *
|
|
294
|
+
* limitation of liability shall not apply to liability for death or *
|
|
295
|
+
* personal injury resulting from such party's negligence to the *
|
|
296
|
+
* extent applicable law prohibits such limitation. Some *
|
|
297
|
+
* jurisdictions do not allow the exclusion or limitation of *
|
|
298
|
+
* incidental or consequential damages, so this exclusion and *
|
|
299
|
+
* limitation may not apply to You. *
|
|
300
|
+
* *
|
|
301
|
+
************************************************************************
|
|
302
|
+
|
|
303
|
+
8. Litigation
|
|
304
|
+
-------------
|
|
305
|
+
|
|
306
|
+
Any litigation relating to this License may be brought only in the
|
|
307
|
+
courts of a jurisdiction where the defendant maintains its principal
|
|
308
|
+
place of business and such litigation shall be governed by laws of that
|
|
309
|
+
jurisdiction, without reference to its conflict-of-law provisions.
|
|
310
|
+
Nothing in this Section shall prevent a party's ability to bring
|
|
311
|
+
cross-claims or counter-claims.
|
|
312
|
+
|
|
313
|
+
9. Miscellaneous
|
|
314
|
+
----------------
|
|
315
|
+
|
|
316
|
+
This License represents the complete agreement concerning the subject
|
|
317
|
+
matter hereof. If any provision of this License is held to be
|
|
318
|
+
unenforceable, such provision shall be reformed only to the extent
|
|
319
|
+
necessary to make it enforceable. Any law or regulation which provides
|
|
320
|
+
that the language of a contract shall be construed against the drafter
|
|
321
|
+
shall not be used to construe this License against a Contributor.
|
|
322
|
+
|
|
323
|
+
10. Versions of the License
|
|
324
|
+
---------------------------
|
|
325
|
+
|
|
326
|
+
10.1. New Versions
|
|
327
|
+
|
|
328
|
+
Mozilla Foundation is the license steward. Except as provided in Section
|
|
329
|
+
10.3, no one other than the license steward has the right to modify or
|
|
330
|
+
publish new versions of this License. Each version will be given a
|
|
331
|
+
distinguishing version number.
|
|
332
|
+
|
|
333
|
+
10.2. Effect of New Versions
|
|
334
|
+
|
|
335
|
+
You may distribute the Covered Software under the terms of the version
|
|
336
|
+
of the License under which You originally received the Covered Software,
|
|
337
|
+
or under the terms of any subsequent version published by the license
|
|
338
|
+
steward.
|
|
339
|
+
|
|
340
|
+
10.3. Modified Versions
|
|
341
|
+
|
|
342
|
+
If you create software not governed by this License, and you want to
|
|
343
|
+
create a new license for such software, you may create and use a
|
|
344
|
+
modified version of this License if you rename the license and remove
|
|
345
|
+
any references to the name of the license steward (except to note that
|
|
346
|
+
such modified license differs from this License).
|
|
347
|
+
|
|
348
|
+
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
|
349
|
+
Licenses
|
|
350
|
+
|
|
351
|
+
If You choose to distribute Source Code Form that is Incompatible With
|
|
352
|
+
Secondary Licenses under the terms of this version of the License, the
|
|
353
|
+
notice described in Exhibit B of this License must be attached.
|
|
354
|
+
|
|
355
|
+
Exhibit A - Source Code Form License Notice
|
|
356
|
+
-------------------------------------------
|
|
357
|
+
|
|
358
|
+
This Source Code Form is subject to the terms of the Mozilla Public
|
|
359
|
+
License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
360
|
+
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
361
|
+
|
|
362
|
+
If it is not possible or desirable to put the notice in a particular
|
|
363
|
+
file, then You may include the notice in a location (such as a LICENSE
|
|
364
|
+
file in a relevant directory) where a recipient would be likely to look
|
|
365
|
+
for such a notice.
|
|
366
|
+
|
|
367
|
+
You may add additional accurate notices of copyright ownership.
|
|
368
|
+
|
|
369
|
+
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
|
370
|
+
---------------------------------------------------------
|
|
371
|
+
|
|
372
|
+
This Source Code Form is "Incompatible With Secondary Licenses", as
|
|
373
|
+
defined by the Mozilla Public License, v. 2.0.
|
package/README.md
CHANGED
|
@@ -10,21 +10,36 @@
|
|
|
10
10
|
|
|
11
11
|
Add to your MCP client configuration (Claude Code, Cursor, etc.):
|
|
12
12
|
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"mcpServers": {
|
|
16
|
+
"ferrlabs": {
|
|
17
|
+
"command": "npx",
|
|
18
|
+
"args": ["-y", "@ferrlabs/mcp"]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The first time you call a tool that needs auth, the MCP opens `auth.ferrlabs.com` in your default browser (OAuth 2.0 loopback PKCE). After you click Allow, the token is saved locally and reused for future sessions. No env var required.
|
|
25
|
+
|
|
26
|
+
### CI / scripted / headless use
|
|
27
|
+
|
|
28
|
+
Bypass the browser dance by injecting a token directly:
|
|
29
|
+
|
|
13
30
|
```json
|
|
14
31
|
{
|
|
15
32
|
"mcpServers": {
|
|
16
33
|
"ferrlabs": {
|
|
17
34
|
"command": "npx",
|
|
18
35
|
"args": ["-y", "@ferrlabs/mcp"],
|
|
19
|
-
"env": {
|
|
20
|
-
"FERRLABS_API_TOKEN": "fl_..."
|
|
21
|
-
}
|
|
36
|
+
"env": { "FERRLABS_API_TOKEN": "fl_..." }
|
|
22
37
|
}
|
|
23
38
|
}
|
|
24
39
|
}
|
|
25
40
|
```
|
|
26
41
|
|
|
27
|
-
Create
|
|
42
|
+
Create the token from `app.ferrlabs.com` → Settings → API Tokens. It's forwarded as `x-api-token` to `api.ferrlabs.com`.
|
|
28
43
|
|
|
29
44
|
## Available Tools
|
|
30
45
|
|
|
@@ -55,11 +70,26 @@ FerrFlow CLI-specific tools (`dry_run`, `validate_config`, `read_config`, `read_
|
|
|
55
70
|
|
|
56
71
|
## Configuration
|
|
57
72
|
|
|
58
|
-
| Variable
|
|
59
|
-
|
|
|
60
|
-
| `API_URL`
|
|
61
|
-
| `
|
|
62
|
-
| `
|
|
73
|
+
| Variable | Description | Default |
|
|
74
|
+
| ------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
|
|
75
|
+
| `API_URL` | FerrLabs API base URL (no `/v1` suffix — paths are prefixed in code) | `https://api.ferrlabs.com` |
|
|
76
|
+
| `FERRLABS_AUTH_URL` | Auth SPA base URL (where the OAuth browser flow lands) | `https://auth.ferrlabs.com` |
|
|
77
|
+
| `FERRLABS_API_TOKEN` | Pre-provisioned token. Bypasses the OAuth flow. Use for CI / scripted environments. | — |
|
|
78
|
+
| `FERRFLOW_API_TOKEN` | **Deprecated** — accepted as a fallback for backward compatibility with v3.x. | — |
|
|
79
|
+
| `FERRLABS_MCP_NO_OAUTH` | Set to `1` to disable the OAuth fallback. Then `FERRLABS_API_TOKEN` becomes required. | unset |
|
|
80
|
+
| `FERRLABS_MCP_TOKEN_PATH` | Override the path where the OAuth-acquired token is persisted. | `%APPDATA%\ferrlabs\mcp\token.json` / `~/.config/ferrlabs/mcp/token.json` |
|
|
81
|
+
| `FERRLABS_MCP_NO_PERSIST` | Set to `1` to keep the token in memory only (re-auth on every cold start). | unset |
|
|
82
|
+
|
|
83
|
+
### How auth resolution works
|
|
84
|
+
|
|
85
|
+
On the first authenticated tool call, the MCP looks for a token in this order:
|
|
86
|
+
|
|
87
|
+
1. In-memory cache (set during this MCP process's lifetime)
|
|
88
|
+
2. `FERRLABS_API_TOKEN` (or `FERRFLOW_API_TOKEN`) env var
|
|
89
|
+
3. Persisted token file (`FERRLABS_MCP_TOKEN_PATH`)
|
|
90
|
+
4. **OAuth 2.0 loopback PKCE flow** — opens the user's browser, captures the callback on `http://127.0.0.1:54321/cb`, exchanges the code for a session token via `POST /v1/auth/exchange`. Token is persisted to step 3 for future sessions.
|
|
91
|
+
|
|
92
|
+
If you set `FERRLABS_MCP_NO_OAUTH=1`, step 4 is skipped — useful for CI where opening a browser would hang.
|
|
63
93
|
|
|
64
94
|
## Smoke test
|
|
65
95
|
|
|
@@ -86,4 +116,4 @@ Tokens issued by the legacy FerrFlow-only API are not valid against the unified
|
|
|
86
116
|
|
|
87
117
|
## License
|
|
88
118
|
|
|
89
|
-
|
|
119
|
+
Mozilla Public License 2.0 — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/auth/__tests__/index.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
describe('getToken', () => {
|
|
3
|
+
const originalEnv = process.env;
|
|
4
|
+
beforeEach(() => {
|
|
5
|
+
vi.resetModules();
|
|
6
|
+
process.env = { ...originalEnv };
|
|
7
|
+
delete process.env.FERRLABS_API_TOKEN;
|
|
8
|
+
delete process.env.FERRFLOW_API_TOKEN;
|
|
9
|
+
delete process.env.FERRLABS_MCP_NO_OAUTH;
|
|
10
|
+
process.env.FERRLABS_MCP_NO_PERSIST = '1';
|
|
11
|
+
});
|
|
12
|
+
afterEach(() => {
|
|
13
|
+
process.env = originalEnv;
|
|
14
|
+
});
|
|
15
|
+
it('returns FERRLABS_API_TOKEN when set, without touching persistence or OAuth', async () => {
|
|
16
|
+
process.env.FERRLABS_API_TOKEN = 'fl_env_token';
|
|
17
|
+
const { getToken } = await import('../index.js');
|
|
18
|
+
expect(await getToken()).toBe('fl_env_token');
|
|
19
|
+
});
|
|
20
|
+
it('falls back to FERRFLOW_API_TOKEN (legacy compat)', async () => {
|
|
21
|
+
process.env.FERRFLOW_API_TOKEN = 'fl_legacy_token';
|
|
22
|
+
const { getToken } = await import('../index.js');
|
|
23
|
+
expect(await getToken()).toBe('fl_legacy_token');
|
|
24
|
+
});
|
|
25
|
+
it('throws when no token and FERRLABS_MCP_NO_OAUTH=1', async () => {
|
|
26
|
+
process.env.FERRLABS_MCP_NO_OAUTH = '1';
|
|
27
|
+
const { getToken } = await import('../index.js');
|
|
28
|
+
await expect(getToken()).rejects.toThrow(/FERRLABS_API_TOKEN environment variable is required/);
|
|
29
|
+
});
|
|
30
|
+
it('caches the token across calls (env path)', async () => {
|
|
31
|
+
process.env.FERRLABS_API_TOKEN = 'fl_cached';
|
|
32
|
+
const { getToken } = await import('../index.js');
|
|
33
|
+
const a = await getToken();
|
|
34
|
+
process.env.FERRLABS_API_TOKEN = 'fl_changed';
|
|
35
|
+
const b = await getToken();
|
|
36
|
+
expect(a).toBe(b);
|
|
37
|
+
expect(a).toBe('fl_cached');
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth.test.d.ts","sourceRoot":"","sources":["../../../src/auth/__tests__/oauth.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { generatePkcePair } from '../oauth.js';
|
|
3
|
+
import { createHash } from 'node:crypto';
|
|
4
|
+
describe('generatePkcePair', () => {
|
|
5
|
+
it('returns a verifier between 43 and 128 chars (RFC 7636)', () => {
|
|
6
|
+
const { verifier } = generatePkcePair();
|
|
7
|
+
expect(verifier.length).toBeGreaterThanOrEqual(43);
|
|
8
|
+
expect(verifier.length).toBeLessThanOrEqual(128);
|
|
9
|
+
});
|
|
10
|
+
it('returns a challenge that is SHA-256(verifier) base64url-encoded', () => {
|
|
11
|
+
const { verifier, challenge } = generatePkcePair();
|
|
12
|
+
const expected = createHash('sha256').update(verifier).digest('base64url');
|
|
13
|
+
expect(challenge).toBe(expected);
|
|
14
|
+
});
|
|
15
|
+
it('returns different verifier+challenge pairs each call', () => {
|
|
16
|
+
const a = generatePkcePair();
|
|
17
|
+
const b = generatePkcePair();
|
|
18
|
+
expect(a.verifier).not.toBe(b.verifier);
|
|
19
|
+
expect(a.challenge).not.toBe(b.challenge);
|
|
20
|
+
});
|
|
21
|
+
it('returns base64url-encoded values (no +, /, =)', () => {
|
|
22
|
+
const { verifier, challenge } = generatePkcePair();
|
|
23
|
+
expect(verifier).toMatch(/^[A-Za-z0-9_-]+$/);
|
|
24
|
+
expect(challenge).toMatch(/^[A-Za-z0-9_-]+$/);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAMA,wBAAsB,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC,CAgChD;AAED,wBAAgB,yBAAyB,IAAI,IAAI,CAGhD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { readPersistedToken, writePersistedToken } from './persistence.js';
|
|
2
|
+
import { runLoopbackOauthFlow } from './oauth.js';
|
|
3
|
+
let cached = null;
|
|
4
|
+
let inFlight = null;
|
|
5
|
+
export async function getToken() {
|
|
6
|
+
if (cached)
|
|
7
|
+
return cached;
|
|
8
|
+
const envToken = process.env.FERRLABS_API_TOKEN ?? process.env.FERRFLOW_API_TOKEN;
|
|
9
|
+
if (envToken) {
|
|
10
|
+
cached = envToken;
|
|
11
|
+
return envToken;
|
|
12
|
+
}
|
|
13
|
+
const persisted = await readPersistedToken();
|
|
14
|
+
if (persisted) {
|
|
15
|
+
cached = persisted;
|
|
16
|
+
return persisted;
|
|
17
|
+
}
|
|
18
|
+
if (process.env.FERRLABS_MCP_NO_OAUTH === '1') {
|
|
19
|
+
throw new Error('FERRLABS_API_TOKEN environment variable is required (FERRLABS_MCP_NO_OAUTH=1 disables the OAuth fallback).');
|
|
20
|
+
}
|
|
21
|
+
if (!inFlight) {
|
|
22
|
+
inFlight = (async () => {
|
|
23
|
+
const { token } = await runLoopbackOauthFlow();
|
|
24
|
+
await writePersistedToken(token);
|
|
25
|
+
cached = token;
|
|
26
|
+
return token;
|
|
27
|
+
})().finally(() => {
|
|
28
|
+
inFlight = null;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return inFlight;
|
|
32
|
+
}
|
|
33
|
+
export function resetTokenCacheForTesting() {
|
|
34
|
+
cached = null;
|
|
35
|
+
inFlight = null;
|
|
36
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface PkcePair {
|
|
2
|
+
verifier: string;
|
|
3
|
+
challenge: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function generatePkcePair(): PkcePair;
|
|
6
|
+
export interface RunLoopbackFlowResult {
|
|
7
|
+
token: string;
|
|
8
|
+
scope?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function runLoopbackOauthFlow(): Promise<RunLoopbackFlowResult>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=oauth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../src/auth/oauth.ts"],"names":[],"mappings":"AAWA,UAAU,QAAQ;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,gBAAgB,IAAI,QAAQ,CAI3C;AA4FD,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,qBAAqB,CAAC,CA+C3E"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { createHash, randomBytes } from 'node:crypto';
|
|
2
|
+
import { createServer } from 'node:http';
|
|
3
|
+
import { spawn } from 'node:child_process';
|
|
4
|
+
import { platform } from 'node:os';
|
|
5
|
+
const AUTH_BASE = process.env.FERRLABS_AUTH_URL ?? 'https://auth.ferrlabs.com';
|
|
6
|
+
const API_BASE = process.env.API_URL ?? 'https://api.ferrlabs.com';
|
|
7
|
+
const CLIENT_ID = 'mcp';
|
|
8
|
+
const REDIRECT_PORTS = [54321, 54322];
|
|
9
|
+
const AUTH_TIMEOUT_MS = 2 * 60 * 1000;
|
|
10
|
+
export function generatePkcePair() {
|
|
11
|
+
const verifier = randomBytes(64).toString('base64url');
|
|
12
|
+
const challenge = createHash('sha256').update(verifier).digest('base64url');
|
|
13
|
+
return { verifier, challenge };
|
|
14
|
+
}
|
|
15
|
+
function generateState() {
|
|
16
|
+
return randomBytes(16).toString('base64url');
|
|
17
|
+
}
|
|
18
|
+
function openBrowser(url) {
|
|
19
|
+
const args = (() => {
|
|
20
|
+
switch (platform()) {
|
|
21
|
+
case 'win32':
|
|
22
|
+
return { cmd: 'cmd', args: ['/c', 'start', '""', url] };
|
|
23
|
+
case 'darwin':
|
|
24
|
+
return { cmd: 'open', args: [url] };
|
|
25
|
+
default:
|
|
26
|
+
return { cmd: 'xdg-open', args: [url] };
|
|
27
|
+
}
|
|
28
|
+
})();
|
|
29
|
+
const child = spawn(args.cmd, args.args, { detached: true, stdio: 'ignore' });
|
|
30
|
+
child.on('error', () => {
|
|
31
|
+
// ignore — caller will time out and surface the URL via error
|
|
32
|
+
});
|
|
33
|
+
child.unref();
|
|
34
|
+
}
|
|
35
|
+
function listenForCallback(port, expectedState) {
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
const server = createServer((req, res) => {
|
|
38
|
+
try {
|
|
39
|
+
const url = new URL(req.url ?? '/', `http://127.0.0.1:${port}`);
|
|
40
|
+
if (url.pathname !== '/cb') {
|
|
41
|
+
res.writeHead(404).end('Not found');
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const code = url.searchParams.get('code');
|
|
45
|
+
const state = url.searchParams.get('state');
|
|
46
|
+
if (!code || !state) {
|
|
47
|
+
res.writeHead(400).end('Missing code or state');
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (state !== expectedState) {
|
|
51
|
+
res.writeHead(400).end('state mismatch');
|
|
52
|
+
reject(new Error('OAuth callback state mismatch (CSRF protection triggered)'));
|
|
53
|
+
server.close();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8', Connection: 'close' });
|
|
57
|
+
res.end("<!doctype html><html><body style='font-family:sans-serif;padding:2rem;color:#1e293b'><h1>Authorized</h1><p>You can close this tab and return to your terminal.</p></body></html>");
|
|
58
|
+
setImmediate(() => server.close());
|
|
59
|
+
resolve({ code, state });
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
res.writeHead(500).end('Internal error');
|
|
63
|
+
reject(err instanceof Error ? err : new Error(String(err)));
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
server.on('error', reject);
|
|
67
|
+
server.listen(port, '127.0.0.1');
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
async function exchangeCodeForToken(code, codeVerifier, redirectUri) {
|
|
71
|
+
const res = await fetch(`${API_BASE}/v1/auth/exchange`, {
|
|
72
|
+
method: 'POST',
|
|
73
|
+
headers: { 'Content-Type': 'application/json', 'User-Agent': 'ferrlabs-mcp/oauth' },
|
|
74
|
+
body: JSON.stringify({
|
|
75
|
+
code,
|
|
76
|
+
client_id: CLIENT_ID,
|
|
77
|
+
redirect_uri: redirectUri,
|
|
78
|
+
code_verifier: codeVerifier,
|
|
79
|
+
}),
|
|
80
|
+
});
|
|
81
|
+
if (!res.ok) {
|
|
82
|
+
const body = (await res.json().catch(() => ({})));
|
|
83
|
+
throw new Error(`OAuth exchange failed (HTTP ${res.status}): ${body.error ?? body.message ?? 'unknown'}`);
|
|
84
|
+
}
|
|
85
|
+
const data = (await res.json());
|
|
86
|
+
if (!data.token)
|
|
87
|
+
throw new Error('OAuth exchange returned no token');
|
|
88
|
+
return data.token;
|
|
89
|
+
}
|
|
90
|
+
export async function runLoopbackOauthFlow() {
|
|
91
|
+
const pkce = generatePkcePair();
|
|
92
|
+
const state = generateState();
|
|
93
|
+
let port = null;
|
|
94
|
+
let callbackPromise = null;
|
|
95
|
+
for (const candidate of REDIRECT_PORTS) {
|
|
96
|
+
try {
|
|
97
|
+
callbackPromise = listenForCallback(candidate, state);
|
|
98
|
+
port = candidate;
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
callbackPromise = null;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (port === null || !callbackPromise) {
|
|
106
|
+
throw new Error(`Could not bind any of the loopback ports (${REDIRECT_PORTS.join(', ')}). Close whatever is using them and retry.`);
|
|
107
|
+
}
|
|
108
|
+
const redirectUri = `http://127.0.0.1:${port}/cb`;
|
|
109
|
+
const authorizeUrl = new URL(`${AUTH_BASE}/authorize`);
|
|
110
|
+
authorizeUrl.searchParams.set('client_id', CLIENT_ID);
|
|
111
|
+
authorizeUrl.searchParams.set('redirect_uri', redirectUri);
|
|
112
|
+
authorizeUrl.searchParams.set('response_type', 'code');
|
|
113
|
+
authorizeUrl.searchParams.set('code_challenge', pkce.challenge);
|
|
114
|
+
authorizeUrl.searchParams.set('code_challenge_method', 'S256');
|
|
115
|
+
authorizeUrl.searchParams.set('state', state);
|
|
116
|
+
openBrowser(authorizeUrl.toString());
|
|
117
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
118
|
+
setTimeout(() => reject(new Error(`OAuth flow timed out after ${AUTH_TIMEOUT_MS / 1000}s. If your browser didn't open, visit: ${authorizeUrl.toString()}`)), AUTH_TIMEOUT_MS);
|
|
119
|
+
});
|
|
120
|
+
const { code } = await Promise.race([callbackPromise, timeoutPromise]);
|
|
121
|
+
const token = await exchangeCodeForToken(code, pkce.verifier, redirectUri);
|
|
122
|
+
return { token };
|
|
123
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persistence.d.ts","sourceRoot":"","sources":["../../src/auth/persistence.ts"],"names":[],"mappings":"AAmCA,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAYjE;AAED,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBzF;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAOzD"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { mkdir, readFile, writeFile, chmod } from 'node:fs/promises';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import { homedir, platform } from 'node:os';
|
|
4
|
+
function defaultTokenPath() {
|
|
5
|
+
const override = process.env.FERRLABS_MCP_TOKEN_PATH;
|
|
6
|
+
if (override)
|
|
7
|
+
return override;
|
|
8
|
+
const home = homedir();
|
|
9
|
+
switch (platform()) {
|
|
10
|
+
case 'win32':
|
|
11
|
+
return join(process.env.APPDATA ?? join(home, 'AppData', 'Roaming'), 'ferrlabs', 'mcp', 'token.json');
|
|
12
|
+
case 'darwin':
|
|
13
|
+
return join(home, 'Library', 'Application Support', 'ferrlabs', 'mcp', 'token.json');
|
|
14
|
+
default:
|
|
15
|
+
return join(process.env.XDG_CONFIG_HOME ?? join(home, '.config'), 'ferrlabs', 'mcp', 'token.json');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export async function readPersistedToken() {
|
|
19
|
+
if (process.env.FERRLABS_MCP_NO_PERSIST === '1')
|
|
20
|
+
return null;
|
|
21
|
+
try {
|
|
22
|
+
const raw = await readFile(defaultTokenPath(), 'utf8');
|
|
23
|
+
const parsed = JSON.parse(raw);
|
|
24
|
+
if (typeof parsed.token === 'string' && parsed.token.length > 0) {
|
|
25
|
+
return parsed.token;
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export async function writePersistedToken(token, scopes) {
|
|
34
|
+
if (process.env.FERRLABS_MCP_NO_PERSIST === '1')
|
|
35
|
+
return;
|
|
36
|
+
const path = defaultTokenPath();
|
|
37
|
+
await mkdir(dirname(path), { recursive: true });
|
|
38
|
+
const payload = {
|
|
39
|
+
token,
|
|
40
|
+
obtained_at: new Date().toISOString(),
|
|
41
|
+
scopes,
|
|
42
|
+
};
|
|
43
|
+
await writeFile(path, JSON.stringify(payload, null, 2), 'utf8');
|
|
44
|
+
if (platform() !== 'win32') {
|
|
45
|
+
try {
|
|
46
|
+
await chmod(path, 0o600);
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
// ignore — best effort on platforms that don't support POSIX modes
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export async function clearPersistedToken() {
|
|
54
|
+
const { unlink } = await import('node:fs/promises');
|
|
55
|
+
try {
|
|
56
|
+
await unlink(defaultTokenPath());
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
// ignore
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issues.d.ts","sourceRoot":"","sources":["../../src/tools/issues.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"issues.d.ts","sourceRoot":"","sources":["../../src/tools/issues.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAsBpE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,QA+BpD"}
|
package/dist/tools/issues.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { apiRequest } from './api-client.js';
|
|
3
|
-
|
|
4
|
-
function requireToken() {
|
|
5
|
-
if (!API_TOKEN) {
|
|
6
|
-
throw new Error('FERRLABS_API_TOKEN environment variable is required for authenticated operations.');
|
|
7
|
-
}
|
|
8
|
-
return API_TOKEN;
|
|
9
|
-
}
|
|
3
|
+
import { getToken } from '../auth/index.js';
|
|
10
4
|
export function registerIssuesTools(server) {
|
|
11
5
|
server.tool('list_issues', 'List FerrTrack issues for a project (FerrTrack — issue tracker)', {
|
|
12
6
|
org_slug: z.string().min(1).describe('Organization slug'),
|
|
@@ -20,7 +14,7 @@ export function registerIssuesTools(server) {
|
|
|
20
14
|
.optional()
|
|
21
15
|
.describe('Items per page (default 25, max 100)'),
|
|
22
16
|
}, async ({ org_slug, project_slug, page, per_page }) => {
|
|
23
|
-
const token =
|
|
17
|
+
const token = await getToken();
|
|
24
18
|
const params = new URLSearchParams();
|
|
25
19
|
if (page !== undefined)
|
|
26
20
|
params.set('page', String(page));
|
package/dist/tools/orgs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orgs.d.ts","sourceRoot":"","sources":["../../src/tools/orgs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"orgs.d.ts","sourceRoot":"","sources":["../../src/tools/orgs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAqBpE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,QA+BlD"}
|
package/dist/tools/orgs.js
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { apiRequest } from './api-client.js';
|
|
3
|
-
|
|
4
|
-
function requireToken() {
|
|
5
|
-
if (!API_TOKEN) {
|
|
6
|
-
throw new Error('FERRLABS_API_TOKEN environment variable is required for authenticated operations.');
|
|
7
|
-
}
|
|
8
|
-
return API_TOKEN;
|
|
9
|
-
}
|
|
3
|
+
import { getToken } from '../auth/index.js';
|
|
10
4
|
export function registerOrgsTools(server) {
|
|
11
5
|
server.tool('list_orgs', 'List FerrLabs organizations the authenticated user belongs to', {}, async () => {
|
|
12
|
-
const token =
|
|
6
|
+
const token = await getToken();
|
|
13
7
|
const orgs = await apiRequest('/v1/orgs', { token });
|
|
14
8
|
return {
|
|
15
9
|
content: [{ type: 'text', text: JSON.stringify(orgs, null, 2) }],
|
|
@@ -18,7 +12,7 @@ export function registerOrgsTools(server) {
|
|
|
18
12
|
server.tool('list_projects', 'List projects inside a FerrLabs organization', {
|
|
19
13
|
org_slug: z.string().min(1).describe('Organization slug (from list_orgs)'),
|
|
20
14
|
}, async ({ org_slug }) => {
|
|
21
|
-
const token =
|
|
15
|
+
const token = await getToken();
|
|
22
16
|
const projects = await apiRequest(`/v1/orgs/${encodeURIComponent(org_slug)}/projects`, { token });
|
|
23
17
|
return {
|
|
24
18
|
content: [{ type: 'text', text: JSON.stringify(projects, null, 2) }],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../src/tools/subscriptions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../src/tools/subscriptions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAgBpE,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,QAkB3D"}
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { apiRequest } from './api-client.js';
|
|
3
|
-
|
|
4
|
-
function requireToken() {
|
|
5
|
-
if (!API_TOKEN) {
|
|
6
|
-
throw new Error('FERRLABS_API_TOKEN environment variable is required for authenticated operations.');
|
|
7
|
-
}
|
|
8
|
-
return API_TOKEN;
|
|
9
|
-
}
|
|
3
|
+
import { getToken } from '../auth/index.js';
|
|
10
4
|
export function registerSubscriptionsTools(server) {
|
|
11
5
|
server.tool('list_subscriptions', 'List FerrLabs product subscriptions for an organization (FerrVault, FerrTrack, FerrGrowth, FerrFleet)', {
|
|
12
6
|
org_slug: z.string().min(1).describe('Organization slug'),
|
|
13
7
|
}, async ({ org_slug }) => {
|
|
14
|
-
const token =
|
|
8
|
+
const token = await getToken();
|
|
15
9
|
const subs = await apiRequest(`/v1/orgs/${encodeURIComponent(org_slug)}/subscriptions`, { token });
|
|
16
10
|
return {
|
|
17
11
|
content: [{ type: 'text', text: JSON.stringify(subs, null, 2) }],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/tools/tokens.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/tools/tokens.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA4BpE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,QA4EnD"}
|
package/dist/tools/tokens.js
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { apiRequest } from './api-client.js';
|
|
3
|
-
|
|
4
|
-
function requireToken() {
|
|
5
|
-
if (!API_TOKEN) {
|
|
6
|
-
throw new Error('FERRLABS_API_TOKEN environment variable is required for authenticated operations (FERRFLOW_API_TOKEN is accepted as a fallback for backward compatibility).');
|
|
7
|
-
}
|
|
8
|
-
return API_TOKEN;
|
|
9
|
-
}
|
|
3
|
+
import { getToken } from '../auth/index.js';
|
|
10
4
|
export function registerTokenTools(server) {
|
|
11
5
|
server.tool('get_me', 'Get the current authenticated FerrLabs user profile', {}, async () => {
|
|
12
|
-
const token =
|
|
6
|
+
const token = await getToken();
|
|
13
7
|
const user = await apiRequest('/v1/auth/me', { token });
|
|
14
8
|
return {
|
|
15
9
|
content: [
|
|
@@ -21,7 +15,7 @@ export function registerTokenTools(server) {
|
|
|
21
15
|
};
|
|
22
16
|
});
|
|
23
17
|
server.tool('list_tokens', 'List all API tokens for the authenticated user', {}, async () => {
|
|
24
|
-
const token =
|
|
18
|
+
const token = await getToken();
|
|
25
19
|
const tokens = await apiRequest('/v1/auth/tokens', { token });
|
|
26
20
|
return {
|
|
27
21
|
content: [
|
|
@@ -37,7 +31,7 @@ export function registerTokenTools(server) {
|
|
|
37
31
|
scopes: z.array(z.string()).describe('Token scopes (e.g. ["*"] for all)'),
|
|
38
32
|
expires_at: z.string().optional().describe('Expiration date (ISO 8601)'),
|
|
39
33
|
}, async ({ name, scopes, expires_at }) => {
|
|
40
|
-
const token =
|
|
34
|
+
const token = await getToken();
|
|
41
35
|
const result = await apiRequest('/v1/auth/tokens', {
|
|
42
36
|
method: 'POST',
|
|
43
37
|
body: { name, scopes, expires_at },
|
|
@@ -56,7 +50,7 @@ export function registerTokenTools(server) {
|
|
|
56
50
|
server.tool('revoke_token', 'Revoke a FerrLabs API token by ID', {
|
|
57
51
|
token_id: z.string().uuid().describe('Token ID to revoke'),
|
|
58
52
|
}, async ({ token_id }) => {
|
|
59
|
-
const token =
|
|
53
|
+
const token = await getToken();
|
|
60
54
|
await apiRequest(`/v1/auth/tokens/${token_id}`, {
|
|
61
55
|
method: 'DELETE',
|
|
62
56
|
token,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vaults.d.ts","sourceRoot":"","sources":["../../src/tools/vaults.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"vaults.d.ts","sourceRoot":"","sources":["../../src/tools/vaults.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAapE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,QAmBpD"}
|
package/dist/tools/vaults.js
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { apiRequest } from './api-client.js';
|
|
3
|
-
|
|
4
|
-
function requireToken() {
|
|
5
|
-
if (!API_TOKEN) {
|
|
6
|
-
throw new Error('FERRLABS_API_TOKEN environment variable is required for authenticated operations.');
|
|
7
|
-
}
|
|
8
|
-
return API_TOKEN;
|
|
9
|
-
}
|
|
3
|
+
import { getToken } from '../auth/index.js';
|
|
10
4
|
export function registerVaultsTools(server) {
|
|
11
5
|
server.tool('list_vaults', 'List FerrVault vaults inside a project (FerrVault — secrets management)', {
|
|
12
6
|
org_slug: z.string().min(1).describe('Organization slug'),
|
|
13
7
|
project_slug: z.string().min(1).describe('Project slug'),
|
|
14
8
|
}, async ({ org_slug, project_slug }) => {
|
|
15
|
-
const token =
|
|
9
|
+
const token = await getToken();
|
|
16
10
|
const vaults = await apiRequest(`/v1/orgs/${encodeURIComponent(org_slug)}/projects/${encodeURIComponent(project_slug)}/vaults`, { token });
|
|
17
11
|
return {
|
|
18
12
|
content: [{ type: 'text', text: JSON.stringify(vaults, null, 2) }],
|
package/package.json
CHANGED
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"model-context-protocol",
|
|
40
40
|
"ai"
|
|
41
41
|
],
|
|
42
|
-
"license": "
|
|
42
|
+
"license": "MPL-2.0",
|
|
43
43
|
"main": "./dist/index.js",
|
|
44
44
|
"name": "@ferrlabs/mcp",
|
|
45
45
|
"publishConfig": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"url": "https://github.com/FerrLabs/MCP.git"
|
|
51
51
|
},
|
|
52
52
|
"type": "module",
|
|
53
|
-
"version": "
|
|
53
|
+
"version": "5.1.0",
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "tsc",
|
|
56
56
|
"ci:local": "pnpm typecheck && pnpm test && pnpm build",
|