@launchdarkly/mcp-server 0.2.3 → 0.2.5
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 +21 -0
- package/README.md +50 -485
- package/bin/mcp-server.js +5 -5
- package/bin/mcp-server.js.map +4 -4
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/mcp-server/mcp-server.js +1 -1
- package/dist/commonjs/mcp-server/server.js +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/mcp-server/mcp-server.js +1 -1
- package/dist/esm/mcp-server/server.js +1 -1
- package/jsr.json +1 -1
- package/package.json +9 -1
- package/src/lib/config.ts +2 -2
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 LaunchDarkly
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -3,87 +3,34 @@
|
|
|
3
3
|
The official [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server for [LaunchDarkly](https://launchdarkly.com/).
|
|
4
4
|
|
|
5
5
|
<div align="left">
|
|
6
|
-
<a href="https://www.speakeasy.com/?utm_source=@launchdarkly/mcp-server&utm_campaign=typescript"><img src="https://custom-icon-badges.demolab.com/badge/-Built%20By%20Speakeasy-212015?style=for-the-badge&logoColor=FBE331&logo=speakeasy&labelColor=545454" /></a>
|
|
7
6
|
<a href="https://opensource.org/licenses/MIT">
|
|
8
7
|
<img src="https://img.shields.io/badge/License-MIT-blue.svg" style="width: 100px; height: 28px;" />
|
|
9
8
|
</a>
|
|
10
9
|
</div>
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
<br /><br />
|
|
14
|
-
> [!IMPORTANT]
|
|
15
|
-
> This SDK is not yet ready for production use. To complete setup please follow the steps outlined in your [workspace](https://app.speakeasy.com/org/launchdarkly/mcp). Delete this section before > publishing to a package manager.
|
|
16
|
-
|
|
17
11
|
<!-- No Summary [summary] -->
|
|
18
12
|
|
|
19
13
|
<!-- Start Table of Contents [toc] -->
|
|
20
14
|
## Table of Contents
|
|
21
15
|
<!-- $toc-max-depth=2 -->
|
|
22
16
|
* [LaunchDarkly's Model Context Protocol (MCP) Server](#launchdarklys-model-context-protocol-mcp-server)
|
|
23
|
-
* [
|
|
17
|
+
* [Installation](#installation)
|
|
24
18
|
* [Requirements](#requirements)
|
|
25
|
-
* [SDK Example Usage](#sdk-example-usage)
|
|
26
|
-
* [Authentication](#authentication)
|
|
27
19
|
* [Available Resources and Operations](#available-resources-and-operations)
|
|
28
|
-
* [
|
|
29
|
-
* [Retries](#retries)
|
|
30
|
-
* [Error Handling](#error-handling)
|
|
31
|
-
* [Server Selection](#server-selection)
|
|
32
|
-
* [Custom HTTP Client](#custom-http-client)
|
|
33
|
-
* [Debugging](#debugging)
|
|
34
|
-
* [Development](#development)
|
|
35
|
-
* [Maturity](#maturity)
|
|
20
|
+
* [Available environments](#available-environments)
|
|
36
21
|
* [Contributions](#contributions)
|
|
22
|
+
* [About LaunchDarkly](#about-launchdarkly)
|
|
37
23
|
|
|
38
24
|
<!-- End Table of Contents [toc] -->
|
|
39
25
|
|
|
40
|
-
<!--
|
|
41
|
-
##
|
|
42
|
-
|
|
43
|
-
The SDK can be installed with either [npm](https://www.npmjs.com/), [pnpm](https://pnpm.io/), [bun](https://bun.sh/) or [yarn](https://classic.yarnpkg.com/en/) package managers.
|
|
26
|
+
<!-- No SDK Installation [installation] -->
|
|
27
|
+
## Installation
|
|
44
28
|
|
|
45
|
-
|
|
29
|
+
This MCP server can be installed in any AI client that supports the MCP protocol. Refer to your AI client's instructions if it isn't listed here.
|
|
46
30
|
|
|
47
|
-
|
|
48
|
-
npm add @launchdarkly/mcp-server
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### PNPM
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
pnpm add @launchdarkly/mcp-server
|
|
55
|
-
```
|
|
31
|
+
### Cursor installation steps
|
|
56
32
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
bun add @launchdarkly/mcp-server
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### Yarn
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
yarn add @launchdarkly/mcp-server zod
|
|
67
|
-
|
|
68
|
-
# Note that Yarn does not install peer dependencies automatically. You will need
|
|
69
|
-
# to install zod as shown above.
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
> [!NOTE]
|
|
73
|
-
> This package is published with CommonJS and ES Modules (ESM) support.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
### Model Context Protocol (MCP) Server
|
|
77
|
-
|
|
78
|
-
This SDK is also an installable MCP server where the various SDK methods are
|
|
79
|
-
exposed as tools that can be invoked by AI applications.
|
|
80
|
-
|
|
81
|
-
> Node.js v20 or greater is required to run the MCP server from npm.
|
|
82
|
-
|
|
83
|
-
<details>
|
|
84
|
-
<summary>Claude installation steps</summary>
|
|
85
|
-
|
|
86
|
-
Add the following server definition to your `claude_desktop_config.json` file:
|
|
33
|
+
Create a `.cursor/mcp.json` file in your project root with the following content:
|
|
87
34
|
|
|
88
35
|
```json
|
|
89
36
|
{
|
|
@@ -92,21 +39,19 @@ Add the following server definition to your `claude_desktop_config.json` file:
|
|
|
92
39
|
"command": "npx",
|
|
93
40
|
"args": [
|
|
94
41
|
"-y", "--package", "@launchdarkly/mcp-server",
|
|
95
|
-
"--",
|
|
96
|
-
"
|
|
97
|
-
"--api-key", "..."
|
|
42
|
+
"--", "mcp", "start",
|
|
43
|
+
"--api-key", "api-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
|
98
44
|
]
|
|
99
45
|
}
|
|
100
46
|
}
|
|
101
47
|
}
|
|
102
48
|
```
|
|
103
49
|
|
|
104
|
-
|
|
50
|
+
Specify your API key as found on LaunchDarkly's Authorization page.
|
|
105
51
|
|
|
106
|
-
|
|
107
|
-
<summary>Cursor installation steps</summary>
|
|
52
|
+
### Claude installation steps
|
|
108
53
|
|
|
109
|
-
|
|
54
|
+
Add the following server definition to your `claude_desktop_config.json` file:
|
|
110
55
|
|
|
111
56
|
```json
|
|
112
57
|
{
|
|
@@ -115,112 +60,35 @@ Create a `.cursor/mcp.json` file in your project root with the following content
|
|
|
115
60
|
"command": "npx",
|
|
116
61
|
"args": [
|
|
117
62
|
"-y", "--package", "@launchdarkly/mcp-server",
|
|
118
|
-
"--",
|
|
119
|
-
"
|
|
120
|
-
"--api-key", "..."
|
|
63
|
+
"--", "mcp", "start",
|
|
64
|
+
"--api-key", "api-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
|
121
65
|
]
|
|
122
66
|
}
|
|
123
67
|
}
|
|
124
68
|
}
|
|
125
69
|
```
|
|
126
70
|
|
|
127
|
-
|
|
71
|
+
Specify your API key as found on LaunchDarkly's Authorization page.
|
|
72
|
+
|
|
73
|
+
### Standalone binary installation steps
|
|
128
74
|
|
|
129
|
-
You can also run MCP
|
|
75
|
+
You can also run the MCP server as a standalone binary with no additional dependencies. You must pull these binaries from available GitHub releases while specifying the appropriate `tag` value:
|
|
130
76
|
|
|
131
77
|
```bash
|
|
132
78
|
curl -L -o mcp-server \
|
|
133
|
-
https://github.com/
|
|
79
|
+
https://github.com/launchdarkly/mcp-server/releases/download/{tag}/mcp-server-bun-darwin-arm64 && \
|
|
134
80
|
chmod +x mcp-server
|
|
135
81
|
```
|
|
136
82
|
|
|
137
|
-
If the repo is a private repo you must add your Github PAT to download a release `-H "Authorization: Bearer {GITHUB_PAT}"`.
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
```json
|
|
141
|
-
{
|
|
142
|
-
"mcpServers": {
|
|
143
|
-
"Todos": {
|
|
144
|
-
"command": "./DOWNLOAD/PATH/mcp-server",
|
|
145
|
-
"args": [
|
|
146
|
-
"start"
|
|
147
|
-
]
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
For a full list of server arguments, run:
|
|
154
|
-
|
|
155
|
-
```sh
|
|
156
|
-
npx -y --package @launchdarkly/mcp-server -- mcp start --help
|
|
157
|
-
```
|
|
158
|
-
<!-- End SDK Installation [installation] -->
|
|
159
|
-
|
|
160
83
|
<!-- Start Requirements [requirements] -->
|
|
161
84
|
## Requirements
|
|
162
85
|
|
|
163
86
|
For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
|
|
164
87
|
<!-- End Requirements [requirements] -->
|
|
165
88
|
|
|
166
|
-
<!--
|
|
167
|
-
## SDK Example Usage
|
|
168
|
-
|
|
169
|
-
### Example
|
|
170
|
-
|
|
171
|
-
```typescript
|
|
172
|
-
import { LaunchDarkly } from "@launchdarkly/mcp-server";
|
|
173
|
-
|
|
174
|
-
const launchDarkly = new LaunchDarkly({
|
|
175
|
-
apiKey: process.env["LAUNCHDARKLY_API_KEY"] ?? "",
|
|
176
|
-
});
|
|
89
|
+
<!-- No SDK Example Usage [usage] -->
|
|
177
90
|
|
|
178
|
-
|
|
179
|
-
const result = await launchDarkly.featureFlags.list({
|
|
180
|
-
projectKey: "<value>",
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
// Handle the result
|
|
184
|
-
console.log(result);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
run();
|
|
188
|
-
|
|
189
|
-
```
|
|
190
|
-
<!-- End SDK Example Usage [usage] -->
|
|
191
|
-
|
|
192
|
-
<!-- Start Authentication [security] -->
|
|
193
|
-
## Authentication
|
|
194
|
-
|
|
195
|
-
### Per-Client Security Schemes
|
|
196
|
-
|
|
197
|
-
This SDK supports the following security scheme globally:
|
|
198
|
-
|
|
199
|
-
| Name | Type | Scheme | Environment Variable |
|
|
200
|
-
| -------- | ------ | ------- | ---------------------- |
|
|
201
|
-
| `apiKey` | apiKey | API key | `LAUNCHDARKLY_API_KEY` |
|
|
202
|
-
|
|
203
|
-
To authenticate with the API the `apiKey` parameter must be set when initializing the SDK client instance. For example:
|
|
204
|
-
```typescript
|
|
205
|
-
import { LaunchDarkly } from "@launchdarkly/mcp-server";
|
|
206
|
-
|
|
207
|
-
const launchDarkly = new LaunchDarkly({
|
|
208
|
-
apiKey: process.env["LAUNCHDARKLY_API_KEY"] ?? "",
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
async function run() {
|
|
212
|
-
const result = await launchDarkly.featureFlags.list({
|
|
213
|
-
projectKey: "<value>",
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
// Handle the result
|
|
217
|
-
console.log(result);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
run();
|
|
221
|
-
|
|
222
|
-
```
|
|
223
|
-
<!-- End Authentication [security] -->
|
|
91
|
+
<!-- No Authentication [security] -->
|
|
224
92
|
|
|
225
93
|
<!-- Start Available Resources and Operations [operations] -->
|
|
226
94
|
## Available Resources and Operations
|
|
@@ -252,350 +120,47 @@ run();
|
|
|
252
120
|
</details>
|
|
253
121
|
<!-- End Available Resources and Operations [operations] -->
|
|
254
122
|
|
|
255
|
-
<!--
|
|
256
|
-
## Standalone functions
|
|
257
|
-
|
|
258
|
-
All the methods listed above are available as standalone functions. These
|
|
259
|
-
functions are ideal for use in applications running in the browser, serverless
|
|
260
|
-
runtimes or other environments where application bundle size is a primary
|
|
261
|
-
concern. When using a bundler to build your application, all unused
|
|
262
|
-
functionality will be either excluded from the final bundle or tree-shaken away.
|
|
263
|
-
|
|
264
|
-
To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
|
|
265
|
-
|
|
266
|
-
<details>
|
|
267
|
-
|
|
268
|
-
<summary>Available standalone functions</summary>
|
|
269
|
-
|
|
270
|
-
- [`aiConfigsCreate`](docs/sdks/aiconfigs/README.md#create) - Create new AI Config
|
|
271
|
-
- [`aiConfigsCreateVariation`](docs/sdks/aiconfigs/README.md#createvariation) - Create AI Config variation
|
|
272
|
-
- [`aiConfigsDelete`](docs/sdks/aiconfigs/README.md#delete) - Delete AI Config
|
|
273
|
-
- [`aiConfigsDeleteVariation`](docs/sdks/aiconfigs/README.md#deletevariation) - Delete AI Config variation
|
|
274
|
-
- [`aiConfigsGet`](docs/sdks/aiconfigs/README.md#get) - Get AI Config
|
|
275
|
-
- [`aiConfigsGetVariation`](docs/sdks/aiconfigs/README.md#getvariation) - Get AI Config variation
|
|
276
|
-
- [`aiConfigsList`](docs/sdks/aiconfigs/README.md#list) - List AI Configs
|
|
277
|
-
- [`aiConfigsUpdate`](docs/sdks/aiconfigs/README.md#update) - Update AI Config
|
|
278
|
-
- [`aiConfigsUpdateVariation`](docs/sdks/aiconfigs/README.md#updatevariation) - Update AI Config variation
|
|
279
|
-
- [`featureFlagsCreate`](docs/sdks/featureflags/README.md#create) - Create a feature flag
|
|
280
|
-
- [`featureFlagsDelete`](docs/sdks/featureflags/README.md#delete) - Delete feature flag
|
|
281
|
-
- [`featureFlagsGet`](docs/sdks/featureflags/README.md#get) - Get feature flag
|
|
282
|
-
- [`featureFlagsList`](docs/sdks/featureflags/README.md#list) - List feature flags
|
|
283
|
-
- [`featureFlagsPatch`](docs/sdks/featureflags/README.md#patch) - Update feature flag
|
|
284
|
-
|
|
285
|
-
</details>
|
|
286
|
-
<!-- End Standalone functions [standalone-funcs] -->
|
|
287
|
-
|
|
288
|
-
<!-- Start Retries [retries] -->
|
|
289
|
-
## Retries
|
|
290
|
-
|
|
291
|
-
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
|
|
292
|
-
|
|
293
|
-
To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
|
|
294
|
-
```typescript
|
|
295
|
-
import { LaunchDarkly } from "@launchdarkly/mcp-server";
|
|
296
|
-
|
|
297
|
-
const launchDarkly = new LaunchDarkly({
|
|
298
|
-
apiKey: process.env["LAUNCHDARKLY_API_KEY"] ?? "",
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
async function run() {
|
|
302
|
-
const result = await launchDarkly.featureFlags.list({
|
|
303
|
-
projectKey: "<value>",
|
|
304
|
-
}, {
|
|
305
|
-
retries: {
|
|
306
|
-
strategy: "backoff",
|
|
307
|
-
backoff: {
|
|
308
|
-
initialInterval: 1,
|
|
309
|
-
maxInterval: 50,
|
|
310
|
-
exponent: 1.1,
|
|
311
|
-
maxElapsedTime: 100,
|
|
312
|
-
},
|
|
313
|
-
retryConnectionErrors: false,
|
|
314
|
-
},
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
// Handle the result
|
|
318
|
-
console.log(result);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
run();
|
|
322
|
-
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
|
|
326
|
-
```typescript
|
|
327
|
-
import { LaunchDarkly } from "@launchdarkly/mcp-server";
|
|
328
|
-
|
|
329
|
-
const launchDarkly = new LaunchDarkly({
|
|
330
|
-
retryConfig: {
|
|
331
|
-
strategy: "backoff",
|
|
332
|
-
backoff: {
|
|
333
|
-
initialInterval: 1,
|
|
334
|
-
maxInterval: 50,
|
|
335
|
-
exponent: 1.1,
|
|
336
|
-
maxElapsedTime: 100,
|
|
337
|
-
},
|
|
338
|
-
retryConnectionErrors: false,
|
|
339
|
-
},
|
|
340
|
-
apiKey: process.env["LAUNCHDARKLY_API_KEY"] ?? "",
|
|
341
|
-
});
|
|
342
|
-
|
|
343
|
-
async function run() {
|
|
344
|
-
const result = await launchDarkly.featureFlags.list({
|
|
345
|
-
projectKey: "<value>",
|
|
346
|
-
});
|
|
347
|
-
|
|
348
|
-
// Handle the result
|
|
349
|
-
console.log(result);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
run();
|
|
353
|
-
|
|
354
|
-
```
|
|
355
|
-
<!-- End Retries [retries] -->
|
|
356
|
-
|
|
357
|
-
<!-- Start Error Handling [errors] -->
|
|
358
|
-
## Error Handling
|
|
359
|
-
|
|
360
|
-
Some methods specify known errors which can be thrown. All the known errors are enumerated in the `models/errors/errors.ts` module. The known errors for a method are documented under the *Errors* tables in SDK docs. For example, the `list` method may throw the following errors:
|
|
361
|
-
|
|
362
|
-
| Error Type | Status Code | Content Type |
|
|
363
|
-
| ----------------------------- | ----------- | ---------------- |
|
|
364
|
-
| errors.InvalidRequestErrorRep | 400 | application/json |
|
|
365
|
-
| errors.UnauthorizedErrorRep | 401 | application/json |
|
|
366
|
-
| errors.ForbiddenErrorRep | 403 | application/json |
|
|
367
|
-
| errors.NotFoundErrorRep | 404 | application/json |
|
|
368
|
-
| errors.RateLimitedErrorRep | 429 | application/json |
|
|
369
|
-
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
370
|
-
|
|
371
|
-
If the method throws an error and it is not captured by the known errors, it will default to throwing a `APIError`.
|
|
372
|
-
|
|
373
|
-
```typescript
|
|
374
|
-
import { LaunchDarkly } from "@launchdarkly/mcp-server";
|
|
375
|
-
import {
|
|
376
|
-
ForbiddenErrorRep,
|
|
377
|
-
InvalidRequestErrorRep,
|
|
378
|
-
NotFoundErrorRep,
|
|
379
|
-
RateLimitedErrorRep,
|
|
380
|
-
SDKValidationError,
|
|
381
|
-
UnauthorizedErrorRep,
|
|
382
|
-
} from "@launchdarkly/mcp-server/models/errors";
|
|
383
|
-
|
|
384
|
-
const launchDarkly = new LaunchDarkly({
|
|
385
|
-
apiKey: process.env["LAUNCHDARKLY_API_KEY"] ?? "",
|
|
386
|
-
});
|
|
387
|
-
|
|
388
|
-
async function run() {
|
|
389
|
-
let result;
|
|
390
|
-
try {
|
|
391
|
-
result = await launchDarkly.featureFlags.list({
|
|
392
|
-
projectKey: "<value>",
|
|
393
|
-
});
|
|
394
|
-
|
|
395
|
-
// Handle the result
|
|
396
|
-
console.log(result);
|
|
397
|
-
} catch (err) {
|
|
398
|
-
switch (true) {
|
|
399
|
-
// The server response does not match the expected SDK schema
|
|
400
|
-
case (err instanceof SDKValidationError): {
|
|
401
|
-
// Pretty-print will provide a human-readable multi-line error message
|
|
402
|
-
console.error(err.pretty());
|
|
403
|
-
// Raw value may also be inspected
|
|
404
|
-
console.error(err.rawValue);
|
|
405
|
-
return;
|
|
406
|
-
}
|
|
407
|
-
case (err instanceof InvalidRequestErrorRep): {
|
|
408
|
-
// Handle err.data$: InvalidRequestErrorRepData
|
|
409
|
-
console.error(err);
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
|
-
case (err instanceof UnauthorizedErrorRep): {
|
|
413
|
-
// Handle err.data$: UnauthorizedErrorRepData
|
|
414
|
-
console.error(err);
|
|
415
|
-
return;
|
|
416
|
-
}
|
|
417
|
-
case (err instanceof ForbiddenErrorRep): {
|
|
418
|
-
// Handle err.data$: ForbiddenErrorRepData
|
|
419
|
-
console.error(err);
|
|
420
|
-
return;
|
|
421
|
-
}
|
|
422
|
-
case (err instanceof NotFoundErrorRep): {
|
|
423
|
-
// Handle err.data$: NotFoundErrorRepData
|
|
424
|
-
console.error(err);
|
|
425
|
-
return;
|
|
426
|
-
}
|
|
427
|
-
case (err instanceof RateLimitedErrorRep): {
|
|
428
|
-
// Handle err.data$: RateLimitedErrorRepData
|
|
429
|
-
console.error(err);
|
|
430
|
-
return;
|
|
431
|
-
}
|
|
432
|
-
default: {
|
|
433
|
-
// Other errors such as network errors, see HTTPClientErrors for more details
|
|
434
|
-
throw err;
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
run();
|
|
441
|
-
|
|
442
|
-
```
|
|
443
|
-
|
|
444
|
-
Validation errors can also occur when either method arguments or data returned from the server do not match the expected format. The `SDKValidationError` that is thrown as a result will capture the raw value that failed validation in an attribute called `rawValue`. Additionally, a `pretty()` method is available on this error that can be used to log a nicely formatted multi-line string since validation errors can list many issues and the plain error string may be difficult read when debugging.
|
|
445
|
-
|
|
446
|
-
In some rare cases, the SDK can fail to get a response from the server or even make the request due to unexpected circumstances such as network conditions. These types of errors are captured in the `models/errors/httpclienterrors.ts` module:
|
|
447
|
-
|
|
448
|
-
| HTTP Client Error | Description |
|
|
449
|
-
| ---------------------------------------------------- | ---------------------------------------------------- |
|
|
450
|
-
| RequestAbortedError | HTTP request was aborted by the client |
|
|
451
|
-
| RequestTimeoutError | HTTP request timed out due to an AbortSignal signal |
|
|
452
|
-
| ConnectionError | HTTP client was unable to make a request to a server |
|
|
453
|
-
| InvalidRequestError | Any input used to create a request is invalid |
|
|
454
|
-
| UnexpectedClientError | Unrecognised or unexpected error |
|
|
455
|
-
<!-- End Error Handling [errors] -->
|
|
456
|
-
|
|
457
|
-
<!-- Start Server Selection [server] -->
|
|
458
|
-
## Server Selection
|
|
459
|
-
|
|
460
|
-
### Select Server by Index
|
|
461
|
-
|
|
462
|
-
You can override the default server globally by passing a server index to the `serverIdx: number` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
|
|
463
|
-
|
|
464
|
-
| # | Server | Description |
|
|
465
|
-
| --- | ------------------------------ | --------------- |
|
|
466
|
-
| 0 | `https://app.launchdarkly.com` | Default |
|
|
467
|
-
| 1 | `https://app.launchdarkly.us` | Federal |
|
|
468
|
-
| 2 | `https://app.launchdarkly.com` | Prod API server |
|
|
469
|
-
|
|
470
|
-
#### Example
|
|
471
|
-
|
|
472
|
-
```typescript
|
|
473
|
-
import { LaunchDarkly } from "@launchdarkly/mcp-server";
|
|
123
|
+
<!-- No Standalone functions [standalone-funcs] -->
|
|
474
124
|
|
|
475
|
-
|
|
476
|
-
serverIdx: 2,
|
|
477
|
-
apiKey: process.env["LAUNCHDARKLY_API_KEY"] ?? "",
|
|
478
|
-
});
|
|
125
|
+
<!-- No Retries [retries] -->
|
|
479
126
|
|
|
480
|
-
|
|
481
|
-
const result = await launchDarkly.featureFlags.list({
|
|
482
|
-
projectKey: "<value>",
|
|
483
|
-
});
|
|
127
|
+
<!-- No Error Handling [errors] -->
|
|
484
128
|
|
|
485
|
-
|
|
486
|
-
console.log(result);
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
run();
|
|
490
|
-
|
|
491
|
-
```
|
|
492
|
-
|
|
493
|
-
### Override Server URL Per-Client
|
|
494
|
-
|
|
495
|
-
The default server can also be overridden globally by passing a URL to the `serverURL: string` optional parameter when initializing the SDK client instance. For example:
|
|
496
|
-
```typescript
|
|
497
|
-
import { LaunchDarkly } from "@launchdarkly/mcp-server";
|
|
498
|
-
|
|
499
|
-
const launchDarkly = new LaunchDarkly({
|
|
500
|
-
serverURL: "https://app.launchdarkly.com",
|
|
501
|
-
apiKey: process.env["LAUNCHDARKLY_API_KEY"] ?? "",
|
|
502
|
-
});
|
|
503
|
-
|
|
504
|
-
async function run() {
|
|
505
|
-
const result = await launchDarkly.featureFlags.list({
|
|
506
|
-
projectKey: "<value>",
|
|
507
|
-
});
|
|
508
|
-
|
|
509
|
-
// Handle the result
|
|
510
|
-
console.log(result);
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
run();
|
|
514
|
-
|
|
515
|
-
```
|
|
516
|
-
<!-- End Server Selection [server] -->
|
|
517
|
-
|
|
518
|
-
<!-- Start Custom HTTP Client [http-client] -->
|
|
519
|
-
## Custom HTTP Client
|
|
520
|
-
|
|
521
|
-
The TypeScript SDK makes API calls using an `HTTPClient` that wraps the native
|
|
522
|
-
[Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). This
|
|
523
|
-
client is a thin wrapper around `fetch` and provides the ability to attach hooks
|
|
524
|
-
around the request lifecycle that can be used to modify the request or handle
|
|
525
|
-
errors and response.
|
|
526
|
-
|
|
527
|
-
The `HTTPClient` constructor takes an optional `fetcher` argument that can be
|
|
528
|
-
used to integrate a third-party HTTP client or when writing tests to mock out
|
|
529
|
-
the HTTP client and feed in fixtures.
|
|
129
|
+
<!-- No Server Selection [server] -->
|
|
530
130
|
|
|
531
|
-
|
|
532
|
-
custom header and a timeout to requests and how to use the `"requestError"` hook
|
|
533
|
-
to log errors:
|
|
534
|
-
|
|
535
|
-
```typescript
|
|
536
|
-
import { LaunchDarkly } from "@launchdarkly/mcp-server";
|
|
537
|
-
import { HTTPClient } from "@launchdarkly/mcp-server/lib/http";
|
|
538
|
-
|
|
539
|
-
const httpClient = new HTTPClient({
|
|
540
|
-
// fetcher takes a function that has the same signature as native `fetch`.
|
|
541
|
-
fetcher: (request) => {
|
|
542
|
-
return fetch(request);
|
|
543
|
-
}
|
|
544
|
-
});
|
|
545
|
-
|
|
546
|
-
httpClient.addHook("beforeRequest", (request) => {
|
|
547
|
-
const nextRequest = new Request(request, {
|
|
548
|
-
signal: request.signal || AbortSignal.timeout(5000)
|
|
549
|
-
});
|
|
550
|
-
|
|
551
|
-
nextRequest.headers.set("x-custom-header", "custom value");
|
|
552
|
-
|
|
553
|
-
return nextRequest;
|
|
554
|
-
});
|
|
555
|
-
|
|
556
|
-
httpClient.addHook("requestError", (error, request) => {
|
|
557
|
-
console.group("Request Error");
|
|
558
|
-
console.log("Reason:", `${error}`);
|
|
559
|
-
console.log("Endpoint:", `${request.method} ${request.url}`);
|
|
560
|
-
console.groupEnd();
|
|
561
|
-
});
|
|
562
|
-
|
|
563
|
-
const sdk = new LaunchDarkly({ httpClient });
|
|
564
|
-
```
|
|
565
|
-
<!-- End Custom HTTP Client [http-client] -->
|
|
566
|
-
|
|
567
|
-
<!-- Start Debugging [debug] -->
|
|
568
|
-
## Debugging
|
|
569
|
-
|
|
570
|
-
You can setup your SDK to emit debug logs for SDK requests and responses.
|
|
571
|
-
|
|
572
|
-
You can pass a logger that matches `console`'s interface as an SDK option.
|
|
573
|
-
|
|
574
|
-
> [!WARNING]
|
|
575
|
-
> Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production.
|
|
576
|
-
|
|
577
|
-
```typescript
|
|
578
|
-
import { LaunchDarkly } from "@launchdarkly/mcp-server";
|
|
579
|
-
|
|
580
|
-
const sdk = new LaunchDarkly({ debugLogger: console });
|
|
581
|
-
```
|
|
131
|
+
<!-- No Custom HTTP Client [http-client] -->
|
|
582
132
|
|
|
583
|
-
|
|
584
|
-
<!-- End Debugging [debug] -->
|
|
133
|
+
<!-- No Debugging [debug] -->
|
|
585
134
|
|
|
586
135
|
<!-- Placeholder for Future Speakeasy SDK Sections -->
|
|
587
136
|
|
|
588
|
-
|
|
137
|
+
## Available environments
|
|
589
138
|
|
|
590
|
-
|
|
139
|
+
Most customer accounts run on LaunchDarkly's commercial (default) environment. Customers on other environments can specify the `--server-url` argument to connect to the appropriate environment. For example, customers on LaunchDarkly's Federal environment should specify the `--server-url https://app.launchdarkly.us` argument when starting their MCP server.
|
|
591
140
|
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
141
|
+
| Environment | Server URL |
|
|
142
|
+
| -------------------- | --------------------------------- |
|
|
143
|
+
| Commercial (Default) | `https://app.launchdarkly.com` |
|
|
144
|
+
| Federal | `https://app.launchdarkly.us` |
|
|
145
|
+
| EU | `https://app.eu.launchdarkly.com` |
|
|
595
146
|
|
|
596
147
|
## Contributions
|
|
597
148
|
|
|
598
149
|
While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation.
|
|
599
150
|
We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
|
|
600
151
|
|
|
601
|
-
|
|
152
|
+
## About LaunchDarkly
|
|
153
|
+
|
|
154
|
+
- LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can:
|
|
155
|
+
- Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
|
|
156
|
+
- Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
|
|
157
|
+
- Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
|
|
158
|
+
- Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan).
|
|
159
|
+
- Disable parts of your application to facilitate maintenance, without taking everything offline.
|
|
160
|
+
- LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Read [our documentation](https://launchdarkly.com/docs/sdk) for a complete list.
|
|
161
|
+
- Explore LaunchDarkly
|
|
162
|
+
- [https://app.launchdarkly.com/signup](Sign up for a free LaunchDarkly account here)
|
|
163
|
+
- [launchdarkly.com](https://www.launchdarkly.com/ 'LaunchDarkly Main Website') for more information
|
|
164
|
+
- [launchdarkly.com/docs](https://launchdarkly.com/docs/home 'LaunchDarkly Documentation') for our documentation and SDK reference guides
|
|
165
|
+
- [launchdarkly.com/docs/api](https://launchdarkly.com/docs/api 'LaunchDarkly API Documentation') for our API documentation
|
|
166
|
+
- [blog.launchdarkly.com](https://launchdarkly.com/blog/ 'LaunchDarkly Blog Documentation') for the latest product updates
|
package/bin/mcp-server.js
CHANGED
|
@@ -34236,9 +34236,9 @@ var init_config = __esm(() => {
|
|
|
34236
34236
|
SDK_METADATA = {
|
|
34237
34237
|
language: "typescript",
|
|
34238
34238
|
openapiDocVersion: "2.0",
|
|
34239
|
-
sdkVersion: "0.2.
|
|
34239
|
+
sdkVersion: "0.2.5",
|
|
34240
34240
|
genVersion: "2.610.0",
|
|
34241
|
-
userAgent: "speakeasy-sdk/typescript 0.2.
|
|
34241
|
+
userAgent: "speakeasy-sdk/typescript 0.2.5 2.610.0 2.0 @launchdarkly/mcp-server"
|
|
34242
34242
|
};
|
|
34243
34243
|
});
|
|
34244
34244
|
|
|
@@ -40075,7 +40075,7 @@ var init_featureFlagsPatch2 = __esm(() => {
|
|
|
40075
40075
|
function createMCPServer(deps) {
|
|
40076
40076
|
const server = new McpServer({
|
|
40077
40077
|
name: "LaunchDarkly",
|
|
40078
|
-
version: "0.2.
|
|
40078
|
+
version: "0.2.5"
|
|
40079
40079
|
});
|
|
40080
40080
|
const client = new LaunchDarklyCore({
|
|
40081
40081
|
apiKey: deps.apiKey,
|
|
@@ -41317,7 +41317,7 @@ var routes = an({
|
|
|
41317
41317
|
var app = He(routes, {
|
|
41318
41318
|
name: "mcp",
|
|
41319
41319
|
versionInfo: {
|
|
41320
|
-
currentVersion: "0.2.
|
|
41320
|
+
currentVersion: "0.2.5"
|
|
41321
41321
|
}
|
|
41322
41322
|
});
|
|
41323
41323
|
zt(app, process3.argv.slice(2), buildContext(process3));
|
|
@@ -41325,5 +41325,5 @@ export {
|
|
|
41325
41325
|
app
|
|
41326
41326
|
};
|
|
41327
41327
|
|
|
41328
|
-
//# debugId=
|
|
41328
|
+
//# debugId=B8EF49D8197E02A264756E2164756E21
|
|
41329
41329
|
//# sourceMappingURL=mcp-server.js.map
|