github-rag-mcp
Enables AI agents to search and retrieve context from GitHub issues, pull requests, releases, and documentation using hybrid semantic search and time-ordered activity scans.
README
github-rag-mcp
Language: English | Japanese
GitHub issue, pull request, release, and documentation search for MCP clients on Cloudflare Workers.
github-rag-mcp is designed as a shared working memory over GitHub. It does not try to remember every conversation. Instead, it helps agents recover the current project state from durable artifacts that humans can also inspect: issues, pull requests, docs, and releases.
It is the search-oriented counterpart to github-webhook-mcp. Together they provide both:
- push-based awareness of what just happened
- hybrid retrieval (dense + sparse) of the state that matters for the next step
Memory Model
The project treats GitHub as a visible state store for AI work.
- Do not aim for complete memory.
- Do not add unnecessary material.
- Do not omit information required for the next correct action.
- Preserve state in human-readable, reviewable artifacts.
- Recover context by search instead of replaying full chat history.
For a fuller explanation, see:
Architecture
GitHub webhooks + GitHub API
|
v
Cloudflare Worker
+ MCP HTTP surface
+ webhook receiver
+ cron poller (fallback)
+ embedding pipeline
+ hybrid retrieval (dense + sparse + RRF fusion + cross-encoder rerank)
|
+--> Vectorize (dense semantic index)
+--> D1 FTS5 (BM25 sparse index)
+--> Durable Object / SQLite (structured state store)
+--> Workers AI BGE-M3 (embeddings)
+--> Workers AI bge-reranker-base (cross-encoder rerank)
- The MCP surface exposes hybrid retrieval and context tools to AI clients.
- The webhook receiver updates memory in near real time when GitHub changes.
- The cron poller repairs missed updates and supports backfill.
- Vectorize stores semantic embeddings for the dense side of retrieval.
- D1 FTS5 stores the BM25 sparse index for exact-term and identifier queries.
- The cross-encoder reranker re-scores fused candidates as the 3rd tier (toggleable per query).
- Durable Object keeps structured state for fast lookups and activity views.
Why GitHub
GitHub already contains the artifacts that matter for software work:
- issues for requirements and open decisions
- pull requests for implementation history and review state
- documentation for stabilized understanding
- releases for shipped checkpoints
Using those artifacts as memory makes handoff and auditing easier than keeping state inside a private chat transcript.
Installation
See:
Requirements
See:
MCP Tools
This MCP server exposes a single consolidated tool. All retrieval modes — semantic search, time-ordered activity scan, and inline doc content fetch — are reached through search via its parameter set. Earlier builds split these across get_issue_context, get_doc_content, and list_recent_activity; those tools have been removed and their use cases now fold into the parameters below.
search
Unified search across GitHub issues, pull requests, releases, repository documentation, GitHub Wiki pages, commit diffs, and comment / review surfaces (top-level comments on issues and PRs, PR review bodies, and PR inline review comments).
Three modes are selected by the combination of query and sort:
- Hybrid semantic search (default) — dense BGE-M3 over Vectorize + sparse BM25 over D1 FTS5, fused via Reciprocal Rank Fusion (RRF, k=60), then re-scored with the
@cf/baai/bge-reranker-basecross-encoder. Pass a natural-languagequery. - Time-ordered activity scan — omit or leave
queryempty and setsortto"updated_desc"or"created_desc". Optionally narrow withsince/untilto list recent activity across every type. This subsumes the previouslist_recent_activitytool. - Doc / wiki content fetch — set
include_content: true. For result rows whosetypeis"doc", the raw file content is fetched from the GitHub contents API; fortype: "wiki_doc"rows, the raw markup is fetched fromraw.githubusercontent.com/wiki/. Both are inlined as acontentfield. Capped at the first few rows of each type to bound API fan-out. This subsumes the previousget_doc_contenttool.
Structured filters (repo, state, labels, milestone, assignee, type) apply in every mode.
Bot-authored comments (sender.login ending in [bot]) and comments shorter than 10 characters (trimmed) are filtered out at ingest time so noise such as LGTM, +1, or CI chatter does not dilute the retrieval surface.
Parameters
| Name | Type | Description |
|---|---|---|
query |
string (optional) | Natural-language query. Omit or empty = scan mode. |
repo |
string | Filter by repository (owner/repo). |
state |
"open" | "closed" | "all" |
Filter by state (default all). |
labels |
string[] | Filter by label names (AND). |
milestone |
string | Filter by milestone title. |
assignee |
string | Filter by assignee login. |
type |
see below | Filter by type (default all). |
top_k |
number | Max results (default 10, max 50). |
fusion |
"rrf" | "dense_only" | "sparse_only" |
Fusion strategy (default rrf). Ignored in scan mode. |
rerank |
boolean | Cross-encoder rerank (default true). Ignored in scan mode. |
sort |
"relevance" | "updated_desc" | "created_desc" |
Result ordering. Default relevance with a query, updated_desc without. Time sorts override ranker score. |
since |
ISO 8601 string | Keep only results with updated_at >= since. |
until |
ISO 8601 string | Keep only results with updated_at < until. |
include_content |
boolean | Inline raw content on top doc results (default false). |
type values
| Value | Surface |
|---|---|
"issue" |
GitHub issues (title + body). |
"pull_request" |
Pull request descriptions (title + body). |
"release" |
Release notes (name + body). |
"doc" |
Markdown documentation files. |
"diff" |
Per-file commit diffs (commit message + file path + patch). |
"issue_comment" |
Top-level comments on issues and PRs. |
"pr_review" |
PR review bodies (APPROVED / CHANGES_REQUESTED / COMMENTED). |
"pr_review_comment" |
PR inline review comments (per-line diff comments). |
"all" |
Union of every type above (default). |
Examples
Semantic search for a specific topic:
{
"query": "rerank latency budget",
"repo": "Liplus-Project/github-rag-mcp",
"top_k": 5
}
Time-ordered activity scan across the last 24 hours:
{
"sort": "updated_desc",
"since": "2026-04-22T00:00:00Z",
"top_k": 20
}
Semantic search with inline doc content on the top doc hits:
{
"query": "memory philosophy",
"type": "doc",
"include_content": true,
"top_k": 3
}
Search past PR review judgments about a specific topic:
{
"query": "rerank threshold tuning",
"type": "pr_review",
"top_k": 5
}
Repository Structure
src/
index.ts
mcp.ts
oauth.ts
webhook.ts
pipeline.ts
github-ip.ts
poller.ts
store.ts
types.ts
docs/
0-requirements.md
0-requirements.ja.md
1-memory-philosophy.md
1-memory-philosophy.ja.md
installation.md
installation.ja.md
mcp-server/
wrangler.toml
Related
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。