Initialize earlier
This still does not avoid that we get the error notifications/initialized is not allowed.
This commit is contained in:
parent
c96cc26939
commit
0a5c29c1ce
|
|
@ -238,7 +238,11 @@ class MCPBrowser:
|
|||
# Initialize if needed for other requests
|
||||
if not self._initialized:
|
||||
await self.initialize()
|
||||
|
||||
# After initalization we MUST return notfications iniitialized
|
||||
return {
|
||||
"jsonrpc": "2.0",
|
||||
"method": "notifications/initialized"
|
||||
}
|
||||
# Check if this is a virtual tool call
|
||||
if jsonrpc_object.get("method") == "tools/call":
|
||||
tool_name = jsonrpc_object.get("params", {}).get("name")
|
||||
|
|
@ -456,7 +460,18 @@ class MCPBrowser:
|
|||
# Add to registry without going through filter
|
||||
existing_tools = self.registry.raw_tool_list
|
||||
self.registry.update_tools(existing_tools + builtin_tools)
|
||||
|
||||
|
||||
# Send initialize request directly to server
|
||||
init_response = await self.server.send_request("initialize", {
|
||||
"protocolVersion": "2024-11-05",
|
||||
"capabilities": {},
|
||||
"clientInfo": {
|
||||
"name": "mcp-browser",
|
||||
"version": "0.1.0"
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
def _handle_server_message(self, message: dict):
|
||||
"""Handle incoming message from MCP server."""
|
||||
# Apply incoming filter
|
||||
|
|
|
|||
Loading…
Reference in New Issue