Build a local AI PR reviewer with LangGraph and Ollama
Mohammad Awwaad's tutorial walks through building a fully local, zero-cost autonomous pull request reviewer on macOS using Ollama (`qwen2.5-coder:7b`), a Dockerized GitLab CE instance, and LangGraph for orchestration — no external APIs required.
Score breakdown
Developers building agentic code-review pipelines in security-conscious enterprises can use this blueprint to run the full workflow locally — avoiding data-privacy risks from external LLM APIs — while navigating real-world tooling gaps in the MCP ecosystem.
- 01The stack runs entirely locally on macOS: Ollama + `qwen2.5-coder:7b`, Dockerized GitLab CE, and LangGraph — no external API calls.
- 02macOS binds `python3` to Apple's default 3.9 install; modern AI packages require Python >= 3.10, fixed by installing Python 3.12 via Homebrew.
- 03The official open-source GitLab MCP server does not yet support MR diff reading or note posting (GitLab Issue #561564).
Mohammad Awwaad's tutorial tackles a real enterprise constraint: corporate security policies often prohibit sending proprietary source code to external APIs like OpenAI, yet teams still want agentic code-review workflows. The solution presented is a fully local stack on macOS consisting of Ollama serving `qwen2.5-coder:7b` (a model specifically tuned for codebase analysis), GitLab Community Edition deployed via Docker Compose as a sandboxed repository host, and LangGraph handling deterministic agent orchestration. Python dependencies — including `langchain`, `langgraph`, `langchain-community`, `langchain-ollama`, `mcp`, `fastapi`, `uvicorn`, `python-dotenv`, and `requests` — are managed in a virtual environment, with credentials stored in a `.env` file to avoid token leakage.
The tutorial is notably honest about the traps encountered along the way.
The tutorial is notably honest about the traps encountered along the way. First, macOS aggressively maps the `python3` command to Apple's bundled 3.9 installation, which is incompatible with modern AI packages that enforce Python >= 3.10; the fix is to install Python 3.12 via Homebrew and explicitly invoke `/opt/homebrew/bin/python3.12` when creating the virtual environment. Second, the official `@modelcontextprotocol/server-gitlab` MCP bridge crashes with `McpError: Unknown tool` because MR diff reading and note posting are not yet implemented in the open-source GitLab MCP server (referenced as GitLab Issue #561564). The workaround is a custom `mcp_client.py` that calls the GitLab REST API directly — hitting the `/merge_requests/X/changes` endpoint to fetch diffs and the `/merge_requests/X/notes` endpoint to post review comments — keeping the data layer cleanly abstracted for the LangGraph agent to consume.
Key facts
- 01The stack runs entirely locally on macOS: Ollama + `qwen2.5-coder:7b`, Dockerized GitLab CE, and LangGraph — no external API calls.
- 02macOS binds `python3` to Apple's default 3.9 install; modern AI packages require Python >= 3.10, fixed by installing Python 3.12 via Homebrew.
- 03The official open-source GitLab MCP server does not yet support MR diff reading or note posting (GitLab Issue #561564).
- 04The workaround uses a custom `mcp_client.py` that calls GitLab's REST API directly to fetch diffs and post review comments.
- 05GitLab CE is deployed via Docker Compose with persistent volumes for config, logs, and data.
- 06A `.env` file stores the GitLab Personal Access Token to prevent credential leakage in source code.