end0tknr's kipple - web写経開発

太宰府天満宮の狛犬って、妙にカワイイ

qwen2.5vl/qwen3 + ollama + open-webui + mcpo for win による local llm での mcp

以前の ollama for win + qwen2.5:14b + langchain for python によるローカルllmでのmcp - end0tknr's kipple - web写経開発 では langchain-mcp-adapters を用い、ローカルLLM環境を構築しましたが、 今回は、open-webui を用い、以下の手順で構築しました。

当初、qwen2.5vl のみで、mcpからブラウザを起動し、画面キャプチャや 画面キャプチャからのocrを考えましたが、 qwen2.5vlでは上手くブラウザを操作できませんでしたので、 mcpでの操作は qwen3を用い、open webuiで切替え、 ocrのみ qwen2.5vlを使用するとよいかもしれません。

ただ、2025年4月頃に公開されたqwen3は、以前のlocal llmと比較して、性能が上昇している印象を受けましたが、 それでも「claude desktop を用いたmcpと比較すると、まだまだ」でした。

目次

参考

環境

項目 内容
PC thinkpad x1 carbon , cpu:core i7, mem:64GB
OS windows11 pro
GPU nvidia geforce rtx 4090
Local LLM ollama + qwen2.5vl / qwen3
UI Python 3.11 + Open WebUI
MCP mcpo + playwright

Local LLM - ollama + qwen2.5vl / qwen3

ollama for win は以前、install済みですので、qwen2.5vl と qwen3 のみ pull

C:\Users\end0t>where ollama
C:\Users\end0t\AppData\Local\Programs\Ollama\ollama.exe
C:\Users\end0t>ollama --version
ollama version is 0.11.10

C:\Users\end0t>pull qwen3:14b
C:\Users\end0t>pull qwen2.5vl:7b

C:\Users\end0t>ollama list
NAME            ID              SIZE      MODIFIED
qwen3:14b       bdbd181c33f2    9.3 GB    8 hours ago
qwen2.5vl:7b    5ced39dfa4ba    6.0 GB    10 hours ago

UI - Python 3.11 + Open WebUI

open webui の how to install に「python 3.11を使用すること」の旨が 記載されていましたので、python 3.11 for win からinstall

Open WebUI can be installed using pip, the Python package installer.
Before proceeding, ensure you're using Python 3.11 to avoid compatibility issues.
DOS> curl -sSL -O https://www.python.org/ftp/python/3.11.9/python-3.11.9-embed-amd64.zip
DOS> mkdir python3.11
DOS> tar -xf python-3.11.9-embed-amd64.zip -C python3.11

DOS> curl -sSL -O https://bootstrap.pypa.io/get-pip.py
DOS> python3.11\python.exe get-pip.py

zip版pythonのdefaultは Lib/site-packages 以下を読まず、pip installできない為、 python311._pth を編集後、pip install

DOS> vi python3.11\ python311._pth
old) #import site
new) import site

DOS> python3.11\Scripts\pip.exe install --no-warn-script-location open-webui

mcpoの準備は先ですが、ここでopen webui + ollama + qwen2.5vl/qwen3 の動作確認。 open-webui.exe 実行後、1分もすると、open webuiが起動しますので、 http://localhost:8080 へ アクセスし、 qwen3に対しての質問や、qwen2.5vlへのocrで簡単な動作確認を行ってください。

C:\Users\end0t\dev\OPEN_WEBUI>..\..\python3.11\Scripts\open-webui.exe serve --port 8080

Loading WEBUI_SECRET_KEY from file, not provided as an environment variable.
Loading WEBUI_SECRET_KEY from C:\Users\end0t\dev\OPEN_WEBUI\.webui_secret_key
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [open_webui.env] 'ENABLE_SIGNUP' loaded from the latest database entry
WARNI [open_webui.env]

WARNING: CORS_ALLOW_ORIGIN IS SET TO '*' - NOT RECOMMENDED FOR PRODUCTION DEPLOYMENTS.

INFO  [open_webui.env] VECTOR_DB: chroma
INFO  [open_webui.env] Embedding model set: sentence-transformers/all-MiniLM-L6-v2
C:\Users\end0t\python3.11\Lib\site-packages\pydub\utils.py:170:
RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work
  warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)
WARNI [langchain_community.utils.user_agent] USER_AGENT environment variable not set,
  consider setting it to identify your requests.
 ██████╗ ██████╗ ███████╗███╗   ██╗    ██╗    ██╗███████╗██████╗ ██╗   ██╗██╗
██╔═══██╗██╔══██╗██╔════╝████╗  ██║    ██║    ██║██╔════╝██╔══██╗██║   ██║██║
██║   ██║██████╔╝█████╗  ██╔██╗ ██║    ██║ █╗ ██║█████╗  ██████╔╝██║   ██║██║
██║   ██║██╔═══╝ ██╔══╝  ██║╚██╗██║    ██║███╗██║██╔══╝  ██╔══██╗██║   ██║██║
╚██████╔╝██║     ███████╗██║ ╚████║    ╚███╔███╔╝███████╗██████╔╝╚██████╔╝██║
 ╚═════╝ ╚═╝     ╚══════╝╚═╝  ╚═══╝     ╚══╝╚══╝ ╚══════╝╚═════╝  ╚═════╝ ╚═╝
v0.6.26 - building the best AI user interface.
https://github.com/open-webui/open-webui

INFO:     Started server process [10096]
INFO:     Waiting for application startup.

★しばらく待ちます

MCP - mcpo + playwright

DOS> python3.11\Scripts\pip.exe install --no-warn-script-location mcpo
DOS> python3.11\Scripts\mcpo.exe --help

 Usage: mcpo [OPTIONS]

╭─ Options ─────────────────────────────────────╮
│ --host                -h      TEXT     Host address [default: 0.0.0.0]             │
│ --port                -p      INTEGER  Port number [default: 8000]                 │
│ --cors-allow-origins          TEXT     CORS allowed origins [default: *]           │
│ --api-key             -k      TEXT     API key for authentication                  │
│ --strict-auth                          API key protects all endpoints and          │
│                                        documentation                               │
│ --env                 -e      TEXT     Environment variables                       │
│ --env-path                    TEXT     Path to environment variables file          │
│ --type,--server-type          TEXT     Server type [default: stdio]                │
│ --config              -c      TEXT     Config file path                            │
│ --name                -n      TEXT     Server name                                 │
│ --description         -d      TEXT     Server description                          │
│ --version             -v      TEXT     Server version                              │
│ --ssl-certfile        -t      TEXT     SSL certfile                                │
│ --ssl-keyfile         -K      TEXT     SSL keyfile                                 │
│ --path-prefix                 TEXT     URL prefix                                  │
│ --header              -H      TEXT     Headers in JSON format                      │
│ --hot-reload                           Enable hot reload for config file changes   │
│ --install-completion                   Install completion for the current shell.   │
│ --show-completion                      Show completion for the current shell, to   │
│                                        copy it or customize the installation.      │
│ --help                                 Show this message and exit.                 │
╰───────────────────────────────────────────╯

mcpの設定fileは、以前、claudeでのmcpで作成したものと、同様のものを利用できます。

DOS> vi c:/Users/end0t/dev/OPEN_WEBUI/mcpo_config.json

{
    "mcpServers": {
        "playwright": {
            "command": "npx",
            "args": [
                "@playwright/mcp@latest"
            ]
        },
        "file-system": {
            "command": "npx",
            "args": [
                "-y",
                "@modelcontextprotocol/server-filesystem",
                "C:/Users/end0t/tmp"
            ]
        }
    }
}

mcpo.exe を実行し、先程の open webui を再起動した上で http://localhost:8080 へ アクセスしてください。

DOS> python3.11\Scripts\mcpo.exe --port 8000 --host 0.0.0.0 --config c:/Users/end0t/dev/OPEN_WEBUI/mcpo_config.json
S

Starting MCP OpenAPI Proxy with config file: c:/Users/end0t/dev/OPEN_WEBUI/mcpo_config.json
2025-09-14 06:10:30,372 - INFO - Starting MCPO Server...
2025-09-14 06:10:30,372 - INFO -   Name: MCP OpenAPI Proxy
2025-09-14 06:10:30,372 - INFO -   Version: 1.0
2025-09-14 06:10:30,372 - INFO -   Description: Automatically generated API from MCP Tool Schemas
2025-09-14 06:10:30,372 - INFO -   Hostname: a64
2025-09-14 06:10:30,372 - INFO -   Port: 8000
2025-09-14 06:10:30,372 - INFO -   API Key: Not Provided
2025-09-14 06:10:30,372 - INFO -   CORS Allowed Origins: ['*']
2025-09-14 06:10:30,372 - INFO -   Path Prefix: /
2025-09-14 06:10:30,372 - INFO - Loading MCP server configurations from:
   c:/Users/end0t/dev/OPEN_WEBUI/mcpo_config.json
2025-09-14 06:10:30,387 - INFO - Configuring MCP Servers:
2025-09-14 06:10:30,387 - INFO - Uvicorn server starting...
2025-09-14 06:10:30,387 - WARNING - loop.add_signal_handler is not available on this platform.
    Using signal.signal().
INFO:     Started server process [22924]
INFO:     Waiting for application startup.
2025-09-14 06:10:30,403 - INFO - Initiating connection for server: 'playwright'...
2025-09-14 06:11:05,475 - INFO - Successfully connected to 'playwright'.
2025-09-14 06:11:05,507 - INFO -
--- Server Startup Summary ---
2025-09-14 06:11:05,507 - INFO - Successfully connected to:
2025-09-14 06:11:05,507 - INFO -   - playwright
2025-09-14 06:11:05,507 - INFO - --------------------------

INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)

http://localhost:8080 にあるopen webui へログイン後、 設定 → ツール 画面を開き、先程の mcpo_config.json で定義した mcpツールを追加することで 利用できます