-
-
Notifications
You must be signed in to change notification settings - Fork 209
Expand file tree
/
Copy pathconfig.nix
More file actions
104 lines (94 loc) · 3.13 KB
/
config.nix
File metadata and controls
104 lines (94 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
cfg = config.vim.assistant.mcphub-nvim;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = [
"plenary-nvim"
];
lazy.plugins = {
mcphub-nvim = {
package = "mcphub-nvim";
setupModule = "mcphub";
inherit (cfg) setupOpts;
event = ["DeferredUIEnter"];
};
};
# avante-nvim
assistant.avante-nvim.setupOpts = {
system_prompt = lib.generators.mkLuaInline ''
function()
local hub = require("mcphub").get_hub_instance()
return hub and hub:get_active_servers_prompt() or ""
end
'';
custom_tools = lib.generators.mkLuaInline ''
function()
return {
require("mcphub.extensions.avante").mcp_tool(),
}
end
'';
};
# codecompanion-nvim
assistant.codecompanion-nvim.setupOpts.extensions.mcphub = {
callback = "mcphub.extensions.codecompanion";
opts = {
## MCP Tools
make_tools = true;
show_server_tools_in_chat = true;
add_mcp_prefix_to_tool_names = false;
show_result_in_chat = true;
format_tool = null;
## MCP Resources
make_vars = true;
## MCP Prompts
make_slash_commands = true;
};
};
# lualine
statusline.lualine.setupOpts.sections.lualine_x = lib.generators.mkLuaInline ''
{{
function()
-- Check if MCPHub is loaded
if not vim.g.loaded_mcphub then
return " -"
end
local count = vim.g.mcphub_servers_count or 0
local status = vim.g.mcphub_status or "stopped"
local executing = vim.g.mcphub_executing
-- Show "-" when stopped
if status == "stopped" then
return " -"
end
-- Show spinner when executing, starting, or restarting
if executing or status == "starting" or status == "restarting" then
local frames = { "⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏" }
local frame = math.floor(vim.loop.now() / 100) % #frames + 1
return " " .. frames[frame]
end
return " " .. count
end,
color = function()
if not vim.g.loaded_mcphub then
return { fg = "#6c7086" } -- Gray for not loaded
end
local status = vim.g.mcphub_status or "stopped"
if status == "ready" or status == "restarted" then
return { fg = "#50fa7b" } -- Green for connected
elseif status == "starting" or status == "restarting" then
return { fg = "#ffb86c" } -- Orange for connecting
else
return { fg = "#ff5555" } -- Red for error/stopped
end
end,
},}
'';
};
};
}