Forked from RafalWilinski/claude-desktop-auto-allow-everything-mcp.js
Last active
March 18, 2025 17:35
-
-
Save kepoorz/f328fbaf92aa3f8916f1cb4873fe3fb2 to your computer and use it in GitHub Desktop.
Auto-approve all MCP tool calls in Claude Desktop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // original: https://gist.github.com/RafalWilinski/3416a497f94ee2a0c589a8d930304950 | |
| // これの日本語Claude対応版 | |
| // HOW TO INSTRUCTIONS | |
| // 1. Open Claude Desktop | |
| // 2. Go to Help -> Enable Developer Mode | |
| // 3. Navigate Developer Tools window named "Developer Tools - https://claude.ai" | |
| // 4. Go to "Console" tab | |
| // 5. Type "allow pasting" and hit Enter | |
| // 6. Paste this snippet and hit Enter | |
| // From now on, all MCP calls will be auto-approved | |
| // END INSTRUCTIONS | |
| // Cooldown tracking | |
| let lastClickTime = 0; | |
| const COOLDOWN_MS = 1000; // 1 second cooldown | |
| const observer = new MutationObserver((mutations) => { | |
| // Check if we're still in cooldown | |
| const now = Date.now(); | |
| if (now - lastClickTime < COOLDOWN_MS) { | |
| console.log("🕒 Still in cooldown period, skipping..."); | |
| return; | |
| } | |
| console.log("🔍 Checking mutations..."); | |
| const dialog = document.querySelector('[role="dialog"]'); | |
| if (!dialog) return; | |
| const buttonWithDiv = dialog.querySelector("button div"); | |
| if (!buttonWithDiv) return; | |
| const toolText = buttonWithDiv.textContent; | |
| if (!toolText) return; | |
| console.log("📝 Found tool request:", toolText); | |
| const toolNameMatch = toolText.match(/(\S+)(を実行|から実行)/); | |
| const toolName = toolNameMatch?.[1]; | |
| if (!toolName) return; | |
| console.log("🛠️ Tool name:", toolName); | |
| const allowButton = Array.from(dialog.querySelectorAll("button")).find( | |
| (button) => button.textContent.includes("このチャットで許可") | |
| ); | |
| if (allowButton) { | |
| console.log("🚀 Auto-approving tool:", toolName); | |
| lastClickTime = now; // Set cooldown | |
| allowButton.click(); | |
| } | |
| }); | |
| // Start observing | |
| observer.observe(document.body, { | |
| childList: true, | |
| subtree: true, | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment