You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Introduce optional Context Engine MCP support for repository-aware reviews. Adds new env/inputs (CONTEXT_ENGINE_API_KEY / context_engine_api_key, CONTEXT_ENGINE_MCP_URL / context_engine_mcp_url, CONTEXT_ENGINE_COLLECTION / context_engine_collection, CONTEXT_ENGINE_TOOLS / context_engine_tools, CONTEXT_ENGINE_MAX_TOOLS / context_engine_max_tools), documents usage and defaults in README, and exposes the flags in action.yml. Implements a new context_engine_mcp module and wires MCP tool exposure into review prompts (per-batch tool scoping), with graceful fallback to diff-only mode on failures. Includes tests for CLI, context engine integration and prompts, and updates built artifacts (dist) and related source files.
Copy file name to clipboardExpand all lines: README.md
+101Lines changed: 101 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,9 +80,110 @@ Common optional settings:
80
80
- `ALLOW_TITLE_UPDATE`: set to `true` to allow title rewriting when the PR title explicitly asks for it.
81
81
- `GITHUB_API_URL`: GitHub Enterprise API URL.
82
82
- `GITHUB_SERVER_URL`: GitHub Enterprise web URL.
83
+
- `CONTEXT_ENGINE_API_KEY` or `CTXCE_API_KEY`: optional Context Engine API key. When set, review prompts can call Context Engine MCP tools for repository context.
84
+
- `CONTEXT_ENGINE_MCP_URL` or `CTXCE_INDEXER_URL`: optional Context Engine MCP indexer URL. Defaults to `https://dev.context-engine.ai/indexer/mcp`.
85
+
- `CONTEXT_ENGINE_COLLECTION`: optional collection name to scope MCP searches.
86
+
- `CONTEXT_ENGINE_TOOLS`: optional comma-separated MCP tool allow-list. Defaults to `repo_search,batch_search,symbol_graph,batch_symbol_graph,graph_query,batch_graph_query,search_tests_for,search_config_for,search_commits_for`.
87
+
- `CONTEXT_ENGINE_MAX_TOOLS`: maximum MCP tools exposed to reviewer LLMs. Defaults to `9`.
83
88
84
89
The action input names mirror the environment variables where applicable, for example `custom_mode`, `llm_model`, `llm_provider`, `github_api_url`, and `github_server_url`.
85
90
91
+
### Optional Context Engine MCP access
92
+
93
+
By default, the reviewer works from PR diffs only. This is the free/default mode and does not make Context Engine network calls.
94
+
95
+
Customers who want repository-aware review can opt in by providing a Context Engine API key. When enabled, the reviewer exposes a small allow-list of explicit Context Engine MCP tools to the LLM during review inference. If MCP setup or tool discovery fails, the reviewer logs a warning and falls back to the normal diff-only path for that run.
96
+
97
+
The default SaaS MCP endpoint is:
98
+
99
+
```text
100
+
https://dev.context-engine.ai/indexer/mcp
101
+
```
102
+
103
+
The memory MCP endpoint is not used by this reviewer.
104
+
105
+
#### GitHub Action usage
106
+
107
+
You can enable Context Engine either with action inputs or environment variables. Supplying the API key is the opt-in switch; no separate boolean flag is required.
- `context_engine_max_tools`: maximum number of MCP tools exposed to the reviewer LLM. Defaults to `9`.
137
+
138
+
#### Default tool allow-list
139
+
140
+
The default allow-list intentionally exposes direct code/navigation tools only:
141
+
142
+
- `repo_search`
143
+
- `batch_search`
144
+
- `symbol_graph`
145
+
- `batch_symbol_graph`
146
+
- `graph_query`
147
+
- `batch_graph_query`
148
+
- `search_tests_for`
149
+
- `search_config_for`
150
+
- `search_commits_for`
151
+
152
+
The unified `search` router is excluded by default because it can be noisy for an autonomous reviewer. Memory tools are also excluded by default and the reviewer does not connect to the memory MCP endpoint. `search_commits_for` is included so the reviewer can inspect relevant commit history or historically co-changing files when that materially improves review quality.
Context Engine tools are available only during PR review prompts, not during the PR summary prompt. The reviewer still uses the normal PR diff batching strategy:
164
+
165
+
1. Split changed files into review batches using `REVIEW_MAX_REVIEW_CHARS`.
166
+
2. Invoke the review prompt once per batch.
167
+
3. Expose Context Engine tools independently inside each batch inference.
168
+
169
+
This avoids prefetching repository context for the whole PR and keeps tool calls scoped to the batch being reviewed.
170
+
171
+
#### Local dry-run debugging
172
+
173
+
For local dry-run debugging, set the same variables in `.env` or pass them directly to the CLI. The dry-run path still uses the normal PR diff batching loop, so Context Engine tools are available independently to each review batch instead of prefetching repository context for the whole PR.
The reviewer uses the AI SDK provider surface. Direct API providers use `LLM_API_KEY`, Z.AI can use `ZAI_API_KEY`, and AWS Bedrock can use AWS credentials instead.
0 commit comments