agy-ollama-mcp
Provides tools backed by local Ollama models for code drafting, summarization and extraction, chunked map-reduce compression of large files, structured JSON extraction, and model listing/prewarming.
Click on "Deploy 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., "@agy-ollama-mcp Summarize this diff locally before sending it to the cloud model"
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 Bridge for Google Antigravity CLI (agy)
Tiered Edge-Cloud Architecture: High-performance local inference daemon as a zero-cost semantic pre-filter, code drafter, and map-reduce compressor for Google Antigravity CLI.
1. System Context & The Token Bottleneck
Google Antigravity CLI (agy) is a terminal-first autonomous coding agent harness designed for deep engineering workflows: repository-wide code exploration, multi-file edits, test execution, and multi-step reasoning.
Because agy-cli routes its primary reasoning loop through cloud-hosted frontier models (such as Gemini 2.0 Flash / Pro), feeding uncurated logs, raw data files, or entire repository ASTs rapidly inflates input/output context. This leads to quota exhaustion, throttling, and latency spikes.
[ Large Context: Dumps / Logs / Drafts ]
│
▼
┌──────────────────────┐
│ Local Pre-Filter │ <-- Fast, Zero Token Cost (Ollama)
│ (Ollama / C++ Eng) │ Summarization, Extraction, AST Pruning
└──────────┬───────────┘
│ (Only high-density signal forwarded)
▼
┌──────────────────────┐
│ agy-cli Core │ <-- Protected Quota, High-Speed Reasoning
│ (Gemini 2.0 / Cloud) │ Strategic Decisions, Code Synthesis
└──────────────────────┘By placing Ollama as a local semantic pre-filter via the open Model Context Protocol (MCP), you offload token-heavy preliminary workloads, saving 70% to 95% of cloud context tokens while accelerating turnaround latency.
Related MCP server: antigravity-mcp
2. Architecture & Data Flow
flowchart TD
subgraph Antigravity ["Google Antigravity CLI (Cloud Frontier Harness)"]
AGY["agy Core Agent Loop\n(Gemini 2.0 Flash / Pro)"]
CLO_QUOTA["Cloud Quota / Token Budget\n(Protected)"]
end
subgraph MCP_Boundary ["Local Protocol Boundary (STDIO Transport)"]
STDIO["JSON-RPC 2.0 over Stdio"]
SERVER["src/ollama_bridge/server.py\n(FastMCP Server)"]
ISOLATION["Stderr Logging Isolation\nsrc/ollama_bridge/config.py"]
end
subgraph Bridge_Engine ["Deterministic Edge Engine (Python 3.10+)"]
RES["src/ollama_bridge/resolution.py\n4-Tier Precedence Resolver"]
ENG["src/ollama_bridge/engine.py\nChunking, Drafting, Map-Reduce"]
CLI["src/ollama_bridge/client.py\nInventory & Prewarming"]
end
subgraph Hardware_Tier ["Local Accelerated Compute Tier"]
OLLAMA["Ollama Daemon (http://localhost:11434)"]
VRAM["GPU VRAM (keep_alive: -1 pinned)"]
QWEN["qwen2.5-coder:14b"]
DEEPSEEK["deepseek-r1:14b"]
end
AGY -->|"Tools: draft, summarize,\nmap-reduce, extract_json"| STDIO
STDIO --> SERVER
SERVER --> RES
SERVER --> ENG
SERVER --> CLI
SERVER -.->|"Diagnostic Logs (Stderr)"| ISOLATION
RES -->|"Resolved Model"| ENG
ENG -->|"POST /api/generate"| OLLAMA
CLI -->|"GET /api/tags\nPOST /api/generate"| OLLAMA
OLLAMA --> VRAM
VRAM --> QWEN
VRAM --> DEEPSEEK
OLLAMA -->|"Fast Local Output (0 tokens billed)"| ENG
ENG -->|"Clean JSON / Brief Result"| SERVER
SERVER -->|"JSON-RPC Response"| STDIO
STDIO --> AGY
AGY -.->|"Only Curated Insights Fed"| CLO_QUOTA3. Registered MCP Tools
The bridge daemon registers 7 specialized Model Context Protocol tools:
Tool Name | Parameters | Purpose & Rationale |
| Drafts code implementations, boilerplate, and scaffolding locally without burning cloud tokens. | |
| Strips noise, boilerplate, and repetitive lines from logs or text into a high-density technical summary. | |
| In-memory line-aware chunk partitioning and tree-synthesis map-reduce for texts exceeding single-pass limits. | |
| File-direct sliding-window map-reduce. Streams multi-megabyte files directly from disk, runs concurrent worker map distillation with | |
| Extracts strict structured JSON conforming to a specified schema at low temperature ( | |
(none) | Queries | |
| Sends |
4. Antigravity CLI Integration & Slash Commands
4.1. FastMCP Daemon Registration
Add the bridge to your Antigravity configuration at ~/.gemini/config/mcp_config.json:
{
"mcpServers": {
"local-ollama": {
"command": "python3",
"args": [
"/home/leifdavisson/.local/bin/ollama_mcp_bridge.py"
],
"env": {
"LOCAL_LLM_MODEL": "qwen2.5-coder:14b",
"OLLAMA_HOST": "http://localhost:11434"
}
}
}
}4.2. Installed Antigravity Skills
The project installs two complementary slash commands for agy-cli:
/local-draft(Open SKILL.md (file:///home/leifdavisson/.gemini/config/skills/local-draft/SKILL.md)): Forces AST parsing, code scaffolding, or boilerplate generation onto local Ollama models./local-draft Create a Pydantic V2 schema for our customer ingestion webhook/reduce(Open SKILL.md (file:///home/leifdavisson/.gemini/config/skills/reduce/SKILL.md)): Performs file-direct chunked map-reduce on massive files (>300 lines) before ingesting into context./reduce /var/log/syslog.log "Identify database connection timeouts and trace IDs"
4.3. Standalone CLI Utility (chunk_reduce.py)
Run the map-reduce pipeline directly from your shell or pipe from stdin:
# File direct execution:
chunk_reduce.py -f /var/log/syslog.log -g "Find failed SSH logins" -j 4
# Piped execution:
cat massive_output.txt | chunk_reduce.py -g "Extract unhandled exceptions"5. Automated Verification & Validation (DO-178C Level A)
The codebase is governed by formal INCOSE requirements and verified according to DO-178C Level A High-Assurance verification criteria:
Metric | Required Standard | Achieved Result |
Requirements Verified | 100% (9 / 9) | 100% (9 / 9) |
Uncovered Requirements | 0 | 0 |
Orphaned Tests | 0 | 0 |
Total Test Suite | >= 80 | 139 Passed (135 AST Mapped) |
Statement Coverage | 100.0% | 100.0% (366 / 366 statements) |
Branch Coverage | 100.0% | 100.0% (92 / 92 branches) |
DO-178C Level A MC/DC | 100.0% | 100.0% Verified Pairs |
Mutation Kill Score | >= 90.0% | 91.0% (mutmut) |
Strict Static Typing | 0 errors | 0 errors ( |
Protocol Isolation | Pure JSON-RPC | Zero stdout pollution (stderr isolated) |
Detailed audit documentation and artifacts:
Open VERIFICATION_REPORT.md (file:///data/agy_ollama_mcp/VERIFICATION_REPORT.md)
Open RTM_MATRIX.json (file:///data/agy_ollama_mcp/RTM_MATRIX.json)
Open requirements.json (file:///data/agy_ollama_mcp/requirements.json)
Open features/ (file:///data/agy_ollama_mcp/features/)
6. Quick Start & Installation
Requirements
Python 3.10+
Ollama running locally (
http://localhost:11434)Recommended local models:
qwen2.5-coder:14bordeepseek-r1:14b
Installation
# 1. Clone repository
git clone https://github.com/leifdavisson/agy-ollama-mcp.git
cd agy-ollama-mcp
# 2. Install package in editable mode
pip install -e .
pip install -r requirements-dev.txt
# 3. Pull recommended local models in Ollama
ollama pull qwen2.5-coder:14b
ollama pull deepseek-r1:14b
# 4. Verify local installation
pytest --cov=src --cov-branch --cov-fail-under=100 tests/
python3 scripts/verify_mcdc.py
python3 scripts/generate_rtm.py7. Configuration Environment Variables
Variable | Default | Description |
|
| Endpoint of the local Ollama daemon. |
| Auto-detected | Preferred model override (e.g. |
|
| Request timeout in seconds for generation tasks. |
|
| Context window size allocated in local model memory. |
|
| Sampling temperature for code generation. |
|
| Set to |
8. Companion Ecosystem & Project Attribution
This project is built atop the open-source AI and developer tooling ecosystem. Direct backlinks to official project documentation, homepages, and repositories:
Ollama: Official Runtime Daemon (GitHub Repository)
Model Context Protocol (MCP): Standard Specification (GitHub Organization)
Qwen2.5-Coder: Specialized Code Intelligence Model (Ollama Card)
DeepSeek-R1: Reasoning and Verification Model (Ollama Card)
llama.cpp: Pure C/C++ Inference Engine
Google Antigravity CLI (
agy): Autonomous Terminal Coding Harness (Open antigravity-guide (file:///home/leifdavisson/.gemini/config/skills/antigravity-guide/SKILL.md))
9. License
This project is licensed under the GNU Affero General Public License v3.0 (GNU AGPLv3). See LICENSE (Open LICENSE (file:///data/agy_ollama_mcp/LICENSE)) for full legal terms.
Available Tools
7 toolslocal_chunked_summaryC
Map-reduce chunked summarization for massive files or logs that exceed single context limits.
Inputs: content (required), model, chunk_chars, extraction_goal. Returns: result
local_draft_codeA
Generate initial code drafts, boilerplate, unit tests, or scaffolding locally via Ollama without consuming cloud tokens.
Inputs: task_description (required), model, context, language. Returns: result
local_extract_jsonB
Extract structured JSON from unstructured text, logs, or documentation according to a target schema description.
Inputs: content (required), schema_description (required), model. Returns: result
local_list_modelsA
List all models currently installed and available in the local Ollama instance.
Inputs: no named parameters. Returns: result
local_map_reduce_fileB
Compress large files, traces, or logs using local Ollama Map-Reduce before ingesting into context.
Inputs: file_path (required), extraction_goal (required), model, overlap, +2 more. Returns: result
local_prewarm_modelA
Pre-warm a local model into memory/VRAM with keep_alive=-1 so subsequent calls have zero cold-start delay.
Inputs: model. Returns: result
local_summarize_and_extractC
Compress massive files, logs, terminal traces, or documentation into high-density summaries before cloud reasoning.
Inputs: content (required), extraction_goal (required), model. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
The tools have significant overlap: local_summarize_and_extract, local_chunked_summary, and local_map_reduce_file all perform summarization/compression with only subtle differences. This can confuse an agent about which to use. Other tools are clearer, but the redundant trio lowers the score.
All tools use a 'local_' prefix and snake_case, which is consistent, but the names are not fully uniform: 'summarize_and_extract' combines two actions while others use a single verb, and 'chunked_summary' vs 'map_reduce_file' are stylistic variations. The patterns are mostly consistent but not perfectly aligned.
Seven tools is a reasonable, well-scoped number for a local Ollama helper. It covers core operations without being overwhelming, fitting comfortably within the typical 3-15 range.
The tools cover the main capabilities (code generation, summarization, extraction, model management, prewarming) well. However, the presence of three overlapping summarization tools suggests redundancy rather than a missing feature; the domain appears largely covered, with minor gaps like model downloading or inference not being addressed.
Maintenance
Related MCP Connectors
LLM cost optimization gateway, repo token-waste auditor & model arbitrage MCP server.
Stateless agentic tools over MCP: concept extraction, long-context, knowledge graph, planning.
MCP-Native LLM Orchestration Agent
Multiple MCP tools, persistent graph memory, token-saving data pointers, and more.
Related MCP Servers
- AlicenseBqualityCmaintenanceA lightweight MCP bridge that lets Claude Code delegate heavy tasks to the Antigravity CLI - saving context window and tokens for what matters.112MIT
- AlicenseAqualityDmaintenanceBridges Google Antigravity CLI with MCP clients, enabling 13 specialized tools for AI-assisted coding, automation, and security audits.13MIT
- FlicenseNot gradedqualityDmaintenanceEnables local AI agents to generate code and interact with Google Antigravity (Gemini Pro) via MCP, consuming zero API tokens.-
- AlicenseAqualityBmaintenanceExposes Google's Antigravity CLI agent as MCP tools, letting any MCP host run persistent, resumable conversations with streamed progress and per-call workspace, model, effort, and mode overrides. Enables agents to delegate coding and shell-capable tasks to the Antigravity agent from OpenCode, Claude Desktop, Cursor, or custom agents.7MIT