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 "Install 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
A lightweight Model Context Protocol (MCP) server that exposes Ollama Cloud models as tools to MCP clients such as Claude Code.
This server not only lets you chat with Ollama Cloud models — it also makes it easy to switch between the best model for each task: coding, math, reasoning, agentic workflows, and more.
Features
List models – Discover all models available on your Ollama Cloud instance.
Get / set default model – Switch the active model at runtime to match the task.
Chat – Send prompts to any Ollama Cloud model, with optional system messages and per-request model overrides.
Web search – Search the web through Ollama's hosted web search API.
Web fetch – Fetch and extract a webpage's content through Ollama's hosted web fetch API.
Task-aware model guide – Built-in recommendations for choosing the right model for coding, math, reasoning, and other workloads.
Related MCP server: mcp-ollama-python
Requirements
Python 3.10+
An Ollama Cloud account with an API key.
Installation
Clone the repository:
git clone https://github.com/chakkritt/ollama-mcp.git cd ollama-mcpCreate a virtual environment (recommended):
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activateInstall dependencies:
pip install -r requirements.txt
Configuration
Copy .env.example to .env and fill in your API key:
cp .env.example .envThen edit .env and replace the placeholder values with your own:
OLLAMA_HOST=https://ollama.com
OLLAMA_API_KEY=YOUR_OLLAMA_API_KEY
DEFAULT_MODEL=gpt-oss:120bOLLAMA_HOST– Base URL of your Ollama Cloud instance.OLLAMA_API_KEY– Your Ollama Cloud API key.DEFAULT_MODEL– Fallback model used when a chat request does not specify one.
You can override the model on every chat request, so the DEFAULT_MODEL is just a sensible starting point.
Model selection guide
Use this guide to pick the best Ollama Cloud model for your task. Switch models anytime with the set_current_model tool.
Coding & software engineering
These models excel at writing, debugging, and reasoning about code.
Model | Why use it |
| Flagship long-horizon model; great for complex coding and agentic engineering tasks. |
| Coding-specialized variant of Kimi K2.6; efficient long-horizon coding with lower thinking-token usage. |
| Native multimodal agentic model with strong long-horizon coding and autonomous execution. |
| Coding and agentic frontier model with a 1M context window and native multimodality. |
Recommended default for coding: glm-5.2 or kimi-k2.7-code.
Math, reasoning & problem solving
Model | Why use it |
| Frontier MoE with multiple reasoning modes and a large context window; best for deep math and logic. |
| Fast, efficient 284B MoE (13B activated) with 1M-token context and strong reasoning. |
| Handles long-horizon reasoning tasks well. |
| NVIDIA's efficient open MoE for complex multi-agent and reasoning applications. |
| High-throughput reasoning for extended agent workflows. |
Recommended default for math: deepseek-v4-pro.
General-purpose & agentic tasks
Model | Why use it |
| OpenAI open-weight model for reasoning, agentic tasks, and developer use cases. |
| Production-grade multimodal MoE for enterprise workloads. |
| Large open-source multimodal family with sizes from 0.8B to 122B. |
| Multimodal agentic model with vision/language understanding and instant/thinking modes. |
Multimodal & vision
Model | Why use it |
| Strong performance across scales; supports reasoning, coding, multimodal understanding, and audio. |
| Fast, cost-efficient frontier intelligence. |
| Native multimodal agentic capabilities. |
| Native multimodality with a 1M context window. |
Fast / cost-efficient tasks
Model | Why use it |
| Large MoE with only 13B activated parameters; fast and efficient. |
| Optimized for speed and cost. |
| Small, efficient agentic models at 4B and 30B. |
| Tiny, fast variants for simple tasks. |
Running the server
python server.pyBy default, the server runs as an MCP server over stdio, which is the standard transport for most MCP clients.
Available tools
Tool | Description |
| List all available Ollama Cloud models. |
| Return the current default model. |
| Change the default model used for chat. |
| Send a prompt to the current (or specified) model. Supports an optional |
| Search the web using Ollama's hosted web search API. Returns up to |
| Fetch a webpage using Ollama's hosted web fetch API. Returns the page title, main text content, and up to 10 links. |
Example usage with Claude Code
Add the server to your Claude Code MCP configuration:
{
"mcpServers": {
"ollama": {
"command": "python",
"args": ["/absolute/path/to/server.py"],
"env": {
"OLLAMA_HOST": "https://ollama.com",
"OLLAMA_API_KEY": "YOUR_OLLAMA_API_KEY",
"DEFAULT_MODEL": "gpt-oss:120b"
}
}
}
}Then you can ask Claude to:
"List available Ollama models"
"Switch to the coding model" — the guide recommends
glm-5.2orkimi-k2.7-code."Use the math model to solve this problem" — the guide recommends
deepseek-v4-pro."Chat with
glm-5.2and refactor this function""Set the default model to
deepseek-v4-pro""Think through this problem with
deepseek-v4-pro" — callschatwiththink: trueand returns the reasoning trace inthinking."Search the web for the latest news on …" — uses
web_search."Fetch the page at https://… and summarize it" — uses
web_fetch.
Quick task-to-model cheatsheet
Task | Suggested model |
General coding |
|
Complex / long-horizon coding |
|
Math & deep reasoning |
|
Fast reasoning on a budget |
|
Agentic workflows |
|
Multimodal tasks |
|
General-purpose chat |
|
Project structure
ollama-mcp/
├── .env.example # Environment variable template
├── .gitignore # Files ignored by Git
├── LICENSE # MIT license
├── pyproject.toml # Project metadata
├── README.md # This file
├── requirements.txt # Python dependencies
└── server.py # MCP server implementationDependencies
fastmcp– Framework for building MCP servers in Python.ollama– Official Ollama Python client.httpx– HTTP client for the Ollama hosted web search/fetch APIs.python-dotenv– Load environment variables from.env.
Keeping model recommendations up to date
Ollama Cloud's model catalog changes frequently. To refresh this guide:
Update the Model selection guide and Quick task-to-model cheatsheet sections with new releases or benchmarks.
Adjust your
DEFAULT_MODELandset_current_modelcalls to match your current workload.
License
Apache License 2.0
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/chakkritte/ollama-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server