local-genai-mcp
Allows listing locally available Ollama models (flagging currently loaded ones) and sending instructions to an Ollama model to generate text responses, with the model and thinking/reasoning mode selectable per request. Conversation history is not retained between calls.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@local-genai-mcpForge Neoで夕焼けの海辺の猫を1枚描いて"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
local-genai-mcp
LAN内で動いているローカル生成AIを、Claude Code から使えるようにするMCPサーバです。
Ollama(ローカルLLM): モデル一覧、文章生成
Stable Diffusion WebUI Forge Neo(WebUI1111互換API): チェックポイント・LoRA・サンプラーの一覧、画像生成(txt2img)
Claude Code に「Ollamaの gemma3:12b でこの文章を要約して」「Forge Neoで夕焼けの海辺の猫を1枚描いて」のように頼むと、このMCPサーバ経由で各サービスを呼び出します。
構成の例
[Ubuntu] Claude Code ──(stdio)── local-genai-mcp ──(HTTP)──┬─ [Windows] Ollama :11434
└─ [Windows] Forge Neo :7860MCPサーバは Claude Code と同じマシンで動き、Ollama や Forge Neo へは LAN 越しに HTTP でアクセスします。生成した画像は、MCPサーバ側のマシンのフォルダ(既定では ~/ai-studio/repo/genai-outputs/forge)に保存されます。
Related MCP server: Ollama MCP Server
使えるツール
ツール | 内容 |
| 設定されている各サービスに接続できるかを確認する |
| 使い方・頼み方の例と、現在の既定値を返す |
| Ollama のモデル一覧(読み込み中のものに印) |
| Ollama のモデルに指示を送り、応答の文章を返す(会話の履歴は保持しない)。モデル( |
| Forge Neo のチェックポイント一覧と、現在のモデル |
| Forge Neo の LoRA 一覧 |
| Forge Neo のサンプラー・スケジューラ・アップスケーラ(Hires.fix用)一覧 |
| 画像を生成して PNG で保存し、パスとシード値、縮小プレビューを返す。サイズ、Hires.fix、チェックポイントを1回ごとに指定できる |
forge_txt2img のプロンプトには、WebUI1111 と同じ書き方((word:1.2) の強調、<lora:名前:重み>)が使えます。
画像の大きさは、width x height(既定 1024x1024)で描いてから、Hires.fix で hr_scale 倍(既定 2倍、ESRGAN_4x)に拡大して描き直します。既定値は config.toml の [forge.defaults] で変えられ、Claude Code に「縦長で」「Hires.fixなしで」「1.5倍で」のように頼めば、1回ごとの指定もできます。
checkpoint を指定すると、Forge Neo 側で選ばれているモデルも切り替わったままになります(続けて同じモデルで生成するときに、読み込み直しを避けるため)。
使い方のヘルプ
使い方と頼み方の例(現在の既定値入り)は、次のどれかで確認できます。
Claude Code の会話中に
/mcp__local-genai__helpと入力する(MCP のプロンプト機能。/を入力すると候補に出る)Claude Code に「local-genai の使い方を教えて」と頼む(
usage_guideツールが使われる)ターミナルで
local-genai-mcp --guideを実行する(下の「うまく動かないとき」のコマンドの--checkを--guideに変える)
必要なもの
Claude Code を使うマシン: Linux(Ubuntu で確認)。Python は uv が自動で用意します
Ollama 側: 環境変数
OLLAMA_HOST=0.0.0.0:11434を設定して起動(別のマシンから使う場合)Forge Neo 側:
webui-user.batのCOMMANDLINE_ARGSに--api --listenを付けて起動Windows 側のファイアウォールで、各ポート(11434、7860 など)への接続を許可
セットアップ
cd ~/ai-studio/repo/local-genai-mcp
./install.shinstall.sh が行うこと:
uv がなければ、確認のうえ公式スクリプトでインストール
依存ライブラリのインストール(仮想環境は
~/.local/share/local-genai-mcp/venv。このフォルダが NAS 上にあっても、仮想環境はローカルのディスクに置く)config.tomlがなければconfig.example.tomlからコピーconfig.tomlがあれば接続確認(--check)Claude Code に
local-genaiという名前で登録(既定は--scope user= どのフォルダで起動した Claude Code からも使える)
初回は config.toml が作られた時点で、書き換えを促すメッセージが出ます。config.toml を編集してから、接続確認をしてください。
UV_PROJECT_ENVIRONMENT=~/.local/share/local-genai-mcp/venv uv run --project . --no-dev local-genai-mcp --check主なオプション(./install.sh --help で一覧):
--no-register: 依存関係の準備と接続確認だけ行い、Claude Code には登録しない--dry-run: 実行するコマンドを表示するだけ--scope project: 今いるフォルダの.mcp.jsonに登録する(そのフォルダで起動したときだけ使える)
登録できたかは、Claude Code を起動し直して、会話中に /mcp と入力すると確認できます。
設定ファイル(config.toml)
config.example.toml に説明付きで全項目があります。主な項目:
[ollama]
base_url = "http://192.168.0.10:11434" # Ollama のアドレス
default_model = "qwen3.5:9b" # モデル名を省略したときに使う
think = false # 思考対応モデルで考える過程を使うか(使うと遅い)
[forge]
base_url = "http://192.168.0.20:7860" # Forge Neo のアドレス
output_dir = "~/ai-studio/repo/genai-outputs/forge" # 画像の保存先
preview = true # 縮小プレビューを Claude に返すか
[forge.defaults] # 画像生成の既定値
width = 1024
height = 1024
steps = 25
cfg_scale = 7.0
sampler_name = "Euler a"
enable_hr = true # Hires.fix を使うか
hr_scale = 2.0 # Hires.fix の倍率
hr_upscaler = "ESRGAN_4x" # アップスケーラ(forge_list_samplers で確認)
denoising_strength = 0.4 # 描き直す強さ使わないサービスは
enabled = falseにすると、そのツール自体が表示されなくなりますForge Neo を
--api-auth ユーザー名:パスワード付きで起動している場合はusername/passwordを設定しますconfig.tomlには実際のアドレスや認証情報が入るので、Git の管理対象外にしています(.gitignore)設定ファイルは、環境変数
LOCAL_GENAI_MCP_CONFIG→ このフォルダのconfig.toml→~/.config/local-genai-mcp/config.tomlの順に探します(local-genai-mcp --print-config-pathsで確認できます)設定を書き換えたら、Claude Code を起動し直すと反映されます
登録の解除
./uninstall.sh # Claude Code への登録を解除
./uninstall.sh --remove-venv # 仮想環境も削除(config.toml は残す)うまく動かないとき
まず接続確認を実行すると、つながらない理由が表示されます。
UV_PROJECT_ENVIRONMENT=~/.local/share/local-genai-mcp/venv uv run --project . --no-dev local-genai-mcp --checkOllama に接続できない: Ollama 側で
OLLAMA_HOST=0.0.0.0:11434を設定して起動し直したか、ファイアウォールで 11434 番を許可したかForge Neo に接続できない:
--listenを付けたか、ファイアウォールで 7860 番(--portで変えた場合はその番号)を許可したかForge Neo の /sdapi/... が 404:
--apiを付け忘れている認証エラー(401):
--api-authを使っている場合はconfig.tomlのusername/password画像生成がタイムアウトする:
config.tomlの[forge]のtimeout_secondsを増やす(大きいモデルの初回読み込みは時間がかかる)接続の確立は5秒で打ち切るので、アドレスの間違いなどはすぐに分かります
開発
uv sync # 開発用(pytest)も含めてインストール
uv run pytest # テスト(実際の Ollama / Forge Neo は不要。HTTP の応答を模擬している)MCP の Python SDK は 2.x 系を使っています(mcp.server.mcpserver.MCPServer)。1.x 系の FastMCP とは書き方が異なります。
未対応・今後の候補
img2img、ComfyUI、音声合成(Irodori-TTS)などは未対応
ライセンス
MIT License(LICENSE を参照)。依存ライブラリ(mcp: MIT、httpx: BSD-3-Clause、Pillow: MIT-CMU ほか)はいずれも MIT と両立する許諾条件で、このリポジトリには同梱していません(インストール時に uv が取得します)。
Available Tools
1 toolcheck_connectionsB
ローカル生成AIの設定・接続状況を返す(現在は設定エラー)。
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It does disclose a meaningful behavioral trait — that the connection currently resolves to a configuration error — which an agent should know before calling. However, it says nothing about whether the check is read-only, whether it triggers reconnection attempts, or what triggers the error.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single front-loaded sentence with no filler; the core purpose comes first and the caveat follows. It is efficient, though the trailing parenthetical reads as an operational note rather than tool documentation.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists, so return values need not be described, and there are no parameters to document. Still, for a diagnostic tool with no annotations, the description omits whether it is a safe read-only probe and whether the 'configuration error' note is transient or persistent, leaving the agent to guess.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool takes zero parameters, so there is no parameter semantics to explain; the baseline for a no-arg tool is 4. Nothing in the description is required to compensate for a schema gap.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and resource: returns the configuration/connection status of the local generative AI. It even flags the current runtime state (a configuration error), which tells the agent what to expect. No siblings exist to differentiate from, so the ceiling is 4 rather than 5.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no explicit when-to-use guidance, no preconditions, and no alternatives (none exist). The intent is only weakly implied by the name and the status-reporting phrasing.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
v0.1.0- First observed
check_connections
TDQS
Scored across 1 tool
With only a single tool there is no risk of misselection between tools, so ambiguity is effectively zero. However, the name 'check_connections' is somewhat generic, leaving mild uncertainty about what exactly it inspects (config, network, model endpoints).
The lone tool uses a clear snake_case verb_noun pattern (check_connections), which is a readable, conventional style. Consistency cannot really be demonstrated with one tool, so it cannot earn a full 5.
A single diagnostic tool is far too thin for a server purporting to manage 'local generative AI' configuration and connections. There is no companion tool for configuring, listing models, or testing generation, so the surface is severely under-scoped.
The only tool returns status and currently reports a configuration error, with no way for an agent to set configuration, inspect available models, or run any inference. This is a dead end that will cause agent failures rather than enabling a workflow.
Maintenance
Related MCP Connectors
Use AI models for chat, image, and video generation from Claude Code and other MCP hosts.
LLM chat, text tools, image generation, editing, batch image jobs, and asynchronous video generation
One workspace of tools for Claude and ChatGPT: connect 600+ apps, generate media, build tools.
Remote MCP for RunComfy: ComfyUI deployments, hosted models, LoRA training. 31 tools.
Related MCP Servers
- AlicenseAqualityFmaintenanceEnables Claude Desktop to interact with local ComfyUI installations for AI-powered image generation, including workflow management, model selection, real-time monitoring, and custom workflow execution through natural language.1426,520 npm18MIT
- AlicenseNot gradedqualityDmaintenanceA bridge that enables Claude Code to interact with local Ollama instances for text generation, multi-turn chat, and vision-based analysis. It supports model management tasks such as listing, pulling, and showing details, alongside generating text embeddings.475 npm1MIT
- AlicenseNot gradedqualityDmaintenanceExposes local Ollama instances as tools for Claude Code, allowing users to offload code generation, text drafting, and embedding tasks to local GPUs. It supports multi-turn conversations and model management through the Model Context Protocol.MIT
- AlicenseAqualityCmaintenanceLets Claude query and manage a local Ollama server — list models, inspect them, run generate/chat completions, pull or delete models.8MIT