Overview
The Linear integration pulls issue context into PR reviews so Nectr’s AI can understand what problem the code is solving. When reviewing a PR, Nectr queries the Linear MCP server for issues matching the PR’s topic or linked directly in the description. Example: A PR titled “Fix OAuth redirect loop” triggers a search for Linear issues with “OAuth” or “authentication” keywords. Nectr includes issue descriptions in the review context.How It Works
Linear integration uses the Model Context Protocol (MCP) — Nectr acts as an MCP client and calls a Linear MCP server to fetch issues.Graceful Degradation
IfLINEAR_MCP_URL is not set or the Linear MCP server is offline:
- Nectr logs an info message:
"LINEAR_MCP_URL not configured — skipping Linear issue fetch" - Returns an empty list
[] - Review continues without Linear context
Prerequisites
- Linear Workspace (free or paid plan)
- Linear API Key (linear.app/settings/api)
- Linear MCP Server (self-hosted or cloud-deployed)
Setup Guide
1. Deploy a Linear MCP Server
You need an external MCP server that implements thesearch_issues tool. This server bridges Linear’s GraphQL API and the MCP protocol.
- Docker (Recommended)
- Self-Hosted Python
- Hosted Service
2. Set Environment Variables
Add the following to Nectr’s.env:
.env
3. Restart Nectr
Usage
Automatic Issue Fetching
When a PR is opened, Nectr automatically:- Extracts keywords from the PR title and description
- Calls Linear MCP server with
search_issues(team_id, query) - Includes issue context in the AI prompt
Manual Testing
Test the Linear MCP server directly:Implementation Details
MCPClientManager
File:app/mcp/client.py:45
MCP Request Format
File:app/mcp/client.py:116
Configuration Reference
Base URL of the Linear MCP server (e.g.,
http://linear-mcp-server:8001)Linear API key for authentication. Generate at linear.app/settings/api.
Troubleshooting
No issues returned
No issues returned
Cause: Linear MCP server is not running or
LINEAR_MCP_URL is incorrect.Fix:- Test the MCP server directly:
curl http://linear-mcp-server:8001/ - Check logs:
docker logs linear-mcp-server - Verify
LINEAR_MCP_URLis set in Nectr’s.env
Error: HTTP 401 Unauthorized
Error: HTTP 401 Unauthorized
Timeout errors
Timeout errors
Cause: Linear GraphQL API is slow or MCP server is overloaded.Fix:
- Increase timeout: Edit
_MCP_TIMEOUTinapp/mcp/client.py(default: 10s) - Add caching to the MCP server (cache issue queries for 60s)
Issues not relevant to PR
Issues not relevant to PR
Cause: Search query is too broad or team_id is incorrect.Fix:
- Refine query extraction logic in
ReviewToolExecutor - Hardcode
team_idin.envif you only have one team
Next Steps
MCP Protocol
Understand how MCP connects Nectr with Linear
Sentry Integration
Surface production errors in PR reviews
Environment Variables
Full configuration reference