Apidog

All-in-one Collaborative API Development Platform

API Design

API Documentation

API Debugging

API Mocking

API Automated Testing

How to Integrate NeoVim MCP Servers Using MCPHub.nvim

Master MCP server integration in NeoVim using MCPHub.nvim. From installation to AI-powered coding, this guide unlocks next-level development.

Ashley Goolam

Ashley Goolam

Updated on March 26, 2025

Imagine telling your code editor, "Create a new React component called Button" and watching it materialize before your eyes. That's the magic of MCPHub.nvim - a game-changing plugin that brings AI-powered tools directly into your NeoVim workflow. In this hands-on guide, we'll transform your text editor into a smart development companion using Model Context Protocol (MCP) servers.

💡
Before we dive in, here’s a quick tip: Download Apidog for free today! It’s a great tool for developers who want to simplify testing AI models, especially those using LLMs (Large Language Models). Apidog helps you streamline the API testing process, making it easier to work with cutting-edge AI technologies. Give it a try!
button

What is NeoVim?

NeoVim is a modern, powerful, and highly customizable text editor that builds upon the foundation of Vim. It was created as a fork of Vim with the goal of providing a better user experience and a more modern codebase. This allows for easier plugin development and integration with external tools, making it a versatile choice for developers.

NeoVim home page

Key Features of NeoVim

  1. Improved Stability: Neovim's codebase has been refactored for better stability and performance compared to its predecessor, Vim.
  2. Enhanced Plugin System: Neovim boasts a more user-friendly plugin system, making it easier to extend its functionality with a wide range of plugins. This includes support for popular plugin managers like Packer, Lazy, and Plug.
  3. Asynchronous API: Neovim features an asynchronous API, which means plugins won't freeze the editor during execution. This is a significant improvement over Vim, which had issues with synchronous plugin execution.
  4. Embedded Terminal: Neovim includes a built-in terminal emulator, allowing you to run shell commands and tools directly within the editor.
  5. Customization: Users can customize Neovim extensively by writing their own configuration files. This flexibility allows developers to tailor their editing environment to their specific needs and preferences.

NeoVim's Modes of Operation

NeoVim operates primarily in two modes:

  • Insert Mode: This mode is used for typing and editing text. You can enter Insert Mode by pressing the i key.
  • Normal Mode: This is the default mode where you can execute commands and navigate through your files. You can switch to Normal Mode by pressing the Esc key.

What is MCPHub.nvim?

MCPHub.nvim is a powerful NeoVim plugin designed to integrate Model Context Protocol (MCP) servers into your workflow. It provides a centralized management interface for MCP servers, allowing developers to configure, manage, and interact with these servers directly within NeoVim.

MCPHub.nvim display interface image

Architecture and Functionality

MCPHub.nvim uses a client-server architecture, where Neovim clients interact with an Express server (mcp-hub) that manages MCP servers. This architecture ensures consistent server management, real-time status monitoring, and efficient resource usage.

MCPHub.nvim architecture

When you set up MCPHub.nvim, it starts the mcp-hub server with your specified port and configuration file. The plugin then provides a REST API interface for managing MCP servers and tools, allowing for multi-client support and automatic cleanup.

MCPHub.nvim API interfaace

Why MCPHub.nvim Matters for Developers

MCPHub.nvim acts as your personal command center for AI-assisted development. Instead of juggling multiple AI tools, you get:

  • Centralized control of all MCP servers
  • Real-time collaboration between different AI models
  • Smart resource management that adapts to your workflow
  • Seamless integration with popular chat plugins like CodeCompanion

Let's get your NeoVim environment upgraded with these futuristic capabilities.

💡
Are you thinking about adding more MCP Server's to your Claude, Cursor or Windsurf, be sure to check out HiMCP and discover 1682+ Awesome MCP Servers and Clients to and turbocharge your AI Coding Workflow with ease!
HiMCP.ai home page

Installation & Setup Guide for MCPHub.nvim

MCPHub.nvim System Requirements

Before installation, verify your environment meets these requirements:

Component Minimum Version Verification Command
NeoVim 0.8.0+ nvim --version
Node.js 18.0.0+ node --version
Python 3.7+ python --version
UVX Latest uvx --version

Pro Tip: Install UVX (Universal Version Executor) for better server management:

npm install -g uvx

MCPHub.nvim Installation via lazy.nvim

Add this configuration to your Neovim setup:

{
    "ravitemer/mcphub.nvim",
    dependencies = {
        "nvim-lua/plenary.nvim",  -- Required for async operations
    },
    build = "npm install -g mcp-hub@latest",  -- Installs core MCP Hub server
    config = function()
        require("mcphub").setup({
            -- Required configuration
            port = 3000,  -- Default hub port
            config = vim.fn.expand("~/.config/nvim/mcpservers.json"),  -- Absolute path required
            
            -- Optional customization
            log = {
                level = vim.log.levels.WARN,  -- DEBUG, INFO, WARN, ERROR
                to_file = true,  -- Creates ~/.local/state/nvim/mcphub.log
            },
            on_ready = function()
                vim.notify("MCP Hub is online!")
            end
        })
    end
}

Post-Installation Steps:

  1. Restart NeoVim
  2. Verify installation with :checkhealth mcphub
  3. Confirm mcp-hub server is running:
curl http://localhost:3000/api/status

MCPHub.nvim Server Configuration

Create your MCP servers configuration file at ~/.config/nvim/mcpservers.json:

{
  "mcpServers": {
    "codegen": {
      "command": "uvx",
      "args": ["mcp-server-codegen"],
      "env": {
        "OPENAI_KEY": "${ENV_YOUR_OPENAI_KEY}"  # Use env variables for security
      }
    },
    "todoist": {
      "command": "npx",
      "args": ["-y", "@abhiz123/todoist-mcp-server"],
      "disabled": true,  # Enable manually when needed
      "env": {
        "TODOIST_API_TOKEN": "your_token_here"
      }
    }
  }
}

Key Configuration Options:

  • disabled: Start server manually via :MCPHubStart <name>
  • env: Environment variables for API keys
  • autostart: Set to false for resource-heavy servers

MCPHub.nvim First-Time Setup Walkthrough

Open the MCP Hub UI:

:MCPHub

In the interactive interface:

  • Press S to start/stop servers
  • Press T to enable/disable tools
  • Press L to view real-time logs

Test a server connection:

:lua require("mcphub").get_hub_instance():call_tool("codegen", "ping", {}, { return_text = true })

Pro Tip: Bookmark :help mcphub for quick reference to all commands and configurations.

MCPHub.nvim's Integration with Chat Plugins

CodeCompanion Setup:

require("codecompanion").setup({
    strategies = {
        chat = {
            tools = {
                ["mcp"] = {
                    callback = function() 
                        return require("mcphub.extensions.codecompanion") 
                    end,
                    opts = {
                      requires_approval = true,  -- Safety toggle
                      temperature = 0.7  # Control creativity
                    }
                }
            }
        }
    }
})

Avante Integration:

require("avante").setup({
    system_prompt = function()
        local hub = require("mcphub").get_hub_instance()
        return hub:get_active_servers_prompt()  # Dynamic prompt with available tools
    end,
    custom_tools = {
        require("mcphub.extensions.avante").mcp_tool()
    }
})

MCPHub.nvim's Troubleshooting Checklist

Issue Solution
Port conflicts lsof -i :3000 then kill <PID>
Missing dependencies Run :MCPHubInstallDeps
JSON syntax errors Use jq . mcpservers.json to validate
Server startup fails Check :MCPHubLogs

Pro Tip: For advanced debugging:

MCP_HUB_DEBUG=1 nvim  # Enables verbose logging

Conclusion

With MCPHub.nvim, you’re not just installing another plugin—you’re unlocking a new paradigm of AI-augmented development. By integrating MCP servers directly into NeoVim, you gain:

1. Effortless Automation – Generate code, refactor legacy systems, and manage tasks with simple commands.
2. Seamless Integrations – Connect with CodeCompanion, Avante, and other chat plugins for fluid AI collaboration.
3. Optimized Workflow – Dynamically enable/disable tools to balance performance and token usage.

What’s Next?

  1. Explore the MCP Marketplace – Discover community-built servers for specialized tasks (Docker, Kubernetes, API testing)
  2. Build Custom Tools – Extend with Lua to create domain-specific AI assistants
  3. Join the Evolution – Contribute to MCPHub’s GitHub and shape the future of AI-driven development

Your turn to experiment! Try these starter commands:

:MCPHubCall codegen "Write a Python Flask endpoint for user login"  
:lua require("mcphub").toggle_server("todoist")  

The future of coding isn’t about replacing developers—it’s about amplifying their capabilities. With MCPHub.nvim, that future is now at your fingertips.

And while you're at it, don't forget to check out Apidog to supercharge you MCP and API development workflow! 🚀

button
How to Run Uncensored QwQ on Your Local MachineViewpoint

How to Run Uncensored QwQ on Your Local Machine

This comprehensive tutorial will guide you through the process of running QwQ-abliterated locally on your machine.

Mikael Svenson

March 30, 2025

Qwen-2.5-72b: Best Open Source VLM for OCR?Viewpoint

Qwen-2.5-72b: Best Open Source VLM for OCR?

This tutorial explores why Qwen-2.5-72b stands out as potentially the best open-source model for OCR tasks

Ashley Innocent

March 29, 2025

What is the Meaning of SDET (Software Development Engineer in Test)?Viewpoint

What is the Meaning of SDET (Software Development Engineer in Test)?

This comprehensive guide examines the SDET role in detail, highlighting responsibilities, required skills, career opportunities, and how this hybrid position enhances software quality in today's agile development environments.

Emmanuel Mumba

March 29, 2025