Skip to main content
Glama
okarin25

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.md