Web-LLM MCP Server
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.
README
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 fromsystemPrompt(string, optional): System prompt to set contextmaxTokens(number, optional): Maximum tokens to generatetemperature(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 chatclearHistory(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-MLCPhi-3.5-mini-instruct-q4f16_1-MLCgemma-2-2b-it-q4f32_1-MLCMistral-7B-Instruct-v0.3-q4f16_1-MLCQwen2.5-1.5B-Instruct-q4f32_1-MLC
Installation
- Install dependencies:
pnpm install
- 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:
- Launching a headless Chromium browser using Playwright
- Loading the
index.htmlfile which contains the Web-LLM interface - Waiting for the Web-LLM model to initialize
- Exposing browser functions through the
window.webllmInterfaceobject - 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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。