Stratagem.php: Project Overview
*(Translated from the original Chinese forum post on zhichai.net.)*
Core Value Proposition
Stratagem.php is a pure-PHP implementation of an AI Agent skill library, MCP server, and A2A protocol. It packages practical capabilities into independent "Stratagems" (锦囊) — units that serve both as executable tools and as agent-readable documentation, aiming to improve AI accuracy and efficiency when performing specific tasks.
Technical Architecture
The architecture follows a "simple yet powerful" design philosophy, visualized as a carefully designed three-layer cake:
- Stratagem Core Layer: Contains all foundational functional modules; every stratagem is a self-contained PHP file.
- Protocol Support Layer: Implements the complete MCP and A2A protocol stacks.
- Application Collaboration Layer: Exemplified by the Yongle Academy (永乐书院) system, providing project management and content generation workflows.
- Pure PHP implementation: Based on PHP 8.0+, zero external dependencies
- Complete MCP support: Supports Stdio, SSE, and HTTP transport modes
- Intelligent stratagem system: Dual-mode operation, metadata search, self-documenting annotations
- Enterprise-grade security: Path traversal protection, operation whitelisting, rate limiting
Protocol Support
| Protocol | Description | Purpose | |----------|-------------|---------| | MCP | Model Context Protocol | Connecting agents with tool resources | | A2A | Agent-to-Agent Protocol | Dynamic collaboration and communication between agents |