Skip to main content
Glama
mbaozi

WebLLMRelay

by mbaozi

WebLLMRelay — Web LLM Distribution MCP

Connect web LLMs to agents: through a unified MCP interface, reuse web login sessions to call the chat and image generation capabilities of various platforms' LLMs — no API key or API costs required. If web search lets agents "look up information", this lets agents "ask experts" — dispatching tasks to the web LLM that excels at them.

Quick Start

Environment: Python 3.10+

  1. Install dependencies

    python -m pip install -r requirements.txt
  2. Download the bundled browser (must be downloaded to the project's browsers/ directory; the app only recognizes this location)

    set PLAYWRIGHT_BROWSERS_PATH=D:\path\to\WebLLMRelay\browsers
    python -m playwright install chromium

    ⚠️ Not setting PLAYWRIGHT_BROWSERS_PATH will download the browser to the system cache, and you'll get an "Executable doesn't exist" error at startup. For networks in China, you can add a mirror: set PLAYWRIGHT_DOWNLOAD_HOST=https://npmmirror.com/mirrors/playwright/

  3. Start the service: start_webllmrelay.bat (if already running, it will open the page; otherwise it will start the service and open the page), or python -m webllmrelay.webui_server --port 8787

  4. Log in to platforms: In the WebUI, click "Web Login" for the target platform → log in in the built-in browser window → close the window; the login session is automatically detected and saved

  5. Verify platforms: Click "Test Chat" to verify text Q&A, click "Test Image" to verify image generation (on success, the platform is automatically marked as verified)

  6. Connect MCP clients: Point your client to http://127.0.0.1:8787/mcp (HTTP), or fill in the command to launch (stdio). See "MCP Client Integration" on the WebUI page for details; click "Copy" to use.

Related MCP server: open-use

MCP Tools

After connecting, three tools are automatically exposed to the agent. Manual invocation is generally unnecessary — just talk to the assistant naturally and it will choose the tool automatically; to force a tool, prefix your message with >; to disable tools, add !.

User: "Use Doubao to look up: What are the new features in Python 3.13?" Assistant: calls ask_web_llm(platform="doubao", prompt="Python 3.13 的新特性有哪些?")

ask_web_llm — Text Q&A / Task Dispatch

Parameter

Description

platform

doubao / deepseek / kimi / qwen / zhipu / yuanbao

prompt

Question or task (asking, writing, summarizing, translating, coding, etc.)

conversation_id

Optional; leave empty = new conversation, provide = continue chatting (preserves context)

Returns {"answer", "conversation_id"}.

ask_web_llm_image — Image Generation

Parameter

Description

platform

doubao / qwen / zhipu / yuanbao support image generation (deepseek / kimi not yet supported)

prompt

Image description prompt

conversation_id

Optional; if provided, can continue editing based on the original image

Returns {"images": [{"url", "path"}], "conversation_id"}:

  • url: image URL served by the local service, can be directly downloaded / displayed / opened;

  • path: absolute path of the image on local disk, which the agent can read directly locally.

Images are automatically downloaded by the MCP within the browser session to generated_images/ (anti-hotlinking of original images is handled internally); when the cache exceeds 100 images, the oldest are automatically cleaned up.

list_web_llms — List Platforms

No parameters; returns [{"platform", "name", "supports_image", "verified"}], where platform is the value for the ask tools.

Architecture

webllmrelay/
├── config.py        # ProviderSpec(每平台知识)+ 平台/登录态持久化
├── browser.py       # BrowserManager:会话式浏览器生命周期、死浏览器自动恢复
├── lock.py          # 持久化浏览器 profile 互斥锁
├── adapters.py      # PlatformAdapter 接口 + CssAdapter 默认实现 + 注册表
├── providers.py     # ask_web_llm / ask_web_llm_image / list_web_llms
├── mcp.py           # MCP server 定义与工具注册
├── activity_log.py  # 活动日志(登录 / 测试 / 调用)
├── login_worker.py  # 登录窗口子进程
├── probe.py         # 平台适配诊断 CLI(接入新平台用)
├── webui.py         # FastAPI:平台管理 / 测试 / 日志
├── webui_server.py  # WebUI 启动入口
└── webui_static/    # WebUI 前端页面

Scope

  • Single-model calls: the agent decides which model to ask; no "multi-model comparison" is performed.

  • Response format: whatever the web page returns is what you get; no formatting is applied.

  • Login: done manually by the user (WebUI "Web Login" opens a browser window); login status is actually detected based on per-platform login indicator elements, automatically detected after the login window closes, and manually via the "Detect" button on the card.

  • Browser: Release builds bundle Chromium by default (packaged with the app, no system dependencies); the WebUI settings card can switch to the system Edge. Login data for the two browsers is independent. It runs visibly by default; you can enable "Hide browser when called by agent" for silent operation.

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    C
    maintenance
    Provides AI agents with a real browser environment for web automation, memory, and secure credential management through 15 MCP tools.
    15
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI agents to automate both web browsers and native desktop applications through a unified interface, supporting tasks like browsing, clicking, typing, and file clipboard operations via exposed MCP tools.
    1
    Apache 2.0
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables MCP-compatible applications to manage, run, chat with, and generate embeddings from local or cloud LLM models, and to perform web search and content fetching via cloud APIs.
    1,165 npm
    AGPL 3.0