-
-
Notifications
You must be signed in to change notification settings - Fork 70
Description
Environment:
- mcphub.nvim version: [latest from main branch]
- Neovim version: 0.11.5
- OS: macOS
Description:
Native MCP servers (particularly the neovim server) are not automatically started when MCPHub initializes. They remain in "disconnected" status until a configuration file change event occurs.
Steps to Reproduce:
- Start Neovim with mcphub.nvim configured
- Open CodeCompanion (or check
:lua vim.print(require('mcphub.state').server_state.native_servers)) - Observe that native servers have
status = "disconnected"initially - Wait for a config file change OR manually toggle a server
- Native servers then transition to
status = "connected"
Expected Behavior:
Native servers should be status = "connected" immediately when the hub becomes ready, since they don't require external processes to start.
Root Cause:
In lua/mcphub/hub.lua, the handle_hub_ready() function (line ~435) calls:
self:update_servers()- which only updates external MCP servers- But does NOT call
self:refresh_native_servers()- which starts native servers
Native servers only get started when:
reload_config()is called (triggered by CONFIG_CHANGED SSE event)- Which then calls
refresh_native_servers()
Proposed Fix:
Add self:refresh_native_servers() to handle_hub_ready():
function MCPHub:handle_hub_ready()
self.ready = true
self.is_restarting = false
self.is_starting = false
self:_update_global_state()
self.on_ready(self)
-- Start native servers on initial hub ready
self:refresh_native_servers() -- ADD THIS LINE
self:update_servers()
if State.marketplace_state.status == "empty" then
self:get_marketplace_catalog()
end
endImpact:
This bug significantly affects user experience with chat integrations (CodeCompanion, Avante, CopilotChat) as the native Neovim tools that provide file operations are not available immediately, causing initial tool calls to fail.