Skip to main content
Glama

Selenium MCP Server

helpers.ts1.12 kB
import { WebDriver } from 'selenium-webdriver'; import { ServerState } from '../types/index.js'; export class StateManager { private state: ServerState; constructor() { this.state = { drivers: new Map(), currentSession: null, }; } getState(): ServerState { return this.state; } getDriver(): WebDriver { if (!this.state.currentSession) { throw new Error('No active browser session'); } const driver = this.state.drivers.get(this.state.currentSession); if (!driver) { throw new Error('No active browser session'); } return driver; } setCurrentSession(sessionId: string): void { this.state.currentSession = sessionId; } addDriver(sessionId: string, driver: WebDriver): void { this.state.drivers.set(sessionId, driver); } removeDriver(sessionId: string): void { this.state.drivers.delete(sessionId); } clearDrivers(): void { this.state.drivers.clear(); } getCurrentSession(): string | null { return this.state.currentSession; } resetCurrentSession(): void { this.state.currentSession = null; } }

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/pshivapr/selenium-mcp'

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