Skip to content

MT-23076: support expires_at on the api token tools - #136

Draft
oshchyhol wants to merge 4 commits into
mainfrom
MT-23076-mcp-api-token-expiration
Draft

MT-23076: support expires_at on the api token tools#136
oshchyhol wants to merge 4 commits into
mainfrom
MT-23076-mcp-api-token-expiration

Conversation

@oshchyhol

@oshchyhol oshchyhol commented Aug 7, 2026

Copy link
Copy Markdown

Motivation

MT-23076

The API token endpoints now accept an optional expires_at (createApiToken request body and a new optional resetApiToken body). This exposes it on the create-api-token and reset-api-token tools.

Changes

  • add expires_at (type: ["string", "null"]) to the create-api-token input schema and CreateApiTokenRequest; the description spells out the tri-state for the LLM (omit = server default, null = never expires, 5-year cap)
  • new dedicated resetApiToken input schema – reset previously shared apiTokenSchema with get/delete, which has additionalProperties: false and would reject the new parameter; get/delete keep the shared schema
  • reset-api-token handler forwards { expires_at } to apiTokens.reset(id, body) only when the key is present, so calls without it keep sending no request body
  • document both parameters in the README tool reference

How to test

  • create-api-token with only a name – token created, expiration behavior unchanged (server default applies once rolled out)
  • create-api-token with expires_at: "2027-06-01T00:00:00Z" – created token reports that expiration
  • create-api-token with expires_at: null – created token never expires
  • create-api-token with a past expires_at – tool returns the server's 422 validation error
  • reset-api-token with only api_token_id – works exactly as before (no request body sent)
  • reset-api-token with expires_at: null – new token never expires

Companion PRs

Depends on the mailtrap npm release that ships MT-23076 (mailtrap-nodejs companion PR): create already passes expires_at through at runtime on mailtrap@4.8, but reset ignores the extra body argument until the dependency is bumped. Before merge, bump mailtrap in package.json to that release and drop the local signature cast in src/tools/apiTokens/resetApiToken.ts.

Caveat: release/merge only after falcon deploys MT-23076 and zap_api_token_expiration is enabled in production.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ab3247b3-1e78-4248-a24b-b968ef4fc2c7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant