Skip to content

Commit 33bd4d3

Browse files
committed
docs: update auto-approval documentation for fine-grained control
- Add autoApprove field documentation to servers.json config - Update CodeCompanion and Avante extension docs with new auto-approval options - Add UI interaction instructions for 'a' keymap - Document auto-approval priority order and configuration examples
1 parent 3e3fae2 commit 33bd4d3

File tree

4 files changed

+97
-4
lines changed

4 files changed

+97
-4
lines changed

doc/configuration.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,12 @@ By default when the LLM calls a tool or resource on a MCP server, we show a conf
141141

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

144-
Set it to to `true` to automatically approve MCP tool calls without user confirmation. This also sets `vim.g.mcphub_auto_approve` variable to `true`. You can toggle this option in the MCP Hub UI with `ga` keymap. You can see the current auto approval status in the Hub UI.
144+
Set it to `true` to automatically approve all MCP tool calls without user confirmation. This also sets `vim.g.mcphub_auto_approve` variable to `true`. You can toggle this option in the MCP Hub UI with `ga` keymap. You can see the current auto approval status in the Hub UI.
145145

146146
![Image](https://github.com/user-attachments/assets/64708065-3428-4eb3-82a5-e32d2d1f98c6)
147147

148+
**Fine-Grained Auto-Approval**: For more granular control, configure auto-approval per server or per tool using the `autoApprove` field in your `servers.json`. You can also toggle auto-approval from the Hub UI using the `a` keymap on individual servers or tools. See [servers.json configuration](/mcp/servers_json#auto-approval-configuration) for detailed examples and configuration options.
149+
148150
### auto_toggle_mcp_servers
149151

150152
Default: `true`
@@ -256,3 +258,4 @@ Logging configuration options:
256258

257259

258260

261+

doc/extensions/avante.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,54 @@ By default, whenever avante calls `use_mcp_tool` or `access_mcp_resource` tool,
7575

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

78-
You can set `auto_approve` to `true` to automatically approve MCP tool calls without user confirmation.
78+
### Global Auto-Approval
79+
80+
You can set `auto_approve` to `true` to automatically approve all MCP tool calls without user confirmation:
81+
7982
```lua
8083
require("mcphub").setup({
8184
-- This sets vim.g.mcphub_auto_approve to true by default (can also be toggled from the HUB UI with `ga`)
8285
auto_approve = true,
8386
})
8487
```
88+
8589
This also sets `vim.g.mcphub_auto_approve` variable to `true`. You can also toggle this option in the MCP Hub UI with `ga` keymap. You can see the current auto approval status in the Hub UI.
8690

8791
![Image](https://github.com/user-attachments/assets/64708065-3428-4eb3-82a5-e32d2d1f98c6)
8892

93+
### Fine-Grained Auto-Approval
94+
95+
For more control, configure auto-approval per server or per tool in your `servers.json`:
96+
97+
```json
98+
{
99+
"mcpServers": {
100+
"trusted-server": {
101+
"command": "npx",
102+
"args": ["trusted-mcp-server"],
103+
"autoApprove": true // Auto-approve all tools on this server
104+
},
105+
"partially-trusted": {
106+
"command": "npx",
107+
"args": ["some-mcp-server"],
108+
"autoApprove": ["read_file", "list_files"] // Only auto-approve specific tools
109+
}
110+
}
111+
}
112+
```
113+
114+
You can also toggle auto-approval from the Hub UI:
115+
- Press `a` on a server line to toggle auto-approval for all tools on that server
116+
- Press `a` on an individual tool to toggle auto-approval for just that tool
117+
- Resources are always auto-approved (no configuration needed)
118+
119+
### Auto-Approval Priority
120+
121+
The system checks auto-approval in this order:
122+
1. **Global**: `vim.g.mcphub_auto_approve = true` (approves everything)
123+
2. **Server-specific**: `autoApprove` field in server config
124+
3. **Default**: Show confirmation dialog
125+
89126

90127
## Usage
91128

@@ -94,3 +131,4 @@ This also sets `vim.g.mcphub_auto_approve` variable to `true`. You can also togg
94131
3. Avante will call `use_mcp_tool` and `access_mcp_resource` tools when necessary
95132

96133

134+

doc/extensions/codecompanion.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ By default, whenever codecompanion calls `use_mcp_tool` or `access_mcp_resource`
5959

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

62-
1. You can set `auto_approve` to `true` to automatically approve MCP tool calls without user confirmation.
62+
### Global Auto-Approval
63+
64+
You can set `auto_approve` to `true` to automatically approve all MCP tool calls without user confirmation:
6365

6466
```lua
6567
require("mcphub").setup({
@@ -72,5 +74,38 @@ This also sets `vim.g.mcphub_auto_approve` variable to `true`. You can also togg
7274

7375
![Image](https://github.com/user-attachments/assets/64708065-3428-4eb3-82a5-e32d2d1f98c6)
7476

75-
2. MCP Hub also respects CodeCompanion auto tool mode: `vim.g.codecompanion_auto_tool_mode = true` (toggled via `gta` in the chat buffer)
77+
### Fine-Grained Auto-Approval
78+
79+
For more control, configure auto-approval per server or per tool in your `servers.json`:
80+
81+
```json
82+
{
83+
"mcpServers": {
84+
"trusted-server": {
85+
"command": "npx",
86+
"args": ["trusted-mcp-server"],
87+
"autoApprove": true // Auto-approve all tools on this server
88+
},
89+
"partially-trusted": {
90+
"command": "npx",
91+
"args": ["some-mcp-server"],
92+
"autoApprove": ["read_file", "list_files"] // Only auto-approve specific tools
93+
}
94+
}
95+
}
96+
```
97+
98+
You can also toggle auto-approval from the Hub UI:
99+
- Press `a` on a server line to toggle auto-approval for all tools on that server
100+
- Press `a` on an individual tool to toggle auto-approval for just that tool
101+
- Resources are always auto-approved (no configuration needed)
102+
103+
### Auto-Approval Priority
104+
105+
The system checks auto-approval in this order:
106+
1. **Global**: `vim.g.mcphub_auto_approve = true` (approves everything)
107+
2. **CodeCompanion**: `vim.g.codecompanion_auto_tool_mode = true` (toggled via `gta` in chat buffer)
108+
3. **Server-specific**: `autoApprove` field in server config
109+
4. **Default**: Show confirmation dialog
110+
76111

doc/mcp/servers_json.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ MCPHub adds several extra keys for each server automatically from the UI:
169169
"disabled_tools": ["expensive-tool"],
170170
"disabled_resources": ["resource://large-data"],
171171
"disabled_resourceTemplates": ["resource://{type}/{id}"],
172+
"autoApprove": ["safe-tool", "read-only-tool"],
172173
"custom_instructions": {
173174
"disabled": false,
174175
"text": "Custom instructions for this server"
@@ -178,5 +179,21 @@ MCPHub adds several extra keys for each server automatically from the UI:
178179
}
179180
```
180181

182+
### Auto-Approval Configuration
183+
184+
The `autoApprove` field allows fine-grained control over which tools are automatically approved without user confirmation:
185+
186+
| Value | Behavior | Example |
187+
|-------|----------|---------|
188+
| `true` | Auto-approve all tools on this server | `"autoApprove": true` |
189+
| `["tool1", "tool2"]` | Auto-approve only specific tools | `"autoApprove": ["read_file", "list_files"]` |
190+
| `[]` or omitted | No auto-approval (show confirmation dialog) | `"autoApprove": []` |
191+
192+
**Notes:**
193+
- Resources are always auto-approved by default (no explicit configuration needed)
194+
- Auto-approval only applies to enabled servers and enabled tools
195+
- You can toggle auto-approval from the UI using the `a` keymap on servers or individual tools
196+
197+
181198

182199

0 commit comments

Comments
 (0)