Skip to main content
Glama

Spec Workflow MCP

session-manager.ts1.35 kB
import { join } from 'path'; import { promises as fs } from 'fs'; import { ensureDirectoryExists } from './path-utils.js'; interface SessionData { dashboardUrl: string; startedAt: string; pid: number; } export class SessionManager { private projectPath: string; private sessionFilePath: string; constructor(projectPath: string) { this.projectPath = projectPath; this.sessionFilePath = join(projectPath, '.spec-workflow', 'session.json'); } async createSession(dashboardUrl: string): Promise<void> { const sessionData: SessionData = { dashboardUrl, startedAt: new Date().toISOString(), pid: process.pid }; // Ensure .spec-workflow directory exists await ensureDirectoryExists(join(this.projectPath, '.spec-workflow')); // Write session.json await fs.writeFile(this.sessionFilePath, JSON.stringify(sessionData, null, 2), 'utf-8'); } async getSession(): Promise<SessionData | null> { try { const sessionContent = await fs.readFile(this.sessionFilePath, 'utf-8'); return JSON.parse(sessionContent) as SessionData; } catch (error) { // Session file doesn't exist or is invalid return null; } } async getDashboardUrl(): Promise<string | undefined> { const session = await this.getSession(); return session?.dashboardUrl; } }

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/Pimzino/spec-workflow-mcp'

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