Mediator Agent MCP
Enables agentic CLIs to start, manage, and resolve structured mediations between product managers and architects, following a protocol to separate positions from interests and produce auditable recommendations.
README
Mediator Agent
An impartial AI mediator for disputes between product managers and architects. It talks to several parties at once in a shared session — on Slack, in Microsoft Teams, on the CLI, through a generic webhook, or from inside any agentic CLI (Claude Code, Codex, Cursor, …) over MCP. It follows a structured protocol to separate positions from interests and makes an auditable recommendation weighed against your organization's recorded criteria — with human approval.
It is vendor-independent (Claude, OpenAI, or any OpenAI-compatible endpoint), OS-independent (Windows, macOS, Linux), and needs no Azure Bot for Teams.
How it works
- Exploration – separate positions from the underlying interests, ask targeted questions
- Facts – request missing/disputed facts (effort, deadline, tech debt, A-SPICE impact)
- Steelman – restate both sides in their strongest form, with the parties' confirmation
- Decision – fixed format: DECISION / RATIONALE / CONDITIONS / DISPUTED FACTS / ESCALATION
There is a code-level guard too: the engine won't allow a final decision until every
party has spoken at least twice (position + reaction) — unless the parties explicitly
ask (the decide command), in which case the uncertainty stays flagged.
Install
Works on Windows, macOS, and Linux (Python 3.10+).
pip install -e . # base engine + CLI + Claude provider
pip install -e ".[openai]" # + OpenAI / OpenAI-compatible provider
pip install -e ".[slack]" # + Slack adapter
pip install -e ".[teams]" # + Microsoft Teams (Bot Framework) adapter
pip install -e ".[webhook]" # + generic HTTP webhook adapter (no Azure Bot)
pip install -e ".[mcp]" # + MCP server for agentic CLIs
pip install -e ".[all]" # everything
Copy .env.example to .env and fill in the keys you need. On PowerShell:
Copy-Item .env.example .env. On bash: cp .env.example .env.
In a hurry? See the Quick Start guide — the fastest path to a running mediation on each surface, including a fully offline local-model setup.
Choosing an LLM provider (vendor-independent)
The mediator's reasoning is decoupled from any single vendor. Pick a backend in
config.yaml (provider:) or with the MEDIATOR_PROVIDER env var:
| Provider | Set | Needs | Notes |
|---|---|---|---|
anthropic |
default | ANTHROPIC_API_KEY |
Claude via the Anthropic SDK |
openai |
provider: openai |
OPENAI_API_KEY |
OpenAI or any OpenAI-compatible API |
ollama |
provider: ollama |
Ollama running locally | Local models, no cloud, no key |
Local models with Ollama (fully offline):
ollama pull llama3.1 # once
export MEDIATOR_PROVIDER=ollama # PowerShell: $env:MEDIATOR_PROVIDER="ollama"
# set model: llama3.1 in config.yaml, then run any surface (CLI, webhook, MCP…)
Ollama defaults to http://localhost:11434/v1; override with OLLAMA_BASE_URL.
For Azure OpenAI / LM Studio / OpenRouter / vLLM, use provider: openai with
OPENAI_BASE_URL set to that endpoint.
1. Try it on the CLI (~2 min)
# bash: export ANTHROPIC_API_KEY=sk-ant-...
# PowerShell: $env:ANTHROPIC_API_KEY = "sk-ant-..."
python -m mediator.cli
Dispute topic: Ship Feature X in Q3 vs. refactor the payment module
> kata: Feature X has to ship in Q3, it's a contractual OEM commitment.
> gabor: In its current state the payment module can't handle it — refactor first.
...
> /decide
Commands: /decide, /reset, /exit.
2. Use it from any agentic CLI (MCP)
The mediator ships as an MCP server, so Claude Code, Codex, Cursor, Windsurf and other MCP-speaking CLIs can drive it directly.
claude mcp add mediator -- python -m mediator.mcp_server
Or in an MCP client config (Codex, Cursor, …):
{
"mcpServers": {
"mediator": {
"command": "python",
"args": ["-m", "mediator.mcp_server"],
"env": { "ANTHROPIC_API_KEY": "sk-ant-...", "MEDIATOR_CONFIG": "config.yaml" }
}
}
}
Exposed tools: start_mediation, add_statement, request_decision,
mediation_status, reset_mediation (each takes an optional session_id).
3. Generic webhook (no Azure Bot, any platform)
The webhook adapter is the platform-neutral surface: a tiny HTTP server that takes a message as JSON and returns the mediator's replies as JSON. This is how you run the mediator in Microsoft Teams without an Azure Bot resource — build a Teams flow in Power Automate / Workflows (trigger on a new channel message → HTTP POST here → post the replies back). The same endpoint works for Slack/Discord/Mattermost bridges, cron jobs, or your own app.
python -m mediator.adapters.webhook_app # listens on $PORT (default 3979)
curl -X POST http://localhost:3979/message \
-H "Content-Type: application/json" \
-d '{"channel_id":"team-42","user_id":"u1","name":"Kata","text":"start Ship X vs refactor"}'
Request fields: channel_id, user_id, text (required); name, mentioned
(optional). Response: {"replies": [...]}. Set MEDIATOR_WEBHOOK_TOKEN to require an
X-Mediator-Token header.
4. Slack bot
- https://api.slack.com/apps → Create New App → From scratch
- Socket Mode → enable, generate an App-Level Token with
connections:write→SLACK_APP_TOKEN(xapp-) - OAuth & Permissions → Bot Token Scopes:
chat:write,channels:history,groups:history,users:read→ Install →SLACK_BOT_TOKEN(xoxb-) - Event Subscriptions → bot events:
message.channels,message.groups - Fill
participantsinconfig.yamlwith Slack user IDs (profile → ⋮ → Copy member ID) python -m mediator.adapters.slack_app- Invite the bot:
/invite @Mediator
5. Microsoft Teams
Two options:
- Webhook (recommended, no Azure Bot) — use the generic webhook adapter above with a Teams Workflow/Power Automate flow. Nothing to register in Azure.
- Bot Framework adapter (
mediator/adapters/teams_app.py, the[teams]extra) — if you do run an Azure Bot resource: set the messaging endpoint tohttps://<host>/api/messages, fillMICROSOFT_APP_ID/MICROSOFT_APP_PASSWORD, thenpython -m mediator.adapters.teams_app.
Chat commands (Slack, Teams, webhook)
| Command | Effect |
|---|---|
@Mediator start <topic> |
Start a new dispute |
@Mediator decide |
Request a decision (approve with ✅/❌ reactions) |
@Mediator status |
Who has spoken, where the dispute stands |
@Mediator reset |
Clear the session |
The mediator doesn't reply to every message: it speaks when addressed, or once both parties have responded since its last turn — so it doesn't talk over anyone.
Customization
Everything is in config.yaml:
- provider / model / max_tokens – which LLM backend and model to use
- criteria – the decision criteria and their weights (the auditable governance core)
- participants – platform user ID → name + role
The mediator's behaviour (protocol, tone, decision format) lives in mediator/prompts.py.
Architecture
Slack ───────────┐
Microsoft Teams ─┤
Webhook (any) ───┤─► commands.py (shared protocol) ─► session.py (state, guards, JSON)
Agentic CLI (MCP)┤ │
CLI ─────────────┘ ▼
engine.py (protocol enforcement)
│
┌───────────────┴───────────────┐
▼ ▼
prompts.py (protocol, llm.py (provider layer:
criteria) Anthropic | OpenAI-compatible)
mediator/llm.py— vendor-independent provider layer (Claude, OpenAI-compatible)mediator/commands.py— platform-agnostic command + turn logic shared by every adaptermediator/adapters/—slack_app.py,teams_app.py,webhook_app.pymediator/mcp_server.py— MCP server for agentic CLIsmediator/cli.py— interactive local CLI
Session state persists in state/ across restarts (filenames are slugified, so any
platform's channel/conversation IDs are safe on any OS).
Possible next steps
- Jira/Confluence fact-checking via MCP (effort, capacity, roadmap)
- Advocate sub-agents – separate agents reinforcing the PM and architect perspectives
- Decision log exported to Confluence (audit trail for A-SPICE)
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。