Skip to main content
Glama

Swit MCP Server

by TykanN
token-cache.ts984 B
import fs from 'fs'; import path from 'path'; import os from 'os'; import { TokenInfo } from './oauth-manager.js'; export class TokenCache { private filePath: string; constructor(filePath?: string) { this.filePath = filePath || path.join(os.homedir(), '.swit-mcp-token.json'); } save(tokenInfo: TokenInfo): void { const data = JSON.stringify(tokenInfo, null, 2); fs.writeFileSync(this.filePath, data, 'utf8'); } load(): TokenInfo | null { try { if (!this.exists()) { return null; } const data = fs.readFileSync(this.filePath, 'utf8'); const tokenInfo = JSON.parse(data) as TokenInfo; return tokenInfo; } catch { return null; } } clear(): void { if (this.exists()) { fs.unlinkSync(this.filePath); } } exists(): boolean { try { return fs.existsSync(this.filePath); } catch { return false; } } getFilePath(): string { return this.filePath; } }

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/TykanN/swit-mcp'

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