Skip to main content

Overview

Nectr acts as an MCP client to pull live context from external tools during PR reviews. This enriches reviews with:
  • Linear issues - Task descriptions and requirements
  • Sentry errors - Production errors related to changed files
  • Slack messages - Team discussions (future)
All MCP integrations are optional. If not configured, Nectr gracefully skips that source and logs an info message. Reviews continue normally.

Architecture

File: app/mcp/client.py

Generic MCP Query Method

All integrations use the same underlying protocol:
MCP context is best-effort. A slow external server should not block the PR review from completing. If a call times out, Nectr logs a warning and continues without that context.

Linear Integration

Configuration

Tool: get_linear_issues

Called by: ReviewToolExecutor (get_linked_issues tool)

Use Case

When Claude calls get_linked_issues(query="JWT token refresh", source="linear"), Nectr:
  1. Calls Linear MCP server with search_issues tool
  2. Returns list of matching issues
  3. Claude includes issue context in review (e.g., “This PR addresses ENG-123”)
Why not use Linear API directly?MCP provides a standardized protocol for tool calling. If Linear changes their API, only the MCP server needs updating — Nectr’s code stays the same.

Sentry Integration

Configuration

Tool: get_sentry_errors

Called by: ReviewToolExecutor (get_related_errors tool)

Use Case

When a PR modifies app/auth/jwt_utils.py, Claude calls:
Nectr:
  1. Calls Sentry MCP server with search_errors tool
  2. Returns recent errors for that file
  3. Claude includes error context in review (e.g., “This PR might fix the recurring JWTDecodeError”)
Sentry error culprits include stack traces. The MCP server filters errors where the top frame matches the given filename. This surfaces production errors directly related to the code being reviewed.

GitHub Integration (Placeholder)

GitHub issues are fetched directly via GitHub REST API (not MCP) because Nectr already has GitHub credentials. This method is a placeholder for future use.

How Claude Uses MCP Context

Tool Call Flow

  1. Claude analyzes PR diff
    • Sees changes to app/auth/jwt_utils.py
    • Decides to check for related production errors
  2. Claude calls tool:
  3. ReviewToolExecutor executes:
  4. Claude receives result:
  5. Claude includes in review:

    Issues

    • 🟡 Moderate: The verify_token() function has 42 production errors in the last 30 days (JWTDecodeError: Invalid token signature). This PR changes signature validation logic — ensure backward compatibility.

Error Handling

All MCP calls are wrapped in try-except blocks that degrade gracefully:
User impact: Review continues without MCP context. Claude doesn’t know about Linear issues or Sentry errors for this PR.
User impact: Same as timeout — graceful degradation.
User impact: MCP result is included as-is (might be less useful, but doesn’t break review).

Performance Characteristics

MCP calls run in parallel with other context fetching (Mem0, Neo4j). Total latency is bound by the slowest call, not the sum.

Configuration Best Practices

Environment Variables

Option 1: Use Anthropic’s MCP servers (if available)Option 2: Build custom MCP serversOption 3: Skip MCP
  • Leave LINEAR_MCP_URL and SENTRY_MCP_URL unset
  • Nectr reviews still work — just without external context

Monitoring

Check backend logs for MCP failures:

Future Integrations

Slack

Planned: Pull relevant channel messages during PR reviews.Use case: If a PR mentions “authentication refactor”, search Slack for recent discussions about auth to provide context.Config:

Datadog

Planned: Pull APM traces and metrics for files being modified.Use case: If a PR touches a high-latency endpoint, surface recent performance data.Config:

Next Steps

Service Layer

Learn how ReviewToolExecutor uses MCP client

Data Flow

See MCP context in the PR review flow