main

Project rules for a TypeScript server that provides GitHub pull-request reviews through the Model Context Protocol (MCP). They describe the code layout and the required pattern for adding tools.

In plain words
What is it for?
They are for building and extending the server, including defining validated tool inputs, adding MCP tools, calling GitHub through the service layer, and maintaining the TypeScript project structure.
Why use it?
They keep GitHub API access, analysis, prompts, types, and the server entry point organised, while preventing direct edits to compiled output.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/jamesjfoong/github-pr-review-mcp/main
Clone the repo
git clone --depth 1 https://github.com/jamesjfoong/github-pr-review-mcp

Made for: Cursor.

Per session 1,667 This file is loaded in full into every session.
When invoked 1,667 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.01667 $0.01667
Opus 5 $0.00834 $0.00834
Sonnet 5 $0.00333 $0.00333
Haiku 4.5 $0.00167 $0.00167

Measured yesterday against content hash 3aac06893aca, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

main scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/main.mdc · 214 lines

How it starts

The opening of the file, as written. The whole thing — 214 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Cursor Rules for GitHub PR Review MCP

You are an AI assistant helping develop a GitHub PR Review MCP Server built with TypeScript, FastMCP, and GitHub API.

Project Overview

  • Type: Model Context Protocol (MCP) server
  • Language: TypeScript (ES2022, strict mode)
  • Framework: FastMCP
  • Purpose: Provides GitHub PR review capabilities to LLMs in VSCode/Cursor

Core Architecture

File Structure

  • src/index.ts - Main MCP server entry point (register tools here)
  • src/github-service.ts - GitHub API abstraction layer (all GitHub API calls go here)
  • src/code-analyzer.ts - Code analysis engine (static analysis logic)
  • src/review-prompt.ts - Review prompt generation
  • src/types.ts - Zod schemas and TypeScript types (all tool parameters defined here)
  • dist/ - Compiled output (NEVER edit directly)

Adding New MCP Tools (3-Step Process)

  1. Define Schema and Type in src/types.ts:

    // Define schema for runtime validation
    export const NewToolSchema = z.object({
      param1: z.string().describe("Parameter description"),
    });
    
    // Define explicit type (preferred over z.infer<typeof>)
    export interface NewToolParams {
      param1: string;
    }
    
  2. Add Service Method in src/github-service.ts:

    async newMethod(params: NewToolParams): Promise<ResultType> {
      // Use this.octokit for GitHub API calls
      // Handle errors with try-catch
      // Return typed result
    }
    
  3. Register Tool in src/index.ts:

    server.addTool({
      name: "new_tool_name",
      description: "Clear description",
      parameters: NewToolSchema,
      execute: async (params) => {
        const result = await githubService.newMethod(params);
        return {
          content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
        };
      },
    });
    

Code Standards

TypeScript

  • Strict mode: Always enabled (no implicit any, strict null checks)
  • Strong typing: Always use explicit, strong types. Avoid any types (warnings acceptable for external APIs only)
  • Use ? for optional: Don't use | null | undefined, use optional properties (?) instead
  • Zod schemas: All tool parameters MUST have Zod schemas for runtime validation
  • Type definitions: Prefer explicit interface or type definitions over z.infer<typeof Schema>
  • Modules: ES2022 modules (import/export)
  • Imports: Use .js extension for compiled output (TypeScript requirement)

Read the full file on GitHub · 214 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 214 lines · 1,667 tokens per session scan A 3aac06893aca

Subscribe to this mod's changes

main is a cursor rule published in the GitHub repository jamesjfoong/github-pr-review-mcp (1 stars, last pushed 6mo ago), licensed MIT. It adds 1,667 tokens to every session, about $0.0083 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.