Skip to main content
Glama

Web-LLM MCP Server

by ragingwind

Web-LLM MCP Server

An MCP server that uses Playwright to load and interact with an HTML page containing @mlc-ai/web-llm for local LLM inference.

Features

  • Browser-based LLM: Uses @mlc-ai/web-llm running in a Chromium browser instance
  • Playwright Integration: Automates browser interactions for seamless LLM operations
  • Multiple Tools: Generate text, chat, check status, change models, and take screenshots
  • Model Management: Support for various Web-LLM models with dynamic switching

Available Tools

playwright_llm_generate

Generate text using Web-LLM through the browser interface.

Parameters:

  • prompt (string): The prompt to generate text from
  • systemPrompt (string, optional): System prompt to set context
  • maxTokens (number, optional): Maximum tokens to generate
  • temperature (number, optional): Temperature for generation (0-1)
  • model (string, optional): Model to use (will reinitialize if different)

playwright_llm_chat

Start an interactive chat session and return the response.

Parameters:

  • message (string): Message to send in the chat
  • clearHistory (boolean, optional): Clear chat history before sending

playwright_llm_status

Get the current status of the Web-LLM Playwright interface.

playwright_llm_set_model

Change the current Web-LLM model.

Parameters:

  • model (string): Model ID to switch to

playwright_llm_screenshot

Take a screenshot of the Web-LLM interface.

Parameters:

  • path (string, optional): Path to save screenshot

Supported Models

  • Llama-3.2-1B-Instruct-q4f32_1-MLC (default)
  • Llama-3.2-3B-Instruct-q4f32_1-MLC
  • Phi-3.5-mini-instruct-q4f16_1-MLC
  • gemma-2-2b-it-q4f32_1-MLC
  • Mistral-7B-Instruct-v0.3-q4f16_1-MLC
  • Qwen2.5-1.5B-Instruct-q4f32_1-MLC

Installation

  1. Install dependencies:
pnpm install
  1. Install Playwright browsers:
npx playwright install chromium

Usage

Start the MCP server:

node index.js

Or run the test:

node test.js

Technical Details

The server works by:

  1. Launching a headless Chromium browser using Playwright
  2. Loading the index.html file which contains the Web-LLM interface
  3. Waiting for the Web-LLM model to initialize
  4. Exposing browser functions through the window.webllmInterface object
  5. Providing MCP tools that call these browser functions

The HTML interface provides a complete Web-LLM implementation with:

  • Model initialization and loading progress
  • Chat interface for testing
  • JavaScript API for programmatic access
  • Error handling and status reporting

Notes

  • First run will be slower as it downloads and initializes the LLM model
  • The browser runs in headless mode by default
  • Screenshots can be taken for debugging the interface
  • Model switching requires reinitialization which takes time
  • The interface is fully self-contained in the HTML file# project

project

-
security - not tested
F
license - not found
-
quality - not tested

A server that enables browser-based local LLM inference using Playwright to automate interactions with @mlc-ai/web-llm, supporting text generation, chat sessions, model switching, and status monitoring.

  1. Features
    1. Available Tools
      1. playwright_llm_generate
      2. playwright_llm_chat
      3. playwright_llm_status
      4. playwright_llm_set_model
      5. playwright_llm_screenshot
    2. Supported Models
      1. Installation
        1. Usage
          1. Technical Details
            1. Notes
              1. project

                Related MCP Servers

                • A
                  security
                  A
                  license
                  A
                  quality
                  A Model Context Protocol server that provides browser automation capabilities using Playwright. This server enables LLMs to interact with web pages, take screenshots, and execute JavaScript in a real browser environment.
                  Last updated -
                  13
                  10,534
                  3,956
                  TypeScript
                  MIT License
                  • Linux
                  • Apple
                • -
                  security
                  A
                  license
                  -
                  quality
                  A Model Context Protocol server that provides browser automation capabilities using Playwright, enabling LLMs to interact with web pages, take screenshots, and execute JavaScript in a real browser environment.
                  Last updated -
                  3
                  Python
                  Apache 2.0
                • A
                  security
                  A
                  license
                  A
                  quality
                  A Model Context Protocol server that provides browser automation capabilities using Playwright, enabling LLMs to interact with web pages through structured accessibility snapshots without requiring screenshots or vision models.
                  Last updated -
                  21
                  70,036
                  TypeScript
                  Apache 2.0
                  • Apple
                  • Linux
                • A
                  security
                  A
                  license
                  A
                  quality
                  A Model Context Protocol server that provides browser automation capabilities using Playwright, enabling LLMs to interact with web pages, take screenshots, generate test code, scrape web content, and execute JavaScript in real browser environments.
                  Last updated -
                  31
                  10,534
                  TypeScript
                  MIT License
                  • Linux
                  • Apple

                View all related MCP servers

                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/ragingwind/web-llm-mcp-server'

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