Skip to main content
Glama
evalstate

Hugging Face MCP Server

by evalstate
browser-detection.test.ts2.36 kB
import { describe, it, expect } from 'vitest'; import { isBrowser } from '../../../src/server/utils/browser-detection.js'; describe('isBrowser', () => { it('returns false when accept header is missing', () => { expect(isBrowser({})).toBe(false); expect(isBrowser({ 'user-agent': 'Mozilla/5.0' })).toBe(false); }); it('returns false when accept contains text/event-stream', () => { // this is VSCode expect(isBrowser({ accept: 'text/event-stream' })).toBe(false); expect(isBrowser({ accept: 'text/event-stream, text/html' })).toBe(false); }); it('returns false when accept contains application/json', () => { expect(isBrowser({ accept: 'application/json' })).toBe(false); expect(isBrowser({ accept: 'application/json, text/plain' })).toBe(false); }); it('returns true when accept contains */*', () => { expect(isBrowser({ accept: '*/*' })).toBe(true); expect(isBrowser({ accept: 'text/html, */*' })).toBe(true); }); it('returns false for other accept headers', () => { expect(isBrowser({ accept: 'text/html' })).toBe(false); expect(isBrowser({ accept: 'text/plain' })).toBe(false); expect(isBrowser({ accept: 'image/png' })).toBe(false); }); it('handles array accept headers', () => { expect(isBrowser({ accept: ['text/event-stream'] })).toBe(false); expect(isBrowser({ accept: ['*/*', 'text/html'] })).toBe(true); expect(isBrowser({ accept: ['application/json', 'text/plain'] })).toBe(false); }); it('real browser examples', () => { // Chrome expect( isBrowser({ accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8', }) ).toBe(true); // Safari expect( isBrowser({ accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', }) ).toBe(true); // hugging face javascript mcp-client expect( isBrowser({ accept: 'text/event-stream', }) ).toBe(false); // hugging face javascript mcp-client expect( isBrowser({ accept: 'text/event-stream', }) ).toBe(false); }); it('API client examples', () => { // SSE client expect(isBrowser({ accept: 'text/event-stream' })).toBe(false); // JSON API client expect(isBrowser({ accept: 'application/json' })).toBe(false); // Mixed API client expect(isBrowser({ accept: 'application/json, text/event-stream' })).toBe(false); }); });

Latest Blog Posts

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/evalstate/hf-mcp-server'

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