
repopeek-mcp
io.github.kitepon/repopeek-mcp
Read-only GitHub MCP server (5 tools) over bare git — plain-text output, deny-by-default.
Documentation
This image represents clear, read-only observation from outside the vault — seeing every line without ever opening a write lock.
RepoPeek (repopeek-mcp)
English · 日本語
RepoPatch (Write Sibling) · Tools · Architecture · Security · Contributing · Releases · MIT License
Least-privilege read-only GitHub MCP server (5 tools) over bare git — plain-text output, deny-by-default.
Built and maintained by Quo at kitepon.dev.
Part of the kitepon GitHub MCP pair: RepoPeek (read-only, 5 tools — this repo) + RepoPatch (write-scoped diff commits & draft PRs, 5 tools). Split read and write into two small, auditable servers so AI agents get read access everywhere and write access only when editing.
Why RepoPeek?
- Blast-radius isolation: Most AI sessions only need to read code. RepoPeek has zero write tools, reads only from bare
gitobjects (never a working tree, never a shell), and denies every repository unless explicitly listed inALLOWED_REPOS. - Plain-text connector reliability: Every tool result — errors included — is plain
type: "text"content. Web connectors such as Gemini's custom MCP connector (which drop file bodies returned as MCPresourceblocks) receive complete file contents reliably.
Official GitHub MCP vs. RepoPeek + RepoPatch
| Capability | Official GitHub MCP | RepoPeek + RepoPatch |
|---|---|---|
| Tool surface | ~50+ tools in one server | 5 read (RepoPeek) + 5 write (RepoPatch) |
| Read / write token split | Shared token | Strictly separated (read-only PAT vs. write-scoped PAT) |
| Large-file edits | Full-file push_files / create_or_update_file (truncates on LLM output limits) | Server-side diff patching (old_text -> new_text, atomic 1-commit push) |
| Default-branch & force-push safety | Relies on prompt discipline / repo rules | Hard-refused in server (main/master/default_branch, force: false, secret-path blocks) |
| Plain-text web connectors (Gemini, etc.) | Mixed resource / JSON blocks | 100% plain type: "text" results |
How the pair fits together
flowchart LR
Client["AI Client (Gemini, Claude, Cursor, Codex)"]
Peek["RepoPeek (5 read tools)<br/>bare git · plain text"]
Patch["RepoPatch (5 write tools)<br/>branch · atomic diff · draft PR"]
GH["GitHub (repos / Git Data API)"]
Client -- "list / read / grep" --> Peek
Peek -- "read-only PAT or public clone" --> GH
Client -- "create_branch / patch_files / PR" --> Patch
Patch -- "write-scoped PAT (non-default only)" --> GH
Tools (5 read-only)
| Tool | Purpose |
|---|---|
list_repos | List repositories allowed by ALLOWED_REPOS with their default branch |
list_files | Recursively list files and directories (secret files and vendor dirs omitted) |
read_file | Read a file with line numbers and start_line / end_line pagination |
read_files | Read multiple files in one call with a total character cap |
grep | Search file contents (git grep, fixed string or extended regex, optional glob) |
Example tool call (grep -> read_file)
{
"name": "grep",
"arguments": {
"repo": "octocat/Hello-World",
"query": "Hello",
"glob": "*.md"
}
}
README:1: Hello World!
Full specs: tool contract · architecture & data flow · deploy guide.
Quick start (Docker Compose)
git clone https://github.com/kitepon/repopeek-mcp.git && cd repopeek-mcp
TOKEN=$(openssl rand -base64 32) # Bearer token; save in your password manager
cat > docker-compose.override.yml <<EOF
services:
repopeek-mcp:
environment:
- ALLOWED_REPOS=octocat/Hello-World
- REPOPEEK_TOKEN_SHA256=$(printf %s "$TOKEN" | sha256sum | cut -d' ' -f1)
- REPOPEEK_STORE_KEY=$(openssl rand -base64 32)
EOF
docker compose up -d --build
curl -s http://127.0.0.1:39230/health # {"status":"ok","service":"repopeek-mcp"}
The server listens on 127.0.0.1:39230 and refuses to start without REPOPEEK_TOKEN_SHA256. Only the token's SHA-256 goes into config; clients send Authorization: Bearer $TOKEN. See docker-compose.override.yml.example for all options.
Without Docker (Node.js 20+ and git)
npm ci && npm run build
export REPOPEEK_TOKEN_SHA256=$(printf %s "$TOKEN" | sha256sum | cut -d' ' -f1)
export REPOPEEK_STORE_KEY=$(openssl rand -base64 32) ALLOWED_REPOS=octocat/Hello-World
npm start # http://0.0.0.0:39230/mcp
Connect an MCP client
Static Bearer header (Cursor, Claude Code, Codex, generic Streamable HTTP clients)
{
"mcpServers": {
"repopeek": {
"url": "https://repopeek.example.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_MCP_TOKEN"
}
}
}
}
Web connectors with OAuth 2.1 (Gemini, etc.)
- Deploy RepoPeek behind HTTPS and set
REPOPEEK_PUBLIC_URL=https://<your-host>. - Add a custom MCP connector with URL
https://<your-host>/mcp. - The client registers via DCR + PKCE S256 and opens
/authorize(protected by Cloudflare Access when configured, or by the Bearer token form). - Test with:
"call list_repos", thenlist_files,read_file, andgrep.
Configuration
| Variable | Default | Meaning |
|---|---|---|
REPOPEEK_TOKEN_SHA256 | required | SHA-256 hex of the shared Bearer token (exits without it) |
ALLOWED_REPOS | empty (refuse all) | Comma-separated owner/name or owner/* (case-insensitive) |
REPOPEEK_PUBLIC_URL | http://localhost:<PORT> | Public origin advertised in OAuth metadata |
PORT | 39230 | HTTP port |
REPOPEEK_DATA_DIR | ./data (/data in Docker) | OAuth store, wrapped store key, clones and mirrors |
REPOPEEK_STORE_KEY | unset | Base64 of 32 bytes; encrypts the OAuth store when no auth module is used |
GITHUB_TOKEN | unset | Read-only fine-grained PAT (Contents: read) for private repos; unset = public only |
REPOPEEK_LOCAL_REPOS | empty | Comma-separated owner/name=/path (local bare repo or checkout, never fetched) |
REPOPEEK_FETCH_INTERVAL_SEC | 300 | Fetch / mirror sync interval (0 disables) |
REPOPEEK_SECRET_PATTERNS | empty | Extra comma-separated secret-file globs (*, ?) |
REPOPEEK_ACCESS_TEAM_DOMAIN | unset | Cloudflare Access team domain (set together with REPOPEEK_ACCESS_AUD) |
REPOPEEK_ACCESS_AUD | unset | Cloudflare Access application AUD |
REPOPEEK_ACCESS_EMAILS | empty | Optional comma-separated e-mail allow-list |
REPOPEEK_AUTH_SOCKET | unset | Auth-module caller socket (module mode + wrapped store key) |
REPOPEEK_WRAP_KEY_NAME | unset | Auth-module wrap key name |
REPOPEEK_MODULE_ITEMS | empty | Comma-separated owner=item for auth-module mode |
REPOPEEK_LIST_MAX_ENTRIES | 500 | list_files entry cap |
REPOPEEK_READ_MAX_CHARS | 40000 | read_file output cap |
REPOPEEK_READ_FILES_MAX_CHARS | 80000 | read_files default total cap |
REPOPEEK_READ_FILES_MAX_CHARS_LIMIT | 400000 | Hard max for max_total_chars |
REPOPEEK_GREP_MAX_RESULTS | 50 | grep default hit cap |
REPOPEEK_GREP_MAX_RESULTS_LIMIT | 500 | Hard max for max_results |
REPOPEEK_GREP_LINE_MAX_CHARS | 300 | grep line trim |
Source modes
- Public clone (
githubmode, default):git clone --bareover HTTPS intoREPOPEEK_DATA_DIR/reposon first use, refreshed everyREPOPEEK_FETCH_INTERVAL_SEC. - Private repositories (standalone): set
GITHUB_TOKENto a read-only fine-grained PAT (Contents: read). Passed viaGIT_CONFIG_*env only — never in argv, remote URL, or tool output. - Local repositories:
REPOPEEK_LOCAL_REPOS=owner/name=/pathserves a local repo without fetching. - Auth module (optional): zero-PAT container mode over a Unix socket (
REPOPEEK_AUTH_SOCKET); see docs/architecture.md.
Security model
- Read-only: zero write tools.
- Allowlist: empty
ALLOWED_REPOSrefuses all repositories. - Secret-file hiding:
.env,.env.*,*.pem,*.key,*secret*,id_rsa*,id_ed25519*,*.p12,*.pfx,credentials.json, plusREPOPEEK_SECRET_PATTERNSare omitted fromlist_files/grepand refused byread_file/read_files. - Input validation: refs starting with
-or containing:,..segments, absolute paths, and pathspec magic are refused. - Authentication:
/mcprequiresAuthorization: Bearer(only SHA-256 stored); OAuth 2.1 tokens are stored in AES-256-GCM;/authorizesupports Cloudflare Access JWT (fail closed).
See SECURITY.md to report vulnerabilities.
Development
npm ci
npm run lint
npm run typecheck
npm run build
npm test
See CONTRIBUTING.md before opening a pull request.
Directory listings
License
MIT — built by kitepon.dev.
ghcr.io/kitepon/repopeek-mcp:0.1.0docker pull ghcr.io/kitepon/repopeek-mcp:0.1.0:undefined