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:Why 10-second timeout?
Why 10-second timeout?
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)
Example Response
Example Response
Use Case
When Claude callsget_linked_issues(query="JWT token refresh", source="linear"), Nectr:
- Calls Linear MCP server with
search_issuestool - Returns list of matching issues
- 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)
Example Response
Example Response
Use Case
When a PR modifiesapp/auth/jwt_utils.py, Claude calls:
- Calls Sentry MCP server with
search_errorstool - Returns recent errors for that file
- Claude includes error context in review (e.g., “This PR might fix the recurring JWTDecodeError”)
Why filter by filename?
Why filter by filename?
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
-
Claude analyzes PR diff
- Sees changes to
app/auth/jwt_utils.py - Decides to check for related production errors
- Sees changes to
-
Claude calls tool:
-
ReviewToolExecutor executes:
-
Claude receives result:
-
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.
- 🟡 Moderate: The
Error Handling
All MCP calls are wrapped in try-except blocks that degrade gracefully:Timeout (10 seconds)
Timeout (10 seconds)
HTTP Error (4xx/5xx)
HTTP Error (4xx/5xx)
JSON Parse Error
JSON Parse Error
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
How to deploy your own MCP servers
How to deploy your own MCP servers
Option 1: Use Anthropic’s MCP servers (if available)
- Check Model Context Protocol docs for official servers
- Use FastMCP (Python) or MCP TypeScript SDK
- Example: FastMCP documentation
- Leave
LINEAR_MCP_URLandSENTRY_MCP_URLunset - 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