Skip to main content
Glama

Token Saver MCP

by jerry426
browser-functions-mock.ts2.32 kB
// Placeholder browser functions - actual implementation requires CDP from main extension async function getCDPClient(): Promise<any> { return { isHealthy: true, isActive: true, connect: async () => {}, navigate: async () => {}, execute: async () => ({ result: null }), getPageInfo: async () => ({}), getConsoleMessages: () => [], clearConsoleMessages: () => {}, getDOMSnapshot: async () => ({}), click: async () => {}, type: async () => {}, screenshot: async () => ({ data: '' }), waitForSelector: async () => {}, } } function _resetCDPClient(): void {} const _logger = { info: console.error, error: console.error, warn: console.warn, } export async function ensureCDPConnection() { return getCDPClient() } export async function executeInBrowser(expression: string, url?: string) { const client = await getCDPClient() if (url) { await client.navigate(url) } const result = await client.execute(expression) return JSON.stringify(result) } export async function getBrowserConsole(filter?: string, clear?: boolean) { const client = await getCDPClient() const messages = client.getConsoleMessages() if (clear) { client.clearConsoleMessages() } return JSON.stringify({ messages }) } export async function navigateBrowser(url: string) { const client = await getCDPClient() await client.navigate(url) return JSON.stringify({ success: true }) } export async function getDOMSnapshot() { const client = await getCDPClient() const snapshot = await client.getDOMSnapshot() return JSON.stringify(snapshot) } export async function clickElement(selector: string) { const client = await getCDPClient() await client.click(selector) return JSON.stringify({ success: true }) } export async function typeInBrowser(selector: string, text: string) { const client = await getCDPClient() await client.type(selector, text) return JSON.stringify({ success: true }) } export async function takeScreenshot() { const client = await getCDPClient() const result = await client.screenshot() return result.data } export async function waitForElement(selector: string, timeout?: number) { const client = await getCDPClient() await client.waitForSelector(selector, timeout) return JSON.stringify({ success: true }) }

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/jerry426/token-saver-mcp'

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