Skip to main content
Glama
TehilaTheStudent

Huawei CCE MCP Server

logs.ts1.82 kB
import fs from 'fs'; // const LOG_FILE_PATH = process.env.LOG_FILE_PATH; const LOG_FILE_PATH ="try-cce-gitlab.log"; const SHOULD_LOG = !!LOG_FILE_PATH; function writeLog(message: string) { if (!SHOULD_LOG) return; const timestamp = new Date().toISOString(); fs.appendFileSync(LOG_FILE_PATH!, `[${timestamp}] ${message}\n`); } export function logHttpRequest( method: string, url: string, headers?: Record<string, string>, body?: any, queryParams?: Record<string, any> ) { writeLog(`[HTTP REQUEST] ${method} ${url}`); if (headers) { writeLog(` Headers: ${JSON.stringify(headers, null, 2)}`); } if (queryParams) { writeLog(` Query Params: ${JSON.stringify(queryParams, null, 2)}`); } if (body) { writeLog(` Body: ${JSON.stringify(body, null, 2)}`); } } export function logHttpResponse( status: number, headers?: Record<string, string>, body?: any, duration?: number ) { const statusText = status < 400 ? 'SUCCESS' : 'ERROR'; writeLog(`[HTTP RESPONSE] Status: ${status} (${statusText})`); if (duration) { writeLog(` Duration: ${duration}ms`); } if (headers) { writeLog(` Headers: ${JSON.stringify(headers, null, 2)}`); } if (body) { writeLog(` Body: ${JSON.stringify(body, null, 2)}`); } } export function logMcpUsage({ tool, args, result, error }: { tool: string, args: any, result?: any, error?: any }) { if (error) { writeLog(`[MCP ERROR] Tool: ${tool} | Args: ${JSON.stringify(args)} | Error: ${error}`); } else { writeLog(`[MCP USAGE] Tool: ${tool} | Args: ${JSON.stringify(args)} | Result: ${result ? JSON.stringify(result).slice(0, 300) : ''}`); } } export function logInfo(message: string) { writeLog(`[INFO] ${message}`); } export function logError(message: string) { writeLog(`[ERROR] ${message}`); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TehilaTheStudent/try-cce-gitlab'

If you have feedback or need assistance with the MCP directory API, please join our Discord server