All files / src/cli/docker oauth-issuer-prompt.ts

100% Statements 5/5
100% Branches 2/2
100% Functions 2/2
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21        4x 4x             4x 6x       5x      
/**
 * Prompt for the public URL of an OAuth deployment (OAUTH_ISSUER)
 */
 
import * as p from '@clack/prompts';
import { issuerValidationError } from '../../oauth/config';
 
/**
 * Ask for the URL clients connect to. It is the issuer of every token and the base of the
 * GitLab callback, so a remote deployment needs its real URL; the default only serves
 * clients on this machine. Values the server would reject are refused here.
 */
export function promptOAuthIssuer(port: number): ReturnType<typeof p.text> {
  return p.text({
    message: 'Public URL clients connect to (OAUTH_ISSUER):',
    placeholder: 'https://mcp.example.com',
    initialValue: `http://localhost:${port}`,
    validate: (value) => issuerValidationError(value ?? ''),
  });
}