@airctrl/mcp 0.2.0 → 0.3.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 +217 -23
- package/dist/config.js +1 -0
- package/dist/index.js +1 -1
- package/dist/tools.js +119 -76
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -205,6 +205,26 @@ any listed operation when the Service Account lacks the required custom-role per
|
|
|
205
205
|
| `update_project` | `accountId`, `projectId`, `name`, `description`, `isActive` | Replace project name, description and active state. |
|
|
206
206
|
| `set_project_archive` | `accountId`, `projectId`, `archived` | Archive or restore one project. |
|
|
207
207
|
|
|
208
|
+
### Groups and access material
|
|
209
|
+
|
|
210
|
+
These tools are human-only. Team+ and RBAC apply; Service Accounts cannot manage or join human groups. Read [Groups and effective access](https://docs.airctrl.dev/guides/projects#groups-and-effective-access) before changing membership.
|
|
211
|
+
|
|
212
|
+
| Tool | Inputs | Purpose |
|
|
213
|
+
|---|---|---|
|
|
214
|
+
| `list_groups` | `accountId`, `projectId` | List groups in the project context and their current grants. |
|
|
215
|
+
| `list_record_group_grants` | `accountId`, `recordId` | Read group sharing options and caller capabilities. |
|
|
216
|
+
| `create_group` | `accountId`, `projectId`, `name`; optional `description` | Create a reusable account group without granting a project role. |
|
|
217
|
+
| `update_group` | `accountId`, `groupId`, `name`; optional `description` | Replace name and description; omission clears description. |
|
|
218
|
+
| `delete_group` | `accountId`, `groupId` | Delete the group while preserving independent access paths. |
|
|
219
|
+
| `list_group_members` | `accountId`, `groupId` | List current members, not candidate users. |
|
|
220
|
+
| `add_group_member` | `accountId`, `groupId`, `userId` | Add membership across existing group grants. |
|
|
221
|
+
| `remove_group_member` | `accountId`, `groupId`, `userId` | Remove only this membership and reconcile effective access. |
|
|
222
|
+
| `grant_project_group` | `accountId`, `projectId`, `groupId`, `roleId` | Grant an existing delegable project role. |
|
|
223
|
+
| `revoke_project_group` | `accountId`, `projectId`, `groupId`, `roleId` | Revoke only this project/group/role assignment. |
|
|
224
|
+
| `reconcile_group_access` | `accountId`; optional `projectIds` | Attempt pending material repair with the configured local vault. |
|
|
225
|
+
|
|
226
|
+
Membership, deletion and grant results are server snapshots, including `changed`, wrapper-deletion counts and per-resource `changes`. Check pending material and remaining paths; success is not proof that every recipient can decrypt. Reconciliation returns attempts in `attemptedProjectIds`, never a permission grant. Optional project IDs limit project repair, not pending direct group-record shares in the account. Missing holder material can remain pending. Never put a passphrase in a prompt; use the existing local MCP vault configuration.
|
|
227
|
+
|
|
208
228
|
### Service Account metadata
|
|
209
229
|
|
|
210
230
|
| Tool | Inputs | Purpose |
|
|
@@ -219,30 +239,30 @@ These metadata tools are human-only. Service Account creation, state changes, cr
|
|
|
219
239
|
| Tool | Inputs | Purpose |
|
|
220
240
|
|---|---|---|
|
|
221
241
|
| `list_records` | Optional `projectId`, `accountId`, `tab`, `includeArchived`, `limit`, `offset` | List accessible record metadata. |
|
|
222
|
-
| `get_secret` | `recordId` | Decrypt one
|
|
223
|
-
| `read_record` | `recordId`; optional `scope`, `environment` | Read selected record sections. `fields` returns
|
|
224
|
-
| `get_all` | `projectId` | Decrypt
|
|
242
|
+
| `get_secret` | `recordId`; optional `environment` | Decrypt one General or selected Environment value locally. |
|
|
243
|
+
| `read_record` | `recordId`; optional `scope`, `environment` | Read selected record sections and only the selected secret value. `fields` returns its complete decrypted field map. |
|
|
244
|
+
| `get_all` | `projectId`; optional `environment` | Decrypt accessible General or selected Environment values in one project. |
|
|
225
245
|
| `list_secret_types` | None | List supported record formats and field definitions. |
|
|
226
246
|
| `generate_secret` | `format`; optional `options` | Generate supported secret material locally without storing it. |
|
|
227
|
-
| `create_record` | `projectId`, `name`, `secretFormat`; optional `fields`, `generate`, `options`, `tags`, `secretDueAt`, `rotationIntervalDays`, `idempotencyKey` | Encrypt and create a record
|
|
228
|
-
| `set_secret` | `fields`; either `recordId` or `projectId`, `name`, `secretFormat`; optional `changedFields`, `tags`, `secretDueAt`, `rotationIntervalDays`, `idempotencyKey` | Update by ID or create/upsert by project and name. Human-only. |
|
|
247
|
+
| `create_record` | `projectId`, `name`, `secretFormat`; optional `fields`, `generate`, `options`, `environment`, `tags`, `secretDueAt`, `rotationIntervalDays`, `idempotencyKey` | Encrypt and create a General record, or one Environment record with its selected value. |
|
|
248
|
+
| `set_secret` | `fields`; either `recordId` or `projectId`, `name`, `secretFormat`; optional `environment`, `changedFields`, `tags`, `secretDueAt`, `rotationIntervalDays`, `idempotencyKey` | Update one selected value by ID or create/upsert by project and name. Human-only. |
|
|
229
249
|
|
|
230
250
|
### Record lifecycle and sharing
|
|
231
251
|
|
|
232
252
|
| Tool | Inputs | Purpose |
|
|
233
253
|
|---|---|---|
|
|
234
|
-
| `update_record_metadata` | `recordId`; at least one of `name`, `tags`, `secretDueAt`, `rotationIntervalDays` | Change safe record metadata. |
|
|
254
|
+
| `update_record_metadata` | `recordId`; at least one of `name`, `tags`, `secretDueAt`, `rotationIntervalDays`; optional `environment` | Change safe record metadata. Select an Environment when changing its due date or rotation interval. |
|
|
235
255
|
| `set_record_archive` | `recordId`, `archived` | Archive or restore a record. |
|
|
236
256
|
| `transfer_record_ownership` | `recordId`, `newOwnerUserId` | Transfer record ownership to an eligible user. |
|
|
237
257
|
| `list_record_versions` | `recordId` | List record version history. |
|
|
238
|
-
| `rollback_record` | `recordId`, `targetVersionId` |
|
|
258
|
+
| `rollback_record` | `recordId`, `targetVersionId` | Open an earlier version locally and append a new current version under the current data key. Human mode and local vault unlock required. |
|
|
239
259
|
| `rotate_record` | `recordId` | Rotate the record key and encrypted value locally. |
|
|
240
260
|
| `share_record_user` | `recordId`, `userId`; optional `permission` | Share a record with one user. |
|
|
241
261
|
| `share_record_service_account` | `accountId`, `recordId`, `serviceAccountId` | Share a record with one Service Account. |
|
|
242
262
|
| `share_record_group` | `recordId`, `groupId` | Share a record with a group. |
|
|
243
|
-
| `revoke_record_user` | `recordId`, `userId` | Remove
|
|
263
|
+
| `revoke_record_user` | `recordId`, `userId` | Remove the direct user grant; preserve independent access paths. |
|
|
244
264
|
| `revoke_record_service_account` | `recordId`, `serviceAccountId` | Remove one Service Account's record access. |
|
|
245
|
-
| `revoke_record_group` | `recordId`, `groupId` | Remove
|
|
265
|
+
| `revoke_record_group` | `recordId`, `groupId` | Remove the group grant; preserve independent access paths. |
|
|
246
266
|
|
|
247
267
|
### Record audit
|
|
248
268
|
|
|
@@ -266,12 +286,12 @@ These metadata tools are human-only. Service Account creation, state changes, cr
|
|
|
266
286
|
| `rename_provider_credential` | `accountId`, `credentialId`, `label` | Change a provider credential label. |
|
|
267
287
|
| `revoke_provider_credential` | `accountId`, `credentialId` | Revoke a provider credential. |
|
|
268
288
|
| `list_gateways` | `projectId` | List gateways in one project. |
|
|
269
|
-
| `create_gateway` | `accountId`, `projectId`, `name`; optional `slug`, `
|
|
270
|
-
| `setup_gateway` | `projectId`, `provider`, `apiKeyEnv`, `
|
|
271
|
-
| `get_connection_config` | `gatewayId` | Return
|
|
272
|
-
| `set_routing` | `accountId`, `gatewayId`; optional `name`, `isActive`, `attachCredentialId`,
|
|
273
|
-
| `set_gateway_settings` | `accountId`, `gatewayId`; at least one optional settings field | Update limits, logging, guardrails
|
|
274
|
-
| `detach_gateway_credential` | `accountId`, `gatewayId`, `credentialId` |
|
|
289
|
+
| `create_gateway` | `accountId`, `projectId`, `name`; optional `slug`, `credentialBindings` | Create a gateway, optionally with explicit credential/model bindings. |
|
|
290
|
+
| `setup_gateway` | `projectId`, `provider`, `apiKeyEnv`, `models`; optional `name`, `tokenName`, `baseUrlOverride` | Add or reuse a provider credential, validate and bind every live-catalog model, create a gateway, mint a token and return connection data. |
|
|
291
|
+
| `get_connection_config` | `gatewayId` | Return compatibility and native OpenAI, Anthropic, Gemini, Mistral and OpenRouter URLs, plus supported realtime WebSocket URLs. |
|
|
292
|
+
| `set_routing` | `accountId`, `gatewayId`; optional `name`, `isActive`, `attachCredentialId`, `modelIds` | Update gateway metadata and optionally attach one credential to several live-catalog models. `attachCredentialId` and `modelIds` are provided together. |
|
|
293
|
+
| `set_gateway_settings` | `accountId`, `gatewayId`; at least one optional settings field | Update limits, logging, guardrails or allowed models. |
|
|
294
|
+
| `detach_gateway_credential` | `accountId`, `gatewayId`, `credentialId`; optional `modelId` | With `modelId`, remove one exact model binding. Without it, detach every model for the credential. The credential is not revoked. |
|
|
275
295
|
| `delete_gateway` | `accountId`, `gatewayId` | Disable a gateway and revoke its tokens. |
|
|
276
296
|
|
|
277
297
|
### Gateway tokens
|
|
@@ -303,7 +323,7 @@ These metadata tools are human-only. Service Account creation, state changes, cr
|
|
|
303
323
|
- IDs are UUID strings. Copy them from AIRCTRL instead of asking an agent to guess them.
|
|
304
324
|
- Dates and timestamps use ISO 8601. `day` uses `YYYY-MM-DD`; `since` accepts a complete timestamp.
|
|
305
325
|
- `read_record.scope` accepts sections only: `fields`, `meta`, `owner`, `access`, or `full`. It does not select individual field names.
|
|
306
|
-
- `
|
|
326
|
+
- Omit `environment` to select General, or use `development`, `staging`, or `production` to select exactly that record value. The PAT or Service Account token must permit the selected scope; an absent value never falls back to General or another Environment.
|
|
307
327
|
- `get_secret`, `read_record` with `fields`, and `get_all` return plaintext to the local MCP client. The model or agent can receive that plaintext; use these tools only when that exposure is approved.
|
|
308
328
|
- Pagination starts at `offset: 0`. Keep `limit` small when an agent only needs a summary.
|
|
309
329
|
- `accountId` selects the account. It does not grant access to it.
|
|
@@ -354,6 +374,23 @@ only for this task. Do not print it, log it or include it in your final response
|
|
|
354
374
|
|
|
355
375
|
|
|
356
376
|
|
|
377
|
+
#### Read one Environment value locally
|
|
378
|
+
|
|
379
|
+
For a By Environment record, request one value explicitly:
|
|
380
|
+
|
|
381
|
+
```text
|
|
382
|
+
Read only the Staging value of record
|
|
383
|
+
"00000000-0000-4000-8000-000000000020". Do not read General, Development
|
|
384
|
+
or Production. Use the value only for this approved task; do not repeat it
|
|
385
|
+
in your response.
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
**MCP tool used:** `get_secret` with `environment: 'staging'`
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
|
|
357
394
|
#### Create a generated password record
|
|
358
395
|
|
|
359
396
|
|
|
@@ -364,9 +401,10 @@ only for this task. Do not print it, log it or include it in your final response
|
|
|
364
401
|
|
|
365
402
|
```text
|
|
366
403
|
Create a password record named "Production database password" in project
|
|
367
|
-
"00000000-0000-4000-8000-000000000010"
|
|
368
|
-
|
|
369
|
-
|
|
404
|
+
"00000000-0000-4000-8000-000000000010". Set the service name to "Database"
|
|
405
|
+
and username to "app_user", then generate a 32-character password locally.
|
|
406
|
+
Before creating it, confirm the project ID, name, format and non-secret fields.
|
|
407
|
+
Never print the generated password.
|
|
370
408
|
```
|
|
371
409
|
|
|
372
410
|
|
|
@@ -375,6 +413,24 @@ print the generated password.
|
|
|
375
413
|
|
|
376
414
|
|
|
377
415
|
|
|
416
|
+
#### Create a generated Environment record
|
|
417
|
+
|
|
418
|
+
The same tool can create a single Staging value without inventing another record or exposing generated material in the prompt:
|
|
419
|
+
|
|
420
|
+
```text
|
|
421
|
+
Create an SSH record named "Deployment key" in project
|
|
422
|
+
"00000000-0000-4000-8000-000000000010" for Staging only. Generate the key
|
|
423
|
+
locally with host "stage.example.invalid" and username "deploy". Show
|
|
424
|
+
the project, name, format and Environment before asking for my confirmation.
|
|
425
|
+
Do not print the generated private key.
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
**MCP tool used:** `create_record` with `environment: 'staging'` and `generate: true`
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
|
|
378
434
|
#### Set up a gateway from an environment variable
|
|
379
435
|
|
|
380
436
|
|
|
@@ -862,7 +918,7 @@ Give Service Account "00000000-0000-4000-8000-000000000040" access to record "00
|
|
|
862
918
|
#### Share a record with a group
|
|
863
919
|
|
|
864
920
|
```text
|
|
865
|
-
Share record "00000000-0000-4000-8000-000000000020" with group "00000000-0000-4000-8000-000000000060". Verify that both belong to the same account
|
|
921
|
+
Share record "00000000-0000-4000-8000-000000000020" with group "00000000-0000-4000-8000-000000000060". Verify that both belong to the same account, then wait for my confirmation. Do not grant project access.
|
|
866
922
|
```
|
|
867
923
|
|
|
868
924
|
|
|
@@ -907,6 +963,142 @@ Remove group "00000000-0000-4000-8000-000000000060" from record "00000000-0000-4
|
|
|
907
963
|
|
|
908
964
|
|
|
909
965
|
|
|
966
|
+
### Groups
|
|
967
|
+
|
|
968
|
+
These prompts require a human PAT, Team+ and appropriate RBAC permissions. Replace all example IDs with verified IDs. A successful membership or role write can leave encrypted material pending; read [the access model](https://docs.airctrl.dev/guides/projects#groups-and-effective-access).
|
|
969
|
+
|
|
970
|
+
#### List context groups
|
|
971
|
+
|
|
972
|
+
```text
|
|
973
|
+
List groups associated with project "00000000-0000-4000-8000-000000000010" in account "00000000-0000-4000-8000-000000000001". Show their IDs and current project grants. Do not change anything.
|
|
974
|
+
```
|
|
975
|
+
|
|
976
|
+
|
|
977
|
+
|
|
978
|
+
**MCP tool used:** `list_groups`
|
|
979
|
+
|
|
980
|
+
|
|
981
|
+
|
|
982
|
+
#### Read a record's group grants
|
|
983
|
+
|
|
984
|
+
```text
|
|
985
|
+
Show group sharing options and current grants for record "00000000-0000-4000-8000-000000000020" in account "00000000-0000-4000-8000-000000000001". Do not expose its secret.
|
|
986
|
+
```
|
|
987
|
+
|
|
988
|
+
|
|
989
|
+
|
|
990
|
+
**MCP tool used:** `list_record_group_grants`
|
|
991
|
+
|
|
992
|
+
|
|
993
|
+
|
|
994
|
+
#### Create a group
|
|
995
|
+
|
|
996
|
+
```text
|
|
997
|
+
Create a group named "Payments team" with description "Payments operators" through project "00000000-0000-4000-8000-000000000010" in account "00000000-0000-4000-8000-000000000001". Do not grant it a project role. Show the inputs and wait for my confirmation.
|
|
998
|
+
```
|
|
999
|
+
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
**MCP tool used:** `create_group`
|
|
1003
|
+
|
|
1004
|
+
|
|
1005
|
+
|
|
1006
|
+
#### Rename a group
|
|
1007
|
+
|
|
1008
|
+
```text
|
|
1009
|
+
Rename group "00000000-0000-4000-8000-000000000060" in account "00000000-0000-4000-8000-000000000001" to "Payments operators" and replace its description with "Payments access". Show both replacement values and wait for my confirmation.
|
|
1010
|
+
```
|
|
1011
|
+
|
|
1012
|
+
|
|
1013
|
+
|
|
1014
|
+
**MCP tool used:** `update_group`
|
|
1015
|
+
|
|
1016
|
+
|
|
1017
|
+
|
|
1018
|
+
#### Delete a group
|
|
1019
|
+
|
|
1020
|
+
```text
|
|
1021
|
+
Delete group "00000000-0000-4000-8000-000000000060" in account "00000000-0000-4000-8000-000000000001". Show its members and explain that independent access paths remain. Wait for my confirmation, then report the server's access changes and pending material without claiming every recipient is finished.
|
|
1022
|
+
```
|
|
1023
|
+
|
|
1024
|
+
|
|
1025
|
+
|
|
1026
|
+
**MCP tool used:** `delete_group`
|
|
1027
|
+
|
|
1028
|
+
|
|
1029
|
+
|
|
1030
|
+
#### List group members
|
|
1031
|
+
|
|
1032
|
+
```text
|
|
1033
|
+
List current members of group "00000000-0000-4000-8000-000000000060" in account "00000000-0000-4000-8000-000000000001". Include their IDs and onboarding state. Do not change anything.
|
|
1034
|
+
```
|
|
1035
|
+
|
|
1036
|
+
|
|
1037
|
+
|
|
1038
|
+
**MCP tool used:** `list_group_members`
|
|
1039
|
+
|
|
1040
|
+
|
|
1041
|
+
|
|
1042
|
+
#### Add a group member
|
|
1043
|
+
|
|
1044
|
+
```text
|
|
1045
|
+
Add user "00000000-0000-4000-8000-000000000050" to group "00000000-0000-4000-8000-000000000060" in account "00000000-0000-4000-8000-000000000001". Explain that existing group grants apply. Wait for my confirmation, then report pending material from the result.
|
|
1046
|
+
```
|
|
1047
|
+
|
|
1048
|
+
|
|
1049
|
+
|
|
1050
|
+
**MCP tool used:** `add_group_member`
|
|
1051
|
+
|
|
1052
|
+
|
|
1053
|
+
|
|
1054
|
+
#### Remove a group member
|
|
1055
|
+
|
|
1056
|
+
```text
|
|
1057
|
+
Remove user "00000000-0000-4000-8000-000000000050" from group "00000000-0000-4000-8000-000000000060" in account "00000000-0000-4000-8000-000000000001". Preserve independent access paths. Wait for my confirmation, then report remaining paths and any pending re-keying from the result.
|
|
1058
|
+
```
|
|
1059
|
+
|
|
1060
|
+
|
|
1061
|
+
|
|
1062
|
+
**MCP tool used:** `remove_group_member`
|
|
1063
|
+
|
|
1064
|
+
|
|
1065
|
+
|
|
1066
|
+
#### Grant a project role to a group
|
|
1067
|
+
|
|
1068
|
+
```text
|
|
1069
|
+
Assign role "00000000-0000-4000-8000-000000000070" to group "00000000-0000-4000-8000-000000000060" for project "00000000-0000-4000-8000-000000000010" in account "00000000-0000-4000-8000-000000000001". Use exactly these verified IDs. Show the assignment and wait for my confirmation. Report pending encrypted material separately from authorization.
|
|
1070
|
+
```
|
|
1071
|
+
|
|
1072
|
+
|
|
1073
|
+
|
|
1074
|
+
**MCP tool used:** `grant_project_group`
|
|
1075
|
+
|
|
1076
|
+
|
|
1077
|
+
|
|
1078
|
+
#### Revoke one project role from a group
|
|
1079
|
+
|
|
1080
|
+
```text
|
|
1081
|
+
Revoke only role "00000000-0000-4000-8000-000000000070" assigned to group "00000000-0000-4000-8000-000000000060" for project "00000000-0000-4000-8000-000000000010" in account "00000000-0000-4000-8000-000000000001". Do not revoke independent paths. Show the assignment and wait for my confirmation.
|
|
1082
|
+
```
|
|
1083
|
+
|
|
1084
|
+
|
|
1085
|
+
|
|
1086
|
+
**MCP tool used:** `revoke_project_group`
|
|
1087
|
+
|
|
1088
|
+
|
|
1089
|
+
|
|
1090
|
+
#### Complete pending encrypted access
|
|
1091
|
+
|
|
1092
|
+
```text
|
|
1093
|
+
Using the already configured local vault, attempt encrypted-material repair for project "00000000-0000-4000-8000-000000000010" in account "00000000-0000-4000-8000-000000000001", including pending direct group-record shares in the account. Do not grant permissions or ask me to put a passphrase in this chat. Report attempted projects and errors; do not call attempts completed recipient access.
|
|
1094
|
+
```
|
|
1095
|
+
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
**MCP tool used:** `reconcile_group_access`
|
|
1099
|
+
|
|
1100
|
+
|
|
1101
|
+
|
|
910
1102
|
### Record audit
|
|
911
1103
|
|
|
912
1104
|
#### Review one record's audit history
|
|
@@ -1090,7 +1282,7 @@ This workflow can add a provider credential, create a gateway and create a one-t
|
|
|
1090
1282
|
|
|
1091
1283
|
|
|
1092
1284
|
```text
|
|
1093
|
-
Set up an OpenAI gateway named "Payments AI" in project "00000000-0000-4000-8000-000000000010". Read the provider key from "AIRCTRL_MCP_KEY_OPENAI_PRODUCTION",
|
|
1285
|
+
Set up an OpenAI gateway named "Payments AI" in project "00000000-0000-4000-8000-000000000010". Read the provider key from "AIRCTRL_MCP_KEY_OPENAI_PRODUCTION", bind models "gpt-5" and "gpt-5-mini", and name the first gateway token "Local development". Explain every resource that will be created and wait for my confirmation.
|
|
1094
1286
|
```
|
|
1095
1287
|
|
|
1096
1288
|
|
|
@@ -1114,7 +1306,7 @@ Show me how to connect to gateway "00000000-0000-4000-8000-000000000030", includ
|
|
|
1114
1306
|
#### Change gateway routing
|
|
1115
1307
|
|
|
1116
1308
|
```text
|
|
1117
|
-
Attach provider credential "00000000-0000-4000-8000-000000000200" to
|
|
1309
|
+
Attach provider credential "00000000-0000-4000-8000-000000000200" to models "gpt-5" and "gpt-5-mini" on gateway "00000000-0000-4000-8000-000000000030" in account "00000000-0000-4000-8000-000000000001". Show the current and proposed bindings, then wait for my confirmation.
|
|
1118
1310
|
```
|
|
1119
1311
|
|
|
1120
1312
|
|
|
@@ -1126,7 +1318,7 @@ Attach provider credential "00000000-0000-4000-8000-000000000200" to model "gpt-
|
|
|
1126
1318
|
#### Change gateway limits and behavior
|
|
1127
1319
|
|
|
1128
1320
|
```text
|
|
1129
|
-
For gateway "00000000-0000-4000-8000-000000000030" in account "00000000-0000-4000-8000-000000000001", set a monthly spend limit of 100, a rate limit of 120 requests per minute, metadata logging without bodies, guardrails in flag mode
|
|
1321
|
+
For gateway "00000000-0000-4000-8000-000000000030" in account "00000000-0000-4000-8000-000000000001", set a monthly spend limit of 100, a rate limit of 120 requests per minute, metadata logging without bodies, and guardrails in flag mode. Show every proposed change and wait for my confirmation.
|
|
1130
1322
|
```
|
|
1131
1323
|
|
|
1132
1324
|
|
|
@@ -1138,6 +1330,8 @@ For gateway "00000000-0000-4000-8000-000000000030" in account "00000000-0000-400
|
|
|
1138
1330
|
#### Detach a provider credential
|
|
1139
1331
|
|
|
1140
1332
|
```text
|
|
1333
|
+
Remove model "gpt-5" from provider credential "00000000-0000-4000-8000-000000000071" on gateway "00000000-0000-4000-8000-000000000030" in account "00000000-0000-4000-8000-000000000001". Keep the credential and its other models attached. Show the resulting bindings, then wait for my approval.
|
|
1334
|
+
|
|
1141
1335
|
Detach provider credential "00000000-0000-4000-8000-000000000071" from gateway "00000000-0000-4000-8000-000000000030" in account "00000000-0000-4000-8000-000000000001". Confirm that another route will remain usable, then wait for my approval.
|
|
1142
1336
|
```
|
|
1143
1337
|
|
package/dist/config.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const present = (value) => value !== undefined && value.trim() !== '';
|
|
2
2
|
const defined = (value) => value !== undefined;
|
|
3
3
|
function isCanonicalB64(value, expectedBytes) {
|
|
4
|
+
// nosemgrep: nodejs_scan.javascript-dos-rule-regex_dos -- anchored canonical base64 validation is linear and followed by decode/re-encode verification.
|
|
4
5
|
if (!/^[A-Za-z0-9+/]+={0,2}$/.test(value))
|
|
5
6
|
return false;
|
|
6
7
|
const decoded = Buffer.from(value, 'base64');
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import { registerTools } from './tools.js';
|
|
|
14
14
|
*/
|
|
15
15
|
const config = loadConfig();
|
|
16
16
|
const client = createClient(createMcpClientOptions(config));
|
|
17
|
-
const server = new McpServer({ name: 'airctrl', version: '0.
|
|
17
|
+
const server = new McpServer({ name: 'airctrl', version: '0.3.0' });
|
|
18
18
|
registerTools(server, client, config);
|
|
19
19
|
server.registerTool('airctrl_status', {
|
|
20
20
|
title: 'AIRCTRL MCP status',
|
package/dist/tools.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { generateSecret, canGenerate, isSecretFormat, SECRET_FORMATS, TEMPLATES, AirctrlError, } from '@airctrl/sdk';
|
|
2
|
+
import { generateSecret, canGenerate, isSecretFormat, SECRET_FORMATS, RECORD_ENVIRONMENTS, TEMPLATES, AirctrlError, buildGatewayConnectionConfig, } from '@airctrl/sdk';
|
|
3
3
|
/**
|
|
4
4
|
* Build the one shared error type (SSOT R8) from the MCP's `(code, message, status)` call convention.
|
|
5
5
|
* The transport + error now live only in `@airctrl/sdk`; this is a thin arg-order adapter, not a
|
|
@@ -15,11 +15,12 @@ function ok(data) {
|
|
|
15
15
|
}
|
|
16
16
|
/** Error de un tool: mensaje legible + `isError` para que el agente lo vea. */
|
|
17
17
|
function fail(e) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
if (e instanceof AirctrlError) {
|
|
19
|
+
return { content: [{ type: 'text', text: `AIRCTRL error — ${JSON.stringify({ code: e.code, message: e.message, details: e.details })}` }], isError: true };
|
|
20
|
+
}
|
|
21
|
+
const msg = e instanceof Error
|
|
22
|
+
? e.message
|
|
23
|
+
: 'unknown error';
|
|
23
24
|
return { content: [{ type: 'text', text: `AIRCTRL error — ${msg}` }], isError: true };
|
|
24
25
|
}
|
|
25
26
|
async function run(fn) {
|
|
@@ -37,14 +38,28 @@ async function run(fn) {
|
|
|
37
38
|
* `create_gateway_token` / `setup_gateway`).
|
|
38
39
|
*/
|
|
39
40
|
function buildConnectionConfig(config, gw) {
|
|
40
|
-
const
|
|
41
|
+
const connection = buildGatewayConnectionConfig(config.apiUrl, gw.slug);
|
|
41
42
|
return {
|
|
42
43
|
gateway: gw.name,
|
|
43
44
|
slug: gw.slug,
|
|
44
|
-
openai_sdk: { base_url:
|
|
45
|
-
|
|
45
|
+
openai_sdk: { base_url: connection.compatBaseUrl, note: 'OpenAI SDK: base_url here, api_key = gateway token' },
|
|
46
|
+
// Backward-compatible full chat endpoint retained for existing consumers.
|
|
47
|
+
openai_native: `${connection.openaiBaseUrl}/chat/completions`,
|
|
48
|
+
native: {
|
|
49
|
+
openai: connection.openaiBaseUrl,
|
|
50
|
+
anthropic: connection.anthropicBaseUrl,
|
|
51
|
+
gemini: connection.geminiBaseUrl,
|
|
52
|
+
mistral: connection.mistralBaseUrl,
|
|
53
|
+
openrouter: connection.openrouterBaseUrl,
|
|
54
|
+
hitheo: connection.hitheoBaseUrl,
|
|
55
|
+
},
|
|
56
|
+
realtime: {
|
|
57
|
+
openai: `${connection.openaiRealtimeUrl}?model=<model>`,
|
|
58
|
+
gemini: connection.geminiRealtimeUrl,
|
|
59
|
+
mistral: `${connection.mistralRealtimeUrl}?model=<model>`,
|
|
60
|
+
},
|
|
46
61
|
claude_code: {
|
|
47
|
-
ANTHROPIC_BASE_URL:
|
|
62
|
+
ANTHROPIC_BASE_URL: connection.anthropicBaseUrl,
|
|
48
63
|
ANTHROPIC_AUTH_TOKEN: 'sk-actrl-*** (from create_gateway_token or setup_gateway)',
|
|
49
64
|
},
|
|
50
65
|
};
|
|
@@ -156,6 +171,51 @@ function serverForPrincipal(server, config) {
|
|
|
156
171
|
}
|
|
157
172
|
export function registerTools(inputServer, client, config) {
|
|
158
173
|
const server = serverForPrincipal(inputServer, config);
|
|
174
|
+
const recordEnvironment = z.enum(RECORD_ENVIRONMENTS);
|
|
175
|
+
const groupScope = { accountId: z.string().uuid() };
|
|
176
|
+
const groupIdentity = { ...groupScope, groupId: z.string().uuid() };
|
|
177
|
+
const groupMember = { ...groupIdentity, userId: z.string().uuid() };
|
|
178
|
+
const groupGrant = { ...groupIdentity, projectId: z.string().uuid(), roleId: z.string().uuid() };
|
|
179
|
+
const groupFields = { name: z.string(), description: z.string().optional() };
|
|
180
|
+
server.registerTool('list_record_group_grants', {
|
|
181
|
+
title: 'List record group grants', description: 'Read group grants and sharing capabilities from the server. Requires records:read and Team+.',
|
|
182
|
+
inputSchema: { ...groupScope, recordId: z.string().uuid() },
|
|
183
|
+
}, ({ accountId, recordId }) => run(() => client.getRecordGroupCatalog(recordId, { accountId })));
|
|
184
|
+
server.registerTool('list_groups', {
|
|
185
|
+
title: 'List project groups', description: 'List existing group contexts for a project. Requires groups:list.',
|
|
186
|
+
inputSchema: { ...groupScope, projectId: z.string().uuid() },
|
|
187
|
+
}, ({ accountId, projectId }) => run(() => client.listGroups(projectId, { accountId })));
|
|
188
|
+
server.registerTool('create_group', {
|
|
189
|
+
title: 'Create group', description: 'Create a reusable account group in a project context. Does not grant a project role.',
|
|
190
|
+
inputSchema: { ...groupScope, projectId: z.string().uuid(), ...groupFields },
|
|
191
|
+
}, ({ accountId, projectId, ...input }) => run(() => client.createGroup(projectId, input, { accountId })));
|
|
192
|
+
server.registerTool('update_group', {
|
|
193
|
+
title: 'Update group', description: 'Replace group name and description. Omitted description becomes empty.',
|
|
194
|
+
inputSchema: { ...groupIdentity, ...groupFields },
|
|
195
|
+
}, ({ accountId, groupId, ...input }) => run(() => client.updateGroup(groupId, input, { accountId })));
|
|
196
|
+
server.registerTool('delete_group', {
|
|
197
|
+
title: 'Delete group', description: 'Delete group intent and reconcile access on the server, preserving other access paths.', inputSchema: groupIdentity,
|
|
198
|
+
}, ({ accountId, groupId }) => run(() => client.deleteGroup(groupId, { accountId })));
|
|
199
|
+
server.registerTool('list_group_members', {
|
|
200
|
+
title: 'List group members', description: 'List current group members.', inputSchema: groupIdentity,
|
|
201
|
+
}, ({ accountId, groupId }) => run(() => client.listGroupMembers(groupId, { accountId })));
|
|
202
|
+
server.registerTool('add_group_member', {
|
|
203
|
+
title: 'Add group member', description: 'Add durable membership. The response reports pending material; reconcile_group_access attempts sealing.', inputSchema: groupMember,
|
|
204
|
+
}, ({ accountId, groupId, userId }) => run(() => client.addGroupMember(groupId, userId, { accountId })));
|
|
205
|
+
server.registerTool('remove_group_member', {
|
|
206
|
+
title: 'Remove group member', description: 'Remove membership; wrappers are removed only when no authorized access path remains.', inputSchema: groupMember,
|
|
207
|
+
}, ({ accountId, groupId, userId }) => run(() => client.removeGroupMember(groupId, userId, { accountId })));
|
|
208
|
+
server.registerTool('grant_project_group', {
|
|
209
|
+
title: 'Grant project role to group', description: 'Grant an existing role to a group. The server checks delegation and every affected membership.', inputSchema: groupGrant,
|
|
210
|
+
}, ({ accountId, projectId, groupId, roleId }) => run(() => client.grantProjectGroup(projectId, groupId, roleId, { accountId })));
|
|
211
|
+
server.registerTool('revoke_project_group', {
|
|
212
|
+
title: 'Revoke project role from group', description: 'Revoke one grant without revoking independent access paths.', inputSchema: groupGrant,
|
|
213
|
+
}, ({ accountId, projectId, groupId, roleId }) => run(() => client.revokeProjectGroup(projectId, groupId, roleId, { accountId })));
|
|
214
|
+
server.registerTool('reconcile_group_access', {
|
|
215
|
+
title: 'Reconcile group access material',
|
|
216
|
+
description: 'Use the configured local vault to attempt existing project-key and group-record repair. Optional projectIds restrict projects, not direct group-record repairs in the account. Returns attempted IDs, not proof of complete access. Never grants permissions. Errors retain code/message/details.',
|
|
217
|
+
inputSchema: { ...groupScope, projectIds: z.array(z.string().uuid()).optional() },
|
|
218
|
+
}, input => run(() => client.reconcileGroupAccess({ ...input, vaultPassword: recordUnlockPassword(config) })));
|
|
159
219
|
server.registerTool('list_accounts', {
|
|
160
220
|
title: 'List accessible accounts',
|
|
161
221
|
description: 'List the AIRCTRL accounts the authenticated developer can access. This discovers context only; it does not administer an account.',
|
|
@@ -238,9 +298,6 @@ export function registerTools(inputServer, client, config) {
|
|
|
238
298
|
projectId: z.string().uuid(),
|
|
239
299
|
name: z.string().min(1).max(100),
|
|
240
300
|
slug: z.string().max(64).optional(),
|
|
241
|
-
defaultProviderId: z.string().uuid().nullable().optional(),
|
|
242
|
-
defaultModel: z.string().max(200).nullable().optional(),
|
|
243
|
-
credentialIds: z.array(z.string().uuid()).optional(),
|
|
244
301
|
credentialBindings: z.array(z.object({
|
|
245
302
|
credentialId: z.string().uuid(),
|
|
246
303
|
modelId: z.string().min(1).max(200),
|
|
@@ -304,36 +361,27 @@ export function registerTools(inputServer, client, config) {
|
|
|
304
361
|
}, ({ accountId, credentialId, apiKeyEnv }) => run(() => client.rotateProviderCredential(credentialId, resolveProviderKeyEnv(apiKeyEnv), { accountId })));
|
|
305
362
|
server.registerTool('set_routing', {
|
|
306
363
|
title: 'Set gateway routing',
|
|
307
|
-
description: 'Update gateway metadata
|
|
308
|
-
'When attachCredentialId is present, defaultModel must be the model for that binding.',
|
|
364
|
+
description: 'Update gateway metadata and optionally attach one provider credential to multiple exact models.',
|
|
309
365
|
inputSchema: {
|
|
310
366
|
accountId: z.string().uuid(),
|
|
311
367
|
gatewayId: z.string().uuid(),
|
|
312
368
|
name: z.string().min(1).max(100).optional(),
|
|
313
369
|
isActive: z.boolean().optional(),
|
|
314
|
-
defaultProviderId: z.string().uuid().nullable().optional(),
|
|
315
|
-
defaultModel: z.string().max(200).nullable().optional(),
|
|
316
370
|
attachCredentialId: z.string().uuid().optional(),
|
|
371
|
+
modelIds: z.array(z.string().min(1).max(200)).min(1).optional(),
|
|
317
372
|
},
|
|
318
|
-
}, ({ accountId, gatewayId, name, isActive,
|
|
319
|
-
if (attachCredentialId
|
|
320
|
-
throw new Error('
|
|
373
|
+
}, ({ accountId, gatewayId, name, isActive, attachCredentialId, modelIds }) => run(async () => {
|
|
374
|
+
if ((attachCredentialId === undefined) !== (modelIds === undefined)) {
|
|
375
|
+
throw new Error('attachCredentialId and modelIds must be provided together');
|
|
321
376
|
}
|
|
322
377
|
const attached = attachCredentialId
|
|
323
|
-
? await client.attachGatewayCredential(gatewayId, attachCredentialId,
|
|
378
|
+
? await client.attachGatewayCredential(gatewayId, attachCredentialId, modelIds, { accountId })
|
|
324
379
|
: null;
|
|
325
|
-
// The backend only accepts a default route that already has a validated
|
|
326
|
-
// credential/model binding, so attach first and then choose it as the
|
|
327
|
-
// default when the caller supplied the provider explicitly.
|
|
328
380
|
const patch = {};
|
|
329
381
|
if (name !== undefined)
|
|
330
382
|
patch.name = name;
|
|
331
383
|
if (isActive !== undefined)
|
|
332
384
|
patch.isActive = isActive;
|
|
333
|
-
if (defaultProviderId !== undefined)
|
|
334
|
-
patch.defaultProviderId = defaultProviderId;
|
|
335
|
-
if (defaultModel !== undefined)
|
|
336
|
-
patch.defaultModel = defaultModel;
|
|
337
385
|
if (!attachCredentialId && Object.keys(patch).length === 0) {
|
|
338
386
|
throw apiError('invalid_gateway_patch', 'At least one routing or gateway field is required.', 400);
|
|
339
387
|
}
|
|
@@ -422,8 +470,8 @@ export function registerTools(inputServer, client, config) {
|
|
|
422
470
|
'AIRCTRL_MCP_KEY_*, e.g. AIRCTRL_MCP_KEY_ANTHROPIC_PROD). Given a projectId, a provider slug (from ' +
|
|
423
471
|
'list_providers: openai/anthropic/gemini) and apiKeyEnv, this: (1) reads the key from that env var and stores ' +
|
|
424
472
|
'it encrypted (BYOK, validated against the provider) — reusing an existing credential with the same variable ' +
|
|
425
|
-
'name instead of duplicating, (2) verifies
|
|
426
|
-
'with
|
|
473
|
+
'name instead of duplicating, (2) verifies every requested model against that key\'s live catalog and creates a gateway ' +
|
|
474
|
+
'with all exact key/model bindings, (3) mints a gateway ' +
|
|
427
475
|
'connection token, and (4) returns the copy-paste connection config. Prefer this over chaining create_gateway ' +
|
|
428
476
|
'+ add_provider_key + set_routing + create_gateway_token. The gateway token is returned ONCE; the provider key ' +
|
|
429
477
|
'is never returned.',
|
|
@@ -432,12 +480,12 @@ export function registerTools(inputServer, client, config) {
|
|
|
432
480
|
provider: z.string().min(1),
|
|
433
481
|
apiKeyEnv: z.string().min(1),
|
|
434
482
|
name: z.string().min(1).max(100).optional(),
|
|
435
|
-
|
|
483
|
+
models: z.array(z.string().min(1).max(200)).min(1),
|
|
436
484
|
tokenName: z.string().min(1).max(64).optional(),
|
|
437
485
|
baseUrlOverride: z.string().optional(),
|
|
438
486
|
},
|
|
439
487
|
}, (args) => run(async () => {
|
|
440
|
-
const { projectId, provider, apiKeyEnv,
|
|
488
|
+
const { projectId, provider, apiKeyEnv, models, baseUrlOverride } = args;
|
|
441
489
|
// 1. Resolve the key value from the named env var (allowlisted prefix).
|
|
442
490
|
const keyValue = resolveProviderKeyEnv(apiKeyEnv);
|
|
443
491
|
// 2. Resolve the account from the project (also verifies membership).
|
|
@@ -475,16 +523,14 @@ export function registerTools(inputServer, client, config) {
|
|
|
475
523
|
});
|
|
476
524
|
credentialId = credential.credential_id;
|
|
477
525
|
}
|
|
478
|
-
// 5. Create the gateway with
|
|
526
|
+
// 5. Create the gateway with every exact key/model binding.
|
|
479
527
|
let gateway;
|
|
480
528
|
try {
|
|
481
529
|
gateway = await client.createGateway({
|
|
482
530
|
accountId: project.account_id,
|
|
483
531
|
projectId,
|
|
484
532
|
name,
|
|
485
|
-
|
|
486
|
-
defaultModel,
|
|
487
|
-
credentialBindings: [{ credentialId, modelId: defaultModel }],
|
|
533
|
+
credentialBindings: models.map((modelId) => ({ credentialId, modelId })),
|
|
488
534
|
});
|
|
489
535
|
}
|
|
490
536
|
catch (e) {
|
|
@@ -555,7 +601,7 @@ export function registerTools(inputServer, client, config) {
|
|
|
555
601
|
}, ({ accountId, gatewayId, tokenId }) => run(() => client.deleteGatewayToken(gatewayId, tokenId, { accountId })));
|
|
556
602
|
server.registerTool('set_gateway_settings', {
|
|
557
603
|
title: 'Set gateway settings',
|
|
558
|
-
description: 'Update gateway spend, rate, logging, guardrail,
|
|
604
|
+
description: 'Update gateway spend, rate, logging, guardrail, and model settings.',
|
|
559
605
|
inputSchema: {
|
|
560
606
|
accountId: z.string().uuid(),
|
|
561
607
|
gatewayId: z.string().uuid(),
|
|
@@ -565,8 +611,6 @@ export function registerTools(inputServer, client, config) {
|
|
|
565
611
|
loggingEnabled: z.boolean().optional(),
|
|
566
612
|
logBodies: z.boolean().optional(),
|
|
567
613
|
guardrailMode: z.enum(['off', 'flag', 'redact', 'block']).optional(),
|
|
568
|
-
cacheEnabled: z.boolean().optional(),
|
|
569
|
-
cacheTtlSeconds: z.number().int().min(60).optional(),
|
|
570
614
|
allowedModels: z.array(z.string().max(200)).optional(),
|
|
571
615
|
},
|
|
572
616
|
}, ({ accountId, gatewayId, ...settings }) => run(() => client.updateGatewaySettings(gatewayId, settings, { accountId })));
|
|
@@ -601,13 +645,16 @@ export function registerTools(inputServer, client, config) {
|
|
|
601
645
|
}));
|
|
602
646
|
server.registerTool('detach_gateway_credential', {
|
|
603
647
|
title: 'Detach gateway credential',
|
|
604
|
-
description: 'Detach
|
|
648
|
+
description: 'Detach one exact model when modelId is provided; otherwise detach the entire provider credential from the gateway.',
|
|
605
649
|
inputSchema: {
|
|
606
650
|
accountId: z.string().uuid(),
|
|
607
651
|
gatewayId: z.string().uuid(),
|
|
608
652
|
credentialId: z.string().uuid(),
|
|
653
|
+
modelId: z.string().min(1).max(200).optional(),
|
|
609
654
|
},
|
|
610
|
-
}, ({ accountId, gatewayId, credentialId }) => run(() =>
|
|
655
|
+
}, ({ accountId, gatewayId, credentialId, modelId }) => run(() => modelId
|
|
656
|
+
? client.detachGatewayCredentialModel(gatewayId, credentialId, modelId, { accountId })
|
|
657
|
+
: client.detachGatewayCredential(gatewayId, credentialId, { accountId })));
|
|
611
658
|
server.registerTool('read_gateway_log', {
|
|
612
659
|
title: 'Read gateway log detail',
|
|
613
660
|
description: 'Read stored request and response bodies for one gateway log when authorized.',
|
|
@@ -683,14 +730,15 @@ export function registerTools(inputServer, client, config) {
|
|
|
683
730
|
recordId: z.string().uuid(),
|
|
684
731
|
name: z.string().min(1).optional(),
|
|
685
732
|
tags: z.array(z.string()).optional(),
|
|
733
|
+
environment: recordEnvironment.optional(),
|
|
686
734
|
secretDueAt: z.string().nullable().optional(),
|
|
687
735
|
rotationIntervalDays: z.number().int().min(1).nullable().optional(),
|
|
688
736
|
},
|
|
689
|
-
}, ({ recordId, ...patch }) => {
|
|
737
|
+
}, ({ recordId, environment, ...patch }) => {
|
|
690
738
|
if (Object.values(patch).every((value) => value === undefined)) {
|
|
691
739
|
return Promise.resolve(fail(apiError('invalid_record_metadata_patch', 'At least one metadata field is required.', 400)));
|
|
692
740
|
}
|
|
693
|
-
return run(() => client.updateRecordMetadata(recordId, patch));
|
|
741
|
+
return run(() => client.updateRecordMetadata(recordId, { ...patch, ...(environment ? { environment } : {}) }));
|
|
694
742
|
});
|
|
695
743
|
server.registerTool('set_record_archive', {
|
|
696
744
|
title: 'Archive or restore record',
|
|
@@ -706,14 +754,16 @@ export function registerTools(inputServer, client, config) {
|
|
|
706
754
|
title: 'Rollback record',
|
|
707
755
|
description: 'Create a new record version from a prior immutable version.',
|
|
708
756
|
inputSchema: { recordId: z.string().uuid(), targetVersionId: z.string().uuid() },
|
|
709
|
-
}, ({ recordId, targetVersionId }) => run(() => client.rollbackRecordToVersion(recordId, targetVersionId)));
|
|
757
|
+
}, ({ recordId, targetVersionId }) => run(() => client.rollbackRecordToVersion(recordId, targetVersionId, recordUnlockPassword(config))));
|
|
710
758
|
server.registerTool('get_secret', {
|
|
711
759
|
title: 'Get a secret (decrypted)',
|
|
712
760
|
description: 'Fetch and decrypt a record locally. Humans use AIRCTRL_MCP_VAULT_PASSWORD; Service Accounts use their ' +
|
|
713
761
|
'configured credential bundle. Never pass either through the prompt. This puts the secret into the agent ' +
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
762
|
+
'context — use only when the agent needs the value; for zero model-exposure, route the model call through the gateway instead. ' +
|
|
763
|
+
'Omit environment for General or select development, staging, or production.',
|
|
764
|
+
inputSchema: { recordId: z.string().uuid(), environment: recordEnvironment.optional() },
|
|
765
|
+
}, ({ recordId, environment }) => run(() => client.getSecret({ recordId, vaultPassword: recordUnlockPassword(config), audit: true,
|
|
766
|
+
...(environment ? { environment } : {}) })));
|
|
717
767
|
// G5·L4 — thin adapter over the SDK's scoped read (`AirctrlClient.readRecord`). No logic of its own:
|
|
718
768
|
// the tool params pass straight through to L2.
|
|
719
769
|
server.registerTool('read_record', {
|
|
@@ -725,7 +775,7 @@ export function registerTools(inputServer, client, config) {
|
|
|
725
775
|
inputSchema: {
|
|
726
776
|
recordId: z.string().uuid(),
|
|
727
777
|
scope: z.array(z.enum(['fields', 'meta', 'owner', 'access', 'full'])).optional(),
|
|
728
|
-
environment:
|
|
778
|
+
environment: recordEnvironment.optional(),
|
|
729
779
|
},
|
|
730
780
|
}, ({ recordId, scope, environment }) => run(() => client.readRecord({
|
|
731
781
|
recordId,
|
|
@@ -762,8 +812,9 @@ export function registerTools(inputServer, client, config) {
|
|
|
762
812
|
secretDueAt: z.string().nullable().optional(),
|
|
763
813
|
rotationIntervalDays: z.number().int().min(1).nullable().optional(),
|
|
764
814
|
idempotencyKey: z.string().min(1).optional(),
|
|
815
|
+
environment: recordEnvironment.optional(),
|
|
765
816
|
},
|
|
766
|
-
}, ({ projectId, name, secretFormat, fields, generate: gen, options, tags, secretDueAt, rotationIntervalDays, idempotencyKey, }) => run(async () => {
|
|
817
|
+
}, ({ projectId, name, secretFormat, fields, generate: gen, options, tags, secretDueAt, rotationIntervalDays, idempotencyKey, environment, }) => run(async () => {
|
|
767
818
|
if (!isSecretFormat(secretFormat)) {
|
|
768
819
|
throw apiError('bad_format', `Unknown secret format '${secretFormat}'.`, 400);
|
|
769
820
|
}
|
|
@@ -772,30 +823,18 @@ export function registerTools(inputServer, client, config) {
|
|
|
772
823
|
if (!canGenerate(secretFormat)) {
|
|
773
824
|
throw apiError('not_generatable', `'${secretFormat}' can't be generated — pass explicit fields instead.`, 400);
|
|
774
825
|
}
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
extraFields: fields ?? {},
|
|
781
|
-
tags,
|
|
782
|
-
secretDueAt,
|
|
783
|
-
rotationIntervalDays,
|
|
784
|
-
idempotencyKey,
|
|
785
|
-
vaultPassword,
|
|
786
|
-
});
|
|
826
|
+
const common = { projectId, name, secretFormat: secretFormat,
|
|
827
|
+
tags, idempotencyKey, vaultPassword };
|
|
828
|
+
return client.createGeneratedRecord(environment
|
|
829
|
+
? { ...common, accessScope: 'environment', environmentValues: [{ environment,
|
|
830
|
+
options: options ?? {}, extraFields: fields ?? {}, secretDueAt, rotationIntervalDays }] }
|
|
831
|
+
: { ...common, options: options ?? {}, extraFields: fields ?? {}, secretDueAt, rotationIntervalDays });
|
|
787
832
|
}
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
fieldValues: fields ?? {},
|
|
793
|
-
tags,
|
|
794
|
-
secretDueAt,
|
|
795
|
-
rotationIntervalDays,
|
|
796
|
-
idempotencyKey,
|
|
797
|
-
vaultPassword,
|
|
798
|
-
});
|
|
833
|
+
const common = { projectId, name, secretFormat, tags, idempotencyKey, vaultPassword };
|
|
834
|
+
return client.createSecret(environment
|
|
835
|
+
? { ...common, accessScope: 'environment', environmentValues: [{ environment,
|
|
836
|
+
fieldValues: fields ?? {}, secretDueAt, rotationIntervalDays }] }
|
|
837
|
+
: { ...common, fieldValues: fields ?? {}, secretDueAt, rotationIntervalDays });
|
|
799
838
|
}));
|
|
800
839
|
server.registerTool('list_record_anomalies', {
|
|
801
840
|
title: 'List record anomalies',
|
|
@@ -848,13 +887,14 @@ export function registerTools(inputServer, client, config) {
|
|
|
848
887
|
name: z.string().min(1).max(200).optional(),
|
|
849
888
|
secretFormat: z.string().optional(),
|
|
850
889
|
fields: z.record(z.string(), z.unknown()),
|
|
890
|
+
environment: recordEnvironment.optional(),
|
|
851
891
|
changedFields: z.array(z.string()).optional(),
|
|
852
892
|
tags: z.array(z.string()).optional(),
|
|
853
893
|
secretDueAt: z.string().nullable().optional(),
|
|
854
894
|
rotationIntervalDays: z.number().int().min(1).nullable().optional(),
|
|
855
895
|
idempotencyKey: z.string().min(1).optional(),
|
|
856
896
|
},
|
|
857
|
-
}, ({ recordId, projectId, name, secretFormat, fields, changedFields, tags, secretDueAt, rotationIntervalDays, idempotencyKey, }) => run(async () => {
|
|
897
|
+
}, ({ recordId, projectId, name, secretFormat, fields, environment, changedFields, tags, secretDueAt, rotationIntervalDays, idempotencyKey, }) => run(async () => {
|
|
858
898
|
if (secretFormat !== undefined && !isSecretFormat(secretFormat)) {
|
|
859
899
|
throw apiError('bad_format', `Unknown secret format '${secretFormat}'.`, 400);
|
|
860
900
|
}
|
|
@@ -864,6 +904,7 @@ export function registerTools(inputServer, client, config) {
|
|
|
864
904
|
name,
|
|
865
905
|
secretFormat,
|
|
866
906
|
fieldValues: fields,
|
|
907
|
+
...(environment ? { environment } : {}),
|
|
867
908
|
changedFields,
|
|
868
909
|
tags,
|
|
869
910
|
secretDueAt,
|
|
@@ -949,7 +990,9 @@ export function registerTools(inputServer, client, config) {
|
|
|
949
990
|
server.registerTool('get_all', {
|
|
950
991
|
title: 'Get all project secrets (decrypted)',
|
|
951
992
|
description: 'Decrypt every record in a project that the caller can access, returning name+value pairs (e.g. to inject as env ' +
|
|
952
|
-
'vars).
|
|
953
|
-
|
|
954
|
-
|
|
993
|
+
'vars). Omit environment for General or select development, staging, or production. Unlock material comes from ' +
|
|
994
|
+
'the configured human password or Service Account credential, never the prompt. Same model-exposure caveat as get_secret.',
|
|
995
|
+
inputSchema: { projectId: z.string().uuid(), environment: recordEnvironment.optional() },
|
|
996
|
+
}, ({ projectId, environment }) => run(() => client.getAll({ projectId, vaultPassword: recordUnlockPassword(config), audit: false,
|
|
997
|
+
...(environment ? { environment } : {}) })));
|
|
955
998
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airctrl/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Local/self-hosted MCP server for AIRCTRL records, projects, gateways and usage workflows.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"start": "node dist/index.js"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@airctrl/sdk": "0.
|
|
41
|
-
"@modelcontextprotocol/sdk": "1.
|
|
40
|
+
"@airctrl/sdk": "0.3.0",
|
|
41
|
+
"@modelcontextprotocol/sdk": "1.32.1",
|
|
42
42
|
"zod": "4.4.3"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|