Skip to content

Commit 084d443

Browse files
Implement after the fact review system
In my dayjob I am allowed to use Github Copilot and other chat tools to enrich my developer experience. Some employers are okay with me using Jira & Concluence MCPs, but I don't like using them. When i ask confluence "The first feature" then the Confluence API will perform a search for "The first feature", but also "The", "first" or "feature", which can drag in IP that I'd rather not share with an internet based LLM. With this pull request I'm adding more granular control over tool execution. When a tool is executed a new option is available "yes & review". when this option is picked, then the tool will execute like normal, but show a window to the user prompting them to read through the text that is going to be fed back to the LLM. if the user is not comfortable with the result returned (or if the result returned would steer the LLM into the wrong direction; or worse includes rather clear prompt poisoning/injection ) then the user can simply just reject the returned result and it will never be fed into the LLM.
1 parent 7cd5db3 commit 084d443

10 files changed

Lines changed: 1553 additions & 67 deletions

File tree

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,12 @@ MCP Hub is a MCP client for neovim that seamlessly integrates [MCP (Model Contex
6161
| | Headers || For API keys/tokens |
6262
| **Chat Integration** ||||
6363
| | [Avante.nvim](https://github.com/yetone/avante.nvim) || Tools, resources, resourceTemplates, prompts(as slash_commands) |
64-
| | [CodeCompanion.nvim](https://github.com/olimorris/codecompanion.nvim) || Tools, resources, templates, prompts (as slash_commands), 🖼 image responses |
64+
| | [CodeCompanion.nvim](https://github.com/olimorris/codecompanion.nvim) || Tools, resources, templates, prompts (as slash_commands), 🖼 image responses, 🔒 tool result review |
6565
| | [CopilotChat.nvim](https://github.com/CopilotC-Nvim/CopilotChat.nvim) || Tools, resources, function calling support |
66+
| **Security & Control** ||||
67+
| | Tool Confirmation || User confirmation before tool execution |
68+
| | Result Review || Inspect & approve/reject tool results before sending to LLM |
69+
| | Granular Auto-Approval || Per-server, per-tool, or function-based approval rules |
6670
| **Marketplace** ||||
6771
| | Server Discovery || Browse from verified MCP servers |
6872
| | Installation || Manual and auto install with AI |

doc/extensions/codecompanion.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,30 @@ If `make_slash_commands = true`, MCP prompts are available as slash commands:
156156

157157

158158

159-
## Auto-Approval
159+
## Tool Approval & Review
160160

161161
By default, whenever codecompanion calls `use_mcp_tool` or `access_mcp_resource` tool or a specific tool on some MCP server, it shows a confirm dialog with tool name, server name and arguments.
162162

163163
![Image](https://github.com/user-attachments/assets/201a5804-99b6-4284-9351-348899e62467)
164164

165+
### Review Tool Results
166+
167+
The confirmation dialog now includes a **"Yes & Review"** option, allowing you to inspect tool results before they're sent to the LLM. This is particularly useful for preventing sensitive data leakage when working with tools that access confidential information (JIRA, Confluence, databases, etc.).
168+
169+
**Keyboard shortcuts in confirmation dialog:**
170+
- `y`/`Y` - Yes (execute and auto-send to LLM)
171+
- `r`/`R` - **Yes & Review** (execute, then show review window)
172+
- `n`/`N` - No (don't execute)
173+
- `c`/`C` or `<Esc>` - Cancel
174+
175+
When you select "Yes & Review", the tool executes and then displays a review window where you can:
176+
- Inspect the full result (with scrolling for large outputs)
177+
- Approve to send to LLM (`y`, `a`, or `<CR>` on Approve)
178+
- Reject to prevent data leakage (`n`, `r`, or `<Esc>`)
179+
180+
**See the full documentation**: [Tool Result Review Feature](/other/review-feature)
181+
182+
### Auto-Approval
165183

166184
#### Fine-Grained Auto-Approval
167185

@@ -239,6 +257,11 @@ require("mcphub").setup({
239257
end
240258
end
241259

260+
-- Execute JIRA/Confluence tools but always review results
261+
if params.server_name == "jira" or params.server_name == "confluence" then
262+
return { approve = true, review = true }
263+
end
264+
242265
-- Check if tool is configured for auto-approval in servers.json
243266
if params.is_auto_approved_in_server then
244267
return true -- Respect servers.json configuration
@@ -258,8 +281,9 @@ require("mcphub").setup({
258281
- `params.is_auto_approved_in_server` - Boolean indicating if tool is configured for auto-approval in servers.json
259282

260283
**Return values:**
261-
- `true` - Auto-approve the call
262-
- `false` - Show confirmation prompt
284+
- `true` - Auto-approve and execute immediately (no review)
285+
- `false` - Show confirmation prompt (user can choose review)
286+
- `{ approve = true, review = true }` - Execute and force review window
263287
- `string` - Deny with error message
264288
- `nil` - Show confirmation prompt (same as false)
265289

doc/mcphub.txt

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*mcphub.nvim.txt* For NVIM v0.10.0 Last change: 2025 December 12
1+
*mcphub.nvim.txt* For NVIM v0.10.0 Last change: 2026 February 17
22

33
==============================================================================
44
Table of Contents *mcphub.nvim-table-of-contents*
@@ -3295,13 +3295,36 @@ If `make_slash_commands = true`, MCP prompts are available as slash commands:
32953295
_Example: Using an MCP prompt via slash command_:
32963296

32973297

3298-
AUTO-APPROVAL ~
3298+
TOOL APPROVAL & REVIEW ~
32993299

33003300
By default, whenever codecompanion calls `use_mcp_tool` or
33013301
`access_mcp_resource` tool or a specific tool on some MCP server, it shows a
33023302
confirm dialog with tool name, server name and arguments.
33033303

33043304

3305+
REVIEW TOOL RESULTS
3306+
3307+
The confirmation dialog now includes a **“Yes & Review”** option, allowing
3308+
you to inspect tool results before they’re sent to the LLM. This is
3309+
particularly useful for preventing sensitive data leakage when working with
3310+
tools that access confidential information (JIRA, Confluence, databases, etc.).
3311+
3312+
**Keyboard shortcuts in confirmation dialog:** - `y`/`Y` - Yes (execute and
3313+
auto-send to LLM) - `r`/`R` - **Yes & Review** (execute, then show review
3314+
window) - `n`/`N` - No (don’t execute) - `c`/`C` or `<Esc>` - Cancel
3315+
3316+
When you select "Yes & Review", the tool executes and then displays a review
3317+
window where you can: - Inspect the full result (with scrolling for large
3318+
outputs) - Approve to send to LLM (`y`, `a`, or `<CR>` on Approve) - Reject to
3319+
prevent data leakage (`n`, `r`, or `<Esc>`)
3320+
3321+
**See the full documentation**: Tool Result Review Feature
3322+
</other/review-feature>
3323+
3324+
3325+
AUTO-APPROVAL
3326+
3327+
33053328
FINE-GRAINED AUTO-APPROVAL
33063329

33073330
For fine-grained control, configure auto-approval per server or per tool in
@@ -3378,6 +3401,11 @@ specific tool call:
33783401
end
33793402
end
33803403

3404+
-- Execute JIRA/Confluence tools but always review results
3405+
if params.server_name == "jira" or params.server_name == "confluence" then
3406+
return { approve = true, review = true }
3407+
end
3408+
33813409
-- Check if tool is configured for auto-approval in servers.json
33823410
if params.is_auto_approved_in_server then
33833411
return true -- Respect servers.json configuration
@@ -3395,9 +3423,10 @@ resources) - `params.arguments` - Table of arguments passed to the tool -
33953423
- Resource URI (for resource access) - `params.is_auto_approved_in_server` -
33963424
Boolean indicating if tool is configured for auto-approval in servers.json
33973425

3398-
**Return values:** - `true` - Auto-approve the call - `false` - Show
3399-
confirmation prompt - `string` - Deny with error message - `nil` - Show
3400-
confirmation prompt (same as false)
3426+
**Return values:** - `true` - Auto-approve and execute immediately (no review)
3427+
- `false` - Show confirmation prompt (user can choose review) - `{ approve =
3428+
true, review = true }` - Execute and force review window - `string` - Deny with
3429+
error message - `nil` - Show confirmation prompt (same as false)
34013430

34023431

34033432
AUTO-APPROVAL PRIORITY

0 commit comments

Comments
 (0)