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.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。