Skip to main content

agent-mcp-framework

CI PyPI Docker Python 3.10+

A Python framework for building multi-agent MCP (Model Context Protocol) servers.

Compose multi-agent systems with sequential, parallel, conditional, and map-reduce pipeline patterns, agent lifecycle hooks, and structured outputs — and expose the result as MCP tools for Claude, VSCode, or any MCP-compatible client.

Features

  • Agent abstractions — Agent, LLMAgent, FunctionAgent with lifecycle hooks
  • Pipeline composition — Sequential, Parallel, Conditional, and MapReduce patterns
  • MCP integration — Expose agent pipelines as MCP tools over stdio or SSE
  • Output formatting — JSON, Markdown, and plain text output modes
  • CLI — Run servers and pipelines from the command line
  • Docker ready — Dockerfile, docker-compose, and container health checks
  • CI — GitHub Actions matrix (Python 3.10–3.13): lint, tests, Docker build

Installation

pip install agent-mcp-framework

Quick Start

from agent_mcp_framework import Agent, AgentContext, AgentResult, SequentialPipeline, AgentMCPServer


class AnalyzerAgent(Agent):
    async def run(self, context: AgentContext) -> AgentResult:
        code = context.get("code", "")
        issues = []
        if len(code.splitlines()) > 500:
            issues.append("File exceeds 500 lines — consider splitting")
        if "import *" in code:
            issues.append("Wildcard imports detected")
        context.set("issues", issues)
        return AgentResult(success=True, output={"issues": issues, "count": len(issues)})


class ScorerAgent(Agent):
    async def run(self, context: AgentContext) -> AgentResult:
        issues = context.get("issues", [])
        score = max(0, 100 - len(issues) * 15)
        return AgentResult(success=True, output={"score": score, "grade": "A" if score >= 90 else "B" if score >= 70 else "C"})


# Compose agents into a pipeline
pipeline = SequentialPipeline("code-review", agents=[
    AnalyzerAgent("analyzer", description="Find code issues"),
    ScorerAgent("scorer", description="Score code quality"),
])

# Expose as an MCP server
server = AgentMCPServer("code-review-server", description="Multi-agent code review")
server.add_pipeline_tool(
    pipeline,
    name="review_code",
    description="Analyze code quality and return a score",
    parameters={"code": str},  # the input schema MCP clients see
)

if __name__ == "__main__":
    server.run()  # Starts MCP server on stdio

Docker

# Build and run locally
docker compose up --build

# Or build manually
docker build -t agent-mcp-framework .
docker run -p 8080:8080 agent-mcp-framework

Health check endpoints:

Endpoint Purpose
GET / Service info
GET /health Liveness probe
GET /ready Readiness probe

Agent Types

Agent — Base class

Implement run() to define your agent's logic.

LLMAgent — Claude-powered agent

Built-in Anthropic client with complete() helper for LLM calls.

FunctionAgent — Quick inline agents

Wrap any async function as an agent without subclassing.

Pipeline Patterns

Pattern Description
SequentialPipeline Run agents one after another, each seeing updated context
ParallelPipeline Run agents concurrently with optional concurrency limits
ConditionalPipeline Route to agents based on a condition function
MapReducePipeline Split work, fan out, and reduce results

CLI

# Start an MCP server
agent-mcp serve my_project.server

# Run a pipeline directly
agent-mcp run my_project.pipeline --input '{"code": "import *"}'

# Show framework info
agent-mcp info

Project Infrastructure

  • Dockerfile — Multi-stage build with health checks
  • docker-compose.yml — Local development
  • .github/workflows/ci.yml — CI pipeline (lint, test, Docker build)

License

MIT

Metadata

Release files for agent-mcp-framework 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agent-mcp-framework 0.2.0
File Size Uploaded Provenance
agent_mcp_framework-0.2.0.tar.gz 21.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for agent-mcp-framework 0.2.0
File Interpreter ABI Platform
agent_mcp_framework-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 35.3 kB

Release files / agent_mcp_framework-0.2.0.tar.gz

Download URL agent_mcp_framework-0.2.0.tar.gz
Size 21.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0fbf9e625d08931a3af18700643ad5c8871a7c590b8ea56429d4a9107d13d800
BLAKE2b-256 checksum
How to use checksums
0c69f50138387f36abfb79718a7c2601a403b8d6d4dc06b6a397d4fcf0863a18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / agent_mcp_framework-0.2.0-py3-none-any.whl

Download URL agent_mcp_framework-0.2.0-py3-none-any.whl
Size 14.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2568c0f3f43de060bb84f35ddf525ffce40cae31bfbcf559436d61a60db900c0
BLAKE2b-256 checksum
How to use checksums
c8c1f23a6b527410758fafeb64eb83cd44cf005c00640c99319f6473e1f57193
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Security for agent-mcp-framework 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page