Skip to main content
Glama
configStore.ts849 B
import { app } from "electron"; import fs from "node:fs"; import path from "node:path"; import type { Config } from "./config"; export class ConfigStore { private dirPath: string; constructor() { this.dirPath = app.getPath("userData"); } load(): Config | undefined { const filePath = path.join(this.dirPath, "config.json"); if (!fs.existsSync(filePath)) { return undefined; } const text = fs.readFileSync(filePath, { encoding: "utf-8" }); const config = JSON.parse(text); return config; } save(config: Config): void { if (!fs.existsSync(this.dirPath)) { fs.mkdirSync(this.dirPath, { recursive: true }); } const filePath = path.join(this.dirPath, "config.json"); const text = JSON.stringify(config, null, 2); fs.writeFileSync(filePath, text, { encoding: "utf-8" }); } }

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/thamaji/yak-mcp'

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