Skip to content

NikitolProject/mcp-hub-flake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

mcp-hub (Nix Flake Edition) 📦

A Nix flake wrapping the mcp-hub CLI (version 3.4.0) — a centralized manager for Model Context Protocol servers.

🔍 What Is mcp-hub?

mcp-hub is a centralized manager for Model Context Protocol (MCP) servers, allowing you to connect, monitor, and use multiple MCP servers through a unified CLI and REST API :contentReference[oaicite:1]{index=1}.

Key capabilities include:

  • Dynamic management of local (STDIO) and remote (streamable-http / SSE) MCP servers
  • Real-time monitoring of servers, tools, and resources
  • Support for OAuth PKCE and header‑based authentication
  • Seamless SSE event streaming to clients
  • Auto-reconnection and health check mechanisms :contentReference[oaicite:2]{index=2}

🌐 Installation with Nix Flake

Add this flake as an input in your flake.nix:

inputs = {
  mcp-hub = { url = "github:NikitolProject/mcp-hub-flake"; };
  nixpkgs = ...;
};

Include it in your packages:

outputs = { self, nixpkgs, mcp-hub }:
{
  environment.systemPackages = [
    mcp-hub.packages.${system}.default
  ];
};

This makes the mcp-hub binary available across your system.

🚀 Usage

Run from terminal:

mcp-hub --port 3000 --config path/to/config.json

Flags:

  • --port <port> — (required) REST server port
  • --config <path> — (required) JSON config file
  • Additional flags supported upstream include --watch, --auto-shutdown, --shutdown-delay

Check builtin help and version:

mcp-hub --help
mcp-hub --version  # 3.4.0

🧪 Development Shell

Launch a dev environment with nix develop to access both mcp-hub and jq:

nix develop
mcp-hub --port 3000 --config ./mcp-servers.json

🛠 Configuration File

Your JSON config can define:

  • Local servers via "command" and "args"
  • Remote servers via "url" and optional "headers"
  • Variable substitution via ${ENV_VAR} or ${cmd:...} syntax
  • Hot-reloading in dev mode with server restarts

Example structure:

{
  "mcpServers": {
    "local-server": {
      "command": "${MCP_BINARY_PATH}/server",
      "args": ["--token", "${API_TOKEN}"],
      "env": { "API_TOKEN": "${cmd: aws ssm get-parameter ...}" },
      "dev": {
        "enabled": true,
        "watch": ["src/**/*.js"],
        "cwd": "/path/to/server"
      }
    },
    "remote-server": {
      "url": "https://${HOST}/mcp",
      "headers": {
        "Authorization": "Bearer ${cmd: op read op://...}"
      }
    }
  }
}

Detailed syntax is documented in the upstream mcp-hub documentation (github.com, github.com).

🔗 Example Integration

Neovim integration with mcphub.nvim:

{ mcphub-nvim, mcp-hub, ... }:

{
  extraPlugins = [ mcphub-nvim ];
  extraConfigLua = ''
    require("mcphub").setup({
      port = 3000,
      config = "~/mcp-servers.json",
      cmd = "${mcp-hub}/bin/mcp-hub"
    })
  '';
}

This enables tool/resource execution directly in Neovim via the MCP hub (github.com, reddit.com).

🎯 Metadata

  • Version: 3.4.0 (npm official)
  • License: MIT
  • Platform: x86_64-linux
  • Dependencies: nodejs, jq

📦 Customization Tips

Feel free to:

  • Update version and src in flake.nix to track newer upstream versions
  • Add support for other platforms by adjusting system

🧭 Quick Commands

mcp-hub --help
mcp-hub --version

📚 Upstream References

  • Core mcp-hub GitHub repo (manager for MCP servers) (github.com)
  • Features overview: streamable‑http, SSE, OAuth, SSE events, reconnect logic (github.com)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages