gitmyhub

mcp-agent

Python ★ 8.4k updated 4mo ago

Build effective agents using Model Context Protocol and simple workflow patterns

A Python framework for building AI agents using the Model Context Protocol, with built-in workflow patterns like orchestrator and map-reduce, and optional Temporal integration for production-grade durable workflows.

PythonYAMLTemporalsetup: moderatecomplexity 4/5

mcp-agent is a Python framework for building AI agents that use the Model Context Protocol, or MCP. MCP is a standard developed by Anthropic that defines how AI systems connect to external tools and data sources, such as file systems, web browsers, databases, or custom APIs. This library handles the connection management for those tools so you can focus on what the agent should actually do.

The central idea is that simple, composable patterns produce more reliable agents than complex architectures. The library implements a set of agent workflow patterns drawn from Anthropic's published guidance on building effective agents: patterns like map-reduce, orchestrator, evaluator-optimizer, and router. You can chain these patterns together to build more sophisticated behavior without writing everything from scratch.

For production use, the framework integrates with Temporal, which is a system for running long-running or failure-prone workflows in a way that can pause, resume, and recover automatically. This integration is available without changing the agent code, meaning you can start with a simple setup and scale to durable production workflows using the same API.

Agents built with this library can themselves be exposed as MCP servers, which means other agents or tools can connect to them the same way they connect to any other tool. A cloud deployment option is also in beta, allowing agents to be hosted as managed services.

The framework supports the full MCP specification, including tools, resources, prompts, notifications, OAuth authentication, and sampling. Multiple AI model providers can be used, including OpenAI. Setup is done through configuration YAML files, and a command-line tool is available for scaffolding and deploying projects. The full README is longer than what was shown.

Where it fits