From 53964445116b6fda802ecdd8a176bfb7c4382a74 Mon Sep 17 00:00:00 2001 From: oliverhnat Date: Thu, 19 Jun 2025 17:32:56 +0200 Subject: [PATCH] feat(mcp): add mcps to avante --- nvim/lua/olinpin/plugins/avante.lua | 11 ++++++++++- nvim/lua/olinpin/plugins/mcphub.lua | 16 ++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 nvim/lua/olinpin/plugins/mcphub.lua diff --git a/nvim/lua/olinpin/plugins/avante.lua b/nvim/lua/olinpin/plugins/avante.lua index 4652c8a..56ef395 100644 --- a/nvim/lua/olinpin/plugins/avante.lua +++ b/nvim/lua/olinpin/plugins/avante.lua @@ -3,7 +3,6 @@ return { event = "VeryLazy", lazy = false, config = function(_, opts) - -- Let the plugin load first require("avante").setup(opts) -- Then remove the default mappings vim.schedule(function() @@ -31,6 +30,16 @@ return { -- max_tokens = 4096, }, }, + system_prompt = function() + local hub = require("mcphub").get_hub_instance() + return hub and hub:get_active_servers_prompt() or "" + end, + -- Using function prevents requiring mcphub before it's loaded + custom_tools = function() + return { + require("mcphub.extensions.avante").mcp_tool(), + } + end, }, build = "make", keys = { diff --git a/nvim/lua/olinpin/plugins/mcphub.lua b/nvim/lua/olinpin/plugins/mcphub.lua new file mode 100644 index 0000000..966d5b8 --- /dev/null +++ b/nvim/lua/olinpin/plugins/mcphub.lua @@ -0,0 +1,16 @@ +return { + "ravitemer/mcphub.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + }, + build = "npm install -g mcp-hub@latest", -- Installs `mcp-hub` node binary globally + config = function() + require("mcphub").setup({ + extensions = { + avante = { + make_slash_commands = true, + }, + }, + }) + end, +}