Add Ollama MCP Plugin
Step 0: Language selection
Before proceeding with any other steps in this skill, ask the user which language to continue in using AskUserQuestion. Keep this initial prompt in English because the preferred language is not yet known.
- Question:
Which language should I continue in? - Options:
English,日本語 (Japanese)
Use the selected language for all subsequent user-facing messages and for every further AskUserQuestion prompt in this skill. Do not translate code, file paths, shell commands, or file contents.
This skill configures the Ollama MCP plugin so container agents can use local LLM models (llama3.2, mistral, gemma2, etc.) for cheaper/faster tasks.
UX Note: Use AskUserQuestion for all user-facing questions.
Phase 1: Pre-flight
Check Ollama is installed
which ollama 2>/dev/null && ollama --version || echo "NOT_FOUND"
If not installed, AskUserQuestion: Install Ollama?
- macOS:
brew install ollama - Linux:
curl -fsSL https://ollama.com/install.sh | sh - Or download from https://ollama.com
Check Ollama is running
curl -s http://localhost:11434/api/tags | head -1 || echo "NOT_RUNNING"
If not running: ollama serve & or start the Ollama app.
Check models are installed
ollama list
If no models, suggest pulling one:
ollama pull llama3.2
Phase 2: Configure entry.ts
Verify deploy/{ASSISTANT_NAME}/host/entry.ts contains the Ollama MCP plugin registration. If not, add this block after the orchestrator creation:
orchestrator.registerMcpPlugin("ollama", {
entryPoint: "/app/mcp-plugins/ollama/dist/index.js",
});
No API token needed — Ollama runs locally. The container reaches the host via host.docker.internal:11434.
If deploy/{ASSISTANT_NAME}/host/entry.ts is outdated, compare with deploy/templates/host/entry.template.ts and update accordingly.
Custom Ollama host (optional)
If Ollama runs on a different host/port, pass it as an environment variable:
orchestrator.registerMcpPlugin("ollama", {
entryPoint: "/app/mcp-plugins/ollama/dist/index.js",
env: { OLLAMA_HOST: "http://192.168.1.100:11434" },
});
Phase 3: Rebuild & Verify
Rebuild Docker image (if not already built with Ollama plugin)
Check which agent type is configured (CONTAINER_IMAGE in .env), then rebuild the matching image:
Claude Code:
./container/claude-code/build.sh
Open Code:
./container/open-code/build.sh
Restart nagi
pnpm dev
Test
Tell user:
Send a message in your Slack channel:
- "What models does Ollama have?"
- "Use Ollama with llama3.2 to summarize: The quick brown fox jumps over the lazy dog."
The agent should use
mcp__ollama__ollama_list_modelsormcp__ollama__ollama_generate.
Available Tools
Once configured, container agents have access to:
ollama_list_models— List installed local models with sizesollama_generate— Send a prompt to a local model and get a response
Troubleshooting
"Failed to connect to Ollama"
- Ollama must be running on the host:
ollama serveor start the Ollama app - Verify:
curl http://localhost:11434/api/tags - Docker must be able to reach the host —
host.docker.internalis used automatically on macOS/Windows. On Linux, ensure--add-host=host.docker.internal:host-gatewayis set (nagi handles this automatically).
Agent doesn't see Ollama tools
- Check
deploy/{ASSISTANT_NAME}/host/entry.tshasregisterMcpPlugin("ollama", ...) - Check Docker image was rebuilt:
./container/claude-code/build.sh(or./container/open-code/build.shfor Open Code) - Restart nagi
No models available
Pull a model on the host:
ollama pull llama3.2 # 2GB, fast
ollama pull mistral # 4GB, good quality
ollama pull gemma2 # 5GB, Google's model