MMCP — Multi-Model Collaboration Pipeline. Auto-routes tasks to Claude, GPT, Gemini, DeepSeek with RL routing, cost optimization, and MCP server support.
Project description
MMCP Python SDK
Self-orchestrating multi-model AI pipeline — auto-routes tasks to the best AI model with smart routing, streaming, and audit trails.
Install
pip install mmcp-core
# With LangChain/LangGraph support
pip install mmcp-core[langchain]
# With Cloud server (PostgreSQL + Stripe)
pip install mmcp-core[cloud]
# Everything
pip install mmcp-core[all]
Quick Start — CLI
# Interactive mode with smart routing
mmcp run
# Autonomous pipeline — MMCP plans and executes
mmcp auto "Research Python best practices and write a summary"
# Direct pipeline commands
mmcp chain "Explain DAGs" -r architect,reviewer --openrouter
mmcp parallel "Analyze market trends" -f analyst,creative,critic -M synthesizer
mmcp verify "Evaluate React vs Vue" -p expert -c challenger -s synthesizer
mmcp shard "Write a report on AI" -r analyst -n 3 -M editor
Quick Start — Python SDK
import asyncio
from mmcp_core import MMCPOrchestrator, RoleBasedRouter, MemoryStore
async def main():
orc = MMCPOrchestrator({
"router": RoleBasedRouter({
"architect": {"model_id": "claude-haiku-4-5-20251001"},
"reviewer": {"model_id": "claude-haiku-4-5-20251001"},
}),
"store": MemoryStore(),
})
result = await orc.run_chain(
"Explain the observer pattern in Python.",
["architect", "reviewer"]
)
print(f"✅ {result.output}")
print(f"🪙 Tokens: {result.total_tokens}")
print(f"💰 Cost: ${result.total_cost_usd:.6f}")
asyncio.run(main())
Streaming Execution (v1.1.0)
from mmcp_core.stream_executor import stream_execute
from mmcp_core.planner import plan_task
plan = await plan_task("Research AI trends", api_key="sk-or-...")
async for event in stream_execute(plan):
if event["type"] == "step_token":
print(event["content"], end="", flush=True)
elif event["type"] == "step_done":
print(f"\n✓ Step {event['step']} ({event['tokens']} tokens)")
elif event["type"] == "plan_done":
print(f"\nTotal: {event['total_tokens']} tokens, ${event['total_cost']}")
v1.1.0 — What's New
| Feature | Description |
|---|---|
| 🧠 Autonomous Mode | mmcp auto — AI plans and executes multi-step tasks |
| 🔀 Smart Routing | Auto-selects model per task (Gemini, GPT-4o, Claude, DeepSeek, Llama) |
| 📡 Streaming | Real-time SSE output during pipeline execution |
| 🏗️ CLI Package | Modular cli/ package (7 modules, was 1,299-line monolith) |
| 🐘 PostgreSQL | Production-ready DB layer (SQLite for dev, PostgreSQL for prod) |
| 💳 Stripe | Subscription billing for Pro/Team plans |
| ✅ Test Suite | 84 automated tests with GitHub Actions CI/CD |
DAG Operations
| Operation | Signature | Description |
|---|---|---|
fork |
1 → N | Spawn parallel sub-contexts |
merge |
N → 1 | Combine parent outputs |
handoff |
1 → 1 | Pass to different model/role |
shard |
1 → N | Split long content |
verify |
1 → 2 | Trust contract (challenger + synthesizer) |
LangGraph Tracer
from langchain_mmcp import MMCPTracer
tracer = MMCPTracer(regulation_tags=["SOC2", "GDPR"], export_path="./mmcp-audits/")
# Add to ANY LangGraph or LangChain pipeline
result = app.invoke(input, config={"callbacks": [tracer]})
tracer.print_summary()
Cloud Server
# Start locally
uvicorn mmcp_cloud.server:app --port 8765
# Or on Railway/Render with DATABASE_URL for PostgreSQL
DATABASE_URL=postgres://... uvicorn mmcp_cloud.server:app
API Endpoints:
POST /v1/auth/register— Create accountPOST /v1/auth/login— Get API keyPOST /v1/chat/completions— Proxy with billingPOST /v1/chat/completions/stream— SSE streamingPOST /v1/billing/checkout— Stripe checkoutGET /v1/account/usage— Usage stats
Environment
# Required (at least one)
export OPENROUTER_API_KEY=sk-or-... # Recommended (multi-model)
export ANTHROPIC_API_KEY=sk-ant-... # Direct Anthropic
# Optional (cloud server)
export DATABASE_URL=postgres://... # PostgreSQL
export STRIPE_SECRET_KEY=sk_... # Stripe billing
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mmcp_core-2.2.0.tar.gz
(98.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
mmcp_core-2.2.0-py3-none-any.whl
(103.4 kB
view details)
File details
Details for the file mmcp_core-2.2.0.tar.gz.
File metadata
- Download URL: mmcp_core-2.2.0.tar.gz
- Upload date:
- Size: 98.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
236b33cc873c28f30ad978e07286117a1ca0397cf9a99de0a48a5c08f9edc488
|
|
| MD5 |
b01d0b727a82576274847bbf170b9146
|
|
| BLAKE2b-256 |
e8e74d84ee9aca225dea2dc319884dffb1189c6b087e6e4b3af751d6e98fa885
|
File details
Details for the file mmcp_core-2.2.0-py3-none-any.whl.
File metadata
- Download URL: mmcp_core-2.2.0-py3-none-any.whl
- Upload date:
- Size: 103.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b9b9698518d9874a6e685aabbef3ccdd14bc008aaa7fc7525ae1b00a55e44ed
|
|
| MD5 |
62d88d190a59a026461efaaf2c8de35b
|
|
| BLAKE2b-256 |
edabd59e005f99ddad39e99be60bb71861345fba53246221c2e438d9dc3cf9c3
|