Ollama MCP
Uses a local Ollama instance and configurable model to summarize source files and diagnose deduplicated log errors, keeping code and log processing on the local machine.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Ollama MCP — local-first development
A Python MCP server for Cursor, Claude Desktop and any other stdio MCP client.
It exposes three read-only tools over stdio:
MCP tool | Input | Work done on your Mac |
| Query + path (+ optional | ripgrep search (no LLM) |
| List of file paths (+ optional | Reads source files and summarizes with Ollama |
| Path to a log file (+ optional | Deduplicates errors and diagnoses with Ollama |
The token-saving detail is that the client sends file paths as MCP arguments instead of whole source files or build logs, and receives compact tool results. The client's own model decides when to call the tools.
One installed server works for any number of projects: each call says which project it is about. Any project you name works.
1. Install once (global installation)
Requirements: Python 3.11+, Ollama, and ripgrep.
brew install ripgrep
ollama pull qwen3.5:9b-q4_K_MOption A — from PyPI (recommended). Install the ollama-mcp command into its own isolated environment with pipx or uv:
pipx install ollama-mcp # or: uv tool install ollama-mcp
which ollama-mcp # e.g. /Users/me/.local/bin/ollama-mcpMCP clients then start the server with that absolute path and no arguments:
"command": "/Users/me/.local/bin/ollama-mcp",
"args": []Option B — from source.
cd /absolute/path/to/ollama-mcp
python3 -m venv .venv
source .venv/bin/activate
pip install -e .The server is then started by any MCP client with either:
/absolute/path/to/ollama-mcp/.venv/bin/ollama-mcp, or/absolute/path/to/ollama-mcp/.venv/bin/python -m ollama_mcp.server.
The configuration examples below use the Option B form; with Option A, replace command and args as shown above.
Always use an absolute path to the command; GUI apps such as Claude Desktop do not inherit your shell's PATH or activated virtualenv. For the same reason the server also looks for ripgrep in /opt/homebrew/bin and /usr/local/bin; set RIPGREP_PATH if yours is elsewhere.
Check Ollama with ollama run qwen3.5:9b-q4_K_M. The 6.6 GB model size listed in Ollama is primarily download/disk size, not full runtime RAM usage; expect additional memory for the KV cache and backend. Start with an 8K-token context.
The package pins the MCP Python SDK v1 maintenance series (mcp>=1.28,<2) for compatibility with its tested FastMCP API.
Related MCP server: TokenLighten
2. How paths are resolved
Every tool accepts an optional workspace_root argument (absolute project directory, ~ allowed).
Path given | Resolved against |
Absolute ( | Used as is; no workspace needed |
Relative + |
|
Relative, no |
|
Relative, neither | Clear error asking for |
The server never uses its current working directory as "the project": Claude Desktop, for example, starts servers with an unrelated working directory.
WORKSPACE_ROOT is optional
Unset: the server starts normally; clients pass
workspace_rootor absolute paths.Set to an absolute directory: it is the default for relative paths (the previous behaviour, so existing Cursor per-project configs keep working). A per-call
workspace_rootoverrides it.Set but unusable (relative path, missing directory,
/, your home directory, or an unexpanded${workspaceFolder}): the server logs a warning on stderr and runs as if it were unset.
3. Configure Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (Claude Desktop → Settings → Developer → Edit Config) and merge this entry into any existing mcpServers:
{
"mcpServers": {
"ollama-local": {
"command": "/absolute/path/to/ollama-mcp/.venv/bin/python",
"args": ["-m", "ollama_mcp.server"],
"env": {
"OLLAMA_BASE_URL": "http://127.0.0.1:11434",
"OLLAMA_MODEL": "qwen3.5:9b-q4_K_M",
"OLLAMA_NUM_CTX": "8192"
}
}
}
}Leave WORKSPACE_ROOT out of this config: Claude Desktop has no notion of an open project, so name the project in your prompt (see examples below). Fully quit and reopen Claude Desktop after editing.
Ready-made files are in the source repository under templates/claude-desktop/ (they are not part of the PyPI package): this config entry, instructions to paste into a Claude Project (so it always passes the right workspace_root), and an optional skill. See templates/README.md.
4. Configure Cursor
Option A — global (one entry for every project). Put this in ~/.cursor/mcp.json:
{
"mcpServers": {
"ollama-local": {
"type": "stdio",
"command": "/absolute/path/to/ollama-mcp/.venv/bin/python",
"args": ["-m", "ollama_mcp.server"],
"env": {
"WORKSPACE_ROOT": "${workspaceFolder}",
"OLLAMA_BASE_URL": "http://127.0.0.1:11434",
"OLLAMA_MODEL": "qwen3.5:9b-q4_K_M",
"OLLAMA_NUM_CTX": "8192"
}
}
}
}When Cursor expands ${workspaceFolder}, relative paths work against the open project. If it is not expanded (for example when no folder is open), the server ignores it and the agent passes workspace_root or absolute paths. The server is a single process, so with several Cursor windows open, passing workspace_root explicitly is the reliable choice; the included rule asks the agent to do that.
Option B — per project (previous setup, unchanged). Copy templates/cursor/.cursor/ into a repository's .cursor/ directory and replace /ABSOLUTE/PATH/TO/ollama-mcp/.venv/bin/python in .cursor/mcp.json with your real path. This creates:
your-project/
└── .cursor/
├── mcp.json
├── rules/prefer-local-mcp.mdc
└── skills/local-first-development/SKILL.mdAvoid overwriting an existing .cursor/mcp.json without merging its other mcpServers entries. The rule and skill are instructions that guide the agent toward the tools.
Open Cursor Settings → MCP and verify the server is available. Restart/reload Cursor if necessary.
5. Try it — different projects, one server
Claude Desktop (or Cursor without a default workspace):
Use ollama-local search_code to find AccountBloc in /Users/me/code/banking-app.Summarize lib/features/accounts/account_bloc.dart and lib/features/accounts/account_repository.dart
in the project /Users/me/code/banking-app.Analyze the log /Users/me/code/api-server/logs/test.log.In /Users/me/code/api-server, search for "def create_order".The resulting tool calls look like:
{"query": "AccountBloc", "path": ".", "workspace_root": "/Users/me/code/banking-app"}
{"paths": ["src/orders.py"], "workspace_root": "/Users/me/code/api-server"}
{"log_path": "/Users/me/code/api-server/logs/test.log"}Cursor with WORKSPACE_ROOT set:
Use the local MCP to find references to AccountBloc in this repository.To analyze logs, save them to disk first, e.g. flutter analyze > logs/analyze.log 2>&1, then ask for logs/analyze.log.
To verify registration independently, use the MCP Inspector or the Python SDK client. The server speaks stdio and all diagnostics go to stderr.
6. Safety and limits
Uses the local Ollama URL
127.0.0.1:11434by default. All processing stays on your machine.Read-only. The tools search and read files; they edit nothing and run no commands.
Scoped reads. Any project you name works.
/and your home directory are refused as a workspace or search directory (too broad).Symlinks: a path must stay inside its workspace after resolution; for a standalone absolute file, inside its own directory. Symlinks that point elsewhere are refused, and recursive search never follows symlinks.
..is refused. A symlinkedworkspace_rootitself is fine.Never readable: private keys and keystores (
*.pem,*.key,*.p12,*.pfx,*.jks,*.keystore,*.ppk,id_rsa,id_ed25519, …) and anything under.ssh,.gnupg,.aws,.azure,.kube,.docker.Needs explicit intent:
.env,.env.*,.envrc,.npmrc,.pypirc,.netrc,.git-credentials,credentials.json,service-account.json, and files under.gitor.configare refused unless the call passesallow_sensitive: true, which the tool descriptions reserve for when the user explicitly asked for that file. Clients that show tool arguments for approval will display this flag.search_codenever searches these files.A symlink is checked under both its own name and its target's, so
notes.txt -> .envis still treated as sensitive.Generated folders (
node_modules,build,.venv,venv,.dart_tool,__pycache__) are skipped by search but can be read when named explicitly (e.g.build/test.log).Input files are limited to 65 KB each for summarization, 72K characters combined, and 2 MB for a log. Large summaries are processed in chunks (up to 10).
search_codereturns up to 50 matches (default 25); it uses literal search, not semantic RAG.Secret redaction is best effort.
Tool responses should be treated as hypotheses, especially for failures and architectural conclusions.
Minimal local token/latency metadata is stored at
~/.ollama-mcp/metrics.sqlite3(override withMCP_METRICS_DB); code, paths and logs are not stored there.
Environment variables
Variable | Default | Purpose |
| unset | Optional default project for relative paths |
|
| Local Ollama endpoint |
|
| Model used for summaries and log analysis |
|
| Context window |
|
| Request timeout |
|
| Metrics database |
| auto-detected | Explicit path to |
7. Test
python -m unittest discover -s tests -vTests use a fake local model, so they run without Ollama. One test starts the real server over stdio without WORKSPACE_ROOT (as Claude Desktop does) and calls it with an MCP client. A real Cursor/Claude Desktop + Ollama acceptance test still needs to be run on your Mac.
8. Next optimization
Use 10-20 real tasks to compare the client with and without this MCP: total cloud tokens, tool latency, failures, and human corrections. A small always-on rule adds a little prompt overhead, so actual net savings must be measured.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
Related MCP Connectors
Read and search folders on your own computer with explicit consent. Files are never uploaded.
Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.
Use your own Windows, Mac or Linux computer from ChatGPT, Claude, Cursor or Gemini CLI: run commands, read, write and search files, run long processes. Your computer only makes an outgoing connection (no open ports or VPN). Read-only mode, allowed folders, blocked commands and an action log keep you in control. Free plan available.
Safe folder access for ChatGPT and Claude: read, write and search files, risky tools opt-in.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables local file search, packing into LLM-ready context, and inspection via an MCP server on stdio.142MIT
- FlicenseNot gradedqualityBmaintenanceLocal-first MCP toolkit that provides coding agents focused repository context via read_file, search_files, and edit_file tools, reducing token usage and task cost.2-
- FlicenseNot gradedqualityCmaintenanceEnables local ChatGPT/OpenAI MCP clients to read files and search within explicitly authorized directories using read-only, policy-constrained tools.1-
- AlicenseNot gradedqualityBmaintenanceEnables AI clients to query a locally generated code map (bundle.json) through MCP tools, including token-budgeted export and impact analysis, keeping code on the machine.3MIT