Ollama MCP Server
Provides tools to list available Ollama Cloud models, switch the active model, send chat prompts with optional system messages and thinking mode, search the web, and fetch webpage content through Ollama's hosted APIs.
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., "@Ollama MCP Serversearch the web for latest AI news"
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.
Ollama MCP Server (with sub-agent support)
A lightweight MCP server that exposes Ollama Cloud models to MCP clients such as Claude Code. Besides single-shot chat and web tools, it can run an Ollama model as an autonomous sub-agent (tool-calling loop) and return a final report.
Requirements
Python 3.10+
An Ollama Cloud account and API key
Related MCP server: mcp-ollama-python
Install
git clone https://github.com/chakkritte/ollama-mcp.git
cd ollama-mcp
python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env # then edit OLLAMA_API_KEYClaude Code setup
Copy .mcp.json.example to your project as .mcp.json (or add the entry to
your MCP config) and fix the absolute paths. Copy
.claude/agents/ollama-worker.md into your project's .claude/agents/ to get a
ready-made dispatcher sub-agent. Claude Code can then run ollama-worker
in parallel with its own work.
Tools
Tool | Purpose |
| List models on your Ollama Cloud account |
| Read / change the process-wide default model (prefer passing |
| One prompt to a model. Options: |
| Ollama hosted web APIs |
| Run a model as a sub-agent with tools, return its final report |
| Show agent tool groups and which are enabled |
agent_run
Argument | Meaning |
| Self-contained brief; the agent sees nothing else |
| Must support tool calling (e.g. |
| Groups: |
| Extra role instructions |
| Model turns, capped by |
| Wall-clock limit for the run |
| Optional thinking mode |
| Sub-directory of the workspace root to confine the agent to |
Returns status (completed / max_steps / timeout / error), content
(final report), steps, and tool_calls (an audit trail of what the agent did).
Group | Tools |
|
|
|
|
|
|
|
|
Security model
The remote model is treated as untrusted.
All paths are confined to
OLLAMA_AGENT_WORKSPACE(default: the server's working directory)...escapes, symlink escapes,.env*files and.gitinternals are blocked, so the API key cannot be read through file tools.writeandshellare off by default. They needOLLAMA_AGENT_ALLOW_WRITE=1/OLLAMA_AGENT_ALLOW_SHELL=1on the server and an explicittoolsentry in the call.run_commanddoes not use a shell (pipes,;, redirects are inert), must matchOLLAMA_AGENT_SHELL_ALLOWLISTtoken-by-token, has a timeout, and runs withoutOLLAMA_API_KEYin its environment. Note that allow-listingpytestexecutes project code; trim the list if that is not acceptable.Everything you send in
taskand every file the agent reads is sent to Ollama Cloud. Do not point it at private data you would not send there.Agent output is unverified model output; review changes (
git diff) before keeping them.
Concurrency
All tools are async. Up to OLLAMA_AGENT_MAX_CONCURRENT (default 4) agents run
at once; extra calls wait for a slot. Always pass model explicitly when running
agents in parallel, so set_current_model cannot affect them.
Configuration
See .env.example. Main variables: OLLAMA_HOST, OLLAMA_API_KEY,
DEFAULT_MODEL, OLLAMA_AGENT_WORKSPACE, OLLAMA_AGENT_ALLOW_WRITE,
OLLAMA_AGENT_ALLOW_SHELL, OLLAMA_AGENT_SHELL_ALLOWLIST,
OLLAMA_AGENT_MAX_CONCURRENT, OLLAMA_AGENT_MAX_STEPS, OLLAMA_AGENT_TIMEOUT.
Model guide
Based on the Ollama cloud catalog (https://ollama.com/search?c=cloud, checked 2026-10-08). The catalog changes often; re-check before relying on it. Picks are my reading of each model's description and tags on that page, not benchmark results, and the page does not list parameter counts for most cloud models.
Best pick by task
Task | Pick | Why (from the catalog) | Alternative |
Coding / long agentic coding |
| "most capable open-weights coding model", 1M context |
|
Reasoning / math |
| Frontier MoE with three reasoning modes |
|
General agentic / orchestration |
| Moonshot's most capable, multimodal, 1M context |
|
Multimodal (vision) |
| Natively multimodal, near top-tier coding |
|
Audio input |
| Only cloud model tagged with audio | none |
Search / fast and cheap |
| Search-focused, fast, vision + tools |
|
Multi-agent / high throughput |
| Built for high-throughput reasoning and long-running agents |
|
Best pick by size
Only some models list sizes, so this table covers those. Which sizes your
account can actually pull may differ from the catalog page: on 2026-10-08 one
account's list_models showed only gemma4:31b, gpt-oss:20b/120b,
nemotron-3-nano:30b and nemotron-3-super (no :4b, no smaller gemma4).
Run list_models before relying on a tiny-size pick.
Size class | Pick | Notes |
Tiny (about 2-4B) |
| Agentic, tools + thinking. |
Small (about 12-31B) |
| Vision, tools, thinking, audio, 256K context |
Mid (20-30B) |
|
|
Large (about 120B) |
|
|
Frontier (size not listed) |
| Pick by task above |
For agent_run
Use a model tagged tools on the catalog page. All models in the tables
above have it. Good defaults: glm-5.3 (coding), kimi-k3 (general),
gpt-oss:120b (reliable and cheap), deepseek-v4.1-flash (fast research).
DEFAULT_MODEL in .env.example is still gpt-oss:120b; change it if you
prefer another default. If a model rejects tool calling, the run returns
status: "error" with the provider's message.
Tests
pip install pytest pytest-asyncio
pytestThe tests use a scripted fake client, so they need no network or API key. They do not cover real Ollama Cloud behaviour (see below).
License
Apache-2.0 (see LICENSE).
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for OpenAI API (chat completions, image generation, embeddings) via AceDataCloud
MCP server for AI dialogue using various LLM models via AceDataCloud
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Related MCP Servers
- FlicenseBqualityDmaintenanceA lightweight MCP server that provides a unified interface to various LLM providers including OpenAI, Anthropic, Google Gemini, Groq, DeepSeek, and Ollama.6739-
- AlicenseNot gradedqualityAmaintenanceA Python MCP server that exposes local Ollama models as tools for AI assistants, enabling chat, generation, embeddings, and model management without cloud APIs.60 PyPI5MIT
- AlicenseNot gradedqualityCmaintenanceA modular MCP server that provides file search, URL fetching, text reading, knowledge base search, and image embedding tools, with a web interface powered by an Ollama agent.MIT
- FlicenseNot gradedqualityCmaintenanceA beginner-friendly MCP server that exposes a local Ollama model as an MCP tool, enabling users to ask questions via VS Code.-