-
Notifications
You must be signed in to change notification settings - Fork 484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
brave search connection fail at claude desktop #161
Comments
There is no way to solve this problem, thank you very much for your advice before |
Does this issue still occur for you with Claude Desktop v0.7.5? |
yeah same to me.i have no idea what was going on |
I think this problem is caused by the internet censorship in mainland China. |
I have the same issue, and I tried using a proxy in CMD, but it didn't solve the problem either. |
SOLVED!Specify Agent in Fetch RequestsInstall Dependencies:npm install https-proxy-agent Import Proxy Agent:"C:\Users\YOUR_USER_NAME\AppData\Roaming\npm\node_modules@modelcontextprotocol\server-brave-search\dist\index.js" import fetch from "node-fetch"; Add: import { HttpsProxyAgent } from "https-proxy-agent"; Create Proxy Instance:In the global scope of const proxyUrl = process.env.HTTPS_PROXY || 'http://127.0.0.1:10809';
const agent = new HttpsProxyAgent(proxyUrl); Ensure your Add Agent to Fetch Request Parameters:In your fetch calls, for example in the Original code: const response = await fetch(url, {
headers: {
'Accept': 'application/json',
'Accept-Encoding': 'gzip',
'X-Subscription-Token': BRAVE_API_KEY
}
}); Modify it to: const response = await fetch(url, {
headers: {
'Accept': 'application/json',
'Accept-Encoding': 'gzip',
'X-Subscription-Token': BRAVE_API_KEY
},
agent
}); Similarly, for other fetch calls in functions like const webResponse = await fetch(webUrl, {
headers: {
'Accept': 'application/json',
'Accept-Encoding': 'gzip',
'X-Subscription-Token': BRAVE_API_KEY
},
agent
}); And: const response = await fetch(url, {
headers: {
'Accept': 'application/json',
'Accept-Encoding': 'gzip',
'X-Subscription-Token': BRAVE_API_KEY
},
agent
}); Restart MCP Service:After making these changes, restart the Claude MCP service. All requests will now go through the proxy channel specified by My index.js modified
|
Please consider submitting a PR with your suggested fixes, instead of attaching long snippets of code to an issue thread. |
OS:WINDOW10
location:CN mainland
Describe the bug
A clear and concise description of what the bug is.
there might be a temporary connectivity issue with the web
Logs
If applicable, add logs to help explain your problem.
2024-12-01T17:26:33.791Z [info] Connected to MCP server brave-search!
but could not use web search at claude desktop .
config:
"brave-search": {
"command": "C:/Program Files/nodejs/node.exe",
"args": [
"C:/Users/z/AppData/Roaming/npm/node_modules/@modelcontextprotocol/server-brave-search/dist/index.js"
],
"env": {
"BRAVE_API_KEY": "BSAMk-6z9hEQHa0w_lMs2kYIsb0NDWa",
"HTTP_PROXY": "http://127.0.0.1:10809",
"HTTPS_PROXY": "http://127.0.0.1:10809",
"SOCKS5_HOST": "127.0.0.1",
"SOCKS5_PORT": "10808"
}
},
The text was updated successfully, but these errors were encountered: