git-issuer-mcp

git-issuer-mcp

Enables AI agents to create GitHub issues on explicitly allow-listed repositories using GitHub App authentication, with input validation, rate limiting, and no token exposure.

Category
访问服务器

README

git-issuer-mcp

An MCP (Model Context Protocol) server that enables AI agents to create GitHub issues on explicitly allow-listed repositories. It uses GitHub App authentication so the agent never touches tokens directly, and enforces input validation, rate limiting, and repository-level access control.

How It Works

AI Agent  →  MCP Server (stdio)  →  GitHub App Auth  →  GitHub REST API  →  Repository

The server exposes a single create_issue tool over MCP's stdio transport. When an agent calls it, the request flows through:

  1. Input validation — Zod-based schema checks, HTML/script sanitization, base64 payload rejection
  2. Rate limiting — Sliding-window limiter (default 10 requests/minute)
  3. Repository allowlist — Only repos listed in ALLOWED_REPOS are accepted
  4. GitHub App authentication — JWT generated from private key, exchanged for a short-lived installation token (cached for 55 minutes)
  5. Issue creation — Octokit REST client creates the issue and returns the number and URL

All errors are returned as structured JSON with a code and message. Tokens and private keys are never logged or exposed.

Prerequisites

1. Node.js

Node.js 18+ is required (ES2022 target).

node --version   # v18.x or higher

2. GitHub App

You need a GitHub App installed on your target organization or account. The app grants the server permission to create issues without sharing personal access tokens with the agent.

Create the app:

  1. Go to GitHub Settings > Developer settings > GitHub Apps > New GitHub App
  2. Set the following permissions:
    • Repository permissions > Issues: Read & Write
  3. Under "Where can this GitHub App be installed?", choose Only on this account (recommended for internal use)
  4. Create the app and note the App ID from the app settings page
  5. Generate a private key (.pem file) — download and store it securely
  6. Install the app on the repositories you want the agent to access
  7. After installation, note the Installation ID (visible in the URL: https://github.com/settings/installations/<INSTALLATION_ID>)

3. Environment Variables

Variable Required Description
GITHUB_APP_ID Yes App ID from your GitHub App settings page
GITHUB_INSTALLATION_ID Yes Installation ID from the app installation URL
GITHUB_PRIVATE_KEY Yes Path to the .pem file or the key as a base64-encoded string
ALLOWED_REPOS Yes Comma-separated list of owner/repo entries the agent may target
RATE_LIMIT_PER_MINUTE No Max issue creations per minute (default: 10)

See .env.example for a documented template.

Installation

git clone <repo-url> git-issuer-mcp
cd git-issuer-mcp
npm install
npm run build

The compiled output lands in dist/.

Running Tests

Tests use Jest with ts-jest and do not require GitHub credentials — all external calls are mocked.

npm test

This runs the full suite covering:

  • validation.test.ts — Repo format, title/body limits, label constraints, HTML sanitization, base64 detection
  • auth.test.ts — Env validation, .pem file loading, base64 key loading, token caching and refresh
  • issues.test.ts — Allowlist enforcement, successful creation, GitHub API error handling
  • rateLimiter.test.ts — Default/custom limits, per-agent tracking, sliding-window expiry
  • tools.test.ts — End-to-end tool handler flow, error code formatting

To type-check without running tests:

npm run typecheck

Setting Up in Claude Code

Add the server to your Claude Code MCP configuration at ~/.claude.json:

{
  "mcpServers": {
    "git-issuer": {
      "command": "node",
      "args": ["/absolute/path/to/git-issuer-mcp/dist/server.js"],
      "env": {
        "GITHUB_APP_ID": "123456",
        "GITHUB_INSTALLATION_ID": "78901234",
        "GITHUB_PRIVATE_KEY": "/absolute/path/to/private-key.pem",
        "ALLOWED_REPOS": "your-org/repo-a,your-org/repo-b",
        "RATE_LIMIT_PER_MINUTE": "10"
      }
    }
  }
}

Claude Code injects the environment variables into the server process at launch. The agent never sees or controls these values.

After saving the config, restart Claude Code. The create_issue tool will appear in the agent's available tools.

Setting Up in Cursor

Add the server to your Cursor MCP configuration. Open Settings > MCP (or edit .cursor/mcp.json in your project root) and add:

{
  "mcpServers": {
    "git-issuer": {
      "command": "node",
      "args": ["/absolute/path/to/git-issuer-mcp/dist/server.js"],
      "env": {
        "GITHUB_APP_ID": "123456",
        "GITHUB_INSTALLATION_ID": "78901234",
        "GITHUB_PRIVATE_KEY": "/absolute/path/to/private-key.pem",
        "ALLOWED_REPOS": "your-org/repo-a,your-org/repo-b",
        "RATE_LIMIT_PER_MINUTE": "10"
      }
    }
  }
}

Restart Cursor after saving. The server will start automatically when the agent invokes the create_issue tool.

MCP Tool Reference

create_issue

Create a GitHub issue on an allowed repository.

Input:

Field Type Required Constraints
repo string Yes owner/repo format
title string Yes 1–200 characters
body string Yes Max 10,000 characters
labels string[] No Max 10 labels, each 1–50 characters

Success response:

{
  "success": true,
  "issue_number": 42,
  "issue_url": "https://github.com/your-org/repo/issues/42"
}

Error response:

{
  "success": false,
  "error": {
    "code": "REPO_NOT_ALLOWED",
    "message": "Repository your-org/other-repo is not on the allowlist"
  }
}

Error codes:

Code Meaning
VALIDATION_ERROR Input failed schema validation or sanitization
REPO_NOT_ALLOWED Repository is not in ALLOWED_REPOS
RATE_LIMITED Too many requests within the rate-limit window
GITHUB_API_ERROR GitHub API returned an error
UNAUTHORIZED GitHub App authentication failed

Security Model

  • Repository allowlist — The agent can only target repos explicitly listed in ALLOWED_REPOS. Everything else is rejected.
  • No token exposure — Tokens are generated server-side, cached in memory, and never logged or returned to the agent.
  • Input sanitization<script> blocks, HTML event attributes, and base64 payloads are stripped or rejected before reaching GitHub.
  • Rate limiting — A configurable sliding-window limiter prevents runaway issue creation.
  • Environment-only config — All secrets are injected via environment variables by the MCP host. The agent cannot modify them at runtime.

Project Structure

src/
├── server.ts                 # Entry point — registers tools, starts stdio transport
├── mcp/
│   └── tools.ts              # Tool schema and handler (validation → rate limit → create)
├── github/
│   ├── auth.ts               # GitHub App JWT + installation token with caching
│   └── issues.ts             # Issue creation, allowlist enforcement, structured logging
├── security/
│   ├── validation.ts         # Zod schema, HTML sanitization, base64 detection
│   └── rateLimiter.ts        # Sliding-window per-agent rate limiter
└── __tests__/
    ├── auth.test.ts
    ├── issues.test.ts
    ├── rateLimiter.test.ts
    ├── tools.test.ts
    └── validation.test.ts

Development

npm install          # Install dependencies
npm run build        # Compile TypeScript to dist/
npm run typecheck    # Type-check without emitting
npm test             # Run test suite
npm start            # Start the server (requires env vars)

License

Internal use only.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选