Ollama MCP Server
Provides a local Ollama model with sandboxed file management tools, allowing the model to read, write, list, and remove files within a controlled workspace directory, along with a demo arithmetic tool and health check.
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 Serverlist the files in my workspace"
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.
I maded this Projects because I wanted to learn more about Model Context Protocols and to learn how to create better README's. I have added simple tools just to have my LLM complete simple task, I plan to add more tool in the future.
Ollama MCP Server
A small Model Context Protocol (MCP) server that gives a local Ollama model a set of safe, sandboxed tools — most importantly the ability to read, write, list, and remove files inside a workspace directory you control.
Everything runs locally. The model, the tools, and your files never leave your machine.
How it works
┌─────────────┐ chat + tool calls ┌────────────────────┐ MCP (stdio) ┌──────────────────┐
│ You (CLI) │ ───────────────────▶ │ Ollama client │ ──────────────▶ │ MCP server │
│ │ ◀─────────────────── │ (ollama_clients) │ ◀────────────── │ (server.py) │
└─────────────┘ responses └────────────────────┘ tool results └──────────────────┘
│ │
▼ ▼
local Ollama model sandboxed workspace
(e.g. qwen2.5:14b) (~/Projects/…)You type a message in the client.
The client sends it to your local Ollama model along with the list of tools the MCP server exposes.
If the model decides to call a tool, the client forwards that call to the MCP server over stdio, gets the result, and feeds it back to the model.
The model produces a final answer.
Related MCP server: mcp-coding
Features
Sandboxed file tools — the model can only touch files inside the active workspace. Absolute paths,
../escapes, and protected directories (.git,.venv,.trash,__pycache__) are all rejected.Recoverable deletes —
remove_project_fileand overwrites don't hard-delete. The previous version is moved into<workspace>/.trash/, preserving its layout.Atomic writes — files are written to a temp file and
os.replace'd into place, so a crash mid-write can't corrupt an existing file.Named workspace profiles — switch between project directories via config or an environment variable.
Size limits — configurable maximum file size for reads and writes.
Available tools
Tool | Description |
| Read a UTF-8 text file from the workspace. |
| Create or overwrite a file (overwrite makes a |
| List files/directories in the workspace (recursive optional). |
| Move a file into |
| Health check — returns |
| Trivial demo tool that adds two numbers. |
Requirements
Python 3.12+
Ollama installed and running, with a model pulled (default:
qwen2.5:14b).Python packages:
mcp[cli]==2.0.0,ollama
Installation
# 1. Clone
git clone <your-repo-url> mcp-server
cd mcp-server
# 2. Create a virtual environment
python3 -m venv .venv
source .venv/bin/activate
# 3. Install dependencies
pip install "mcp[cli]==2.0.0" ollama
# 4. Pull the model (if you haven't already)
ollama pull qwen2.5:14bConfiguration
All settings live in config.toml:
[ollama]
model = "qwen2.5:14b" # any model available to your local Ollama
max_tool_rounds = 8 # max tool round-trips per user message
[mcp]
default_workspace = "ollama-workspace" # replace with desired workplace profile
max_list_results = 500
MAX_FILE_SIZE_BYTES = 1000000 # 1 MB read/write cap
[mcp.workspaces]
ollama-workspace = "~/Projects/ollama-workspace" # replace these for your workspace's path
custom-workspace = "~/Projects/Scripts" # replace these for your workspace's pathEach entry under [mcp.workspaces] is a named profile pointing at a directory the
tools are allowed to operate in. The directory is created automatically if it doesn't
exist.
Environment variables
Variable | Purpose |
| Override the model from |
| Select a named profile from |
| Point at a directory directly (bypasses named profiles — handy for testing). |
| Use a config file other than |
Getting started
Run the assistant (normal use)
source .venv/bin/activate
python3 clients/ollama_clients.pyYou'll see the connected tools and a prompt. Try:
You: create a file called notes.txt that says "hello from ollama"
You: list the files in the workspace
You: read notes.txtType exit or quit to stop.
To use a different workspace or model for a session:
MCP_WORKSPACE_NAME="custom-workspace" \
OLLAMA_MODEL="qwen2.5:14b" \
python3 clients/ollama_clients.pyInspect the server on its own
The MCP CLI inspector lets you call the server's tools directly, without a model:
uv run --with "mcp[cli]==2.0.0" mcp dev ./server/server.pyMaintenance: clearing old trash
Because deletes are recoverable, .trash grows over time. The included script purges
trash entries older than a week:
scripts/clean_trash.sh # clean the configured workspaces
RETENTION_DAYS=14 scripts/clean_trash.sh # keep two weeks insteadTo run it automatically, add a cron entry (daily at 3 AM):
0 3 * * * /path/to/mcp-server/scripts/clean_trash.sh >> $HOME/.mcp-trash-clean.log 2>&1Project layout
mcp-server/
├── server/
│ └── server.py # MCP server + tool definitions
├── clients/
│ └── ollama_clients.py # Ollama <-> MCP bridge (the chat loop)
├── scripts/
│ └── clean_trash.sh # purges .trash entries older than a week
├── config.toml # model + workspace configuration
├── tests/ # (add tests here)
└── README.mdThis 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.
Related MCP Servers
- AlicenseBqualityCmaintenanceA local-first MCP server that provides AI agents with safe codebase access through file discovery, hybrid lexical-semantic search, and project introspection. It features durable local memory and semantic indexing while keeping all data and processing entirely on your local machine.Last updated74615MIT
- Alicense-qualityCmaintenanceExperimental MCP server for local LLM orchestration with filesystem tools (read, write, list, delete files) and a CLI agent that communicates via Ollama.Last updated28ISC
- Flicense-qualityBmaintenanceMCP server that enables AI to read, search, and edit local files securely without external data exposure, using local LLMs via Ollama and integrating with Open WebUI or Claude Desktop.Last updated
- AlicenseAqualityBmaintenanceAn MCP server that provides local, private, synchronous access to Ollama models for prompt answering, text classification, and model listing, without any file access or command execution.Last updated3MIT
Related MCP Connectors
An MCP server that gives your AI access to the source code and docs of all public github repos
Local-first RAG engine with MCP server for AI agent integration.
Person-owned, portable AI memory as a remote MCP server, readable and writable by any MCP client.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- 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/gxm097/ollama-mcp-workspace'
If you have feedback or need assistance with the MCP directory API, please join our Discord server