AI Code Review & Issue Fixer logo

AI Code Review & Issue Fixer

by gokborayilmaz

This AI agent analyzes code repositories, detects potential security vulnerabilities, reviews code quality, and suggests fixes based on Sentry error logs using Sentry and GitHub MCP servers. It is part of the 'A New AI Agent Every Day!' Series.

View on GitHub

Last updated: N/A

What is AI Code Review & Issue Fixer?

An AI agent that analyzes code repositories for security vulnerabilities and code quality issues, then suggests fixes based on Sentry error logs. It utilizes Sentry and GitHub MCP servers to achieve this.

How to use AI Code Review & Issue Fixer?

  1. Clone the repository. 2. Install dependencies using pip install -r requirements.txt. 3. Configure the .env file with necessary API keys and tokens. 4. Start the FastAPI server using uvicorn upsonicai:app --reload. 5. Access the UI in your browser at http://127.0.0.1:8000/. 6. Configure MCP to include GitHub and Sentry.

Key features of AI Code Review & Issue Fixer

  • Fetches recent commits from GitHub/GitLab repositories

  • Analyzes code quality and detects security vulnerabilities

  • Retrieves error logs from Sentry

  • Provides actionable insights and fixes for detected issues

Use cases of AI Code Review & Issue Fixer

  • Automated code review

  • Security vulnerability detection

  • Proactive issue fixing based on error logs

  • Improving code quality

FAQ from AI Code Review & Issue Fixer

What Python version is required?

Python 3.9 or higher is required.

What is MCP?

MCP stands for Model Context Protocol. It's used to integrate with GitHub and Sentry.

Where can I find the API documentation?

Interactive API docs are available at Swagger UI (http://127.0.0.1:8000/docs) and ReDoc (http://127.0.0.1:8000/redoc).

What environment variables are needed?

AZURE_OPENAI_ENDPOINT, AZURE_OPENAI_API_VERSION, AZURE_OPENAI_API_KEY, GITHUB_PERSONAL_ACCESS_TOKEN, and SENTRY_AUTH_TOKEN are required.

How do I configure MCP for GitHub and Sentry?

Modify your MCP configuration file to include the GitHub and Sentry server configurations as shown in the README.