Skip to content

Add CreateJwt MCP tool for Dev Proxy jwt create command - #122

Merged
garrytrinder merged 3 commits into
mainfrom
copilot/add-mcp-tool-for-jwt-tokens
May 18, 2026
Merged

Add CreateJwt MCP tool for Dev Proxy jwt create command#122
garrytrinder merged 3 commits into
mainfrom
copilot/add-mcp-tool-for-jwt-tokens

Conversation

Copilot AI commented Apr 27, 2026

Copy link
Copy Markdown
Contributor
  • Create src/createJwt.ts - implements the devproxy jwt create command execution with all supported parameters
  • Update src/index.ts - register the new CreateJwt MCP tool with Zod parameter schemas
  • Add .default(60) to validFor for practical token lifetime out of the box
  • Add .min(32) to signingKey for schema-level validation
  • Build and verify the changes compile successfully

Copilot AI changed the title [WIP] Add MCP tool for creating JWT tokens via Dev Proxy Add CreateJwt MCP tool for Dev Proxy jwt create command Apr 27, 2026
Copilot AI requested a review from garrytrinder April 27, 2026 09:33

@garrytrinder garrytrinder left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A couple of suggestions for the schema definitions.

Comment thread src/index.ts Outdated
roles: z.array(z.string()).optional().describe('The roles to include in the token'),
scopes: z.array(z.string()).optional().describe('The scopes to include in the token'),
claims: z.array(z.string()).optional().describe('Custom claims to include in the token in the format name:value'),
validFor: z.number().optional().describe('The token validity in minutes'),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Consider adding .default(60) here so tokens have a useful lifetime out of the box. Without it, the CLI defaults to 0 minutes (token expires immediately on creation), which isn't practical for testing.

Suggested change
validFor: z.number().optional().describe('The token validity in minutes'),
validFor: z.number().optional().default(60).describe('The token validity in minutes'),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Applied in a4324bf — added .default(60) to validFor.

Comment thread src/index.ts Outdated
scopes: z.array(z.string()).optional().describe('The scopes to include in the token'),
claims: z.array(z.string()).optional().describe('Custom claims to include in the token in the format name:value'),
validFor: z.number().optional().describe('The token validity in minutes'),
signingKey: z.string().optional().describe('The signing key for the token. Must be at least 32 characters'),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since the description already states the minimum length, worth enforcing it at the schema level with .min(32) for a better error message (vs a cryptic CLI error).

Suggested change
signingKey: z.string().optional().describe('The signing key for the token. Must be at least 32 characters'),
signingKey: z.string().min(32).optional().describe('The signing key for the token. Must be at least 32 characters'),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Applied in a4324bf — added .min(32) to signingKey.

@garrytrinder

Copy link
Copy Markdown
Member

@copilot address the PR comments

Copilot AI requested a review from garrytrinder May 18, 2026 16:11

@garrytrinder garrytrinder left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tested locally — builds clean, all params flow correctly, default validFor and signingKey min validation working as expected. Ship it.

@garrytrinder
garrytrinder marked this pull request as ready for review May 18, 2026 16:15
@garrytrinder
garrytrinder merged commit 0babe8a into main May 18, 2026
@garrytrinder
garrytrinder deleted the copilot/add-mcp-tool-for-jwt-tokens branch May 18, 2026 16:15
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.

Proposal: Add MCP tool for creating JWT tokens via Dev Proxy jwt create command

2 participants