Skip to main content

Overview

The Linear integration allows Nectr to pull issue and task data from Linear during PR reviews. When a PR references a Linear issue (e.g., “Fixes ENG-123”), Nectr fetches the full issue context — title, description, status, assignee — and includes it in the AI review.
This is an inbound MCP integration — Nectr acts as an MCP client connecting to a Linear MCP server.

How It Works

1

PR references Linear issue

Developer includes Linear issue ID in PR title or body:
2

Nectr extracts issue IDs

During PR review, Nectr parses the PR metadata to identify Linear issue references
3

MCP query to Linear

Nectr calls Linear MCP server via MCPClientManager.get_linear_issues():
4

Context included in review

Linear issue data is injected into the AI review prompt:
5

AI review considers issue context

Claude can now verify:
  • Does the PR actually address the issue?
  • Are there gaps between the issue requirements and implementation?
  • Should the PR include additional work mentioned in the issue?

Setup

1. Deploy Linear MCP Server

You need a Linear MCP server running separately from Nectr. Options: Option A: Use official Linear MCP server
Option B: Build your own Linear MCP server

2. Get Linear API Key

1

Go to Linear settings

2

Create personal API key

Click “Create new key” and give it a name like “Nectr MCP”
3

Copy the key

Format: lin_api_...

3. Configure Nectr

Set environment variables in your Nectr backend:
Both LINEAR_MCP_URL and LINEAR_API_KEY must be set for the integration to work. If either is missing, Linear context will be silently skipped.

API Reference

MCPClientManager.get_linear_issues()

Pull issues from Linear MCP server matching a query. Source: app/mcp/client.py:47 Signature:
Parameters:
  • team_id (str): Linear team identifier (e.g., "ENG", "DESIGN", "INFRA")
  • query (str): Free-text search query — typically issue IDs or keywords
Returns:
Returns empty list [] if:
  • LINEAR_MCP_URL is not configured
  • Linear MCP server is unreachable
  • MCP call times out (10-second timeout)
  • No issues match the query
Example Usage:

MCP Protocol Details

Nectr calls the Linear MCP server using JSON-RPC 2.0 over HTTP:

Request Format

Response Format

Nectr’s MCPClientManager unwraps this format automatically:

Timeout and Error Handling

The Linear MCP client has a 10-second timeout to prevent slow external services from blocking PR reviews.
Linear integration is best-effort. If the MCP server is down or slow, PR reviews continue without Linear context. This is by design — external context should enhance reviews, not block them.

Identifying Linear Issues in PRs

Nectr uses several strategies to identify Linear issue references:

Pattern Matching

Branch Name Detection

Usage in PR Review Flow

Here’s how Linear context is pulled during a review:

Example Review with Linear Context

Here’s how Linear context appears in an AI-generated review:

Team ID Configuration

Currently, the team ID is passed directly to get_linear_issues(). You can make this configurable:

Per-Repository Team Mapping

Auto-Detection from Issue IDs

Troubleshooting

No Linear context appearing in reviews

1

Check environment variables

Both must be set and non-empty.
2

Test Linear MCP server directly

Should return JSON with issues.
3

Check Nectr logs

If you see “LINEAR_MCP_URL not configured”, env vars aren’t loaded.
4

Verify PR has Linear issue references

PR title or body must contain issue IDs like “ENG-123”.

Linear MCP server timing out

If Linear API is slow, increase the MCP timeout (default 10s):

Authentication errors

  • Check API key format: Should start with lin_api_
  • Verify key permissions: Must have read access to issues
  • Check key expiration: Linear API keys don’t expire but can be revoked

Sentry Integration

Pull production errors for changed files

Slack Integration

Include relevant team messages in review context
  • app/mcp/client.py:47 - get_linear_issues() implementation
  • app/mcp/client.py:118 - Generic query_mcp_server() method
  • app/services/pr_review_service.py - How Linear context is used in reviews
  • app/core/config.py:66 - LINEAR_MCP_URL and LINEAR_API_KEY settings