Skip to main content
Glama

ollama-agent

Local Ollama models exposed to Claude Code as MCP tools. Claude Code stays the brain (cloud); the RTX 4080 does the bulk work: summarising big files, first-pass code review, semantic code search, boilerplate and tests. A launcher also runs Claude Code fully offline against Ollama.

Tools

Tool

What it does

Local model

delegate_task

Run a self-contained subtask (tests, boilerplate, rewrites, log triage)

strong or fast tier

review_diff

Structured second-opinion review of a diff (git_range="--staged", main...HEAD, or raw diff)

strong, thinking on

summarize

Map-reduce summary of large files/logs, optionally focused on a question

fast (map) + strong (reduce)

index_codebase / search_code

Local embedding index + semantic search by meaning

qwen3-embedding

local_models_status

Profile, tier→model map, ollama ps with GPU/CPU split, thrash warnings

–

Full outputs are always written to ~/.cache/ollama-agent/outputs/*.md; Claude gets the head plus the path.

Related MCP server: Ollama MCP Server

Profiles (16 GB GPU)

Profile

strong

fast

embed

Measured

trio (default)

qwen3.5:latest (9B)

qwen3.5:4b

qwen3-embedding:0.6b

72 / 97 tok/s, all resident (15.0 GB)

big

qwen3.6:35b-a3b

same model

embed on CPU

36–38 tok/s, 12 GiB on GPU + 9 GiB RAM

The profile is fixed per server process (OLLAMA_AGENT_PROFILE); mixing the 35B with the 9B/4B pair would cost a 15–20 s reload on every switch. On startup the server preloads the profile's models in the background, largest first — loading the 9B last leaves ~15% of it on the CPU (OLLAMA_AGENT_WARMUP=0 disables this).

Setup

ollama pull qwen3.5:latest qwen3.5:4b qwen3-embedding:0.6b   # trio
ollama pull qwen3.6:35b-a3b                                    # big (optional)

uv sync --all-groups
uv run ollama-agent --check          # settings + Ollama reachability

# Claude Code, this repo only: .mcp.json is already here (approve it on first start).
# Claude Code, every repo:
scripts/register.sh                  # uv tool install + claude mcp add --scope user

Then in Claude Code: "call local_models_status", "summarize build.log with the local model", "use local-reviewer on my staged changes" (.claude/agents/local-reviewer.md).

Environment variables are listed in .env.example.

Offline fallback

ollama create qwen3.6-cc -f Modelfile.qwen3.6-cc   # once: 35B with 64K context
bin/claude-local                                    # Claude Code -> Ollama /v1/messages
MODEL=qwen3.5:latest bin/claude-local -p "explain this repo"

The launcher points every Claude Code model slot and the MCP tools at the same model so only one LLM is loaded.

Development

uv run pytest                                              # unit tests, fake backend
OLLAMA_AGENT_INTEGRATION=1 uv run pytest tests/integration -s   # real Ollama
uv run scripts/bench.py trio moe big64k                    # VRAM placement + tok/s

stdout is the MCP transport — log to stderr only.

Available Tools

6 tools
delegate_taskA
Read-only

Run a self-contained subtask on a LOCAL model and return its text.

Good for: boilerplate, unit tests for a given file, docstrings, log triage, rewrites, first drafts, mechanical transformations. Pass the files it needs in context_files (absolute paths, ~90k chars total). model_tier="fast" is ~1.4x quicker for simple jobs; think=true adds reasoning for tricky ones (slower). Output is saved to a file whose path is returned, so ask for long outputs freely.

NOT for: final correctness decisions, reasoning about the whole repo, tasks needing more than ~32K tokens of context, or anything you must get right without checking.

Inputs: task (required), think, timeout_s, max_tokens, +2 more.

index_codebaseA
Idempotent

Build or refresh the LOCAL semantic search index for a directory tree.

Incremental: only files whose mtime/hash changed are re-embedded. Stored in the server's data dir (~/.cache/ollama-agent), not in the repo. Run once per repo; search_code refreshes it automatically afterwards. include_globs defaults to common source/doc extensions.

Inputs: root (required), force, include_globs.

local_models_statusA
Read-only

Show the active local profile, which model serves each tier, and what Ollama has loaded.

Call this when a local tool is slow or fails, or before a batch of local work, to see VRAM placement and whether an unrelated model is loaded and competing for the GPU.

Inputs: no named parameters.

review_diffA
Read-only

Second-opinion code review of a diff by a LOCAL model; returns structured findings.

Give either diff text, or git_range and let the server run git diff in cwd (defaults: cwd = current dir, range = HEAD i.e. all uncommitted changes). Examples: git_range="--staged", git_range="main...HEAD". focus narrows the review ("concurrency", "error handling"). Findings carry file, line, severity (critical/major/minor/nit), summary and suggestion.

Use it as a first pass before or alongside your own review, then verify each finding against the code — it is a cheap second opinion, not a verdict.

Inputs: cwd, diff, focus, think, +2 more. Returns: ReviewCore plus metadata about how it was produced.

search_codeA
Read-only

Semantic search over a codebase by MEANING using local embeddings.

Ask in natural language: "where do we retry failed uploads?", "code that parses the config file". Returns the best-matching chunks as path:start-end plus a snippet. Refreshes the index first unless refresh=false.

NOT for exact identifiers or strings — use Grep for those.

Inputs: root (required), query (required), top_k, refresh.

summarizeA
Read-only

Summarise large files, logs or text with LOCAL models (map-reduce; megabytes are fine).

Use instead of Read when a file is long (logs, dumps, generated code, long docs) and you need the gist or an answer to a specific question ("what errors occurred after 14:00?"). Accepts absolute paths and/or inline text. Concrete details (identifiers, numbers, errors) are preserved. Full summary is also saved to a file.

NOT for short files (<200 lines): just Read them.

Inputs: text, paths, question, timeout_s.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool targets a distinct operation: delegated generation, diff review, summarization, index building, semantic search, and model status. Even where multiple tools invoke local models, the descriptions explicitly separate use cases, so an agent is unlikely to misselect.

    Naming Consistency4/5

    Most tool names follow a clear verb_noun pattern (delegate_task, review_diff, index_codebase, search_code). summarize is a lone single-verb name and local_models_status is a noun phrase, but these are minor deviations that do not cause confusion.

    Tool Count5/5

    Six tools is well-scoped for a local-model assistive agent. Each tool earns its place and covers a distinct utility without redundancy or bloat.

    Completeness4/5

    The tool surface covers the main local-model workflows: task delegation, diff review, large-content summarization, semantic code indexing/search, and status checks. Minor gaps exist, such as no exact-match search or model management beyond status, but these are workable and do not block the core purpose.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables Claude to delegate coding tasks to local Ollama models, reducing API token usage by up to 98.75% while leveraging local compute resources. Supports code generation, review, refactoring, and file analysis with Claude providing oversight and quality assurance.
      27
      AGPL 3.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      Exposes local Ollama instances as tools for Claude Code, allowing users to offload code generation, text drafting, and embedding tasks to local GPUs. It supports multi-turn conversations and model management through the Model Context Protocol.
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables Claude Code to offload routine code generation and text processing tasks to a local Ollama LLM, saving Cloud API tokens and costs with automatic model selection and security features.
      11
      204 npm
      3
      Apache 2.0
    • A
      license
      A
      quality
      B
      maintenance
      Enables Claude Code to delegate agent tasks to local LLMs via llama.cpp or vLLM servers on your own hardware, reducing API usage while maintaining full agent capabilities.
      11
      22
      MIT