UNPKG

@stripe/mcp

Version:

A command line tool for setting up Stripe MCP server

33 lines (32 loc) 1.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.extractClientName = extractClientName; exports.buildUserAgent = buildUserAgent; const VERSION = '0.3.1'; const BASE_USER_AGENT = `stripe-mcp-local/${VERSION}`; /** * Extract the client name from an MCP initialize request message. * Returns undefined if the message is not an initialize request or has no clientInfo. */ function extractClientName(message) { if (message.method === 'initialize' && message.params != null && typeof message.params === 'object' && 'clientInfo' in message.params && message.params.clientInfo != null && typeof message.params.clientInfo === 'object' && 'name' in message.params.clientInfo && typeof message.params.clientInfo.name === 'string') { return message.params.clientInfo.name; } return undefined; } /** * Build the User-Agent string, appending the MCP client name if available. */ function buildUserAgent(clientName) { if (clientName) { return `${BASE_USER_AGENT} (${clientName})`; } return BASE_USER_AGENT; }