ollama-agents-mcp
Runs a local Ollama multi-agent pipeline with collector, writer, and reviewer roles to transform messy notes into structured reports with a quality gate.
README
ollama-agents-mcp
MCP server that scaffolds and runs a local Ollama "sub-agent" pipeline with three role prompts (collector, writer, reviewer) and run_agents.sh.
What This MCP Actually Does
This MCP provides a repeatable local pipeline where the same local LLM is run multiple times with different roles, and each output is saved as a file.
Think of it as a small offline workflow engine:
- Collector agent
- Input: messy notes, logs, metrics, tickets
- Output: normalized JSON plus short evidence notes
- Purpose: reduce invention and force structured extraction
- Writer agent
- Input: only the collector JSON
- Output: polished report in Markdown
- Purpose: consistent report structure and faster drafting
- Reviewer agent
- Input: JSON plus report
- Output: PASS/FAIL plus issues and required fixes
- Purpose: quality gate for contradictions, omissions, and vague claims
These are separate role runs with a shared workspace. They are not autonomous background workers.
Pipeline Artifacts (What You Get Every Run)
Under work/, each run creates:
01_collector_<timestamp>_tryN.md: raw collector output02_data.json: normalized source-of-truth data used by writer and reviewer04_report_<timestamp>.md: generated draft report06_review_<timestamp>.md: PASS/FAIL review and required fixes
Why this matters:
- if report text looks wrong, inspect
02_data.jsonfirst - if JSON is wrong, inspect collector output and input notes
- reviewer output tells you exactly what to fix before sharing
Typical Operator Flow
- Paste current month notes into
work/input.txt(incidents, changes, metrics, risks, next plan) - Run setup once (or when role prompts/scripts change)
- Run pipeline
- Open
02_data.json,04_report_*.md, and06_review_*.md - Apply reviewer-required fixes and re-run if needed
Core Use Cases
- Monthly or weekly ops reports
- Input: incidents, key metrics, change summary
- Output: normalized data JSON, final report, quality review
- Benefit: consistent month-over-month format with fewer manual errors
- Post-incident and RCA packs
- Collector extracts timeline, impact, mitigation, and actions
- Writer drafts RCA document
- Reviewer checks missing root cause, owners, due dates, and unsupported claims
- Change review and maintenance summaries
- Turn change notes and outcomes into a standard "what changed / risk / rollback / verification" artifact
- Messy input to clean artifact conversion
- Examples: meeting notes to minutes, ticket dumps to executive summaries, log snippets to hypotheses and next checks
- Offline or privacy-sensitive operations
- Keeps processing local; no cloud dependency for the pipeline itself
Why Split Into Roles Instead Of One Prompt
Single large prompts often mix extraction and writing, miss sections, and drift in style over time.
Role separation gives:
- separation of concerns
- reusable monthly process
- audit trail (
02_data.jsonas source of truth) - quality gate (reviewer can block weak drafts)
Non-Goals
- It does not auto-pull Grafana/Prometheus/Jira data unless you add separate scripts or API integrations.
- It does not run roles in parallel by default.
- It does not know your environment automatically; you still provide inputs.
Quick Start In 60 Seconds
Prereqs:
ollamainstalled and runningpython3available- MCP server configured with env vars:
OLLAMA_AGENTS_MCP_STATE_DIR=<MCP_DATA_ROOT>/ollama-agents-mcpOLLAMA_AGENTS_BASE_DIR=<MCP_DATA_ROOT>/ollama-agents-mcp/workspace
Then run:
health_check()setup_default_environment()list_agent_roles()(expectcollector,writer,reviewer)run_default_pipeline()
Expected outputs under <MCP_DATA_ROOT>/ollama-agents-mcp/workspace/work:
01_collector_*.md02_data.json04_report_*.md06_review_*.md
Optional hardening on run:
run_ollama_agents_pipeline(pipeline_input_file="work/input.txt", collector_retries=3, enforce_schema=true)
Intuitive Commands (Short Aliases)
Use these for day-to-day work:
setup_default_environment()run_default_pipeline()setup_and_run_default_pipeline()
Use full commands only when overriding models/behavior:
setup_ollama_agents_environment(...)run_ollama_agents_pipeline(...)
Guided Inputs (Options + Defaults)
If you want selectable options with default-enter behavior:
list_pipeline_run_options()
- returns available
work/*input files - returns currently installed Ollama models from
ollama list - returns defaults used by guided run
run_pipeline_guided(...)
- leave fields blank to use defaults
- set only fields you care about (for example
collector_model) input_filesupports:- single file:
work/input.txt - multiple files:
work/a.txt,work/b.txt - folder:
work/(recursively combines files into one generated input)
Example:
run_pipeline_guided()run_pipeline_guided(collector_model="deepseek-r1:latest")run_pipeline_guided(input_file="work/input.txt")run_pipeline_guided(input_file="work/incident.txt,work/changes.txt")run_pipeline_guided(input_file="work/")
Path Placeholders
<MCP_STUFF_ROOT>: parent MCP checkout root (example:/Volumes/Data/_ai/_mcp/mcp_stuff)<MCP_DATA_ROOT>: persistent MCP runtime data root (example:/Volumes/Data/_ai/_mcp/mcp-data)
What It Sets Up
Tool setup_ollama_agents_environment supports actions:
setup: scaffold environment filesrun: run existing pipeline onlysetup_and_run: scaffold and then run
When setup is used, it creates:
<MCP_DATA_ROOT>/ollama-agents-mcp/workspace/agents/collector.md<MCP_DATA_ROOT>/ollama-agents-mcp/workspace/agents/writer.md<MCP_DATA_ROOT>/ollama-agents-mcp/workspace/agents/reviewer.md<MCP_DATA_ROOT>/ollama-agents-mcp/workspace/run_agents.sh<MCP_DATA_ROOT>/ollama-agents-mcp/workspace/work/input.txt(optional)
run_agents.sh executes the 3-stage flow:
- Collector extracts structured JSON
- Writer produces monthly report from JSON only
- Reviewer validates report consistency against JSON
Implemented MCP Tools
health_checksetup_ollama_agents_environmentsetup_default_environmentsetup_and_run_default_pipelinelist_pipeline_run_optionsrun_ollama_agents_pipelinerun_default_pipelinerun_pipeline_guidedrun_role_agentlist_agent_rolesget_agent_role_promptupsert_agent_role_promptdelete_agent_role_prompt
Data Root Policy
Runtime state for this MCP is persisted under:
<MCP_DATA_ROOT>/ollama-agents-mcp
Configure with env var:
OLLAMA_AGENTS_MCP_STATE_DIROLLAMA_AGENTS_BASE_DIR(optional override for workspace path)
The server stores the latest action manifest in last_action.json in this state dir.
Local Setup
cd <MCP_STUFF_ROOT>/ollama-agents-mcp
./bootstrap.sh
Run
cd <MCP_STUFF_ROOT>/ollama-agents-mcp
./venv/bin/python run_server.py
Codex Config Example
~/.codex/config.toml
[mcp_servers.ollama-agents-mcp]
command = "bash"
args = ["-lc", "mkdir -p <MCP_DATA_ROOT>/ollama-agents-mcp && cd <MCP_STUFF_ROOT>/ollama-agents-mcp && exec ./venv/bin/python run_server.py"]
[mcp_servers.ollama-agents-mcp.env]
OLLAMA_AGENTS_MCP_STATE_DIR = "<MCP_DATA_ROOT>/ollama-agents-mcp"
OLLAMA_AGENTS_BASE_DIR = "<MCP_DATA_ROOT>/ollama-agents-mcp/workspace"
Claude Code Config Example
~/.claude.json
{
"mcpServers": {
"ollama-agents-mcp": {
"type": "stdio",
"command": "bash",
"args": [
"-lc",
"mkdir -p <MCP_DATA_ROOT>/ollama-agents-mcp && cd <MCP_STUFF_ROOT>/ollama-agents-mcp && exec ./venv/bin/python run_server.py"
],
"env": {
"OLLAMA_AGENTS_MCP_STATE_DIR": "<MCP_DATA_ROOT>/ollama-agents-mcp",
"OLLAMA_AGENTS_BASE_DIR": "<MCP_DATA_ROOT>/ollama-agents-mcp/workspace"
}
}
}
}
Example Tool Usage
Fast path (recommended):
setup_default_environment()run_default_pipeline()setup_and_run_default_pipeline()
Guided path (option listing + defaults):
list_pipeline_run_options()run_pipeline_guided()
Create environment only (uses default workspace under <MCP_DATA_ROOT>/ollama-agents-mcp/workspace):
setup_ollama_agents_environment(action="setup")
Run existing pipeline only:
setup_ollama_agents_environment(action="run", pipeline_input_file="work/input.txt")
Create environment and pull models:
setup_ollama_agents_environment(action="setup", pull_models=true)
Setup and run in one call:
setup_ollama_agents_environment(action="setup_and_run", pull_models=true, pipeline_input_file="work/input.txt")
Run pipeline directly:
run_ollama_agents_pipeline(pipeline_input_file="work/input.txt")run_ollama_agents_pipeline(pipeline_input_file="work/input_a.txt,work/input_b.txt")run_ollama_agents_pipeline(pipeline_input_file="work/")run_ollama_agents_pipeline(pipeline_input_file="work/input.txt", collector_retries=3, enforce_schema=true)
Run a single role directly (works for future added roles too):
run_role_agent(role="collector", input_file="work/input.txt", model="deepseek-r1:latest")
List current role prompts:
list_agent_roles()
Read one role prompt:
get_agent_role_prompt(role="collector")
Add a new role prompt (future expansion):
upsert_agent_role_prompt(role="analyst", prompt="ROLE: Analyst...")
Delete a role prompt:
delete_agent_role_prompt(role="analyst", confirm=true)
Notes
- Requires local
python3andollama. - Model pulls and pipeline execution can take several minutes depending on model size and hardware.
- Pipeline hardening includes collector retry and fallback JSON extraction when fenced blocks are missing.
enforce_schema=truevalidates collector JSON contains keys:incidents,changes,metrics,risks,next_month_plan.
Local Customization Tracking
- Local machine-specific integration, client wiring, and operational state are tracked under the external data root.
- Local metadata path:
/Volumes/Data/_ai/_mcp/mcp-data/<name>/meta - Repo-side capability contract is in
docs/local-capability/. - Secrets are never stored in repo docs; only variable names and loading locations are documented.
Local Enhancements Capture (2026-03-13)
- Captured current local changes, configuration updates, and operational enhancements for GitHub publication.
- Includes synchronization with sub-repo link updates where applicable.
- Cross-reference local docs and capability notes added in this repository.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.