UNPKG

@goparrot/franchise-mcp-server

Version:

MCP Server for Franchise API

20 lines (19 loc) 625 B
/** * Build URL with parameters */ export function buildEndpoint(methodInfo, pathParams, queryParams) { // Build URL with path parameters let endpoint = methodInfo.path; // Replace path parameters Object.entries(pathParams).forEach(([key, value]) => { endpoint = endpoint.replace(`{${key}}`, value); }); // Add query parameters const queryString = Object.entries(queryParams) .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`) .join('&'); if (queryString) { endpoint = `${endpoint}?${queryString}`; } return endpoint; }