Skip to main content
Glama
README.md
# Multi-Agent Dev Automation System — Agentic CI/CD Pipeline

An automated agentic CI/CD pipeline using FastAPI, Claude-powered agents, and Model Context Protocol (MCP) to automatically analyze GitHub Pull Requests, run unit tests, and lint files.

## Project Architecture

```
devagent/
├── agents/             # Claude-powered agents
│   ├── base_agent.py      # Base agent with tool execution loop
│   ├── reviewer_agent.py  # Reviewer agent parsing PR diffs
│   └── prompts.py         # System prompts
├── app/                # FastAPI application
│   ├── api/routes/        # API endpoints (health)
│   ├── services/          # Claude integration service
│   ├── config.py          # Settings and environment config
│   └── main.py            # FastAPI main entrypoint
├── mcp_server/         # MCP Server
│   ├── server.py          # MCPServer registration and endpoints
│   └── tools/             # MCP tools (fetch_pr_diff, lint, run_tests, search)
├── tests/              # Test suite (pytest)
│   ├── test_agents.py
│   ├── test_health.py
│   └── test_mcp_tools.py
├── .env.example        # Environment template
├── .gitignore          # Git ignore files
└── requirements.txt    # Python dependencies
```

## Features & MCP Tools

- **BaseAgent**: Executes a tool-calling loop using the Anthropic API (Claude 3.5 Sonnet) to recursively gather codebase information.
- **ReviewerAgent**: Performs code reviews on PR diffs looking for correctness bugs, security vulnerabilities, and code quality issues.
- **MCP Tools**:
  - `fetch_pr_diff`: Retrieves changed files and patches for a GitHub PR.
  - `search_codebase`: Searches local files using patterns or text search.
  - `run_tests`: Runs unit tests using pytest within the target repository.
  - `lint_code`: Runs Ruff linter on target files.

## Installation & Setup

1. **Clone the repository** (once pushed to GitHub).
2. **Create and activate a virtual environment**:
   ```bash
   python -m venv .venv
   # Windows:
   .venv\Scripts\activate
   # Linux/macOS:
   source .venv/bin/activate
   ```
3. **Install dependencies**:
   ```bash
   pip install -r requirements.txt
   ```
4. **Configure environment variables**:
   Create a `.env` file from the template and fill in your keys:
   ```bash
   cp .env.example .env
   ```
   Add your `ANTHROPIC_API_KEY` and optionally `GITHUB_TOKEN`.

## Running the Project

### Running FastAPI App
```bash
uvicorn app.main:app --reload
```
Access the API docs at `http://localhost:8000/docs`.

### Running MCP Server
To run the MCP server directly:
```bash
python mcp_server/server.py
```

### Running Tests
To run all tests and verify the system works:
```bash
python -m pytest
```