mcpField
L
Lean Github Mcp

Lean Github Mcp

Local
npmjs.comVersion Control0Updated 28w ago

About Lean Github Mcp

Lean Github Mcp is an MCP server that lets Claude manage GitHub repositories, issues, pull requests, releases, and Actions through 19 tools. It trims and caches responses to reduce the data sent into Claude’s context.

Key features

  1. 0119 GitHub management tools
  2. 02Create and manage issues and PRs
  3. 03Read diffs, files, and commits
  4. 04Manage branches and releases
  5. 05List and trigger GitHub Actions
  6. 06Trim and cache API responses

Use cases

  1. 01Triage issues and assign maintainers
  2. 02Review and merge pull requests
  3. 03Create branches and publish releases
  4. 04Trigger repository workflows

MCP support

The server connects Claude to the GitHub API over MCP using stdio. It exposes tools for repository, issue, pull request, branch, file, release, and workflow operations.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

Lean GitHub MCP

Control GitHub entirely through Claude — in plain English.

Create PRs, manage issues, trigger workflows, cut releases, review diffs — without touching a browser.

GitHub MCP Server demo

26x smaller responses than the official GitHub MCP — your Claude context window goes further.

npm CI MCP Compatible TypeScript License: MIT Tests Tools


What is this?

This is a Model Context Protocol (MCP) server that connects Claude directly to the GitHub API. Once installed, you can manage your entire GitHub workflow through natural conversation — no GUI, no copy-pasting URLs, no context switching.

You type this in Claude:

Merge PR #47 with squash, delete the branch, then create a release v2.1.0 with those changes

Claude does all of it. Three API calls. Done.


Why this instead of the official GitHub MCP?

This ServerOfficial GitHub MCP
Setupnpm install + tokenDocker required
Response size~320 avg tokens2000+ tokens (raw API)
Token efficiencyNull stripping, compactifyRaw JSON passthrough
Caching120s in-memory cacheNo cache
Tools19 tools~30 tools
Default branchAuto-detectedHard-coded main
Error messagesStatus codes includedGeneric messages
LicenseMIT — use anywhereMIT

Bottom line: This server was built to be lean. Every response is stripped of nulls, truncated intelligently, and cached where it makes sense. Your Claude context window is treated as a precious resource.


60-Second Setup

Option 1 — Run with npx (no install needed):

GITHUB_TOKEN=ghp_your_token npx @noushad999/lean-github-mcp

Option 2 — Install globally from npm:

npm install -g @noushad999/lean-github-mcp
lean-github-mcp

Option 3 — Docker (coming soon):

docker run -e GITHUB_TOKEN=ghp_your_token ghcr.io/noushad999/lean-github-mcp

Option 4 — Clone from source:

git clone https://github.com/noushad999/lean-github-mcp.git
cd lean-github-mcp
npm install && npm run build
echo "GITHUB_TOKEN=ghp_your_token" > .env

Claude Desktop — edit %APPDATA%\Claude\claude_desktop_config.json (Windows) or ~/Library/Application Support/Claude/claude_desktop_config.json (Mac):

Using npx (easiest — no install needed):

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@noushad999/lean-github-mcp"],
      "env": {
        "GITHUB_TOKEN": "ghp_your_token_here"
      }
    }
  }
}

Using local build:

{
  "mcpServers": {
    "github": {
      "command": "node",
      "args": ["C:/absolute/path/to/lean-github-mcp/dist/index.js"],
      "env": {
        "GITHUB_TOKEN": "ghp_your_token_here"
      }
    }
  }
}

Claude Code (CLI):

claude mcp add github -- node /absolute/path/to/lean-github-mcp/dist/index.js

Restart Claude. You're done.


Token Permissions Required

Go to github.com/settings/tokens?type=beta → Fine-grained token:

PermissionLevelUsed by
ContentsRead & Writeget_file, create_branch, delete_branch
IssuesRead & Writelist_issues, create_issue, assign_issue, add_comment
Pull requestsRead & Writelist_prs, create_pr, merge_pr, get_pr_diff
ActionsRead & Writelist_workflows, trigger_workflow
MetadataReadlist_repos, get_repo

Available Tools

Repositories
list_repos

List repositories for any user or organization.

"Show me all of vercel's public repos sorted by recent activity"
ParamTypeRequiredDefault
ownerstringyes—
typeowner | membernoowner

get_repo

Get detailed stats for a specific repository.

"Tell me about facebook/react — stars, forks, language, open issues"
ParamTypeRequired
ownerstringyes
repostringyes

Issues
list_issues

List issues with labels and assignees.

"Show all open bugs in my repo"
ParamTypeRequiredDefault
ownerstringyes—
repostringyes—
stateopen | closed | allnoopen

create_issue

Create a new issue with labels.

"Create an issue titled 'Login crashes on Safari' with labels bug and priority"
ParamTypeRequired
ownerstringyes
repostringyes
titlestringyes
bodystringno
labelsstring[]no

assign_issue

Add or remove assignees on an issue or PR.

"Assign issue #42 to alice and bob"
ParamTypeRequiredDefault
ownerstringyes—
repostringyes—
issue_numbernumberyes—
assigneesstring[]yes—
actionadd | removenoadd

Pull Requests
list_prs

List pull requests by state.

"What PRs are currently open in vercel/next.js?"
ParamTypeRequiredDefault
ownerstringyes—
repostringyes—
stateopen | closed | allnoopen

create_pr

Create a pull request. Automatically detects the repo's default branch if base is omitted.

"Create a PR from feat/dark-mode to main titled 'Add dark mode support'"
ParamTypeRequiredDefault
ownerstringyes—
repostringyes—
titlestringyes—
bodystringno—
headstringyes—
basestringnorepo default

get_pr_diff

Get the unified diff of a pull request — up to 200 lines.

"Show me the diff for PR #88"
ParamTypeRequired
ownerstringyes
repostringyes
pull_numbernumberyes

merge_pr

Merge with your chosen strategy.

"Squash-merge PR #47 with title 'feat: dark mode'"
ParamTypeRequiredDefault
ownerstringyes—
repostringyes—
pull_numbernumberyes—
methodmerge | squash | rebasenomerge
commit_titlestringno—

Branches
create_branch

Create a branch from any base. Auto-detects default branch.

"Create branch fix/header-overflow from main"
ParamTypeRequiredDefault
ownerstringyes—
repostringyes—
branchstringyes—
basestringnorepo default

delete_branch

Delete a branch — typically after merging.

"Delete the feat/dark-mode branch, it's been merged"
ParamTypeRequired
ownerstringyes
repostringyes
branchstringyes

Commits & Files
list_commits

View recent commit history with authors and timestamps.

"Show the last 5 commits on the main branch"
ParamTypeRequiredDefault
ownerstringyes—
repostringyes—
branchstringnorepo default
per_page1–10no10

get_file

Read file content from any branch. Files over 100 lines are truncated.

"Show me the contents of src/auth.ts on the dev branch"
ParamTypeRequiredDefault
ownerstringyes—
repostringyes—
pathstringyes—
branchstringnorepo default

search_code

Search code across GitHub.

"Find all TypeScript files using useAuth hook"
ParamTypeRequiredDefault
querystringyes—
per_page1–10no10

GitHub's code search API requires authentication and has a rate limit of ~10 requests/minute. Results are cached for 120s.


Comments
add_comment

Comment on any issue or pull request.

"Add a comment to PR #55 saying the deployment is ready for testing"
ParamTypeRequired
ownerstringyes
repostringyes
issue_numbernumberyes
bodystringyes

Releases
get_release

Get the latest release or look up a specific tag.

"What's the latest release of vercel/next.js?"
ParamTypeRequiredDefault
ownerstringyes—
repostringyes—
tagstringnolatest

create_release

Publish a new release with release notes.

"Create release v2.1.0 on the main branch with the changelog I'll paste"
ParamTypeRequiredDefault
ownerstringyes—
repostringyes—
tag_namestringyes—
namestringnotag name
bodystringno—
draftbooleannofalse
prereleasebooleannofalse
target_commitishstringnorepo default

GitHub Actions
list_workflows

List all workflows in a repository.

"What GitHub Actions workflows does this repo have?"
ParamTypeRequired
ownerstringyes
repostringyes

trigger_workflow

Trigger a workflow dispatch event with optional inputs.

"Trigger the deploy.yml workflow on the staging branch"
ParamTypeRequiredDefault
ownerstringyes—
repostringyes—
workflow_idstring | numberyes—
refstringnorepo default
inputsobjectno{}

How It Works

You (natural language)
        │
        ▼
   Claude AI
        │  MCP Protocol (stdio)
        ▼
┌──────────────────────────────────┐
│        lean-github-mcp           │
│                                  │
│  ┌─────────────────────────┐     │
│  │   19 Tool Handlers      │     │
│  └────────┬────────────────┘     │
│           │                      │
│  ┌────────▼─────┐  ┌──────────┐  │
│  │  Token Guard │  │  Cache   │  │
│  │  4000 char   │  │  120s    │  │
│  │  null strip  │  │  200 max │  │
│  └────────┬─────┘  └────┬─────┘  │
│           └──────┬───────┘        │
│                  ▼                │
│      ┌──────────────────┐         │
│      │  GitHub Client   │         │
│      │  Axios + Auth    │         │
│      │  Status codes    │         │
│      └──────────────────┘         │
└──────────────┬───────────────────┘
               │ HTTPS
               ▼
        api.github.com
Token Efficiency — Why It Matters

Every response the MCP server sends consumes your Claude context window. Bloated responses mean Claude forgets earlier parts of your conversation faster. This server aggressively minimizes response size:

Raw GitHub API response for a single repository:

{
  "id": 1296269,
  "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
  "name": "Hello-World",
  "full_name": "octocat/Hello-World",
  "private": false,
  "owner": {
    "login": "octocat",
    "id": 1,
    "node_id": "MDQ6VXNlcjE=",
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "",
    "url": "https://api.github.com/users/octocat",
    "html_url": "https://github.com/octocat",
    "followers_url": "...",
    ... 20 more owner fields
  },
  "html_url": "https://github.com/octocat/Hello-World",
  "description": "This your first repo!",
  ... 80+ more fields, mostly null
}

~2,400 tokens

This server's response:

{
  "name": "Hello-World",
  "full_name": "octocat/Hello-World",
  "description": "This your first repo!",
  "stars": 2045,
  "forks": 1731,
  "language": "JavaScript",
  "open_issues": 12,
  "updated_at": "2024-01-15T10:30:00Z",
  "html_url": "https://github.com/octocat/Hello-World"
}

~90 tokens — 26x smaller


Real-World Example Conversations

Full PR workflow:

You: Show me open PRs in my-org/my-repo

Claude: Found 3 open PRs:
  #88 — "Add OAuth2 support" by sarah_dev
  #91 — "Fix memory leak in worker" by john_k
  #94 — "Upgrade to Node 22" by bot

You: Show me the diff for #91

Claude: [shows unified diff of the memory leak fix]

You: Looks good. Merge it with squash, then delete the branch

Claude: Done — squash merged PR #91 (sha: a3f9c21), deleted branch fix/memory-leak

You: Now create a release v3.2.1 from main with changelog: "Fixed memory leak in background workers"

Claude: Release v3.2.1 published — https://github.com/my-org/my-repo/releases/tag/v3.2.1

Four separate GitHub operations. One conversation.


Automated triage:

You: List open issues in my-org/api-server, assign the ones labeled "bug" to me

Claude: Found 4 open issues. 2 have the "bug" label (#34, #41).
  Assigned #34 and #41 to you.

Testing

npm run build
npx tsx tests/simulate-10-users.ts

Expected output:

╔══════════════════════════════════════════════════════════╗
║     GitHub MCP Server - 10 User Deployment Test        ║
║          19 Tools · Full Coverage Simulation           ║
╚══════════════════════════════════════════════════════════╝
...
║  Total Tests:        49                  ║
║  Passed:             49                  ║
║  Failed:             0                   ║
║  Pass Rate:          100.0          %    ║
║  Null Fields Found:  0                   ║
║  Avg Response:       319            tokens ║
╚══════════════════════════════════════════╝
🎉 ALL TESTS PASSED! Ready for production.

You can also inspect live with the MCP Inspector:

npx @modelcontextprotocol/inspector node dist/index.js

Project Structure

lean-github-mcp/
├── src/
│   ├── index.ts                  # MCP server entry, tool registration
│   ├── github-client.ts          # Axios client + getDefaultBranch helper
│   ├── middleware/
│   │   └── tokenGuard.ts         # Response trimmer: null strip, compactify, 4000 char limit
│   ├── utils/
│   │   └── cache.ts              # 120s TTL in-memory cache, max 200 entries
│   └── tools/                    # 19 tool handlers (one file each)
│       ├── list_repos.ts
│       ├── get_repo.ts
│       ├── list_issues.ts
│       ├── create_issue.ts
│       ├── assign_issue.ts
│       ├── list_prs.ts
│       ├── create_pr.ts
│       ├── get_pr_diff.ts
│       ├── merge_pr.ts
│       ├── create_branch.ts
│       ├── delete_branch.ts
│       ├── list_commits.ts
│       ├── get_file.ts
│       ├── search_code.ts
│       ├── add_comment.ts
│       ├── get_release.ts
│       ├── create_release.ts
│       ├── list_workflows.ts
│       └── trigger_workflow.ts
├── tests/
│   └── simulate-10-users.ts      # Full simulation test, 49 assertions
├── dist/                         # Compiled JS (after npm run build)
├── package.json
├── tsconfig.json
└── .env.example

Troubleshooting

GITHUB_TOKEN not set

cat .env    # make sure GITHUB_TOKEN=ghp_... is there

GitHub API (403): Rate limited or insufficient permissions

  • Fine-grained tokens need explicit repository access — check the permissions table above
  • Code search has a stricter limit (~10 req/min) — wait 60s and retry

GitHub API (404): Resource not found

  • Double-check the owner and repo spelling
  • Private repos need your token to have access to them

GitHub API (422): Unprocessable

  • Usually means a PR already exists for that branch, or a branch name is invalid

Command not found: node in Claude Desktop

  • Use the full path: C:\Program Files\nodejs\node.exe (Windows) or run which node on Mac/Linux

Contributing

Contributions are welcome — see CONTRIBUTING.md for a step-by-step guide to adding new tools, code conventions, and the PR checklist.


Roadmap

  • list_workflow_runs — view CI status for a branch
  • get_commit — detailed single commit with files changed
  • compare_branches — diff between two branches
  • update_file — commit a file change directly
  • add_label / remove_label — label management

Open an issue if you want something added.


License

MIT — do whatever you want with it.


Built for developers who'd rather talk to Claude than click through GitHub.

Report a bug · Request a feature

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.