Self-hosted AI code review.
Run Mesrai inside your own infrastructure — your servers, your Git host, your model. Code and review data never leave your network unless you choose a cloud provider.
What is self-hosted AI code review?
Self-hosted AI code review means the review service runs on infrastructure you control instead of the vendor's cloud. With self-hosted Mesrai, repositories are parsed and reviewed on your servers, review data is stored in your databases, and the AI model is one you choose — a provider under your own contract, or a model running inside your network.
What stays in your infrastructure
Code and review data
Repositories are cloned, parsed and reviewed on your servers. The AST graph cache, review history and configuration live in your own PostgreSQL and MongoDB.
LLM calls
Reviews call the model you configure — a cloud provider under your contract, or an OpenAI-compatible model you host yourself, such as vLLM or Ollama.
Git connection
Connect GitHub, GitLab, Bitbucket or Azure DevOps. With a Git server inside your own network, no public endpoint is needed.
Telemetry, your choice
One anonymous daily heartbeat with aggregate counters only — never code, names or repository identifiers. Preview it, or turn it off with one environment variable.
How a self-hosted review works
- 1
When you add a repository, the worker parses it into an AST graph — functions, classes, imports and calls — and caches it in PostgreSQL.
- 2
When a pull request is opened, your Git host sends a webhook to the webhooks service.
- 3
The worker loads the cached graph, parses only the changed files, and gives the review agents the cross-file context they need.
- 4
The agents review the change with your configured model and post findings as comments on the pull request.
- 5
Merges into the default branch trigger an incremental graph update, so the cache stays current without full rebuilds.
What you deploy
- api
- Main backend
- worker
- Runs code reviews and builds the AST graph (local sandbox)
- webhooks
- Receives pull request events from your Git host
- mesrai-web
- Web app for setup, rules and review history
- PostgreSQL · MongoDB · RabbitMQ
- Bundled — or point at your managed instances
- mcp-manager (optional)
- Model Context Protocol plugins
- worker-analytics (optional)
- Pulse DORA metrics ingestion
Server requirements
- CPU
- 2+ cores (4+ for repositories above ~100k lines)
- Memory
- 8 GB+ (16 GB for large repositories)
- Storage
- 60 GB+ free
- Runtime
- Docker with the Compose plugin
- Network
- A domain or fixed IP only if a cloud Git host must send webhooks
Very large repositories can run the parser in an isolated remote sandbox instead of inside the worker.
Self-hosted vs cloud AI code review
Cloud AI code review tools are the fastest way to start: no servers, automatic upgrades. They also mean your source code is processed and stored in someone else's infrastructure. Self-hosting trades a little operational work for full control over where code, review data and model calls go.
| Cloud (SaaS) AI code review | Self-hosted Mesrai | |
|---|---|---|
| Where code is processed | The vendor's cloud | Your servers or cloud account |
| Where review data is stored | The vendor's databases | Your PostgreSQL and MongoDB |
| Which model reviews the code | Vendor's choice, or your key | Any provider you choose, or a model inside your network |
| Works without internet | No | Yes, with a local Git host and model |
| Upgrades | Automatic | You run the installer when you choose |
| Operational work | None | You run Docker Compose and its databases |
| Best for | Most teams | Regulated, residency-bound or offline environments |
How repositories are parsed: sandbox modes
Mesrai parses each repository into an AST graph once, caches it in PostgreSQL, updates it incrementally when pull requests merge, and on each review parses only the files the pull request touches. Where the parser runs is set by one environment variable:
| Mode | What it does | Trade-off |
|---|---|---|
| local (default) | Runs the repository parser inside the worker container | No external dependency; the worker needs more memory on very large repositories |
| e2b | Runs the parser in a remote isolated sandbox per job | Strong isolation for very large repositories; a paid third-party service, so not for offline installs |
| none | Turns the parser off | Reviews lose cross-file context — not recommended |
Running Mesrai with no internet access
Mirror the images. Copy the Mesrai container images into your internal registry.
Use a Git server on your network. Connect a self-managed Git host inside your network, so no public webhook endpoint is needed.
Run the model inside the network. Serve an open-weight model with vLLM or Ollama and connect it as an OpenAI-compatible provider.
Turn off telemetry. Set MESRAI_TELEMETRY_DISABLED=true so the instance makes no outbound calls.
Who self-hosts AI code review
Regulated industries
Banks, payment companies and healthcare teams that can't send source code to another vendor's cloud, or need review inside an existing compliance boundary.
Data residency
Teams that must keep code and review data in a specific country or region — run Mesrai and the model in that region.
Unreleased or sensitive code
Companies reviewing unannounced products, security tooling or proprietary algorithms where the code shouldn't leave the network.
Existing AI infrastructure
Organizations that already host models on their own GPUs or private endpoints and want review to use them.
Enterprise controls included
- SSO via SAML with your identity provider
- Role-based access control
- Audit logs
- Indian data residency option
- Custom SLA and dedicated support hours
- Onboarding session
Planning a self-hosted rollout
- 1
Decide where it runs — a VM in your cloud account or data centre — and size it for your largest repositories.
- 2
Choose the model: a provider under your existing contract (Bedrock, Vertex AI, Azure-hosted OpenAI-compatible endpoints) or an open-weight model served inside your network.
- 3
Decide how Git reaches Mesrai: public webhook URLs behind your reverse proxy for cloud Git hosts, or internal-only for a Git server on your network.
- 4
Run the installer, then the diagnostics script to confirm every service is healthy.
- 5
Connect SSO, set roles, and pilot on a few active repositories before rolling out organization-wide.
- 6
Plan upgrades: pull the new installer release and re-run the install script, which applies migrations.
What to look for in a self-hosted AI code review tool
Model freedom. Can it use a model inside your network, or only the vendor's cloud models?
Offline operation. Does it work with no outbound internet access, including telemetry?
Full-repository context. Does it understand code outside the diff, or only the changed lines?
Git host support. Does it work with the Git platform — cloud or self-managed — you actually use?
Operational footprint. How many services, how much memory, and how are upgrades and migrations handled?
Identity and audit. SSO, role-based access and audit logs for compliance evidence.
Self-hosted Mesrai — frequently asked
Can Mesrai be self-hosted?
+Yes. Self-hosting is part of the Enterprise plan. Mesrai runs with Docker Compose on your own virtual machine or cloud account, using bundled or managed PostgreSQL, MongoDB and RabbitMQ.
Can Mesrai run without internet access?
+Yes, with a self-managed Git host and an LLM inside your network. Internet access is only needed to reach cloud Git services or cloud model providers. Mirror the container images into your registry, and set MESRAI_TELEMETRY_DISABLED=true.
Which LLMs work with self-hosted Mesrai?
+Any provider Mesrai supports — OpenAI, Anthropic, Google Gemini and Vertex AI, AWS Bedrock — or any OpenAI-compatible endpoint, including models you serve with vLLM or Ollama.
What does the self-hosted telemetry send?
+One anonymous heartbeat per day with version, runtime details and aggregate usage counters. It never includes code, repository names, PR titles, user identities or API keys, and you can disable it.
What are the server requirements?
+2+ CPU cores (4+ for large repositories), 8 GB+ RAM (16 GB for large repositories), 60 GB+ free storage, and Docker with the Compose plugin.
How do updates work?
+Pull the latest installer release and re-run the install script; it pulls new images, restarts services and runs migrations. A diagnostics script checks the installation afterwards.
How much does self-hosted Mesrai cost?
+Self-hosting is part of the Enterprise plan, priced per contract. It includes SSO/SAML, RBAC and audit logs. Contact us for a quote.
Review code where it lives.
Self-hosting is part of Mesrai Enterprise. Tell us about your environment and we'll plan the deployment with you.
Contact us