UNPKG

@crazyrabbitltc/railway-mcp

Version:

Railway MCP Server - 146+ tools with 100% Railway API coverage, comprehensive MCP testing framework, and real infrastructure management through AI assistants. Enhanced version with enterprise features, based on original work by Jason Tan.

35 lines (34 loc) 1.26 kB
export function createSuccessResponse(response) { return { content: [{ type: 'text', text: response.text }], data: response.data }; } export function createErrorResponse(message) { return { content: [{ type: 'text', text: message }], isError: true }; } export function formatError(error) { if (error instanceof Error) { // Sanitize error messages to avoid exposing sensitive information const message = error.message; // Remove potential file paths, API keys, and other sensitive data const sanitized = message .replace(/\/[^\s]+/g, '[PATH]') // Remove file paths .replace(/[A-Za-z0-9+\/=]{32,}/g, '[REDACTED]') // Remove potential tokens/keys .replace(/Bearer\s+[^\s]+/g, 'Bearer [REDACTED]') // Remove Bearer tokens .replace(/token[:\s]+[^\s]+/gi, 'token: [REDACTED]') // Remove token values .replace(/key[:\s]+[^\s]+/gi, 'key: [REDACTED]') // Remove key values .replace(/password[:\s]+[^\s]+/gi, 'password: [REDACTED]'); // Remove passwords return sanitized; } return 'An unknown error occurred'; }