api-dev-agent-mcp
by okarin25
README.md
# š¤ Enterprise Clean-Architecture API Agent (MCP-Powered)
An autonomous, deterministic API Development Agent integrated into VS Code via the **Model Context Protocol (MCP)**. This agent automates the generation of production-grade, asynchronous FastAPI services adhering strictly to **Clean Architecture** principles, complete with automated test execution and self-healing verification loops.
---
## š Key Features
* **Deterministic Code Generation**: Employs Jinja2 templating rather than pure LLM generation to guarantee strict standard compliance.
* **Clean Architecture Layers**: Enforces separation across Model, Schema (DTO), Repository, Service, and Controller layers.
* **Model Context Protocol (MCP)**: Exposes tool execution (`file_ops`, `openapi_parser`, `pytest`) to GitHub Copilot via lightweight JSON-RPC over STDIO.
* **Self-Healing Verification Loop**: Automatically executes `pytest` suite post-scaffolding and reads stack traces to auto-fix errors.
* **OpenAPI Spec Ingestion**: Parses existing OpenAPI (YAML/JSON) specifications to generate complete CRUD APIs automatically.
---
## šļø Architecture & Technology Stack
* **Framework**: [FastAPI](https://fastapi.tiangolo.com/) (Async)
* **ORM**: [SQLAlchemy 2.0](https://www.sqlalchemy.org/) (Async Session)
* **Validation**: [Pydantic v2](https://docs.pydantic.dev/latest/)
* **Agent Engine**: [FastMCP](https://github.com/jlowin/fastmcp) / Model Context Protocol
* **Templating**: [Jinja2](https://jinja.palletsprojects.com/)
* **Testing**: [Pytest](https://docs.pytest.org/) & `httpx`
### Directory Structure
```text
.
āāā .vscode/
ā āāā mcp.json # MCP Server configuration for VS Code
āāā app/
ā āāā controllers/ # FastAPI Routers
ā āāā models/ # SQLAlchemy Database Models
ā āāā repositories/ # Data Access Layer
ā āāā schemas/ # Pydantic Schemas / DTOs
ā āāā services/ # Business Logic Layer
ā āāā main.py # Application Entrypoint & Router Discovery
āāā mcp_server/
ā āāā server.py # FastMCP Tools Definition
ā āāā tools/
ā āāā file_ops.py # Template rendering & workspace disk writes
ā āāā openapi_parser.py # OpenAPI YAML/JSON schema parser
āāā templates/ # Jinja2 Standard Boilerplate Templates
āāā tests/ # Generated Pytest Test Suites
āāā .agent.md # VS Code Copilot Custom Agent Prompt & Protocol
āāā requirements.txt # Python dependencies
āāā README.mdThis server cannot be deployed
Maintenance
ActivitySlowing
ResponsivenessNo issues