🦙 Ollama MCP Server (Python)
Supercharge your AI assistant with local LLM access — run powerful AI models on your own computer, no internet required.
A Python MCP server that exposes your local Ollama models as tools for AI assistants like Windsurf, VS Code, Claude Desktop, and more.
| Links | |
|---|---|
| Docs | Full documentation |
| PyPI | mcp-ollama-python |
| VS Code UI | Companion extension: mcp-ollama-extension · docs · Marketplace |
Ecosystem
These two repositories work together:
┌─────────────────────────────────────┐
│ mcp-ollama-extension (VS Code) │ ← start/stop, models UI, logs
│ https://github.com/pblagoje/ │
│ mcp-ollama-extension │
└─────────────────┬───────────────────┘
│ stdio / MCP
┌─────────────────▼───────────────────┐
│ mcp-ollama-python (this repo) │ ← MCP tools for Ollama
│ https://github.com/pblagoje/ │
│ mcp-ollama-python │
└─────────────────┬───────────────────┘
│ HTTP :11434
┌─────────────────▼───────────────────┐
│ Ollama │
└─────────────────────────────────────┘
- This package is the MCP server (required). Install with
pip install mcp-ollama-python. - MCP Ollama Manager is the optional VS Code UI to manage that server. Prefer it if you use VS Code and want status bar controls, model sidebar, and log viewing without editing JSON by hand.
You can also wire this server into any MCP client (Windsurf, Cursor, Claude Desktop, etc.) without the extension — see Quick Start below.
What It Does
Connect your local LLMs to any MCP-compatible AI assistant. No cloud APIs needed.
| Tool | What it does |
|---|---|
ollama_chat |
Chat with any local model (multi-turn, tool-calling) |
ollama_generate |
Generate text completions |
ollama_embed |
Create vector embeddings |
ollama_list |
List installed models |
ollama_show |
Inspect model details |
ollama_pull |
Download new models |
ollama_delete |
Remove models |
ollama_ps |
List running models |
Quick Start
Prerequisites: Python 3.10+, Ollama running locally
pip install mcp-ollama-python
Option A — VS Code with the companion extension (recommended for VS Code)
- Install MCP Ollama Manager from the Marketplace
- Ensure
mcp-ollama-pythonis installed (the extension can offer Install Now if missing) - Command Palette → MCP Ollama: Configure Server → MCP Ollama: Start Server
Details: extension docs · repo
Option B — Any MCP client (Windsurf / VS Code MCP / Cursor / …)
Add to your MCP config (e.g. mcp_config.json):
{
"mcpServers": {
"ollama": {
"command": "py",
"args": ["-m", "mcp_ollama_python"],
"disabled": false
}
}
}
Restart your editor — done. Your AI assistant can now use local Ollama models.
Try It
Type in your AI assistant's chat:
MCP Tool: ollama / ollama_chat — Use model llama3.1 and explain quantum computing
Key Features
- 🔧 8 MCP tools — Full Ollama SDK access
- 🔄 Hot-swap architecture — Drop a file in
tools/, it's auto-discovered - 🎯 Type-safe — Pydantic models throughout
- 🚀 Lightweight — Minimal dependencies, fast startup
- 🔌 Universal — Works with any MCP client
Documentation
| Guide | Description |
|---|---|
| Installation | Setup and prerequisites |
| Available Tools | All tools with examples |
| Configuration | Environment variables, model config |
| Windsurf Integration | Complete Windsurf setup guide |
| VS Code Integration | VS Code setup + companion extension |
| Architecture | How it works, adding tools |
| Server Control | Start/stop/manage the server |
| Interactive Manager | Menu-driven management UI |
| Development | Contributing, code quality |
| Security | Threat model, host validation, opt-in execute |
Security (v1.0.8)
ollama_executeis opt-in — setOLLAMA_EXECUTE_ENABLED=1; shell/bash removedOLLAMA_HOSTvalidation — loopback by default; setOLLAMA_ALLOW_REMOTE_HOST=1for LAN/remote Ollama- No HTTP redirects — reduces SSRF risk toward internal endpoints
Details: docs/SECURITY.md
Changelog
1.0.8
- Security hardening: host validation, execute tool gating, env allowlist, input limits
- Fixed
__version__mismatch with package version - Added
tests/test_security.pyanddocs/SECURITY.md
Related Projects
| Project | Role | Links |
|---|---|---|
| mcp-ollama-extension | VS Code UI for this server | GitHub · Docs · Marketplace |
| Ollama | Local LLM runtime | ollama.ai |
License
Made with ❤️ using Python, Poetry, and Ollama
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_ollama_python-1.0.9.tar.gz.
File metadata
- Download URL: mcp_ollama_python-1.0.9.tar.gz
- Upload date:
- Size: 39.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea8c95064574f0cf043137949b27bfc6bd189f99710f1cdae1fa2671315e7429
|
|
| MD5 |
6b9a31c0212dfbda22c5f4741b2e315b
|
|
| BLAKE2b-256 |
433cdf50142a632631fa9aa551393d91e7c803e451b2dd620ba89428da33f056
|
Provenance
The following attestation bundles were made for mcp_ollama_python-1.0.9.tar.gz:
Publisher:
release.yml on pblagoje/mcp-ollama-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_ollama_python-1.0.9.tar.gz -
Subject digest:
ea8c95064574f0cf043137949b27bfc6bd189f99710f1cdae1fa2671315e7429 - Sigstore transparency entry: 2568473890
- Sigstore integration time:
-
Permalink:
pblagoje/mcp-ollama-python@dcfd115dde8d4e86feeafd97f4924ad8b0e7b777 -
Branch / Tag:
refs/tags/v1.0.9 - Owner: https://github.com/pblagoje
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@dcfd115dde8d4e86feeafd97f4924ad8b0e7b777 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mcp_ollama_python-1.0.9-py3-none-any.whl.
File metadata
- Download URL: mcp_ollama_python-1.0.9-py3-none-any.whl
- Upload date:
- Size: 51.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ad354e83955b1c9167e3e9bcf7d27f35a390233c01c3e344a448f2a6000bd3c
|
|
| MD5 |
8a0286f04a0312d9c9ed87b0016e9b13
|
|
| BLAKE2b-256 |
63fc16793099b16f7d6db0eba8510128ead530d9a8a94decd50d97a189939ba6
|
Provenance
The following attestation bundles were made for mcp_ollama_python-1.0.9-py3-none-any.whl:
Publisher:
release.yml on pblagoje/mcp-ollama-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_ollama_python-1.0.9-py3-none-any.whl -
Subject digest:
8ad354e83955b1c9167e3e9bcf7d27f35a390233c01c3e344a448f2a6000bd3c - Sigstore transparency entry: 2568473893
- Sigstore integration time:
-
Permalink:
pblagoje/mcp-ollama-python@dcfd115dde8d4e86feeafd97f4924ad8b0e7b777 -
Branch / Tag:
refs/tags/v1.0.9 - Owner: https://github.com/pblagoje
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@dcfd115dde8d4e86feeafd97f4924ad8b0e7b777 -
Trigger Event:
push
-
Statement type: