Skip to main content

A Python framework for building multi-agent MCP servers

Project description

agent-mcp-framework

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

Build production-ready multi-agent systems that expose their capabilities as MCP tools — ready to integrate with Claude, VSCode, and any MCP-compatible client.

Features

  • Agent abstractionsAgent, 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

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",
)

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

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

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

agent_mcp_framework-0.1.0.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

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

agent_mcp_framework-0.1.0-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file agent_mcp_framework-0.1.0.tar.gz.

File metadata

  • Download URL: agent_mcp_framework-0.1.0.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for agent_mcp_framework-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c60ed955f4a8579f4c4668b1b5c6753b1c42296e1e2d71067d09a92f809f8e47
MD5 097129cae01b6cbb7028769832b0850c
BLAKE2b-256 c06090be31f0ed13dbd86db73ec49e453615e84dd0d232d7380684c7a2fc9d1f

See more details on using hashes here.

File details

Details for the file agent_mcp_framework-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agent_mcp_framework-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d56f65e9707d795340fe14b3c275333781354b56fcc1cac0963f1af07e9b8c4
MD5 d0cb05bbb6f8ba9db713ee748e389d2e
BLAKE2b-256 2ded61180586e7796a2123ae785f01e348c624ed8fd73d16b1c62bf6d2170f9e

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