Skip to main content

What is MCP?

The Model Context Protocol is an open standard for AI agents to pull structured data from external tools. Instead of hard-coding REST API calls for every service, Nectr uses MCP to connect with Linear, Sentry, Slack, and other tools via a single protocol.
MCP was created by Anthropic and is designed for LLM-native workflows. Learn more at modelcontextprotocol.io.

MCP in Nectr: Two Modes

Nectr uses MCP in both directions:

1. Inbound: Nectr as MCP Client

During a PR review, Nectr calls external MCP servers to pull live context:
  • Linear → Linked issues and task descriptions
  • Sentry → Production errors for files in the PR diff
  • Slack → Relevant channel messages
Implementation: app/mcp/client.py (MCPClientManager)

2. Outbound: Nectr as MCP Server

Nectr exposes its own review data via MCP so external agents can query:
  • Recent PR reviews and verdicts
  • Contributor stats from the knowledge graph
  • Repository health scores
Implementation: app/mcp/server.py (FastMCP)

Inbound MCP Client

Nectr’s AI reviewer uses MCPClientManager to fetch context from external MCP servers during the review workflow.

Supported Integrations

Linear

Pull issues by team and search query

Sentry

Get errors filtered by project and filename

Slack

Fetch channel messages (roadmap)

How It Works

  1. Configure MCP server URL in .env:
    LINEAR_MCP_URL=http://linear-mcp-server:8001
    LINEAR_API_KEY=lin_api_...
    
  2. Nectr calls the MCP server during review:
    from app.mcp.client import mcp_client
    
    issues = await mcp_client.get_linear_issues(
        team_id="ENG",
        query="authentication bug"
    )
    # Returns: [{id, title, state, url, description}, ...]
    
  3. Graceful degradation — if the MCP server is not configured or fails:
    # Returns [] with a warning log; review continues without that context
    

Transport: HTTP + JSON-RPC 2.0

Nectr sends MCP tool calls as JSON-RPC 2.0 requests over HTTP:
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "search_issues",
    "arguments": {"team_id": "ENG", "query": "auth bug"}
  }
}
Response:
{
  "result": {
    "content": [
      {"type": "text", "text": "[{\"id\": \"ENG-123\", \"title\": \"Fix OAuth flow\"}]"}
    ]
  }
}
The client automatically unwraps the content array and parses JSON strings.

Outbound MCP Server

Nectr exposes its own review database via MCP so external tools (Linear bots, Claude Desktop, Slack apps) can query PR verdicts, contributor stats, and repo health.

Available Tools

Nectr’s MCP server exposes 4 tools:

get_recent_reviews

Fetch recent PR reviews with verdicts and summaries

get_contributor_stats

Get top contributors with PR-touch counts

get_pr_verdict

Retrieve AI verdict for a specific PR

get_repo_health

Calculate repository health score (0-100)

Transport: SSE (Server-Sent Events)

Nectr’s MCP server is mounted at /mcp using FastMCP with SSE transport:
curl -N http://localhost:8000/mcp/sse
Connect from Claude Desktop:
{
  "mcpServers": {
    "nectr": {
      "url": "http://localhost:8000/mcp/sse"
    }
  }
}

Example: Query Recent Reviews

# External MCP client calls Nectr's server
result = await mcp_client.call_tool(
    "get_recent_reviews",
    {"repo": "acme/backend", "limit": 10}
)
# Returns: [{id, repo, pr_number, verdict, summary, created_at, status}, ...]

Configuration

Inbound (Client) Setup

Set environment variables for each external MCP server:
.env
# Linear issues
LINEAR_MCP_URL=http://linear-mcp-server:8001
LINEAR_API_KEY=lin_api_...

# Sentry errors
SENTRY_MCP_URL=http://sentry-mcp-server:8002
SENTRY_AUTH_TOKEN=...

# Slack messages
SLACK_MCP_URL=http://slack-mcp-server:8003

Outbound (Server) Setup

No configuration needed — the MCP server is automatically mounted at /mcp when Nectr starts. See MCP Server Setup for details.

Benefits of MCP

Instead of writing custom REST API clients for Linear, Sentry, Slack, etc., Nectr uses one query_mcp_server method with tool name + arguments.
If an MCP server is offline or not configured, Nectr continues the review without that context. No crashes, no complex error handling.
Add new integrations by deploying a new MCP server and setting *_MCP_URL. No changes to Nectr’s core review logic.
MCP is designed for LLM workflows. External agents (Claude Desktop, Custom GPTs) can call Nectr’s MCP server directly.

Next Steps

Setup Linear

Connect Linear issues to PR reviews

Setup Sentry

Surface production errors during reviews

Run MCP Server

Expose Nectr’s data via MCP

MCP Tools Reference

Browse all available MCP tools

Build docs developers (and LLMs) love