MCP Servers

模型上下文协议服务器、框架、SDK 和模板的综合目录。

M
MCP Review Git Leantime

MCP server by BenBen2109

创建于 4/20/2026
更新于 about 5 hours ago
Repository documentation and setup instructions

mcp-review-git-leantime

An MCP (Model Context Protocol) server that gathers GitHub Pull Request context — plus optional Leantime ticket context — into a single structured bundle that an AI reviewer can consume.

It only collects context. It does not generate the review text. The AI client (Claude Desktop, Claude Code, Cursor, etc.) does the reasoning.


Features

| Tool | Purpose | |-|-| | get_pr_context | Fetch PR metadata, description, changed files with patches, commits, reviews, and all comments. | | get_ticket_context | Fetch a Leantime ticket via JSON-RPC 2.0: title, description, acceptance criteria, status, priority, assignee. Returns null gracefully if Leantime is not configured. | | review_pr | One-shot: call both of the above and merge into a single JSON bundle the AI can review. |

Transport: stdio. No HTTP server, no ports, no daemons.


Requirements

  • Node.js >= 18
  • A GitHub token with at least repo (private) or public_repo (public) read access
  • (Optional) Leantime instance + API key (Leantime → Settings → API Keys)

Install & run

You do not need to publish this to npm. It runs straight from GitHub:

npx -y github:your-org/mcp-review-git-leantime

Or locally, for development:

git clone https://github.com/your-org/mcp-review-git-leantime.git
cd mcp-review-git-leantime
npm install
npm run build
node build/index.js

Inspect it with the official tool:

npm run inspect

Environment variables

| Var | Required | Description | |-|-|-| | GITHUB_TOKEN | yes | GitHub personal access token. | | LEANTIME_BASE_URL | no | e.g. https://leantime.example.com. Omit to disable ticket lookups. | | LEANTIME_API_KEY | no | Leantime API key. | | LEANTIME_GET_TICKET_METHOD | no | Override the JSON-RPC method. Default: leantime.rpc.tickets.tickets.getTicket. |

Copy .env.example to .env for local runs.

How the Leantime call is wired

The server POSTs to ${LEANTIME_BASE_URL}/api/jsonrpc with:

  • Header: x-api-key: ${LEANTIME_API_KEY}
  • Body:
    {
      "jsonrpc": "2.0",
      "method": "leantime.rpc.tickets.tickets.getTicket",
      "params": { "id": 12345 },
      "id": 1
    }
    

If your Leantime version exposes a different RPC path, override it via LEANTIME_GET_TICKET_METHOD — no code change needed.


Claude Desktop setup

Edit your Claude Desktop config:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Add:

{
  "mcpServers": {
    "pr-review": {
      "command": "npx",
      "args": ["-y", "github:your-org/mcp-review-git-leantime"],
      "env": {
        "GITHUB_TOKEN": "ghp_xxxxxxxxxxxxxxxxxxxx",
        "LEANTIME_BASE_URL": "https://leantime.example.com",
        "LEANTIME_API_KEY": "your-leantime-api-key"
      }
    }
  }
}

Restart Claude Desktop. The pr-review server should appear in the tools menu.


Claude Code setup

Claude Code (the CLI) reads MCP servers from a project-local or user-global config.

Project-scoped — create .mcp.json at the repo root:

{
  "mcpServers": {
    "pr-review": {
      "command": "npx",
      "args": ["-y", "github:your-org/mcp-review-git-leantime"],
      "env": {
        "GITHUB_TOKEN": "ghp_xxxxxxxxxxxxxxxxxxxx",
        "LEANTIME_BASE_URL": "https://leantime.example.com",
        "LEANTIME_API_KEY": "your-leantime-api-key"
      }
    }
  }
}

User-scoped via CLI (same config shape, stored globally):

claude mcp add pr-review \
  --env GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxx \
  --env LEANTIME_BASE_URL=https://leantime.example.com \
  --env LEANTIME_API_KEY=your-leantime-api-key \
  -- npx -y github:your-org/mcp-review-git-leantime

Verify:

claude mcp list

Cursor setup

Cursor reads MCP servers from ~/.cursor/mcp.json (global) or .cursor/mcp.json (project-local):

{
  "mcpServers": {
    "pr-review": {
      "command": "npx",
      "args": ["-y", "github:your-org/mcp-review-git-leantime"],
      "env": {
        "GITHUB_TOKEN": "ghp_xxxxxxxxxxxxxxxxxxxx",
        "LEANTIME_BASE_URL": "https://leantime.example.com",
        "LEANTIME_API_KEY": "your-leantime-api-key"
      }
    }
  }
}

Then open Cursor → Settings → MCP and toggle pr-review on. Agent mode will see get_pr_context, get_ticket_context, and review_pr.


Usage from a chat

Inside Claude / Cursor, just ask:

Review https://github.com/your-org/your-repo/pull/42 against Leantime ticket 12345.

The model will call review_pr with prUrl and ticketId, receive the merged JSON, and produce the review.


Tool schemas

get_pr_context

{ prUrl: string }

Returns: { source, owner, repo, number, title, description, files[], commits[], reviews[], issueComments[], reviewComments[], ... }

get_ticket_context

{ ticketId: string }

Returns: { configured: boolean, ticket: { title, description, descriptionPlain, acceptanceCriteria, status, priority, assignee, ... } | null }

review_pr

{ prUrl: string, ticketId?: string, extraContext?: string }

Returns: { schemaVersion, request, pr, ticket, ticketError, reviewInstructions }


Troubleshooting

  • HTTP 401 from GitHubGITHUB_TOKEN is missing/expired, or lacks repo scope for a private repo.
  • HTTP 404 from GitHub — check the PR URL; for a private repo the token must have access.
  • HTTP 403 with rate limit — you are unauthenticated. Set GITHUB_TOKEN.
  • Leantime JSON-RPC error -32601 (Method not found) — your Leantime version uses a different path. Override LEANTIME_GET_TICKET_METHOD.
  • Leantime returns empty ticket — ticket id may not belong to a project your API key can read; check permissions in Leantime.
  • Ticket section always nullLEANTIME_BASE_URL or LEANTIME_API_KEY not set. Ticket lookups fail gracefully by design.
  • Cursor/Claude can't find the server — confirm npx is on PATH of the app's launch environment. On macOS, GUI apps often need an absolute Node path; in that case run which node and use that as "command" with ["/absolute/path/to/build/index.js"] as args, after npm run build.

All server logs go to stderr so they don't interfere with the MCP stdio channel.


License

MIT

快速设置
此服务器的安装指南

安装包 (如果需要)

npx @modelcontextprotocol/server-mcp-review-git-leantime

Cursor 配置 (mcp.json)

{ "mcpServers": { "benben2109-mcp-review-git-leantime": { "command": "npx", "args": [ "benben2109-mcp-review-git-leantime" ] } } }