Skip to main content

MMCP — Multi-Model Collaboration Pipeline CLI. Auto-routes tasks to Claude, GPT, Gemini, DeepSeek with RL routing, multi-verifier voting, and audit trails.

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.

PyPI Tests License: MIT

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 account
  • POST /v1/auth/login — Get API key
  • POST /v1/chat/completions — Proxy with billing
  • POST /v1/chat/completions/stream — SSE streaming
  • POST /v1/billing/checkout — Stripe checkout
  • GET /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


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.1.0.tar.gz (65.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mmcp_core-2.1.0-py3-none-any.whl (67.9 kB view details)

Uploaded Python 3

File details

Details for the file mmcp_core-2.1.0.tar.gz.

File metadata

  • Download URL: mmcp_core-2.1.0.tar.gz
  • Upload date:
  • Size: 65.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for mmcp_core-2.1.0.tar.gz
Algorithm Hash digest
SHA256 f181bd4fc8fbc54d84eec67063e1856d9885d3b7c93d3d36a42f7f698ce8e495
MD5 dfad6e5fbb503ba84861330e342d3ef3
BLAKE2b-256 d5965023da4dc22e2694f226e045158de8613db70c62444df825174097f3ce5b

See more details on using hashes here.

File details

Details for the file mmcp_core-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: mmcp_core-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 67.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for mmcp_core-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ec1a15ad798522ea82dc53cbb4e6ae930088a3055a3737feb219360c9c0785e4
MD5 4d1d26d8686726202e70f1a7b5e72a8b
BLAKE2b-256 543e4e78095357ae31de5a42ebc88931e4420179c827e5fcf9dddcc392d27c17

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page