Skip to main content
Glama

Chat Context MCP

by aolshaun
platform.ts1.87 kB
/** * Platform Detection * * Detects OS and returns appropriate Cursor database path. */ import os from 'os'; import path from 'path'; import fs from 'fs'; /** * Get Cursor database path for current platform * @throws Error if platform is unsupported or DB doesn't exist */ export function getCursorDBPath(): string { const home = os.homedir(); const platform = process.platform; let dbPath: string; switch (platform) { case 'darwin': // macOS dbPath = path.join(home, 'Library/Application Support/Cursor/User/globalStorage/state.vscdb'); break; case 'win32': // Windows dbPath = path.join(home, 'AppData/Roaming/Cursor/User/globalStorage/state.vscdb'); break; case 'linux': // Linux dbPath = path.join(home, '.config/Cursor/User/globalStorage/state.vscdb'); break; default: throw new Error(`Unsupported platform: ${platform}`); } return dbPath; } /** * Check if Cursor database exists */ export function cursorDBExists(): boolean { try { const dbPath = getCursorDBPath(); return fs.existsSync(dbPath); } catch { return false; } } /** * Get metadata database path */ export function getMetadataDBPath(): string { const home = os.homedir(); const metadataDir = path.join(home, '.cursor-context'); // Create directory if it doesn't exist if (!fs.existsSync(metadataDir)) { fs.mkdirSync(metadataDir, { recursive: true }); } return path.join(metadataDir, 'metadata.db'); } /** * Get platform information */ export function getPlatformInfo(): { platform: string; cursorDBPath: string; metadataDBPath: string; cursorDBExists: boolean; } { return { platform: process.platform, cursorDBPath: getCursorDBPath(), metadataDBPath: getMetadataDBPath(), cursorDBExists: cursorDBExists() }; }

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/aolshaun/chat-context-mcp'

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