Skip to main content
Glama

PentestThinkingMCP

by LT7T
state-manager.js1.15 kB
export class StateManager { constructor() { this.sessions = new Map(); } async createSession(sessionId, params) { const state = { context: params.context, currentPaths: [], depth: 0, completed: false, assets: [] // Track assets involved in the session }; this.sessions.set(sessionId, state); return state; } async getSession(sessionId) { const state = this.sessions.get(sessionId); if (!state) { throw new Error('Session not found'); } return state; } async updateSession(sessionId, newPaths) { const state = await this.getSession(sessionId); state.currentPaths = newPaths; state.depth += 1; state.completed = state.depth >= 3; // Max depth reached // Collect unique assets from newPaths state.assets = [ ...new Set( newPaths.flatMap(p => p.path && Array.isArray(p.path) ? p.path.map(step => step.asset).filter(Boolean) : [] ) ) ]; this.sessions.set(sessionId, state); return state; } async deleteSession(sessionId) { this.sessions.delete(sessionId); } }

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/LT7T/SecMCP'

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