Skip to content

feat(vault): add secret copy and service token tools to @ferrvault/api-mcp - #424

Merged
BryanFRD merged 2 commits into
mainfrom
feat/ferrvault-copy-service-tokens
Oct 7, 2026
Merged

BryanFRD merged 2 commits into
mainfrom
feat/ferrvault-copy-service-tokens

Conversation

@BryanFRD

@BryanFRD BryanFRD commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Adds four tools to @ferrvault/api-mcp.

  • copy_ferrvault_secret: source {vault, environment, name}, target {vault, environment, name?} (name defaults to the source name). Reveals the source and creates or versions the target inside the server. The value is never returned and is redacted from errors. Refuses a target equal to the source. Returns outcome (created/versioned), target coordinates, source_version, target_version.
  • list_ferrvault_service_tokens: GET /vaults/{vault}/environments/{env}/operator/tokens. Whitelisted metadata only (id, name, vault, environment, role, created_by, created_at, expires_at, last_used_at); token_preview is dropped too.
  • create_ferrvault_service_token: POST .../operator/tokens with {label, role, expires_at?}, then writes the returned token into store {vault, environment, name} with the same create-or-version logic. The token is never returned and is redacted from errors. If the write fails, the new token is revoked (DELETE .../operator/tokens/{id}) and the error says whether that worked.
  • revoke_ferrvault_service_token: DELETE .../operator/tokens/{id}, id validated as a uuid.

Tokens are bound to one vault environment (that is how the API scopes them), and all three token routes require the admin role on the vault.

The create-or-version logic moved to upsert.ts so the new tools share it. set_ferrvault_secret and generate_ferrvault_secret still report rotated. guarded can now redact values that are only known mid-call (the revealed value, the created token). The test harness moved to __tests__/harness.ts and also exposes the registered input schemas, so the tests check path parameter validation against the real tool schemas, nested objects included.

@ferrfleet ferrfleet Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing blocking. The secret-handling paths look right: copied values and new tokens are redacted from errors through redactLater, a failed store revokes the new token, and the upsertSecret extraction keeps set/generate behaving as before.

  • Nit: there are now two names for the same outcome. set/generate report rotated (secret-writes.ts:12), while copy and create_ferrvault_service_token report versioned through versionOutcome. Pick one word for the public output. If rotated has to stay for compatibility, have versionOutcome take the label so the mapping isn't written twice.
  • Nit: the gitleaks alert on service-tokens.test.ts:15 is a fake fixture UUID. Dismiss it as a test value so it doesn't sit on the PR.

@BryanFRD

BryanFRD commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Folded the outcome mapping into one outcome(upserted, label) helper in upsert.ts, used by all four write tools. set/generate keep rotated so their output stays compatible. Renamed the uuid fixture so gitleaks stops matching on the variable name.


const TOKENS = `${API}/vaults/infra/environments/prod/operator/tokens`;
const STORE_SECRETS = `${API}/vaults/infra/environments/ci/secrets`;
const SAT_ID = '0b0e3c4e-6c2f-4f0e-9a51-7a1f2d1c9e01';

@ferrfleet ferrfleet Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8761b69 handles the outcome-label nit: set/generate and copy/create_ferrvault_service_token now share one mapping through outcome(written, label), and the public output is the same as before. Nothing new is broken.

@BryanFRD
BryanFRD merged commit 3c55af0 into main Oct 7, 2026
16 checks passed
@BryanFRD
BryanFRD deleted the feat/ferrvault-copy-service-tokens branch October 7, 2026 10:22
ferrflow Bot added a commit that referenced this pull request Oct 7, 2026
## [10.4.0] - 2026-10-07

### Features

- feat(vault): add secret copy and service token tools to @ferrvault/api-mcp (#424)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants