Skip to main content
Glama
by OpaqueGlass
index.ts1.62 kB
// debug push let g_DEBUG = 2; const g_NAME = "mcp"; const g_FULLNAME = "MCP_Server"; /* LEVEL 0 忽略所有 LEVEL 1 仅Error LEVEL 2 Err + Warn LEVEL 3 Err + Warn + Info LEVEL 4 Err + Warn + Info + Log LEVEL 5 Err + Warn + Info + Log + Debug 请注意,基于代码片段加入window下的debug设置,可能在刚载入挂件时无效 */ export function commonPushCheck() { if (window.top["OpaqueGlassDebugV2"] == undefined || window.top["OpaqueGlassDebugV2"][g_NAME] == undefined) { return g_DEBUG; } return window.top["OpaqueGlassDebugV2"][g_NAME]; } export function isDebugMode() { return commonPushCheck() > g_DEBUG; } export function debugPush(str: string, ...args: any[]) { if (commonPushCheck() >= 5) { console.debug(`${g_FULLNAME}[D] ${new Date().toLocaleTimeString()} ${str}`, ...args); } } export function infoPush(str: string, ...args: any[]) { if (commonPushCheck() >= 3) { console.info(`${g_FULLNAME}[I] ${new Date().toLocaleTimeString()} ${str}`, ...args); } } export function logPush(str: string, ...args: any[]) { if (commonPushCheck() >= 4) { console.log(`${g_FULLNAME}[L] ${new Date().toLocaleTimeString()} ${str}`, ...args); } } export function errorPush(str: string, ... args: any[]) { if (commonPushCheck() >= 1) { console.error(`${g_FULLNAME}[E] ${new Date().toLocaleTimeString()} ${str}`, ...args); } } export function warnPush(str: string, ... args: any[]) { if (commonPushCheck() >= 2) { console.warn(`${g_FULLNAME}[W] ${new Date().toLocaleTimeString()} ${str}`, ...args); } }

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/OpaqueGlass/syplugin-anMCPServer'

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