@flagdeck/mcp-server 0.1.1 → 0.4.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/README.md CHANGED
@@ -1,65 +1,59 @@
1
1
  # @flagdeck/mcp-server
2
2
 
3
- **Model Context Protocol (MCP) server for Flagdeck** - enables AI agents like Claude, Cursor, and Windsurf to manage feature flags directly.
3
+ **Model Context Protocol (MCP) server for Flagdeck** - enables AI agents like Claude, Cursor, and VS Code to manage feature flags directly.
4
+
5
+ ## Install
6
+
7
+ [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/install-mcp?name=flagdeck&config=eyJ0eXBlIjoic3RkaW8iLCJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBmbGFnZGVjay9tY3Atc2VydmVyIl0sImVudiI6eyJGTEFHREVDS19BUElfS0VZIjoiJHtGTEFHREVDS19BUElfS0VZfSJ9fQ==)
8
+ [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect/mcp/install?name=flagdeck&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40flagdeck%2Fmcp-server%22%5D%2C%22env%22%3A%7B%22FLAGDECK_API_KEY%22%3A%22%24%7Binput%3Aflagdeck-api-key%7D%22%7D%7D&inputs=%5B%7B%22type%22%3A%22promptString%22%2C%22id%22%3A%22flagdeck-api-key%22%2C%22description%22%3A%22Your%20Flagdeck%20API%20key%22%2C%22password%22%3Atrue%7D%5D)
9
+ [![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install_Server-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=flagdeck&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40flagdeck%2Fmcp-server%22%5D%2C%22env%22%3A%7B%22FLAGDECK_API_KEY%22%3A%22%24%7Binput%3Aflagdeck-api-key%7D%22%7D%7D&inputs=%5B%7B%22type%22%3A%22promptString%22%2C%22id%22%3A%22flagdeck-api-key%22%2C%22description%22%3A%22Your%20Flagdeck%20API%20key%22%2C%22password%22%3Atrue%7D%5D&quality=insiders)
4
10
 
5
11
  ## What is This?
6
12
 
7
13
  This is an MCP server that allows AI coding assistants to:
8
- - ✅ Create, read, update, and delete feature flags
9
- - ✅ Evaluate flags for specific users/contexts
10
- - ✅ Manage projects and environments
11
- - ✅ Use natural language to create/update flags ("Create a dark mode flag for premium users")
12
- - ✅ All from within your editor or CLI
13
14
 
14
- ## Quick Start
15
+ - Create, read, update, and delete feature flags
16
+ - Evaluate flags for specific users/contexts
17
+ - Manage projects and environments
18
+ - Manage flags in plain English — your coding agent maps requests to the structured flag tools
19
+ - All from within your editor or CLI
15
20
 
16
- ### Installation
17
-
18
- ```bash
19
- npm install -g @flagdeck/mcp-server
20
- ```
21
-
22
- ### Configuration
21
+ ## Quick Start
23
22
 
24
- Set up your environment variables:
23
+ You'll need a [Flagdeck API key](https://flagdeck.com).
25
24
 
26
- ```bash
27
- export FLAGDECK_API_KEY=your-api-key
28
- export FLAGDECK_API_URL=https://api.flagdeck.com # optional, defaults to http://localhost:3008
29
- export FLAGDECK_PROJECT_ID=your-project-id # optional, can be provided per-request
30
- export FLAGDECK_ENVIRONMENT=production # optional, defaults to production
31
- ```
25
+ > **Project binding.** Scope your key to a single project and the MCP binds to
26
+ > it automatically — you don't set `FLAGDECK_PROJECT_ID`, and the tools take no
27
+ > `projectId` argument. A key that spans multiple projects needs a `projectId`
28
+ > per call (or set `FLAGDECK_PROJECT_ID` as the working project).
32
29
 
33
- ### Running the Server
30
+ ### Claude Code (CLI)
34
31
 
35
32
  ```bash
36
- flagdeck-mcp
33
+ claude mcp add --transport stdio flagdeck \
34
+ --env FLAGDECK_API_KEY=your-org-management-key \
35
+ -- npx -y @flagdeck/mcp-server
37
36
  ```
38
37
 
39
- The server runs on stdio and communicates via the Model Context Protocol.
40
-
41
- ## Usage with AI Assistants
42
-
43
38
  ### Claude Desktop
44
39
 
45
- Add to your `claude_desktop_config.json`:
40
+ Add to `claude_desktop_config.json`:
46
41
 
47
42
  ```json
48
43
  {
49
44
  "mcpServers": {
50
45
  "flagdeck": {
51
- "command": "flagdeck-mcp",
46
+ "command": "npx",
47
+ "args": ["-y", "@flagdeck/mcp-server"],
52
48
  "env": {
53
- "FLAGDECK_API_KEY": "your-api-key",
54
- "FLAGDECK_API_URL": "https://api.flagdeck.com",
55
- "FLAGDECK_PROJECT_ID": "your-project-id"
49
+ "FLAGDECK_API_KEY": "your-org-management-key"
56
50
  }
57
51
  }
58
52
  }
59
53
  }
60
54
  ```
61
55
 
62
- Then in Claude Desktop:
56
+ Then in Claude:
63
57
 
64
58
  ```
65
59
  You: "Create a dark mode feature flag"
@@ -74,32 +68,34 @@ Claude: *uses evaluate_flag tool* Yes, it's enabled for that user.
74
68
 
75
69
  ### Cursor IDE
76
70
 
77
- Add to `.cursor/mcp.json`:
71
+ Click the button above, or add manually to `.cursor/mcp.json`:
78
72
 
79
73
  ```json
80
74
  {
81
- "servers": {
75
+ "mcpServers": {
82
76
  "flagdeck": {
83
- "command": "flagdeck-mcp",
77
+ "command": "npx",
78
+ "args": ["-y", "@flagdeck/mcp-server"],
84
79
  "env": {
85
- "FLAGDECK_API_KEY": "your-api-key"
80
+ "FLAGDECK_API_KEY": "your-org-management-key"
86
81
  }
87
82
  }
88
83
  }
89
84
  }
90
85
  ```
91
86
 
92
- ### Windsurf
87
+ ### VS Code / Windsurf
93
88
 
94
- Add to Windsurf MCP configuration:
89
+ Click the VS Code button above, or add to your MCP config:
95
90
 
96
91
  ```json
97
92
  {
98
93
  "servers": {
99
94
  "flagdeck": {
100
- "command": "npx @flagdeck/mcp-server",
95
+ "command": "npx",
96
+ "args": ["-y", "@flagdeck/mcp-server"],
101
97
  "env": {
102
- "FLAGDECK_API_KEY": "your-api-key"
98
+ "FLAGDECK_API_KEY": "your-org-management-key"
103
99
  }
104
100
  }
105
101
  }
@@ -111,23 +107,29 @@ Add to Windsurf MCP configuration:
111
107
  ### Project & Environment Management
112
108
 
113
109
  #### `list_projects`
110
+
114
111
  List all projects accessible to your API key.
115
112
 
116
113
  **Example:**
114
+
117
115
  ```
118
116
  "Show me all my projects"
119
117
  ```
120
118
 
121
119
  #### `get_project`
120
+
122
121
  Get details of a specific project.
123
122
 
124
123
  **Parameters:**
124
+
125
125
  - `projectId` (optional): Project ID
126
126
 
127
127
  #### `list_environments`
128
+
128
129
  List all environments in a project.
129
130
 
130
131
  **Parameters:**
132
+
131
133
  - `projectId` (optional): Project ID
132
134
 
133
135
  ---
@@ -135,35 +137,43 @@ List all environments in a project.
135
137
  ### Flag Management
136
138
 
137
139
  #### `list_flags`
140
+
138
141
  List all feature flags in a project.
139
142
 
140
143
  **Parameters:**
144
+
141
145
  - `projectId` (optional): Project ID
142
146
  - `status` (optional): Filter by status (active/inactive/archived)
143
147
  - `search` (optional): Search by name or key
144
148
 
145
149
  **Example:**
150
+
146
151
  ```
147
152
  "Show me all active flags"
148
153
  "List flags containing 'checkout'"
149
154
  ```
150
155
 
151
156
  #### `get_flag`
157
+
152
158
  Get details of a specific flag.
153
159
 
154
160
  **Parameters:**
161
+
155
162
  - `projectId` (optional): Project ID
156
163
  - `flagId` OR `flagKey`: Flag identifier
157
164
 
158
165
  **Example:**
166
+
159
167
  ```
160
168
  "Show me the dark-mode flag"
161
169
  ```
162
170
 
163
171
  #### `create_flag`
172
+
164
173
  Create a new feature flag.
165
174
 
166
175
  **Parameters:**
176
+
167
177
  - `projectId` (optional): Project ID
168
178
  - `key` (required): Unique flag key
169
179
  - `name` (required): Human-readable name
@@ -174,42 +184,52 @@ Create a new feature flag.
174
184
  - `rolloutPercentage` (optional): Rollout percentage (0-100)
175
185
 
176
186
  **Example:**
187
+
177
188
  ```
178
189
  "Create a flag called 'new-checkout' with 25% rollout"
179
190
  ```
180
191
 
181
192
  #### `update_flag`
193
+
182
194
  Update an existing flag.
183
195
 
184
196
  **Parameters:**
197
+
185
198
  - `projectId` (optional): Project ID
186
199
  - `flagId` (required): Flag ID
187
200
  - `name`, `description`, `status`, `defaultValue`, `targetingRules`, `rolloutPercentage` (all optional)
188
201
 
189
202
  **Example:**
203
+
190
204
  ```
191
205
  "Increase new-checkout rollout to 50%"
192
206
  "Disable the dark-mode flag"
193
207
  ```
194
208
 
195
209
  #### `delete_flag`
210
+
196
211
  Permanently delete a flag.
197
212
 
198
213
  **Parameters:**
214
+
199
215
  - `projectId` (optional): Project ID
200
216
  - `flagId` (required): Flag ID
201
217
 
202
218
  #### `toggle_flag`
219
+
203
220
  Toggle a flag between active and inactive.
204
221
 
205
222
  **Parameters:**
223
+
206
224
  - `projectId` (optional): Project ID
207
225
  - `flagId` (required): Flag ID
208
226
 
209
227
  #### `archive_flag`
228
+
210
229
  Archive a flag (soft delete).
211
230
 
212
231
  **Parameters:**
232
+
213
233
  - `projectId` (optional): Project ID
214
234
  - `flagId` (required): Flag ID
215
235
 
@@ -218,64 +238,35 @@ Archive a flag (soft delete).
218
238
  ### Flag Evaluation
219
239
 
220
240
  #### `evaluate_flag`
241
+
221
242
  Evaluate a flag for a specific user/context.
222
243
 
223
244
  **Parameters:**
245
+
224
246
  - `flagKey` (required): Flag key
225
247
  - `context` (required): User context object
226
248
  - `userId`, `email`, `plan`, `country`, etc.
227
249
  - `environment` (optional): Environment name
228
250
 
229
251
  **Example:**
252
+
230
253
  ```
231
254
  "Check if dark-mode is enabled for user@example.com"
232
255
  "Evaluate new-checkout for a user with plan=premium"
233
256
  ```
234
257
 
235
258
  #### `evaluate_batch`
259
+
236
260
  Evaluate multiple flags at once.
237
261
 
238
262
  **Parameters:**
263
+
239
264
  - `flagKeys` (required): Array of flag keys
240
265
  - `context` (required): User context
241
266
  - `environment` (optional): Environment name
242
267
 
243
268
  ---
244
269
 
245
- ### Natural Language AI Tools
246
-
247
- #### `create_flag_natural_language`
248
- Create a flag using natural language.
249
-
250
- **Parameters:**
251
- - `projectId` (optional): Project ID
252
- - `input` (required): Natural language description
253
- - `context` (optional): Additional context
254
-
255
- **Examples:**
256
- ```
257
- "Create a dark mode flag for premium users"
258
- "Add a flag to roll out new checkout to 25% of users"
259
- "Enable advanced analytics for users in US and CA"
260
- ```
261
-
262
- #### `update_flag_natural_language`
263
- Update a flag using natural language.
264
-
265
- **Parameters:**
266
- - `projectId` (optional): Project ID
267
- - `input` (required): Natural language description
268
- - `context` (optional): Should include `flagKey`
269
-
270
- **Examples:**
271
- ```
272
- "Disable the dark-mode flag"
273
- "Increase new-checkout rollout to 75%"
274
- "Archive the old-payment-flow flag"
275
- ```
276
-
277
- ---
278
-
279
270
  ## Examples
280
271
 
281
272
  ### Example 1: Create and Configure a Flag
@@ -284,7 +275,7 @@ Update a flag using natural language.
284
275
  User: "Create a feature flag for beta users"
285
276
 
286
277
  AI: I'll create a beta feature flag for you.
287
- *uses create_flag_natural_language tool*
278
+ *uses create_flag tool*
288
279
 
289
280
  Result: Created flag 'beta-features' with targeting rule for users with plan=beta
290
281
  ```
@@ -311,7 +302,7 @@ Result: Rollout increased to 25%
311
302
  User: "Create a premium-analytics flag only for enterprise users"
312
303
 
313
304
  AI: I'll create that with enterprise targeting.
314
- *uses create_flag_natural_language tool*
305
+ *uses create_flag tool*
315
306
 
316
307
  Result: Created flag with targeting rule: plan equals 'enterprise'
317
308
  ```
@@ -335,17 +326,9 @@ Result: {
335
326
 
336
327
  ## Advanced Usage
337
328
 
338
- ### Custom API Endpoint
339
-
340
- If you're self-hosting Flagdeck:
341
-
342
- ```bash
343
- export FLAGDECK_API_URL=https://your-flagdeck-instance.com
344
- ```
345
-
346
329
  ### Per-Request Project ID
347
330
 
348
- If you manage multiple projects, omit `FLAGDECK_PROJECT_ID` and provide it per-request:
331
+ Tools default to the project your API key belongs to. To act on a different project, name it in the request:
349
332
 
350
333
  ```
351
334
  "List flags in project proj-123"
@@ -390,52 +373,55 @@ npm test
390
373
 
391
374
  ### Configuration
392
375
 
393
- | Environment Variable | Required | Default | Description |
394
- |---------------------|----------|---------|-------------|
395
- | `FLAGDECK_API_KEY` | Yes | - | Your Flagdeck API key |
396
- | `FLAGDECK_API_URL` | No | `http://localhost:3008` | Flagdeck API URL |
397
- | `FLAGDECK_PROJECT_ID` | No | - | Default project ID |
398
- | `FLAGDECK_ENVIRONMENT` | No | `production` | Default environment |
376
+ | Environment Variable | Required | Default | Description |
377
+ | ---------------------- | -------- | ------- | -------------------------------------------------------------------------------------- |
378
+ | `FLAGDECK_API_KEY` | Yes | - | Organization management API key (sent as `Authorization: Bearer`) |
379
+ | `FLAGDECK_PROJECT_ID` | No | - | Working project for a key that spans projects; unused for a single-project (bound) key |
380
+ | `FLAGDECK_ENVIRONMENT` | No | - | Default environment for the `evaluate_*` / `set_flag_targeting` tools |
399
381
 
400
382
  ### Tool Summary
401
383
 
402
- | Tool | Purpose | Required Params |
403
- |------|---------|-----------------|
404
- | `list_projects` | List all projects | - |
405
- | `get_project` | Get project details | - |
406
- | `list_environments` | List environments | - |
407
- | `list_flags` | List flags | - |
408
- | `get_flag` | Get flag details | `flagId` or `flagKey` |
409
- | `create_flag` | Create new flag | `key`, `name`, `valueType`, `defaultValue` |
410
- | `update_flag` | Update flag | `flagId` |
411
- | `delete_flag` | Delete flag | `flagId` |
412
- | `toggle_flag` | Toggle flag status | `flagId` |
413
- | `archive_flag` | Archive flag | `flagId` |
414
- | `evaluate_flag` | Evaluate single flag | `flagKey`, `context` |
415
- | `evaluate_batch` | Evaluate multiple flags | `flagKeys`, `context` |
416
- | `create_flag_natural_language` | AI-powered flag creation | `input` |
417
- | `update_flag_natural_language` | AI-powered flag update | `input` |
384
+ | Tool | Purpose | Required Params |
385
+ | ------------------- | ----------------------- | ------------------------------------------ |
386
+ | `list_projects` | List all projects | - |
387
+ | `get_project` | Get project details | - |
388
+ | `list_environments` | List environments | - |
389
+ | `list_flags` | List flags | - |
390
+ | `get_flag` | Get flag details | `flagId` or `flagKey` |
391
+ | `create_flag` | Create new flag | `key`, `name`, `valueType`, `defaultValue` |
392
+ | `update_flag` | Update flag | `flagId` |
393
+ | `delete_flag` | Delete flag | `flagId` |
394
+ | `toggle_flag` | Toggle flag status | `flagId` |
395
+ | `archive_flag` | Archive flag | `flagId` |
396
+ | `evaluate_flag` | Evaluate single flag | `flagKey`, `context` |
397
+ | `evaluate_batch` | Evaluate multiple flags | `flagKeys`, `context` |
418
398
 
419
399
  ---
420
400
 
421
401
  ## Troubleshooting
422
402
 
423
- ### "FLAGDECK_API_KEY is required"
403
+ ### "FLAGDECK_API_KEY ... is required"
404
+
405
+ Set your organization management key (not an SDK key):
424
406
 
425
- Set your API key:
426
407
  ```bash
427
- export FLAGDECK_API_KEY=your-key-here
408
+ export FLAGDECK_API_KEY=your-org-management-key
409
+ # FLAGDECK_PROJECT_ID is only needed for a key that spans multiple projects
410
+ export FLAGDECK_ENVIRONMENT=development # optional
428
411
  ```
429
412
 
430
413
  ### "projectId is required"
431
414
 
432
- Either set `FLAGDECK_PROJECT_ID` or provide it in each request.
415
+ Your key can access multiple projects, so the MCP can't pick one for you. Pass
416
+ `projectId` in the request, or set `FLAGDECK_PROJECT_ID` as the working project.
417
+ A key scoped to a single project binds automatically and never needs this.
433
418
 
434
419
  ### Connection Errors
435
420
 
436
- Check that `FLAGDECK_API_URL` is correct and the API is reachable:
421
+ Check that the Flagdeck API is reachable:
422
+
437
423
  ```bash
438
- curl $FLAGDECK_API_URL/health
424
+ curl https://api.flagdeck.com/health
439
425
  ```
440
426
 
441
427
  ### Tool Not Found
package/dist/client.d.ts CHANGED
@@ -1,76 +1,123 @@
1
1
  /**
2
2
  * Flagdeck API Client
3
- * Handles communication with the Flagdeck API
3
+ *
4
+ * Talks to the Flagdeck ORGANIZATION MANAGEMENT API (/v1), authenticated with an
5
+ * org management key (Authorization: Bearer). Management, reads and test-
6
+ * evaluation all go through /v1; the SDK evaluation plane (/sdk) is not used.
7
+ * The key's own scope decides the project: a single-project key binds the
8
+ * client to that project; a wildcard/multi key resolves the project per call.
4
9
  */
5
- import { FlagdeckConfig, Flag, CreateFlagInput, UpdateFlagInput, EvaluationContext, EvaluationResult, Project, Environment } from './types.js';
6
- export interface ApiKeyContext {
7
- projectId: string;
8
- projectKey: string;
9
- projectName: string;
10
- projectSlug: string;
10
+ import { FlagdeckConfig, Flag, CreateFlagInput, UpdateFlagInput, EvaluationContext, EvaluationResult, Project, Environment, CodeReferencesRequest, CodeReferencesResponse, FlagCodeReference, FlagCodeRefsSummary, Segment, SegmentInput } from './types.js';
11
+ export interface BoundProject {
12
+ id: string;
13
+ key: string;
14
+ name: string;
15
+ slug: string;
16
+ }
17
+ export interface KeyContext {
11
18
  organizationId: string;
12
- environmentId?: string;
19
+ scopes: string[];
20
+ projectAccess: {
21
+ projectId: string;
22
+ }[];
23
+ /** The single project this key is bound to, or null when it spans projects. */
24
+ boundProjectId: string | null;
25
+ boundProject: BoundProject | null;
13
26
  environmentKey?: string;
14
- environmentName?: string;
15
27
  }
16
28
  export declare class FlagdeckClient {
17
29
  private config;
18
30
  private baseHeaders;
19
- private resolvedProjectId;
20
- private resolvedContext;
31
+ private configuredProjectId;
32
+ private boundProjectId;
33
+ private defaultEnvironment;
34
+ private keyContext;
21
35
  constructor(config: FlagdeckConfig);
36
+ private proj;
37
+ private requireEnv;
22
38
  /**
23
- * Resolve project context from the API key at startup.
24
- * Fetches /sdk/v1/context and caches the projectId for all subsequent calls.
39
+ * Resolve this key's scope from the server. A key bound to exactly one project
40
+ * sets boundProjectId; a wildcard/multi key leaves it null, and project-scoped
41
+ * tools then require a projectId per call.
25
42
  */
26
- initialize(): Promise<ApiKeyContext>;
27
- getResolvedProjectId(): string | undefined;
28
- getContext(): ApiKeyContext | undefined;
43
+ initialize(): Promise<KeyContext>;
44
+ /** True when the key is bound to exactly one project. */
45
+ isBound(): boolean;
46
+ getBoundProjectId(): string | undefined;
47
+ getContext(): KeyContext | undefined;
29
48
  private request;
30
49
  listProjects(): Promise<Project[]>;
31
- getProject(_projectId: string): Promise<Project>;
32
- listEnvironments(_projectId: string): Promise<Environment[]>;
33
- getEnvironment(_projectId: string, _environmentKey: string): Promise<Environment>;
34
- listFlags(_projectId: string, params?: {
50
+ getProject(projectId?: string): Promise<Project>;
51
+ listEnvironments(projectId?: string): Promise<Environment[]>;
52
+ getEnvironment(projectId: string | undefined, environmentKey: string): Promise<Environment>;
53
+ listFlags(projectId?: string, params?: {
35
54
  status?: string;
36
55
  search?: string;
37
56
  }): Promise<Flag[]>;
38
- getFlag(_projectId: string, flagId: string): Promise<Flag>;
39
- getFlagByKey(_projectId: string, flagKey: string): Promise<Flag>;
40
- createFlag(_projectId: string, input: CreateFlagInput): Promise<Flag>;
41
- updateFlag(_projectId: string, flagId: string, input: UpdateFlagInput): Promise<Flag>;
42
- deleteFlag(_projectId: string, flagId: string): Promise<void>;
43
- toggleFlag(_projectId: string, flagId: string): Promise<Flag>;
44
- archiveFlag(_projectId: string, flagId: string): Promise<Flag>;
45
- setFlagTargeting(_projectId: string, flagId: string, input: {
57
+ getFlag(projectId: string | undefined, flagIdOrKey: string): Promise<Flag>;
58
+ getFlagByKey(projectId: string | undefined, flagKey: string): Promise<Flag>;
59
+ createFlag(projectId: string | undefined, input: CreateFlagInput): Promise<Flag>;
60
+ updateFlag(projectId: string | undefined, flagIdOrKey: string, input: UpdateFlagInput): Promise<Flag>;
61
+ deleteFlag(projectId: string | undefined, flagIdOrKey: string): Promise<void>;
62
+ toggleFlag(projectId: string | undefined, flagIdOrKey: string, reason?: string): Promise<Flag>;
63
+ archiveFlag(projectId: string | undefined, flagIdOrKey: string, reason?: string): Promise<Flag>;
64
+ setFlagTargeting(projectId: string | undefined, flagIdOrKey: string, input: {
65
+ environment?: string;
66
+ enabled?: boolean;
46
67
  rolloutPercentage?: number;
47
68
  rules?: Array<{
48
69
  attribute: string;
49
70
  operator: string;
50
71
  value: any;
51
72
  }>;
73
+ individualTargets?: Array<{
74
+ attribute?: string;
75
+ key: string;
76
+ value: any;
77
+ }>;
52
78
  useTargeting?: boolean;
79
+ reason?: string;
53
80
  }): Promise<Flag>;
54
- duplicateFlag(_projectId: string, flagId: string, customValues?: {
81
+ setFlagSchedule(projectId: string | undefined, flagIdOrKey: string, input: {
82
+ environment?: string;
83
+ enabled: boolean;
84
+ startDate?: string | null;
85
+ endDate?: string | null;
86
+ timezone?: string;
87
+ paused?: boolean;
88
+ reason?: string;
89
+ }): Promise<Flag>;
90
+ duplicateFlag(projectId: string | undefined, flagIdOrKey: string, customValues?: {
55
91
  key?: string;
56
92
  name?: string;
57
93
  description?: string;
58
94
  }): Promise<Flag>;
59
- bulkArchive(_projectId: string, flagIds: string[]): Promise<{
95
+ bulkArchive(projectId: string | undefined, flagIds: string[]): Promise<{
60
96
  archived: number;
61
97
  }>;
62
- evaluateFlag(flagKey: string, context: EvaluationContext, environment?: string): Promise<EvaluationResult>;
63
- evaluateBatch(flagKeys: string[], context: EvaluationContext, environment?: string): Promise<Record<string, EvaluationResult>>;
64
- listWebhooks(_projectId: string): Promise<any[]>;
65
- createWebhook(_projectId: string, input: {
98
+ listSegments(projectId?: string): Promise<Segment[]>;
99
+ getSegment(key: string, projectId?: string): Promise<Segment>;
100
+ createSegment(input: SegmentInput, projectId?: string): Promise<Segment>;
101
+ updateSegment(key: string, input: Partial<SegmentInput>, projectId?: string): Promise<Segment>;
102
+ deleteSegment(key: string, projectId?: string): Promise<void>;
103
+ evaluateFlag(flagKey: string, context: EvaluationContext, environment?: string, projectId?: string): Promise<EvaluationResult>;
104
+ evaluateBatch(flagKeys: string[], context: EvaluationContext, environment?: string, projectId?: string): Promise<Record<string, EvaluationResult>>;
105
+ reportCodeReferences(request: CodeReferencesRequest, projectId?: string): Promise<CodeReferencesResponse>;
106
+ getFlagCodeReferences(flagKey: string, projectId?: string): Promise<{
107
+ references: FlagCodeReference[];
108
+ summary: FlagCodeRefsSummary;
109
+ }>;
110
+ listWebhooks(projectId?: string): Promise<any[]>;
111
+ createWebhook(projectId: string | undefined, input: {
66
112
  name: string;
67
113
  url: string;
68
114
  events: string[];
69
115
  }): Promise<any>;
70
- deleteWebhook(_projectId: string, webhookId: string): Promise<void>;
71
- toggleWebhook(_projectId: string, webhookId: string): Promise<any>;
72
- getFlagMetrics(_projectId: string, flagId: string): Promise<any>;
73
- getProjectMetrics(_projectId: string): Promise<any>;
116
+ deleteWebhook(projectId: string | undefined, webhookId: string): Promise<void>;
117
+ toggleWebhook(projectId: string | undefined, webhookId: string): Promise<any>;
118
+ getFlagMetrics(projectId: string | undefined, flagIdOrKey: string): Promise<any>;
119
+ getProjectMetrics(projectId?: string): Promise<any>;
120
+ getFlagHealth(projectId?: string): Promise<any>;
74
121
  healthCheck(): Promise<boolean>;
75
122
  }
76
123
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,cAAc,EACd,IAAI,EACJ,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,OAAO,EACP,WAAW,EACZ,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,WAAW,CAAyB;IAC5C,OAAO,CAAC,iBAAiB,CAAqB;IAC9C,OAAO,CAAC,eAAe,CAA4B;gBAEvC,MAAM,EAAE,cAAc;IAQlC;;;OAGG;IACG,UAAU,IAAI,OAAO,CAA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