|
| 1 | +return { |
| 2 | + "ravitemer/mcphub.nvim", |
| 3 | + dependencies = { |
| 4 | + "nvim-lua/plenary.nvim", |
| 5 | + }, |
| 6 | + build = "npm install -g mcp-hub@latest", -- Installs `mcp-hub` node binary globally |
| 7 | + config = function() |
| 8 | + require("mcphub").setup({ |
| 9 | + --- `mcp-hub` binary related options------------------- |
| 10 | + config = vim.fn.expand("~/.config/mcphub/servers.json"), -- Absolute path to MCP Servers config file (will create if not exists) |
| 11 | + port = 37373, -- The port `mcp-hub` server listens to |
| 12 | + shutdown_delay = 5 * 60 * 000, -- Delay in ms before shutting down the server when last instance closes (default: 5 minutes) |
| 13 | + use_bundled_binary = false, -- Use local `mcp-hub` binary (set this to true when using build = "bundled_build.lua") |
| 14 | + mcp_request_timeout = 60000, --Max time allowed for a MCP tool or resource to execute in milliseconds, set longer for long running tasks |
| 15 | + global_env = {}, -- Global environment variables available to all MCP servers (can be a table or a function returning a table) |
| 16 | + workspace = { |
| 17 | + enabled = true, -- Enable project-local configuration files |
| 18 | + look_for = { ".mcphub/servers.json", ".vscode/mcp.json", ".cursor/mcp.json" }, -- Files to look for when detecting project boundaries (VS Code format supported) |
| 19 | + reload_on_dir_changed = true, -- Automatically switch hubs on DirChanged event |
| 20 | + port_range = { min = 40000, max = 41000 }, -- Port range for generating unique workspace ports |
| 21 | + get_port = nil, -- Optional function returning custom port number. Called when generating ports to allow custom port assignment logic |
| 22 | + }, |
| 23 | + |
| 24 | + ---Chat-plugin related options----------------- |
| 25 | + auto_approve = false, -- Auto approve mcp tool calls |
| 26 | + auto_toggle_mcp_servers = true, -- Let LLMs start and stop MCP servers automatically |
| 27 | + extensions = { |
| 28 | + avante = { |
| 29 | + make_slash_commands = true, -- make /slash commands from MCP server prompts |
| 30 | + }, |
| 31 | + }, |
| 32 | + |
| 33 | + --- Plugin specific options------------------- |
| 34 | + native_servers = {}, -- add your custom lua native servers here |
| 35 | + builtin_tools = { |
| 36 | + edit_file = { |
| 37 | + parser = { |
| 38 | + track_issues = true, |
| 39 | + extract_inline_content = true, |
| 40 | + }, |
| 41 | + locator = { |
| 42 | + fuzzy_threshold = 0.8, |
| 43 | + enable_fuzzy_matching = true, |
| 44 | + }, |
| 45 | + ui = { |
| 46 | + go_to_origin_on_complete = true, |
| 47 | + keybindings = { |
| 48 | + accept = ".", |
| 49 | + reject = ",", |
| 50 | + next = "n", |
| 51 | + prev = "p", |
| 52 | + accept_all = "ga", |
| 53 | + reject_all = "gr", |
| 54 | + }, |
| 55 | + }, |
| 56 | + }, |
| 57 | + }, |
| 58 | + ui = { |
| 59 | + window = { |
| 60 | + width = 0.8, -- 0-1 (ratio); "50%" (percentage); 50 (raw number) |
| 61 | + height = 0.8, -- 0-1 (ratio); "50%" (percentage); 50 (raw number) |
| 62 | + align = "center", -- "center", "top-left", "top-right", "bottom-left", "bottom-right", "top", "bottom", "left", "right" |
| 63 | + relative = "editor", |
| 64 | + zindex = 50, |
| 65 | + border = "rounded", -- "none", "single", "double", "rounded", "solid", "shadow" |
| 66 | + }, |
| 67 | + wo = { -- window-scoped options (vim.wo) |
| 68 | + winhl = "Normal:MCPHubNormal,FloatBorder:MCPHubBorder", |
| 69 | + }, |
| 70 | + }, |
| 71 | + json_decode = nil, -- Custom JSON parser function (e.g., require('json5').parse for JSON5 support) |
| 72 | + on_ready = function(hub) |
| 73 | + -- Called when hub is ready |
| 74 | + end, |
| 75 | + on_error = function(err) |
| 76 | + -- Called on errors |
| 77 | + end, |
| 78 | + log = { |
| 79 | + level = vim.log.levels.WARN, |
| 80 | + to_file = false, |
| 81 | + file_path = nil, |
| 82 | + prefix = "MCPHub", |
| 83 | + }, |
| 84 | + }) |
| 85 | + end, |
| 86 | +} |
0 commit comments